Merge pull request #9 from lemniskett/changeable-prefix
Req #6: Changeable prefix
This commit is contained in:
commit
cc7273c14c
15
README.md
15
README.md
@ -22,14 +22,14 @@ sudo archbox --create <archlinux tarball download link>
|
||||
```
|
||||
### Configuring filesystem automount
|
||||
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]
|
||||
Description=Archbox init
|
||||
PartOf=multi-user.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/share/archbox/bin/archboxinit start
|
||||
ExecStart=/usr/local/bin/archbox --mount
|
||||
Type=oneshot
|
||||
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
|
||||
**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
|
||||
```
|
||||
@ -55,7 +55,7 @@ To enter chroot, do :
|
||||
archbox --enter
|
||||
```
|
||||
### Executing commands in chroot enviroment
|
||||
To execute commands inside chroot envirotment, do :
|
||||
To execute commands inside chroot enviroment, do :
|
||||
```
|
||||
archbox <command>
|
||||
```
|
||||
@ -64,16 +64,17 @@ for example, to update chroot, do :
|
||||
archbox sudo pacman -Syu
|
||||
```
|
||||
### 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
|
||||
```
|
||||
%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
|
||||
```
|
||||
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/remount_run
|
||||
permit nopass :wheel as root cmd /usr/local/share/archbox/bin/archboxinit
|
||||
```
|
||||
### Misc
|
||||
#### Systemd services
|
||||
|
22
archbox.bash
22
archbox.bash
@ -7,7 +7,7 @@ checkdep(){
|
||||
}
|
||||
|
||||
copyresolv(){
|
||||
$PRIV /usr/local/share/archbox/bin/copyresolv
|
||||
$PRIV $PREFIX/share/archbox/bin/copyresolv
|
||||
}
|
||||
|
||||
asroot(){
|
||||
@ -33,6 +33,8 @@ OPTIONS:
|
||||
-c, --create URL Creates a chroot enviroment.
|
||||
-e, --enter Enters chroot enviroment.
|
||||
-h, --help Displays this help message.
|
||||
-m, --mount Mount Archbox directories.
|
||||
-u, --umount Unmount Archbox directories.
|
||||
--remount-run Remount /run in chroot enviroment.
|
||||
--mount-runtime-only Mount XDG_RUNTIME_DIR to chroot enviroment.
|
||||
|
||||
@ -83,8 +85,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 +94,21 @@ case $1 in
|
||||
-e|--enter)
|
||||
storeenv
|
||||
copyresolv
|
||||
$PRIV /usr/local/share/archbox/bin/archbox enter
|
||||
$PRIV $PREFIX/share/archbox/bin/archbox enter
|
||||
exit $?
|
||||
;;
|
||||
-m|--mount)
|
||||
$PRIV $PREFIX/share/archbox/bin/archboxinit start
|
||||
;;
|
||||
-u|--umount)
|
||||
$PRIV $PREFIX/share/archbox/bin/archboxinit stop
|
||||
;;
|
||||
--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 +125,7 @@ case $1 in
|
||||
*)
|
||||
storeenv
|
||||
copyresolv
|
||||
$PRIV /usr/local/share/archbox/bin/archbox $@
|
||||
$PRIV $PREFIX/share/archbox/bin/archbox $@
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
@ -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"
|
||||
|
@ -3,4 +3,4 @@
|
||||
source /etc/archbox.conf
|
||||
|
||||
startx
|
||||
$PRIV /usr/local/share/archbox/bin/remount_run killxdg
|
||||
$PRIV $PREFIX/share/archbox/bin/remount_run killxdg
|
||||
|
26
install.sh
26
install.sh
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user