Check that DIR path is an absolute one (starts with '/')
This commit is contained in:
parent
c1218df6a8
commit
e0e576ff0e
@ -3,6 +3,12 @@
|
|||||||
alpine_install=${INSTALL:-'alpine-chroot-install'}
|
alpine_install=${INSTALL:-'alpine-chroot-install'}
|
||||||
alpine_directory=${DIR:-'/alpine'}
|
alpine_directory=${DIR:-'/alpine'}
|
||||||
|
|
||||||
|
# Tests
|
||||||
|
DIR="${alpine_directory}"
|
||||||
|
if ! [[ $DIR == /* ]]; then
|
||||||
|
echo "DIR is not an absolute URL. It should start with a '/'" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# DL alpine install script
|
# DL alpine install script
|
||||||
if ! test -f "$alpine_install"; then
|
if ! test -f "$alpine_install"; then
|
||||||
wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.9.0/alpine-chroot-install -O "$alpine_install" \
|
wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.9.0/alpine-chroot-install -O "$alpine_install" \
|
||||||
@ -12,12 +18,14 @@ if ! test -f "$alpine_install"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Install Alpine
|
# Install Alpine
|
||||||
if ! test -d "$alpine_directory"; then
|
if ! test -d "$DIR"; then
|
||||||
sudo sh ./$alpine_install -d $alpine_directory -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 ./$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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set rc_sys="prefix" to not disturb systemd on current system
|
# Set rc_sys="prefix" to not disturb systemd on current system
|
||||||
sudo sed -e 's/#rc_sys=""/rc_sys="prefix"/g' -i "$alpine_directory/etc/rc.conf"
|
sudo sed -e 's/#rc_sys=""/rc_sys="prefix"/g' -i "$DIR/etc/rc.conf"
|
||||||
|
|
||||||
# Launch chroot
|
# Launch chroot
|
||||||
sh $alpine_directory/enter-chroot ./build
|
sh $DIR/enter-chroot ./build
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user