mirror of
https://github.com/tommytran732/Arch-Setup-Script
synced 2025-02-20 18:01:33 -05:00
Adding some basic sanity checking to the script
- Allows Control-C to terminate the script at any time. - Confirms you have a UEFI/GPT capable system before operating. Signed-off-by: funk-on-code <113871227+funk-on-code@users.noreply.github.com>
This commit is contained in:
parent
a785f2b908
commit
0c35ecf54e
19
install.sh
19
install.sh
@ -3,6 +3,25 @@
|
||||
# Cleaning the TTY.
|
||||
clear
|
||||
|
||||
# Add some basic sanity checking, just in case.
|
||||
if [[ ! "$(id -u)" == "0" ]]; then
|
||||
echo "[!] You MUST this script as root. Aborting."
|
||||
exit 255
|
||||
fi
|
||||
|
||||
if [[ ! "$(ls /sys/firmware/efi/efivars)" ]]; then
|
||||
echo "[!] Please enable booting via UEFI. Aborting."
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# ... and trap Control-C correctly so we can bail out, when required.
|
||||
trap '_confirm_sigint' SIGINT
|
||||
|
||||
_confirm_sigint() {
|
||||
printf "\n"; read -rp "SIGINT caught: Are you sure you want to stop running this script? [y/N] " response
|
||||
{ [ "$response" == "y" ] || [ "$response" == "Y" ]; } && exit 1 || return
|
||||
}
|
||||
|
||||
# Updating the live environment usually causes more problems than its worth, and quite often can't be done without remounting cowspace with more capacity, especially at the end of any given month.
|
||||
pacman -Sy
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user