update scripts text highlighting

This commit is contained in:
Tobias Powalowski 2022-04-05 21:01:07 +02:00
parent 829b6f4020
commit 01928e6cb2
2 changed files with 39 additions and 24 deletions

View file

@ -60,29 +60,35 @@ else
PACMAN_CONF=""
fi
prepare_pacman || (echo "Pacman preparation FAILED!"; return 1)
if ! prepare_pacman; then
echo "Pacman preparation FAILED!"
return 1
fi
chroot_mount
install_packages || (echo "Package installation FAILED."; chroot_umount; exit 1)
if ! install_packages; then
echo "Package installation FAILED."
chroot_umount
exit 1
fi
locale_gen
chroot_umount
echo
echo "Package installation complete."
echo -e "\033[1mPackage installation complete.\033[0m"
echo
echo "Please install a bootloader. Edit the appropriate config file for"
echo "your loader. Please use ${VMLINUZ} as kernel image."
echo "Chroot into your system to install it into the boot sector:"
echo " # mount -o bind /dev ${DESTDIR}/dev"
echo " # mount -t proc none ${DESTDIR}/proc"
echo " # mount -t sysfs none ${DESTDIR}/sys"
echo " # chroot ${DESTDIR} /bin/bash"
echo -e "Please install a \033[1mbootloader\033[0m. Edit the appropriate config file for"
echo -e "your loader. Please use \033[1m${VMLINUZ}\033[0m as kernel image."
echo -e "Chroot into your system to install it:"
echo -e " \033[1m# mount -o bind /dev ${DESTDIR}/dev\033[0m"
echo -e " \033[1m# mount -t proc none ${DESTDIR}/proc\033[0m"
echo -e " \033[1m# mount -t sysfs none ${DESTDIR}/sys\033[0m"
echo -e " \033[1m# chroot ${DESTDIR} /bin/bash\033[0m"
echo
echo "Next step, initramfs setup:"
echo "Edit your /etc/mkinitcpio.conf to fit your needs. After that run:"
echo "# mkinitcpio -p ${KERNELPKG}"
echo
echo "Then exit your chroot shell, edit ${DESTDIR}/etc/fstab and reboot!"
echo -e "Edit your \033[1m/etc/mkinitcpio.conf\033[0m to fit your needs. After that run:"
echo -e " \033[1m# mkinitcpio -p ${KERNELPKG}\033[0m"
echo
echo -e "Then \033[1mexit\033[0m your chroot shell, edit \033[1m${DESTDIR}/etc/fstab\033[0m and \033[1mreboot\033[0m\!"
exit 0
# vim: set ts=4 sw=4 et:

View file

@ -7,8 +7,12 @@
APPNAME=$(basename "${0}")
usage()
{
echo "Restoring an USB device to its original state (FAT32):"
echo "usage: ${APPNAME} <device>"
echo -e "\033[1mWelcome to \033[34marchboot's\033[0m \033[1mRESTORE USB STICK:\033[0m"
echo -e "\033[1m----------------------------------------\033[0m"
echo -e "This script restores an USB device to a \033[1mFAT32\033[0m device."
echo -e "\033[91mWARNING: ALL DATA WILL BE LOST ON THE DEVICE\!\033[0m"
echo ""
echo -e "usage: \033[1m${APPNAME} <device>\033[0m"
exit "$1"
}
@ -21,13 +25,16 @@ if ! [[ ${UID} -eq 0 ]]; then
echo "ERROR: Please run as root user!"
exit 1
fi
echo -e "\033[91mWARNING: 10 seconds for hitting CTRL+C to stop the process on ${1} now\!\033[0m"
sleep 10
# clean partitiontable
dd if=/dev/zero of=<DEVICE> bs=512 count=2048
wipefs -a "$1"
echo -e "\033[1mRestoring USB STICK...\033[0m"
echo -e "\033[1mSTEP 1/3:\033[0m Cleaning partition table..."
dd if=/dev/zero of="${1}" bs=512 count=2048
wipefs -a "${1}"
# create new MBR and partition on <DEVICE>
fdisk "$1" <<EOF
echo -e "\033[1mSTEP 2/3:\033[0m Create new MBR and partitiontable..."
fdisk "${1}" <<EOF
n
p
1
@ -40,4 +47,6 @@ EOF
# wait for partitiontable to be resynced
sleep 5
# create FAT32 filesystem on <device-partition>
mkfs.vfat -F32 "$1"1
echo -e "\033[1mSTEP 3/3:\033[0m Create FAT32 filesystem..."
mkfs.vfat -F32 "${1}"1
echo -e "\033[1mFinished.\033[0m"