diff options
| author | Andreas Politz <politza@hochschule-trier.de> | 2019-02-20 19:35:27 +0100 |
|---|---|---|
| committer | Andreas Politz <politza@hochschule-trier.de> | 2019-02-20 19:35:27 +0100 |
| commit | 2320aec2f5064f47a9fca546d8580c3e05cd9be3 (patch) | |
| tree | 2326632de1dec66b86fb6c88cb62d7cc709191a3 /server/autobuild | |
| parent | 75f11a457a96180cbe3c42f523598de501121986 (diff) | |
Use function handling --os argument and case
Diffstat (limited to 'server/autobuild')
| -rwxr-xr-x | server/autobuild | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/server/autobuild b/server/autobuild index f3e2c69..d16e03f 100755 --- a/server/autobuild +++ b/server/autobuild @@ -412,31 +412,45 @@ os_gentoo() { return 0 } +# By Parameter --os +os_argument() { + [ -z "$OS" ] && return 0 + case $OS in + macos) os_macos "$@";; + freebsd) os_freebsd "$@";; + arch) os_arch "$@";; + centos) os_centos "$@";; + openbsd) os_openbsd "$@";; + fedora) os_fedora "$@";; + debian) os_debian "$@";; + gentoo) os_gentoo "$@";; + msys2) os_msys2 "$@";; + nixos) os_nixos "$@";; + *) echo "Invalid --os argument: $OS" + exit 1 + esac || { + echo "Unable to install on this system as $OS" + exit 1 + } +} + ## +-----------------------------------------------------------+ ## * Figure out were we are, install deps and build the program ## +-----------------------------------------------------------+ handle_options "$@" -if [ -n "$OS" ]; then - OSES="freebsd arch centos openbsd fedora debain gentoo msys2 nixos" - if echo "$OSES" | grep "$OS" > /dev/null 2>&1; then - os_$OS "$@" - else - false - fi -else - os_macos "$@" || \ - os_freebsd "$@" || \ - os_arch "$@" || \ - os_centos "$@" || \ - os_openbsd "$@" || \ - os_fedora "$@" || \ - os_debian "$@" || \ - os_gentoo "$@" || \ - os_msys2 "$@" || \ - os_nixos "$@" -fi || \ +os_argument "$@" || \ +os_macos "$@" || \ +os_freebsd "$@" || \ +os_arch "$@" || \ +os_centos "$@" || \ +os_openbsd "$@" || \ +os_fedora "$@" || \ +os_debian "$@" || \ +os_gentoo "$@" || \ +os_msys2 "$@" || \ +os_nixos "$@" || \ { OS_IS_HANDLED= if [ -z "$DRY_RUN" ]; then |
