Allow changing installation PREFIX.

This commit is contained in:
lemniskett 2021-01-23 16:06:38 +07:00
parent 6166f472c2
commit 496514122e
3 changed files with 25 additions and 17 deletions

View File

@ -7,7 +7,7 @@ checkdep(){
}
copyresolv(){
$PRIV /usr/local/share/archbox/bin/copyresolv
$PRIV $PREFIX/share/archbox/bin/copyresolv
}
asroot(){
@ -83,8 +83,8 @@ case $1 in
checkdep sed
sed -i 's/CheckSpace/#CheckSpace/g' $CHROOT/etc/pacman.conf
msg "Mounting necessary filesystems..."
/usr/local/share/archbox/bin/archboxinit start
cp /usr/local/share/archbox/chroot_setup.bash $CHROOT/chroot_setup
$PREFIX/share/archbox/bin/archboxinit start
cp $PREFIX/share/archbox/chroot_setup.bash $CHROOT/chroot_setup
echo $USER > /tmp/archbox_user
chroot $CHROOT /bin/bash -c "/chroot_setup"
exit $?
@ -92,15 +92,15 @@ case $1 in
-e|--enter)
storeenv
copyresolv
$PRIV /usr/local/share/archbox/bin/archbox enter
$PRIV $PREFIX/share/archbox/bin/archbox enter
exit $?
;;
--remount-run)
$PRIV /usr/local/share/archbox/bin/remount_run
$PRIV $PREFIX/share/archbox/bin/remount_run
exit $?
;;
--mount-runtime-only)
$PRIV /usr/local/share/archbox/bin/remount_run runtimeonly
$PRIV $PREFIX/share/archbox/bin/remount_run runtimeonly
exit $?
;;
-h|--help)
@ -117,7 +117,7 @@ case $1 in
*)
storeenv
copyresolv
$PRIV /usr/local/share/archbox/bin/archbox $@
$PRIV $PREFIX/share/archbox/bin/archbox $@
exit $?
;;
esac

View File

@ -46,4 +46,4 @@ while true; do
passwd $CHROOT_USER && break
done
sed -i 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers
echo "Don't forget to run '/usr/local/share/archbox/bin/archboxinit start' in host on boot"
echo "Don't forget to run \"archbox --mount\" in host on boot"

View File

@ -1,18 +1,26 @@
#!/usr/bin/env bash
mkdir -p /usr/local/share/archbox/bin
install -v -D -m 755 ./archbox.bash /usr/local/bin/archbox
install -v -D -m 755 ./archbox-desktop.bash /usr/local/bin/archbox-desktop
PREFIX="/usr/local"
mkdir -p $PREFIX/share/archbox/bin
install -v -D -m 755 ./archbox.bash $PREFIX/bin/archbox
install -v -D -m 755 ./archbox-desktop.bash $PREFIX/bin/archbox-desktop
[[ ! -e /etc/archbox.conf ]] && install -v -D -m 755 ./archbox.conf /etc/archbox.conf
install -v -D -m 755 ./copyresolv.bash /usr/local/share/archbox/bin/copyresolv
install -v -D -m 755 ./archboxcommand.bash /usr/local/share/archbox/bin/archbox
install -v -D -m 755 ./remount_run.bash /usr/local/share/archbox/bin/remount_run
install -v -D -m 755 ./chroot_setup.bash /usr/local/share/archbox/chroot_setup.bash
install -v -D -m 755 ./archboxinit.bash /usr/local/share/archbox/bin/archboxinit
install -v -D -m 755 ./copyresolv.bash $PREFIX/share/archbox/bin/copyresolv
install -v -D -m 755 ./archboxcommand.bash $PREFIX/share/archbox/bin/archbox
install -v -D -m 755 ./remount_run.bash $PREFIX/share/archbox/bin/remount_run
install -v -D -m 755 ./chroot_setup.bash $PREFIX/share/archbox/chroot_setup.bash
install -v -D -m 755 ./archboxinit.bash $PREFIX/share/archbox/bin/archboxinit
cat << EOF >> /etc/archbox.conf
# Don't change this unless you know what you're doing.
PREFIX="$PREFIX"
EOF
[[ -z $1 ]] && exit 0
if [ $1 = "--exp" ]; then
install -v -D -m 755 ./exp/startx-killxdg.bash /usr/local/bin/startx-killxdg
install -v -D -m 755 ./exp/startx-killxdg.bash $PREFIX/bin/startx-killxdg
else
echo "Unknown install option: $1"
fi