Add way to mount to different directory.

This commit is contained in:
Syahrial Agni Prasetya 2021-03-06 13:58:22 +07:00
parent ed0e441644
commit fe2e490ff4
No known key found for this signature in database
GPG Key ID: 46F88749C8C79383
2 changed files with 24 additions and 5 deletions

View File

@ -141,7 +141,10 @@ Edit SHARED_FOLDER in ```/etc/archbox.conf```. For example:
```
SHARED_FOLDER=( /home /var/www )
```
Note that this will recursively mount directories.
To mount to different directory, use ```:``` separator :
```
SHARED_FOLDER=( /home /var/www:/host_webroot )
```
### Known issues
#### NixOS-specific issues
##### /run mounting
@ -161,7 +164,7 @@ Or alternatively if you use WM-only, just disable mounting ```/run``` entirely a
##### Archbox didn't access resources in /usr/share
In Archbox, Symlink ```/usr``` to ```/run/current-system/sw```:
```
sudo mkdir -p /run/current-system/
sudo mkdir -p /run/current-system
sudo ln -s /usr /run/current-system/sw
```
make sure /run isn't mounted.

View File

@ -12,6 +12,11 @@ rbind() {
[[ $2 = "make-rslave" ]] && mount --make-rslave $CHROOT$1
}
rbind_diff() {
[[ $(mount | grep $CHROOT$2) ]] && msg "$CHROOT$2 already mounted." \
|| (mount -R $1 $CHROOT$2 && msg "$CHROOT$2 mounted!")
}
bindproc() {
[[ $(mount | grep $CHROOT/proc) ]] && msg "$CHROOT/proc already mounted." \
|| (mount -t proc /proc $CHROOT/proc && msg "$CHROOT/proc mounted!")
@ -37,8 +42,14 @@ case $1 in
fi
[[ -d /var/lib/dbus ]] && rbind /var/lib/dbus
for i in ${SHARED_FOLDER[@]}; do
mkdir -p $CHROOT/$i
rbind $i
if [[ $i = *:* ]]; then
source=$(echo $i | sed 's/:.*//')
target=$(echo $i | sed 's/.*://')
mkdir -p $CHROOT$target
rbind_diff $source $target;
else
rbind $i;
fi
done
msg "Starting services"
for j in ${SERVICES[@]}; do
@ -71,7 +82,12 @@ case $1 in
fi
rmbind /var/lib/dbus
for i in ${SHARED_FOLDER[@]}; do
rmbind $i
if [[ $i = *:* ]]; then
target=$(echo $i | sed 's/.*://')
rmbind $target;
else
rmbind $i;
fi
done
exit 0
;;