Browse Source

Add string replacement for dir_install

master
mid-kid 9 years ago
parent
commit
865cfe5950
  1. 20
      astronaut/astronaut

20
astronaut/astronaut

@ -6,6 +6,10 @@
dir_build="/tmp/astronaut/build" # Temporary directory to build packages
dir_source="/tmp/astronaut/source" # Directory where the package sources will be placed
dir_install="/tmp/astronaut/install" # Directory where the package will be installed
# The source directory will have subdirs for each different $name,
# specified inside the satellite file.
# The $dir_install variable will have '{pkg}' replaced with $_satname,
# which is the filename of the satellite, without the .sat suffix.
# Runtime directories
dir_sysroot="/" # The root directory of the system
@ -42,6 +46,11 @@ vcs_compile=false
unset _user_options # Options specified in the command line get the highest priority
#_nuke_dir_install (This can be set from wrappers)
# Should be specified in the satellite
unset name
unset version
unset update_url
# Some printing functions
_show_help() {
echo "This astronaut will help you build some satellites.
@ -60,7 +69,7 @@ Usage: $0 [-sbipr <dir>] [-Id] [-o <options>] <satellite>
-o Set package options (comma-separated)
Tips:
- Use \`head -n 32 $0 > astronaut.conf.example\` to generate a default configuration file.
- Use \`head -n 36 $0 > astronaut.conf.example\` to generate a default configuration file.
- Keep in mind that when specifying options on the command line in a string, the first always takes priority.
For example, in \"opt,someotheropt,!opt\", opt is enabled, due to it being the first occurrence.
- If you have set \$dir_satellites in the config, you can omit the .sat suffix.
@ -126,6 +135,10 @@ _mksum() {
echo "$(md5sum "$@" 2> /dev/null | cut -d' ' -f1)"
}
_safe_sed() {
echo "$1" | sed 's/[[\.*^$/]/\\&/g'
}
download() {
mkdir -p "$dir_source/$name"
@ -138,7 +151,7 @@ download() {
_msg "Downloading $filename"
[ "$3" ] && local cmd="$3" || local cmd="$cmd_download"
eval $(echo "$cmd" | sed -e "s@{dst}@'$path'@g" -e "s@{src}@'$1'@g")
eval $(echo "$cmd" | sed -e "s@{dst}@'$(_safe_sed "$path")'@g" -e "s@{src}@'$(_safe_sed "$1")'@g")
checksum="$(_mksum "$path")"
if [ "$2" -a "$checksum" != "$2" ]; then
@ -287,6 +300,9 @@ mkdir -p "$dir_source"
dir_source="$(realpath "$dir_source")"
if [ "$_download_only" = false ]; then
# Fix up the install path
dir_install="$(echo "$dir_install" | sed -e "s@{pkg}@$(_safe_sed "$satname")@g")"
# This variable can be set by a wrapper script in need to nuke the install dir.
if [ "$_nuke_dir_install" = true -a ! -z "$dir_install" ]; then
rm -rf "$dir_install"

Loading…
Cancel
Save