Change variable to something more readable and more short

This commit is contained in:
2018-08-02 17:08:41 +02:00
parent e0e576ff0e
commit 6d93d48059
2 changed files with 11 additions and 10 deletions

View File

@ -1,25 +1,24 @@
#!/usr/bin/env sh
alpine_install=${INSTALL:-'alpine-chroot-install'}
alpine_directory=${DIR:-'/alpine'}
SCRIPT=${SCRIPTNAME:-'alpine-chroot-install'}
DIR=${DIRPATH:-'/alpine'}
# Tests
DIR="${alpine_directory}"
if ! [[ $DIR == /* ]]; then
echo "DIR is not an absolute URL. It should start with a '/'" && exit 1
echo "DIRPATH is not an absolute URL. It should start with a '/'" && exit 1
fi
# DL alpine install script
if ! test -f "$alpine_install"; then
wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.9.0/alpine-chroot-install -O "$alpine_install" \
&& echo 'e5dfbbdc0c4b3363b99334510976c86bfa6cb251 alpine-chroot-install' | sha1sum -c \
if ! test -f "$SCRIPT"; then
wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.9.0/alpine-chroot-install -O "$SCRIPT" \
&& echo "e5dfbbdc0c4b3363b99334510976c86bfa6cb251 ${SCRIPT}" | sha1sum -c \
|| exit 1
chmod +x "$alpine_install"
chmod +x "$SCRIPT"
fi
# Install Alpine
if ! test -d "$DIR"; then
sudo sh ./$alpine_install -d $DIR -p build-base -p git -p zsh -p lua-filesystem -p luarocks5.1 -p lua-toml -p moonscript -p abuild -p lua-argparse || exit 1
sudo sh ./$SCRIPT -d $DIR -p build-base -p git -p zsh -p lua-filesystem -p luarocks5.1 -p lua-toml -p moonscript -p abuild -p lua-argparse || exit 1
fi
# Set rc_sys="prefix" to not disturb systemd on current system