General improvements

- Changed swap partition to swap file.
- Added the option to list the time zones before setting one
- Fix spelling errors
This commit is contained in:
seajee
2024-08-09 02:35:00 +02:00
parent 0cdfc926b1
commit a48fa85737
2 changed files with 42 additions and 37 deletions

View File

@@ -8,15 +8,25 @@ password=""
echoerr() { cat <<< "$@" 1>&2; }
# Set the time zone
read -p "Enter time zone (${timezone}): " input
if [[ -n "$input" ]]; then
timezone="$input"
fi
while
echo "[INFO] Time zone configuration. Type \"list\" to list time zones"
read -p "Enter time zone (${timezone}): " input
if [[ ! -f "/usr/share/zoneinfo/${timezone}" ]]; then
echoerr "[ERROR] The selected time zone does not exist"
exit 5
fi
if [[ "$input" == "list" ]]; then
awk '/^Z/ { print $2 }; /^L/ { print $3 }' /usr/share/zoneinfo/tzdata.zi | sort | less
continue
fi
if [[ -n "$input" ]]; then
timezone="$input"
fi
if [[ ! -f "/usr/share/zoneinfo/${timezone}" ]]; then
echoerr "[ERROR] The selected time zone does not exist"
fi
[[ ! -f "/usr/share/zoneinfo/${timezone}" ]]
do true; done
echo "[INFO] Setting ${timezone} as the time zone"
ln -sf "/usr/share/zoneinfo/${timezone}" /etc/localtime