Code restructure on configure-stormux stub.

This commit is contained in:
Storm Dragon 2024-03-08 16:35:52 -05:00
parent 0b10dc426b
commit 386cb3230e

View File

@ -15,17 +15,16 @@ if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then
exit 0 exit 0
fi fi
if [[ ! -d /opt/configure-stormux ]]; then # Offer to switch fenrir layout.
# Offer to switch fenrir layout. echo "Would you like to switch Fenrir to laptop layout?"
echo "Would you like to switch Fenrir to laptop layout?" echo "Press y for yes or n for no followed by enter."
echo "Press y for yes or n for no followed by enter." read -r continue
read -r continue continue="${continue::1}"
continue="${continue::1}" if [[ "${continue,}" == "y" ]];then
if [[ "${continue,}" == "y" ]];then
sed -i 's/=desktop/=laptop/' /etc/fenrirscreenreader/settings/settings.conf sed -i 's/=desktop/=laptop/' /etc/fenrirscreenreader/settings/settings.conf
clear clear
systemctl restart fenrirscreenreader.service systemctl restart fenrirscreenreader.service
fi fi
# Check for possible resize # Check for possible resize
diskSource="$(df --output='source' / | tail -1)" diskSource="$(df --output='source' / | tail -1)"
@ -41,7 +40,7 @@ if [[ $diskSize -le 5 ]]; then
fi fi
fi fi
if ! ping -c1 stormux.org &> /dev/null ; then if ! ping -c1 stormux.org &> /dev/null ; then
echo "No internet connection detected. Press enter to open NetworkManager." echo "No internet connection detected. Press enter to open NetworkManager."
echo "Note, it is best to put Fenrir into highlight mode while using NetworkManager." echo "Note, it is best to put Fenrir into highlight mode while using NetworkManager."
echo "In desktop layout this is done by pressing Fenrir+numpad asterisk." echo "In desktop layout this is done by pressing Fenrir+numpad asterisk."
@ -52,22 +51,21 @@ fi
echo "Press enter to continue." echo "Press enter to continue."
read -r continue read -r continue
nmtui-connect nmtui-connect
fi fi
# Check for internet connectivity # Check for internet connectivity
if ping -qc1 -W 1 stormux.org &> /dev/null; then if ping -qc1 -W 1 stormux.org &> /dev/null; then
echo "Updating the clock to prevent certificate errors..." echo "Updating the clock to prevent certificate errors..."
# Get current date and time # Get current date and time
date_time=$(curl -s http://worldtimeapi.org/api/ip | grep -oP '(?<="datetime":")[^"]*') date_time=$(curl -s http://worldtimeapi.org/api/ip | grep -oP '(?<="datetime":")[^"]*')
echo "Current date and time: $date_time" echo "Current date and time: $date_time"
# set date and time # set date and time
date -s "$date_time" date -s "$date_time"
else else
echo "Please connect to the internet and run ${0##*/} again." echo "Please connect to the internet and run ${0##*/} again."
exit 1 exit 1
fi
echo "Installing configure-stormux..."
git -C /opt clone -q https://git.stormux.org/storm/configure-stormux || exit 1
fi fi
echo "Installing configure-stormux..."
git -C /opt clone -q https://git.stormux.org/storm/configure-stormux || exit 1
echo echo
echo "Initial setup is complete." echo "Initial setup is complete."
@ -85,5 +83,4 @@ echo
echo "Thank you for choosing Stormux." echo "Thank you for choosing Stormux."
exit 0 exit 0