set_timezone 676 Bytes
Newer Older
GabMus's avatar
GabMus committed
1 2 3 4 5 6 7 8
#!/bin/bash

zoneinfo_path="/mnt/usr/share/zoneinfo"
internal_zoneinfo_path="/usr/share/zoneinfo"

region=""
city=""

9
[ ! -f /tmp/pmenu ] && curl -sL -o /tmp/pmenu https://raw.githubusercontent.com/sgtpep/pmenu/master/pmenu
GabMus's avatar
GabMus committed
10 11 12 13 14 15 16 17 18 19 20
chmod +x /tmp/pmenu
while [ ! -f $zoneinfo_path/$region/$city ]; do
    region=$(ls $zoneinfo_path | /tmp/pmenu -p "Setting timezone: choose a region > ")
    if [ ! -z $region ]; then
        cities="<-Back $(ls $zoneinfo_path/$region)"
        city=$(/tmp/pmenu -p "Setting timezone: choose a city > " $cities)
    fi
done

internal_zoneinfo_file="$internal_zoneinfo_path/$region/$city"
arch-chroot /mnt ln -sf $internal_zoneinfo_file /etc/localtime