summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorMohammed Yaseen Mowzer <yaseen@mowzer.co.za>2019-02-03 10:02:55 +0200
committerAndreas Politz <politza@hochschule-trier.de>2019-02-20 19:16:52 +0100
commit75f11a457a96180cbe3c42f523598de501121986 (patch)
tree07454d2489d47e3658c19586562ebd7338cec466 /server
parentbcb1fa4597feb5a9d44983444054c9ca68f5ca0f (diff)
Add the ability to specify which installer to use
This is useful when you have two installers on the same machine (e.g. pacman and nix-shell) and you want to choose between one of them.
Diffstat (limited to 'server')
-rwxr-xr-xserver/autobuild50
1 files changed, 34 insertions, 16 deletions
diff --git a/server/autobuild b/server/autobuild
index 4a674e9..f3e2c69 100755
--- a/server/autobuild
+++ b/server/autobuild
@@ -30,6 +30,8 @@ DRY_RUN=
INSTALL_DIR=
# Whether we can install packages.
OS_IS_HANDLED=true
+# Which OSs installer to use
+OS=
## +-----------------------------------------------------------+
## * Utility Functions
@@ -38,17 +40,19 @@ OS_IS_HANDLED=true
usage()
{
cat <<EOF
-usage:$(basename "$0") [--help|-n|[-i DIR|-I]]
+usage:$(basename "$0") [--help|-n|-i DIR|[-d -D]|[--os OS]]
- -n Don't do anything, but check if this OS is handled.
+ -n Don't do anything, but check if this OS is handled.
- -i DIR Install the program in the given directory.
+ -i DIR Install the program in the given directory.
- -d Force dependency installattion.
+ -d Force dependency installattion.
- -D Skip dependency installattion.
+ -D Skip dependency installattion.
- --help Display this message.
+ --os OS Use the given OS's installer
+
+ --help Display this message.
EOF
exit "$1"
@@ -185,6 +189,11 @@ handle_options()
if [ "${1%%/}" != "${PWD%%/}" ]; then
INSTALL_DIR=$1
fi ;;
+ --os)
+ shift
+ [ $# -gt 0 ] || usage 1
+ OS="$1"
+ ;;
*) usage 1 ;;
esac
shift
@@ -409,16 +418,25 @@ os_gentoo() {
handle_options "$@"
-os_macos "$@" || \
-os_freebsd "$@" || \
-os_arch "$@" || \
-os_centos "$@" || \
-os_openbsd "$@" || \
-os_fedora "$@" || \
-os_debian "$@" || \
-os_gentoo "$@" || \
-os_msys2 "$@" || \
-os_nixos "$@" || \
+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_IS_HANDLED=
if [ -z "$DRY_RUN" ]; then