diff --git a/archbox b/archbox deleted file mode 100755 index e8fc917..0000000 --- a/archbox +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -CHROOT="/var/archlinux/root.x86_64" -COMMAND=$(echo $@ | tr ' ' '\ ') -USER=$(whoami) - -doas cp /etc/resolv.conf $CHROOT/etc/resolv.conf -[[ -z $@ ]] && doas chroot $CHROOT /bin/su $USER \ - || doas chroot $CHROOT /bin/su -c "$COMMAND" $USER diff --git a/archbox.bash b/archbox.bash new file mode 100755 index 0000000..fd98532 --- /dev/null +++ b/archbox.bash @@ -0,0 +1,50 @@ +#!/bin/bash + +source /etc/archbox.conf + +checkdep(){ + which $1 >/dev/null 2>&1 || echo "Install $1." && exit 1 +} + +copyresolv(){ + $PRIV /usr/local/share/archbox/bin/copyresolv +} + +asroot(){ + [[ $EUID -ne 0 ]] && echo "Run this as root!" && exit 1 +} + +case $1 in + --create) + asroot + [[ -z $2 ]] && echo "Specify the link of Arch Linux bootstrap tarball." \ + && exit 1 + mkdir $INSTALL_PATH + cd $INSTALL_PATH + checkdep wget + wget -q --show-progress -O archlinux.tar.gz $2 + tar xzf archlinux.tar.gz + cp /etc/resolv.conf $CHROOT/etc/resolv.conf + echo "You will need to edit which mirror you want to use, uncomment needed mirrors and save it." + echo "Editor of your choice:" + read MIRROR_EDITOR + $MIRROR_EDITOR $CHROOT/etc/pacman.d/mirrorlist || exit 1 + checkdep wget + echo "Disabling Pacman's CheckSpace" + checkdep sed + sed -i 's/CheckSpace/#CheckSpace/g' $CHROOT/etc/pacman.conf + + ;; + --enter) + copyresolv + $PRIV /usr/local/share/archbox/bin/archboxenter + ;; + "") + echo "Help text" + ;; + *) + copyresolv + COMMAND=$(echo $@ | tr ' ' '\ ') + $PRIV /usr/local/share/archbox/bin/archboxcommand $COMMAND + ;; +esac diff --git a/archbox.conf b/archbox.conf new file mode 100644 index 0000000..cb3ee23 --- /dev/null +++ b/archbox.conf @@ -0,0 +1,4 @@ +USER=lemniskett +PRIV="sudo" +INSTALL_PATH="/var/archlinux" +CHROOT="$INSTALL_PATH/root.x86_64" \ No newline at end of file diff --git a/archboxcommand.bash b/archboxcommand.bash new file mode 100755 index 0000000..d17e761 --- /dev/null +++ b/archboxcommand.bash @@ -0,0 +1,5 @@ +#!/bin/bash + +source /etc/archbox.conf +echo executing $@ +chroot $CHROOT /bin/su -c $@ $USER \ No newline at end of file diff --git a/archboxenter.bash b/archboxenter.bash new file mode 100755 index 0000000..23c9493 --- /dev/null +++ b/archboxenter.bash @@ -0,0 +1,5 @@ +#!/bin/bash + +source /etc/archbox.conf +COMMAND=$(echo $@ | tr ' ' '\ ') +chroot $CHROOT /bin/su -c "$COMMAND" $USER \ No newline at end of file diff --git a/copyresolv.bash b/copyresolv.bash new file mode 100755 index 0000000..cbf9619 --- /dev/null +++ b/copyresolv.bash @@ -0,0 +1,4 @@ +#!/bin/bash + +source /etc/archbox.conf +cp /etc/resolv.conf $CHROOT/etc/resolv.conf \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..69300c4 --- /dev/null +++ b/install.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +cp -v ./archbox.bash /usr/local/bin/archbox +cp -v ./archbox.conf /etc/archbox.conf +cp -v ./archboxenter.bash /usr/local/share/archbox/bin/archboxenter +cp -v ./copyresolv.bash /usr/local/share/archbox/bin/copyresolv +cp -v ./archboxenter.bash /usr/local/share/archbox/bin/archboxcommand diff --git a/runit/archbox/run b/runit/archbox/run new file mode 100755 index 0000000..705d6b4 --- /dev/null +++ b/runit/archbox/run @@ -0,0 +1,23 @@ +#!/bin/bash + +source /etc/archbox.conf + +mount -R /home $CHROOT/home +mount -t proc /proc $CHROOT/proc +mount -R /tmp $CHROOT/tmp +mount -R /sys $CHROOT/sys +mount -R /dev $CHROOT/dev +mount -R /run $CHROOT/run +mount -R /lib/modules $CHROOT/lib/modules +mount -R /boot $CHROOT/boot + +# Allow chroot enviroment to access host's machine id +# to be able to connect to host's pulseaudio. +# Comment if the chroot enviroment is not able to connect +# to host's pulseaudio, you may want to start pulseaudio in +# the chroot instead. +mount -R /var/lib/dbus $CHROOT/var/lib/dbus + +# Runit will re-execute scripts those are finished, +# so we create a neverending loop. +while true; do sleep 10800; done diff --git a/sv/run b/sv/run deleted file mode 100755 index c5eb236..0000000 --- a/sv/run +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -CHROOT="/var/archlinux/root.x86_64" - -mount -R /home $CHROOT/home -mount -t proc /proc $CHROOT/proc -mount -R /tmp $CHROOT/tmp -mount -R /sys $CHROOT/sys -mount -R /dev $CHROOT/dev -mount -R /run $CHROOT/run -mount -R /var/lib/dbus $CHROOT/var/lib/dbus -mount -R /lib/modules $CHROOT/lib/modules -mount -R /boot $CHROOT/boot - -while true; do sleep 10800; done