diff --git a/archbox.conf b/archbox.conf index 1ef1077..56fd1b7 100644 --- a/archbox.conf +++ b/archbox.conf @@ -5,26 +5,29 @@ CHROOT="$INSTALL_PATH/root.x86_64" # Nix OS will breaks when you mount /run, change MOUNT_RUN to "no" # if you use Nix OS, don't forget to use `archbox --mount-runtime-only` -# after user login +# after user login. MOUNT_RUN="yes" # Mount modules and boot directory, useful if you want to use kernels -# from Arch Linux repo, otherwise it's best to remain disabled +# from Arch Linux repo, otherwise it's best to remain disabled. MOUNT_MOD="no" # Lazy unmounting, make sure you know what you're doing if enabling this! LAZY_UMOUNT="no" -# Put your desired enviroment variable here, for example +# Put your desired enviroment variable here, for example: # # ENV_VAR="HOME=/var/home/lemniskett" # ENV_VAR="" -# Parse a Systemd service and executes it on boot, order matters, for example +# Parse a Systemd service and executes it on boot, order matters, for example. # -# SERVICES=(vmware-networks-configuration vmware-networks vmware-usbarbitrator nginx) +# SERVICES=( vmware-networks-configuration vmware-networks vmware-usbarbitrator nginx ) # # Keep in mind that this doesn't resolve service dependencies, so you may need to -# enable the dependencies manually +# enable the dependencies manually. SERVICES=() + +# Share other host directories into Archbox, absolute path needed. +SHARED_FOLDER=( /home ) diff --git a/archboxinit.bash b/archboxinit.bash index f1deced..198fa80 100644 --- a/archboxinit.bash +++ b/archboxinit.bash @@ -26,7 +26,6 @@ rmbind() { case $1 in start) - rbind /home bindproc rbind /tmp rbind /sys make-rslave @@ -34,13 +33,16 @@ case $1 in [[ $MOUNT_RUN = "yes" ]] && rbind /run [[ $MOUNT_MOD = "yes" ]] && rbind /lib/modules && rbind /boot [[ -d /var/lib/dbus ]] && rbind /var/lib/dbus - for i in ${SERVICES[@]}; do - chroot $CHROOT /bin/su -c "/usr/local/bin/archboxctl exec $i" > /dev/null 2>&1 + for i in ${SHARED_FOLDER[@]}; do + mkdir -p $CHROOT/$i + rbind $i + done + for j in ${SERVICES[@]}; do + chroot $CHROOT /bin/su -c "/usr/local/bin/archboxctl exec $j" > /dev/null 2>&1 done exit 0 ;; stop) - rmbind /home rmbind /proc rmbind /tmp rmbind /sys @@ -48,7 +50,9 @@ case $1 in [[ $MOUNT_RUN = "yes" ]] && rmbind /run [[ $MOUNT_MOD = "yes" ]] && rmbind /lib/modules && rmbind /boot rmbind /var/lib/dbus - kill $(pidof serviced) 2>/dev/null + for i in ${SHARED_FOLDER[@]}; do + rmbind $i + done exit 0 ;; esac