Browse Source

Started config thingy for default commands, commented example satellite

master
mid-kid 10 years ago
parent
commit
558f26d577
  1. 17
      astronaut
  2. 13
      hello.sat

17
astronaut

@ -60,6 +60,10 @@ if [ ! -f "$satellite" ]; then
exiterr "Can't find satellite file" exiterr "Can't find satellite file"
fi fi
# Configuration
cmd_download="curl -#L -o {dst} {src}"
cmd_extract="tar xf {src}"
# Tools for the astronaut # Tools for the astronaut
mksum() { mksum() {
echo $(md5sum "$@" 2> /dev/null | cut -d' ' -f1) echo $(md5sum "$@" 2> /dev/null | cut -d' ' -f1)
@ -75,11 +79,12 @@ download() {
if [ ! -f "$path" -o "$checksum" != "$2" ]; then if [ ! -f "$path" -o "$checksum" != "$2" ]; then
msg "Downloading $name" msg "Downloading $name"
if [ "$3" ]; then if [ "$3" ]; then
local cmd="$(echo "$2" | sed -e 's@{dst}@'"$path"'@g' -e 's@{source}@'"$1"'@g')" local cmd="$3"
$cmd
else else
curl -#L -o "$path" "$1" local cmd="$cmd_download"
fi fi
$(echo "$cmd" | sed -e 's@{dst}@'"$path"'@g' -e 's@{src}@'"$1"'@g')
checksum="$(mksum "$path")" checksum="$(mksum "$path")"
if [ "$2" -a "$checksum" != "$2" ]; then if [ "$2" -a "$checksum" != "$2" ]; then
msg "Checksum: $checksum" msg "Checksum: $checksum"
@ -91,11 +96,11 @@ download() {
extract() { extract() {
msg "Extracting $1" msg "Extracting $1"
if [ "$2" ]; then if [ "$2" ]; then
local cmd="$(echo "$2" | sed -e 's@{src}@'"$dir_source/$1"'@g')" local cmd="$2"
$cmd
else else
tar xf "$dir_source/$1" local cmd="$cmd_extract"
fi fi
$(echo "$cmd" | sed -e 's@{src}@'"$dir_source/$1"'@g')
} }
dlextract() { dlextract() {

13
hello.sat

@ -1,11 +1,20 @@
# Example of a satellite file, which is just a shell script with a cool name. # Example of a satellite file, which is just a shell script with a cool name.
# Info (Please declare it, as it will be used outside of this script, too)
name=hello name=hello
version=2.9 version=2.9
dlextract "http://ftp.gnu.org/pub/gnu/$name/$name-$version.tar.gz" \ # Get them files
"67607d2616a0faaf5bc94c59dca7c3cb" download "http://ftp.gnu.org/pub/gnu/$name/$name-$version.tar.gz" \ # URL [REQUIRED]
"67607d2616a0faaf5bc94c59dca7c3cb" \ # MD5sum [REQUIRED]
"curl -L -o {dst} {src}" # Custom command
extract "$name-$version.tar.gz" \ # Name [REQUIRED]
"tar xvf {src}" # Custom command
#dlextract "http://ftp.gnu.org/pub/gnu/$name/$name-$version.tar.gz" \ # Abbreviation for the above functions
# "67607d2616a0faaf5bc94c59dca7c3cb" # Does not allow custom commands
#extrafile "Herpaderp.txt" # Copy local file to build directory. Path relative to the location of the satellite file
# Compilation instructions
cd "$name-$version" cd "$name-$version"
./configure ./configure
make make

Loading…
Cancel
Save