Basic functionality
This commit is contained in:
parent
1239eea289
commit
6371d1b127
9
archbox
9
archbox
@ -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
|
50
archbox.bash
Executable file
50
archbox.bash
Executable file
@ -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
|
4
archbox.conf
Normal file
4
archbox.conf
Normal file
@ -0,0 +1,4 @@
|
||||
USER=lemniskett
|
||||
PRIV="sudo"
|
||||
INSTALL_PATH="/var/archlinux"
|
||||
CHROOT="$INSTALL_PATH/root.x86_64"
|
5
archboxcommand.bash
Executable file
5
archboxcommand.bash
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/archbox.conf
|
||||
echo executing $@
|
||||
chroot $CHROOT /bin/su -c $@ $USER
|
5
archboxenter.bash
Executable file
5
archboxenter.bash
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/archbox.conf
|
||||
COMMAND=$(echo $@ | tr ' ' '\ ')
|
||||
chroot $CHROOT /bin/su -c "$COMMAND" $USER
|
4
copyresolv.bash
Executable file
4
copyresolv.bash
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/archbox.conf
|
||||
cp /etc/resolv.conf $CHROOT/etc/resolv.conf
|
7
install.sh
Executable file
7
install.sh
Executable file
@ -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
|
23
runit/archbox/run
Executable file
23
runit/archbox/run
Executable file
@ -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
|
15
sv/run
15
sv/run
@ -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
|
Loading…
Reference in New Issue
Block a user