Update README.md and exec with sudo automatically when mounting.

This commit is contained in:
lemniskett 2021-01-23 16:23:49 +07:00
parent 7f9a7f6512
commit e2305d21a5
2 changed files with 10 additions and 11 deletions

View File

@ -22,14 +22,14 @@ sudo archbox --create <archlinux tarball download link>
``` ```
### Configuring filesystem automount ### Configuring filesystem automount
Execute ```/usr/local/share/archbox/bin/archboxinit start``` on boot. Execute ```/usr/local/share/archbox/bin/archboxinit start``` on boot.
If you use systemd, you can create a systemd service with this syntax below : If you use systemd, you can create a systemd service with this syntax below (Assuming the install prefix is ```/usr/local```) :
``` ```
[Unit] [Unit]
Description=Archbox init Description=Archbox init
PartOf=multi-user.target PartOf=multi-user.target
[Service] [Service]
ExecStart=<install prefix>/bin/archbox --mount ExecStart=/usr/local/bin/archbox --mount
Type=oneshot Type=oneshot
User=root User=root
@ -42,9 +42,9 @@ If you don't use systemd, either create your own init service, or create a @rebo
### Removing chroot enviroment ### Removing chroot enviroment
**IMPORTANT**, Make sure you've unmounted everything in chroot enviroment, it's better to remove the init script and reboot to unmount everything. if you can't reboot for some reason, do : **IMPORTANT**, Make sure you've unmounted everything in chroot enviroment, it's better to remove the init script and reboot to unmount everything. if you can't reboot for some reason, do :
``` ```
/usr/local/share/archbox/bin/archboxinit stop archbox -u
``` ```
, then do : then do :
``` ```
mount mount
``` ```
@ -55,7 +55,7 @@ To enter chroot, do :
archbox --enter archbox --enter
``` ```
### Executing commands in chroot enviroment ### Executing commands in chroot enviroment
To execute commands inside chroot envirotment, do : To execute commands inside chroot enviroment, do :
``` ```
archbox <command> archbox <command>
``` ```
@ -64,16 +64,17 @@ for example, to update chroot, do :
archbox sudo pacman -Syu archbox sudo pacman -Syu
``` ```
### Optional steps ### Optional steps
You may want to add this if you don't want to run archbox chroot without password : You may want to add this if you don't want to use Archbox without password (assuming the install prefix is ```/usr/local```) :
#### Sudo #### Sudo
``` ```
%wheel ALL=(root) NOPASSWD: /usr/local/share/archbox/bin/archbox,/usr/local/share/archbox/bin/copyresolv,/usr/local/share/archbox/bin/remount_run %wheel ALL=(root) NOPASSWD: /usr/local/share/archbox/bin/archbox,/usr/local/share/archbox/bin/copyresolv,/usr/local/share/archbox/bin/remount_run,/usr/local/share/archbox/bin/archboxinit
``` ```
#### Doas #### Doas
``` ```
permit nopass :wheel as root cmd /usr/local/share/archbox/bin/archbox permit nopass :wheel as root cmd /usr/local/share/archbox/bin/archbox
permit nopass :wheel as root cmd /usr/local/share/archbox/bin/copyresolv permit nopass :wheel as root cmd /usr/local/share/archbox/bin/copyresolv
permit nopass :wheel as root cmd /usr/local/share/archbox/bin/remount_run permit nopass :wheel as root cmd /usr/local/share/archbox/bin/remount_run
permit nopass :wheel as root cmd /usr/local/share/archbox/bin/archboxinit
``` ```
### Misc ### Misc
#### Systemd services #### Systemd services

View File

@ -98,12 +98,10 @@ case $1 in
exit $? exit $?
;; ;;
-m|--mount) -m|--mount)
asroot $PRIV $PREFIX/share/archbox/bin/archboxinit start
$PREFIX/share/archbox/bin/archboxinit start
;; ;;
-u|--umount) -u|--umount)
asroot $PRIV $PREFIX/share/archbox/bin/archboxinit stop
$PREFIX/share/archbox/bin/archboxinit stop
;; ;;
--remount-run) --remount-run)
$PRIV $PREFIX/share/archbox/bin/remount_run $PRIV $PREFIX/share/archbox/bin/remount_run