From cff049357d73d828ae18269a9bb1a87fa09e5cf0 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Mon, 10 Apr 2017 21:17:08 +0200 Subject: [PATCH] Ensure ash compatibility --- astronaut/astrohelp | 4 ++- astronaut/astronaut | 31 ++++++++++--------- astronaut/astronautpkg | 4 ++- astronaut/pacman-astronaut | 4 ++- astronaut/xbps-astronaut | 4 ++- satellites/devkitarm.sat | 2 +- satellites/functions/compile/cmake.sh | 10 ++++-- satellites/functions/compile/configure.sh | 20 +++++++----- satellites/functions/compile/perl.sh | 9 ++++-- satellites/functions/compile/waf.sh | 4 +-- satellites/functions/vcs/git.sh | 8 ++--- satellites/functions/vcs/svn.sh | 4 +-- satellites/icedtea.sat | 3 +- satellites/lua.sat | 4 +-- .../markdown.sat | 11 ++++--- satellites/palemoon-umatrix.sat | 2 +- satellites/radare2.sat | 2 +- satellites/wine.sat | 4 +-- 18 files changed, 76 insertions(+), 54 deletions(-) rename {graveyard/unmaintained_satellites => satellites}/markdown.sat (59%) diff --git a/astronaut/astrohelp b/astronaut/astrohelp index 2d624a5..c75867f 100755 --- a/astronaut/astrohelp +++ b/astronaut/astrohelp @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/bin/sh +set -e + # Helper functions for programs that work with satellite files. show_help() { diff --git a/astronaut/astronaut b/astronaut/astronaut index 66a684a..ec284c9 100755 --- a/astronaut/astronaut +++ b/astronaut/astronaut @@ -1,4 +1,5 @@ -#!/bin/sh -e +#!/bin/sh +set -e # Configuration @@ -34,12 +35,12 @@ cmd_download='curl -# -L -o {dst} {src}' # Command to execute to download files cmd_extract='tar -x -C {dst} -f {src}' # Command to execute to extract files # If we can't find the satellite file, we'll look in this directory for it. -unset dir_satellites +dir_satellites= # Options are comma-separated and parsed from front to back. # This means that in '!opt,someotheropt,opt', opt is disabled. -unset options # The least-priority global options +options= # The least-priority global options package_options() { :; } # Per-package options function. # Example for package_options: # package_options() { @@ -57,8 +58,14 @@ package_options() { :; } # Per-package options function. download_only=false _vcs_only=false _nuke_dir_install=false -unset _user_options # Options specified in the command line get the highest priority -unset _sat_options # Options defined by the satellite +_user_options= # Options specified in the command line get the highest priority +_sat_options= # Options defined by the satellite + +# Should be specified in the satellite +name= +version= +update_url= +vcs_compile=false # Check if running from a wrapper if [ "$(basename "$0")" != "astronaut" ]; then @@ -69,12 +76,6 @@ else _astronaut_wrapper_post() { :; } fi -# Should be specified in the satellite -unset name -unset version -unset update_url -vcs_compile=false - # Some printing functions _show_help() { echo "This astronaut will help you build some satellites. @@ -141,7 +142,7 @@ while getopts "h?s:b:i:p:IcCdvo:" opt; do esac done -shift $((OPTIND-1)) +shift $(expr $OPTIND - 1) [ "$1" = "--" ] && shift if [ ! "$1" ]; then @@ -164,7 +165,7 @@ download() { [ "$3" ] && local filename="$3" || local filename="$(basename $(echo "$1" | cut -d? -f1))" local path="$dir_source/$name/$filename" - [ "$2" -a -f "$path" ] && local checksum="$(_mksum "$path")" + [ "$2" -a -f "$path" ] && local checksum="$(_mksum "$path")" || true if [ ! -e "$path" -o "$checksum" != "$2" ]; then _msg "Downloading $filename" @@ -193,7 +194,7 @@ getfile() { extrafile() { local dir="$(dirname "$_satellite")" - [ -d "$dir/extrafiles" ] && local dir="$dir/extrafiles/$name" + [ -d "$dir/extrafiles" ] && local dir="$dir/extrafiles/$name" || true cp -a "$dir/$1" "./$1" } @@ -276,7 +277,7 @@ option() { "$@" fi else - return $([ "$enabled" = true ]) + [ "$enabled" = true ] fi } diff --git a/astronaut/astronautpkg b/astronaut/astronautpkg index ba1c7d0..d8b7c64 100755 --- a/astronaut/astronautpkg +++ b/astronaut/astronautpkg @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/bin/sh +set -e + # A hacky script to generate .t?z files using satellites. # It's a fairly simple wrapper to astronaut, that generates pkgtools packages. diff --git a/astronaut/pacman-astronaut b/astronaut/pacman-astronaut index 6b7f145..f58cc72 100755 --- a/astronaut/pacman-astronaut +++ b/astronaut/pacman-astronaut @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/bin/sh +set -e + # A hacky script to generate .pkg.tar.?z files using satellites. # It's a fairly simple wrapper to astronaut, that generates pacman packages. diff --git a/astronaut/xbps-astronaut b/astronaut/xbps-astronaut index e9dcd02..a1c5eb2 100755 --- a/astronaut/xbps-astronaut +++ b/astronaut/xbps-astronaut @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/bin/sh +set -e + # A hacky script to generate .xbps files using satellites. # It's a fairly simple wrapper to astronaut, that generates xbps packages. diff --git a/satellites/devkitarm.sat b/satellites/devkitarm.sat index 1ea083b..7f95e84 100644 --- a/satellites/devkitarm.sat +++ b/satellites/devkitarm.sat @@ -54,7 +54,7 @@ EOF # Install mkdir -p "$dir_install/$dir_prefix/$dir_libdir/devkitPRO" -cp -a "install/$name" "$dir_install/$dir_prefix/$dir_libdir/devkitPRO" +cp -Ta "install/$name" "$dir_install/$dir_prefix/$dir_libdir/devkitPRO/devkitARM" # Install environment cat > devkitarm.sh << EOF diff --git a/satellites/functions/compile/cmake.sh b/satellites/functions/compile/cmake.sh index dd60387..35c7342 100644 --- a/satellites/functions/compile/cmake.sh +++ b/satellites/functions/compile/cmake.sh @@ -9,8 +9,8 @@ compile_cmake() { b) local builddir="$OPTARG" ;; I) local noinstall=true ;; esac; done - shift $((OPTIND-1)) - [ "$1" = '--' ] && shift + shift $(expr $OPTIND - 1) + [ "$1" = '--' ] && shift || true mkdir -p "$builddir"; cd "$builddir" cmake "$olddir" \ @@ -29,6 +29,10 @@ compile_cmake() { -DCMAKE_INSTALL_FULL_LOCALEDIR="/$dir_prefix/$dir_localedir" \ "$@" make - [ "$noinstall" = false ] && make DESTDIR="$dir_install" install + + if [ "$noinstall" = false ]; then + make DESTDIR="$dir_install" install + fi + cd "$olddir" } diff --git a/satellites/functions/compile/configure.sh b/satellites/functions/compile/configure.sh index 627800f..5bfd62e 100644 --- a/satellites/functions/compile/configure.sh +++ b/satellites/functions/compile/configure.sh @@ -16,8 +16,8 @@ compile_configure() { M) local nomake=true ;; I) local noinstall=true ;; esac; done - shift $((OPTIND-1)) - [ "$1" = '--' ] && shift + shift $(expr $OPTIND - 1) + [ "$1" = '--' ] && shift || true if [ "$builddir" ]; then mkdir -p "$builddir" @@ -25,9 +25,9 @@ compile_configure() { fi local cross="$(option =cross)" - [ "$cross" ] && local cross="--host=$cross" + [ "$cross" ] && local cross="--host=$cross" || true local build="$(option =build)" - [ "$build" ] && local build="--build=$build" + [ "$build" ] && local build="--build=$build" || true "$olddir/configure" \ --prefix="/$dir_prefix" \ @@ -44,8 +44,14 @@ compile_configure() { --docdir="/$dir_prefix/$dir_docdir/$name" \ $build $cross "$@" - [ "$nomake" = false ] && make $makeflags - [ "$nomake" = false -a "$noinstall" = false ] && make DESTDIR="$dir_install" $makeflags install + if [ "$nomake" = false ]; then + make $makeflags + if [ "$noinstall" = false ]; then + make DESTDIR="$dir_install" $makeflags install + fi + fi - [ "$builddir" ] && cd "$olddir" || true + if [ "$builddir" ]; then + cd "$olddir" + fi } diff --git a/satellites/functions/compile/perl.sh b/satellites/functions/compile/perl.sh index d2b6145..886da2e 100644 --- a/satellites/functions/compile/perl.sh +++ b/satellites/functions/compile/perl.sh @@ -6,8 +6,8 @@ compile_perl() { while getopts 'I' opt; do case "$opt" in I) local noinstall=true ;; esac; done - shift $((OPTIND-1)) - [ "$1" = '--' ] && shift + shift $(expr $OPTIND - 1) + [ "$1" = '--' ] && shift || true perl Build.PL --create_packlist=0 \ --prefix="/$dir_prefix" \ @@ -19,5 +19,8 @@ compile_perl() { --install_path libdoc="/$dir_prefix/$dir_mandir/man3" \ "$@" ./Build - [ "$noinstall" = false ] && ./Build install || true + + if [ "$noinstall" = false ]; then + ./Build install + fi } diff --git a/satellites/functions/compile/waf.sh b/satellites/functions/compile/waf.sh index eab3b0e..f161949 100644 --- a/satellites/functions/compile/waf.sh +++ b/satellites/functions/compile/waf.sh @@ -6,8 +6,8 @@ compile_waf() { while getopts 'b:' opt; do case "$opt" in b) local binary="$OPTARG" ;; esac; done - shift $((OPTIND-1)) - [ "$1" = '--' ] && shift + shift $(expr $OPTIND - 1) + [ "$1" = '--' ] && shift || true $binary configure build install \ --prefix="/$dir_prefix" \ diff --git a/satellites/functions/vcs/git.sh b/satellites/functions/vcs/git.sh index a228c8f..fdd80d7 100644 --- a/satellites/functions/vcs/git.sh +++ b/satellites/functions/vcs/git.sh @@ -10,8 +10,8 @@ vcs_git() { V) local setver=false ;; C) local clone=false ;; esac; done - shift $((OPTIND-1)) - [ "$1" = '--' ] && shift + shift $(expr $OPTIND - 1) + [ "$1" = '--' ] && shift || true local reponame="$(basename "$1")" local dir="$dir_source/$name/$reponame" @@ -59,8 +59,8 @@ vcs_git_clone() { while getopts 'r:' opt; do case "$opt" in r) local rev="$OPTARG" ;; esac; done - shift $((OPTIND-1)) - [ "$1" = '--' ] && shift + shift $(expr $OPTIND - 1) + [ "$1" = '--' ] && shift || true local reponame="$(basename "$1")" local dir="$dir_source/$name/$reponame" diff --git a/satellites/functions/vcs/svn.sh b/satellites/functions/vcs/svn.sh index 5a5dd6b..cd703ce 100644 --- a/satellites/functions/vcs/svn.sh +++ b/satellites/functions/vcs/svn.sh @@ -6,8 +6,8 @@ vcs_svn() { while getopts 'r:' opt; do case "$opt" in r) local revision="-r $OPTARG" ;; esac; done - shift $((OPTIND-1)) - [ "$1" = '--' ] && shift + shift $(expr $OPTIND - 1) + [ "$1" = '--' ] && shift || true local reponame="$(basename "$1")" local dir="$dir_source/$name/$reponame" diff --git a/satellites/icedtea.sat b/satellites/icedtea.sat index 8c7433f..07d2cec 100644 --- a/satellites/icedtea.sat +++ b/satellites/icedtea.sat @@ -69,10 +69,9 @@ header_end # From: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/multiprocessing.eclass makeopts_jobs() { - [[ $# -eq 0 ]] && set -- ${MAKEFLAGS} # This assumes the first .* will be more greedy than the second .* # since POSIX doesn't specify a non-greedy match (i.e. ".*?"). - local jobs=$(echo " $* " | sed -r -n \ + local jobs=$(echo " $MAKEFLAGS " | sed -r -n \ -e 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' \ -e 's:.*[[:space:]](-j|--jobs)[[:space:]].*:999:p') echo ${jobs:-1} diff --git a/satellites/lua.sat b/satellites/lua.sat index b478b46..3f71042 100644 --- a/satellites/lua.sat +++ b/satellites/lua.sat @@ -48,7 +48,7 @@ rm "install/$dir_bindir/luac" cc src/luac.o src/lopcodes.o src/ldump.o "install/$dir_libdir/liblua.so" $libs -o "install/$dir_bindir/luac" # Actually install -mkdir -p "$dir_install/$dir_prefix" -cp -a install/* "$dir_install/$dir_prefix/" +mkdir -p "$dir_install" +cp -Ta install "$dir_install/$dir_prefix" # vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab: diff --git a/graveyard/unmaintained_satellites/markdown.sat b/satellites/markdown.sat similarity index 59% rename from graveyard/unmaintained_satellites/markdown.sat rename to satellites/markdown.sat index a25042b..51c0070 100644 --- a/graveyard/unmaintained_satellites/markdown.sat +++ b/satellites/markdown.sat @@ -1,14 +1,15 @@ name=Markdown version=1.0.1 -update_url="https://daringfireball.net/projects/markdown/" +update_url='https://daringfireball.net/projects/markdown/' download "https://daringfireball.net/projects/downloads/${name}_$version.zip" \ - "f17b3c2b2830c6fd2fe0098226e59a2f" + 'f17b3c2b2830c6fd2fe0098226e59a2f' header_end # TODO: Support other formats, such as zip, with the extract command. -extract "${name}_$version.zip" "" \ - "unzip -qd {dst} {src}" -install -D "${name}_$version/$name.pl" "$dir_install/$dir_prefix/bin/markdown" +extract "${name}_$version.zip" \ + '' \ + 'unzip -qd {dst} {src}' +install -D "${name}_$version/$name.pl" "$dir_install/$dir_prefix/$dir_bindir/markdown" # vim:set tabstop=4 shiftwidth=4 syntax=sh et: diff --git a/satellites/palemoon-umatrix.sat b/satellites/palemoon-umatrix.sat index 13392c3..3ad5427 100644 --- a/satellites/palemoon-umatrix.sat +++ b/satellites/palemoon-umatrix.sat @@ -16,7 +16,7 @@ cd "$name-$version" # Update the assets, as that's something not done in uMatrix for some reason rm -f assets/checksums.txt -cp -a ../uAssets/thirdparties assets +cp -Ta ../uAssets/thirdparties assets/thirdparties tools/make-firefox.sh all install -Dm644 "dist/build/$name.firefox.xpi" "$dir_install/$dir_prefix/$dir_libdir/palemoon/browser/extensions/$name@raymondhill.net.xpi" diff --git a/satellites/radare2.sat b/satellites/radare2.sat index 44f112c..3b777d8 100644 --- a/satellites/radare2.sat +++ b/satellites/radare2.sat @@ -10,7 +10,7 @@ update_url='http://rada.re/r/down.html' update_names="$name-$version.tar.gz\">$name" dlextract "http://cloud.radare.org/get/$version/$name-$version.tar.gz" \ - '122978ad5b9698717c680e422c1daad4' + '17b6de0edf1d4ba772bbb7c98767619e' extrafile "$name-$version-docdir.patch" header_end diff --git a/satellites/wine.sat b/satellites/wine.sat index 7d94a52..ee9b966 100644 --- a/satellites/wine.sat +++ b/satellites/wine.sat @@ -13,11 +13,11 @@ header_end cd "$name-$version" -compile_configure -b ../build -- $([ "$(uname -m)" = 'x86_64' ] && echo --enable-win64) +compile_configure -b build -- $([ "$(uname -m)" = 'x86_64' ] && echo --enable-win64) wine32="$(option =wine32)" if [ "$(uname -m)" = 'x86_64' -a "$wine32" ]; then - PKG_CONFIG_PATH="$dir_sysroot/$dir_prefix/$wine32/pkgconfig" compile_configure -b ../build-wine32 -- --with-wine64=../build --libdir="/$dir_prefix/$wine32" + PKG_CONFIG_PATH="$dir_sysroot/$dir_prefix/$wine32/pkgconfig" compile_configure -b build-wine32 -- --with-wine64=../build --libdir="/$dir_prefix/$wine32" fi # vim:set tabstop=4 shiftwidth=4 syntax=sh expandtab: