Better output.
This commit is contained in:
parent
03df6666e1
commit
4ded2d0a7f
25
archbox.bash
25
archbox.bash
@ -16,38 +16,52 @@ asroot(){
|
|||||||
|
|
||||||
help_text(){
|
help_text(){
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
USAGE $0 <arguments>
|
USAGE $0 <arguments>
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--create LINK Creates a chroot enviroment.
|
--create LINK Creates a chroot enviroment.
|
||||||
--enter Enters chroot enviroment.
|
--enter Enters chroot enviroment.
|
||||||
--help Displays this help message.
|
--help Displays this help message.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err(){
|
||||||
|
echo "$(tput bold)$(tput setaf 1)==> $@"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
msg(){
|
||||||
|
echo "$(tput bold)$(tput setaf 2)==> $@"
|
||||||
|
}
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
--create)
|
--create)
|
||||||
asroot
|
asroot
|
||||||
[[ -z $2 ]] && echo "Specify the link of Arch Linux bootstrap tarball." \
|
[[ -z $2 ]] && echo "Specify the link of Arch Linux bootstrap tarball." \
|
||||||
&& exit 1
|
&& exit 1
|
||||||
|
msg "Creating chroot directory..."
|
||||||
mkdir $INSTALL_PATH
|
mkdir $INSTALL_PATH
|
||||||
cd $INSTALL_PATH
|
cd $INSTALL_PATH
|
||||||
|
msg "Downloading Arch Linux tarball..."
|
||||||
checkdep wget
|
checkdep wget
|
||||||
wget -q --show-progress -O archlinux.tar.gz $2
|
wget -q --show-progress -O archlinux.tar.gz $2
|
||||||
|
msg "Extracting the tarball..."
|
||||||
tar xzf archlinux.tar.gz
|
tar xzf archlinux.tar.gz
|
||||||
|
msg "Enabling internet connection in chroot enviroment..."
|
||||||
cp /etc/resolv.conf $CHROOT/etc/resolv.conf
|
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."
|
msg "You will need to edit which mirror you want to use, uncomment needed mirrors and save it."
|
||||||
echo "Editor of your choice:"
|
echo "Editor of your choice:"
|
||||||
read MIRROR_EDITOR
|
read MIRROR_EDITOR
|
||||||
$MIRROR_EDITOR $CHROOT/etc/pacman.d/mirrorlist || exit 1
|
$MIRROR_EDITOR $CHROOT/etc/pacman.d/mirrorlist || exit 1
|
||||||
checkdep wget
|
msg "Disabling Pacman's CheckSpace"
|
||||||
echo "Disabling Pacman's CheckSpace"
|
|
||||||
checkdep sed
|
checkdep sed
|
||||||
sed -i 's/CheckSpace/#CheckSpace/g' $CHROOT/etc/pacman.conf
|
sed -i 's/CheckSpace/#CheckSpace/g' $CHROOT/etc/pacman.conf
|
||||||
|
|
||||||
;;
|
;;
|
||||||
--enter)
|
--enter)
|
||||||
copyresolv
|
copyresolv
|
||||||
$PRIV /usr/local/share/archbox/bin/archboxenter
|
$PRIV /usr/local/share/archbox/bin/archboxenter
|
||||||
;;
|
;;
|
||||||
--help)
|
--help)
|
||||||
help_text
|
help_text
|
||||||
@ -55,6 +69,9 @@ case $1 in
|
|||||||
"")
|
"")
|
||||||
help_text
|
help_text
|
||||||
;;
|
;;
|
||||||
|
--*)
|
||||||
|
err "Unknown option: $1"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
copyresolv
|
copyresolv
|
||||||
COMMAND=$(echo $@ | tr ' ' '\ ')
|
COMMAND=$(echo $@ | tr ' ' '\ ')
|
||||||
|
Loading…
Reference in New Issue
Block a user