Some workarounds for NixOS.

This commit is contained in:
lemniskett 2020-12-28 19:15:21 +07:00
parent 3be7844f02
commit 34a0c40550
5 changed files with 17 additions and 4 deletions

View File

@ -28,6 +28,7 @@ OPTIONS:
-e, --enter Enters chroot enviroment.
-h, --help Displays this help message.
--remount-run Remount /run in chroot enviroment.
--mount-runtime-only Mount XDG_RUNTIME_DIR to chroot enviroment.
EOF
}
@ -69,7 +70,7 @@ case $1 in
mount -R /tmp $CHROOT/tmp
mount -R /sys $CHROOT/sys
mount -R /dev $CHROOT/dev
mount -R /run $CHROOT/run
[[ $MOUNT_RUN = "yes" ]] && mount -R /run $CHROOT/run
mount --make-rslave $CHROOT/dev
mount --make-rslave $CHROOT/sys
mkdir -p $CHROOT/var/lib/dbus
@ -79,7 +80,7 @@ case $1 in
mount -R /boot $CHROOT/boot
cp /usr/local/share/archbox/chroot_setup.bash $CHROOT/chroot_setup
echo $USER > /tmp/archbox_user
chroot $CHROOT /bin/bash -c "/bin/sh /chroot_setup"
chroot $CHROOT /bin/bash -c "/chroot_setup"
;;
-e|--enter)
storeenv
@ -89,6 +90,9 @@ case $1 in
--remount-run)
$PRIV /usr/local/share/archbox/bin/remount_run
;;
--mount-runtime-only)
$PRIV /usr/local/share/archbox/bin/remount_run runtimeonly
;;
-h|--help)
help_text
;;

View File

@ -2,6 +2,7 @@ USER="lemniskett"
PRIV="sudo"
INSTALL_PATH="/var/archlinux"
CHROOT="$INSTALL_PATH/root.x86_64"
MOUNT_RUN="yes"
# Put your desired enviroment variable here, for example
# ENV_VAR="HOME=/var/home/lemniskett"

View File

@ -11,7 +11,7 @@ case $1 in
mount --make-rslave $CHROOT/sys
mount -R /dev $CHROOT/dev
mount --make-rslave $CHROOT/dev
mount -R /run $CHROOT/run
[[ $MOUNT_RUN = "yes" ]] && mount -R /run $CHROOT/run
mount -R /lib/modules $CHROOT/lib/modules
mount -R /boot $CHROOT/boot
mount -R /var/lib/dbus $CHROOT/var/lib/dbus
@ -25,7 +25,7 @@ case $1 in
umount -R $CHROOT/tmp
umount -R $CHROOT/sys
umount -R $CHROOT/dev
umount -R $CHROOT/run
[[ $MOUNT_RUN = "yes" ]] && umount -R $CHROOT/run
umount -R $CHROOT/lib/modules
umount -R $CHROOT/boot
umount -R $CHROOT/var/lib/dbus

View File

@ -9,6 +9,7 @@ msg(){
echo "$(tput bold)$(tput setaf 2)==> $@ $(tput sgr0)"
}
PATH=/usr/bin
msg "Initializing pacman keyrings..."
pacman-key --init
pacman-key --populate archlinux

View File

@ -6,9 +6,16 @@ case $1 in
killxdg)
umount -l $CHROOT/run
fuser -km $(cat /tmp/archbox_xdg_runtime_dir)
exit $?
;;
runtimeonly)
mkdir -p $CHROOT/$(cat /tmp/archbox_xdg_runtime_dir)
mount --rbind $(cat /tmp/archbox_xdg_runtime_dir) $CHROOT/$(cat /tmp/archbox_xdg_runtime_dir)
exit $?
;;
*)
umount -l $CHROOT/run
mount --rbind /run $CHROOT/run
exit $?
;;
esac