forked from BodgeMaster/void-usb
install stage 1: add timezone picker, set SEEDRNG_SKIP_CREDIT
parent
faa381effb
commit
c35f412cf4
|
|
@ -324,7 +324,105 @@ else
|
||||||
echo "KEYMAP=\"$KBD_LAYOUT\"" >> /mnt/target/etc/rc.conf
|
echo "KEYMAP=\"$KBD_LAYOUT\"" >> /mnt/target/etc/rc.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#TODO timezone
|
clear
|
||||||
|
REGIONS="$(find /usr/share/zoneinfo/ -mindepth 1 -maxdepth 1 -type d -exec basename \{\} \; | sort)"
|
||||||
|
I=1
|
||||||
|
echo "
|
||||||
|
To set up time zone information, you will now be prompted for a region and location.
|
||||||
|
The location should be the one that determines your timezone, it isn't necessarily the one nearest to you.
|
||||||
|
|
||||||
|
Please choose a region:"
|
||||||
|
for REGION in $REGIONS; do
|
||||||
|
echo "$I: $REGION"
|
||||||
|
I=$((I+1))
|
||||||
|
done
|
||||||
|
REGION=""
|
||||||
|
CHOICE=0
|
||||||
|
while ! [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$REGIONS")" ]; do
|
||||||
|
read -p "Select an option [1-$(wc -l <<< "$REGIONS")]: " CHOICE
|
||||||
|
if [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$REGIONS")" ]; then
|
||||||
|
REGION="$(sed -n -e "${CHOICE}p" <<< "$REGIONS")"
|
||||||
|
else
|
||||||
|
echo "Invalid choice."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
LOCATIONS="$(find /usr/share/zoneinfo/"$REGION"/ -mindepth 1 -maxdepth 1 -exec basename \{\} \; | sort)"
|
||||||
|
I=1
|
||||||
|
echo "
|
||||||
|
Please choose a location or sub-region:"
|
||||||
|
for LOCATION in $LOCATIONS; do
|
||||||
|
if [ "$((I % 3))" -eq 0 ]; then
|
||||||
|
echo "$I: $LOCATION"
|
||||||
|
else
|
||||||
|
echo -n "$I: $LOCATION"
|
||||||
|
echo -ne "\t"
|
||||||
|
fi
|
||||||
|
I=$((I+1))
|
||||||
|
done
|
||||||
|
LOCATION=""
|
||||||
|
CHOICE=0
|
||||||
|
while ! [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$LOCATIONS")" ]; do
|
||||||
|
read -p "Select an option [1-$(wc -l <<< "$LOCATIONS")]: " CHOICE
|
||||||
|
if [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$LOCATIONS")" ]; then
|
||||||
|
LOCATION="$(sed -n -e "${CHOICE}p" <<< "$LOCATIONS")"
|
||||||
|
else
|
||||||
|
echo "Invalid choice."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ -d "/usr/share/zoneinfo/$REGION/$LOCATION" ]; then
|
||||||
|
REGION="$REGION/$LOCATION"
|
||||||
|
LOCATIONS="$(find /usr/share/zoneinfo/"$REGION"/ -mindepth 1 -maxdepth 1 -exec basename \{\} \; | sort)"
|
||||||
|
I=1
|
||||||
|
echo "
|
||||||
|
Please choose a location:"
|
||||||
|
for LOCATION in $LOCATIONS; do
|
||||||
|
if [ "$((I % 3))" -eq 0 ]; then
|
||||||
|
echo "$I: $LOCATION"
|
||||||
|
else
|
||||||
|
echo -n "$I: $LOCATION"
|
||||||
|
echo -ne "\t"
|
||||||
|
fi
|
||||||
|
I=$((I+1))
|
||||||
|
done
|
||||||
|
LOCATION=""
|
||||||
|
CHOICE=0
|
||||||
|
while ! [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$LOCATIONS")" ]; do
|
||||||
|
read -p "Select an option [1-$(wc -l <<< "$LOCATIONS")]: " CHOICE
|
||||||
|
if [ "$CHOICE" -gt 0 -a "$CHOICE" -le "$(wc -l <<< "$LOCATIONS")" ]; then
|
||||||
|
LOCATION="$(sed -n -e "${CHOICE}p" <<< "$LOCATIONS")"
|
||||||
|
else
|
||||||
|
echo "Invalid choice."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
TIMEZONE="$REGION/$LOCATION"
|
||||||
|
echo "Configuring timezone."
|
||||||
|
if grep "#TIMEZONE=" /mnt/target/etc/rc.conf; then
|
||||||
|
sed -i -e 's/#TIMEZONE=.*/TIMEZONE="'"$TIMEZONE"'"/' /mnt/target/etc/rc.conf
|
||||||
|
else
|
||||||
|
clear
|
||||||
|
echo "WARNING: Could not locate the time zone setting in rc.conf." | tee --append $LOGFILE
|
||||||
|
echo "The script will attempt to add one." | tee --append $LOGFILE
|
||||||
|
echo ""
|
||||||
|
press_any_key
|
||||||
|
echo "" >> /mnt/target/etc/rc.conf
|
||||||
|
echo "# Install script could not find time zone setting, adding one here." >> /mnt/target/etc/rc.conf
|
||||||
|
echo "TIMEZONE=\"$TIMEZONE\"" >> /mnt/target/etc/rc.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Setting SEEDRNG_SKIP_CREDIT=true"
|
||||||
|
if grep "#SEEDRNG_SKIP_CREDIT=" /mnt/target/etc/rc.conf; then
|
||||||
|
sed -i -e 's/#SEEDRNG_SKIP_CREDIT=.*/SEEDRNG_SKIP_CREDIT=true/' /mnt/target/etc/rc.conf
|
||||||
|
else
|
||||||
|
clear
|
||||||
|
echo "WARNING: Could not locate the SEEDRNG_SKIP_CREDIT setting in rc.conf." | tee --append $LOGFILE
|
||||||
|
echo "The script will attempt to add one." | tee --append $LOGFILE
|
||||||
|
echo ""
|
||||||
|
press_any_key
|
||||||
|
echo "" >> /mnt/target/etc/rc.conf
|
||||||
|
echo "# Install script could not find SEEDRNG_SKIP_CREDIT setting, adding one here." >> /mnt/target/etc/rc.conf
|
||||||
|
echo "SEEDRNG_SKIP_CREDIT=true" >> /mnt/target/etc/rc.conf
|
||||||
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo "Assume that the hardware clock is UTC?
|
echo "Assume that the hardware clock is UTC?
|
||||||
|
|
@ -386,6 +484,8 @@ done
|
||||||
|
|
||||||
echo "$TARGET_HOSTNAME" > /mnt/target/etc/hostname
|
echo "$TARGET_HOSTNAME" > /mnt/target/etc/hostname
|
||||||
|
|
||||||
|
#TODO: set up / fix locale on glibc
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo -n "Installing bootloader... "
|
echo -n "Installing bootloader... "
|
||||||
mkdir /mnt/target/boot/efi/LOADER >> $LOGFILE 2>&1
|
mkdir /mnt/target/boot/efi/LOADER >> $LOGFILE 2>&1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue