Compare commits

...

20 Commits

Author SHA1 Message Date
Storm Dragon
1658a53081 Hopefully use connected screen to display video if available, fall back to dummy driver if not found. 2024-12-01 19:38:10 -05:00
Storm Dragon
9cc539a6e4 Updated disk size check to 7G. 2024-11-03 02:18:59 -05:00
Storm Dragon
46faab708b Updated default image size to 6G because some packages failed to install. 2024-11-03 02:17:03 -05:00
Storm Dragon
e620f80b0e Minor update for comments. 2024-06-01 22:15:37 -04:00
Storm Dragon
134d25682b Offer a way to sync time at boot in the first boot version of configure-stormux. 2024-05-24 15:51:40 -04:00
Storm Dragon
88d7d12c69 timedatectl seems to be working now with time sync. 2024-05-21 02:06:30 -04:00
Storm Dragon
83b7867da4 Hopefully final touches on getting time and date sync working. 2024-03-21 14:30:48 -04:00
Storm Dragon
af1642b138 Build install openntpd during image build. 2024-03-21 14:29:20 -04:00
Storm Dragon
51a0fd0883 Try to make sure time and date is syncing with the internet. 2024-03-21 11:25:13 -04:00
Storm Dragon
b22785ab3e Make sure systemd-networkd and Networkmanager aren't both trying to get control of the network. 2024-03-21 11:21:51 -04:00
Storm Dragon
ef015add0a Remove dbus-broker from packages b ecause it's now the default. 2024-03-21 02:40:02 -04:00
Storm Dragon
81d60bb1b3 Added message reminding the user to go back to cursor mode after setting up internet connection. 2024-03-12 17:20:11 -04:00
Storm Dragon
50d9099231 Add a message for if inital configure-stormux gets interrupted. 2024-03-12 17:14:32 -04:00
Storm Dragon
aa4ec62c47 Added timezone to configure-stormux stub. 2024-03-12 17:04:11 -04:00
Storm Dragon
7fb1ba5283 Added alias pi-ip. 2024-03-09 04:59:47 -05:00
Storm Dragon
386cb3230e Code restructure on configure-stormux stub. 2024-03-08 16:35:52 -05:00
Storm Dragon
0b10dc426b Added partition size here so it runs on first boot. 2024-03-08 16:27:55 -05:00
Storm Dragon
40fd173777 Make sure audible sudo prompts are available throughout configure-stormux and the start up process. 2024-03-08 01:29:45 -05:00
Storm Dragon
1e24598316 Removed unneeded message from configure-stormux stub. 2024-03-07 17:29:16 -05:00
Storm Dragon
901d5cdb7a Updated first boot script. 2024-03-07 17:28:29 -05:00
7 changed files with 185 additions and 66 deletions

View File

@@ -1,6 +1,6 @@
#! /bin/bash
#
# Copyright 2020, Stormux, <storm_dragon@linux-a11y.org>
# Copyright 2020, Stormux, <storm_dragon@stormux.org>
#
# This is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free
@@ -91,7 +91,7 @@ done
# make sure variables are set, or use defaults.
export imageVersion="${imageVersion:-64}"
export imageSize="${imageSize:-4G}"
export imageSize="${imageSize:-6G}"
imageName="${imageName:-stormux-pi4-${imageVersion}-$(date '+%Y-%m-%d').img}"
imageName="${imageName/-64-/-aarch64-}"
imageName="${imageName/-32-/-armv7h-}"
@@ -175,7 +175,6 @@ pacman -Su --needed --noconfirm \
brltty \
cloud-utils \
cronie \
dbus-broker \
espeak-ng \
fake-hwclock \
firmware-raspberrypi \
@@ -185,7 +184,6 @@ pacman -Su --needed --noconfirm \
man \
man-pages \
networkmanager \
ntp \
pipewire \
pipewire-alsa \
pipewire-jack \
@@ -254,7 +252,7 @@ rm -rf /home/stormux/packages/
# Enable linger so that hopefully sound will start at login.
mkdir -p /var/lib/systemd/linger
touch /var/lib/systemd/linger/stormux
systemctl --global enable dbus-broker.service pipewire.service pipewire-pulse.service
systemctl --global enable pipewire.service pipewire-pulse.service
/usr/share/fenrirscreenreader/tools/configure_pipewire.sh
sudo -u stormux /usr/share/fenrirscreenreader/tools/configure_pipewire.sh
# Configure sudo for group wheel, remove nopasswd for the stormux user
@@ -262,8 +260,8 @@ echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel
# Set the hostname
echo stormux > /etc/hostname
# Configure services
systemctl enable brltty.path cronie.service dbus-broker.service fake-hwclock.service fenrirscreenreader.service log2ram.service NetworkManager.service ntpd.service
systemctl disable dbus.service
systemctl disable systemd-networkd.service systemd-networkd.socket
systemctl enable brltty.path cronie.service fake-hwclock.service fenrirscreenreader.service log2ram.service NetworkManager.service
# Cleanup packages
pacman -Sc --noconfirm
pacman -R --noconfirm go

View File

@@ -1,20 +1,32 @@
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
EndSection
Section "Monitor"
Identifier "dummy_monitor"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
Identifier "Monitor0"
Option "DPMS" "true"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
EndSection
Section "Device"
Identifier "dummy_card"
VideoRam 256000
Driver "dummy"
Identifier "Card0"
# Try standard driver
Driver "modesetting"
# Fallback to dummy
Option "FallbackDriver" "dummy"
VideoRam 256000
EndSection
Section "Screen"
Identifier "dummy_screen"
Device "dummy_card"
Monitor "dummy_monitor"
SubSection "Display"
EndSubSection
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection

View File

@@ -1,7 +1,25 @@
#!/usr/bin/env bash
if [[ "$(tty)" = "/dev/tty1" ]]; then
cat << "EOF"
if [[ "$(tty)" != "/dev/tty1" ]]; then
return
fi
if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then
return
fi
if ! [[ -x /usr/local/bin/configure-stormux ]]; then
return
fi
# For audible sudo prompts:
unset sudoFlags
if [[ -x /etc/audibleprompt.sh ]]; then
export SUDO_ASKPASS=/etc/audibleprompt.sh
export sudoFlags=("-A")
fi
cat << "EOF"
Hello, and welcome to Stormux!
Let's get you set up. After you press enter, you will be prompted for the sudo password.
@@ -12,7 +30,5 @@ Once again, the password is stormux in all lower case letters.
Please press enter to continue.
EOF
read -r
sudo configure-stormux
sudo rm -- "/etc/profile.d/stormux_first_boot.sh"
fi
read -r
sudo "${sudoFlags[@]}" configure-stormux

View File

@@ -1,3 +1,4 @@
# Raspberry Pi Information
alias pi-temp='/usr/bin/vcgencmd measure_temp'
alias pi-version='cat /sys/firmware/devicetree/base/model;echo'
alias pi-ip='ip a | grep -v "127.0.0.1" | grep -E -o "([0-9]{1,3}\.){3}[0-9]{1,3}/[0-9]{1,2}"'

View File

@@ -0,0 +1,11 @@
[Unit]
Description=Update system time from worldtimeapi.org
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/sync_time.sh
[Install]
WantedBy=multi-user.target

View File

@@ -1,7 +1,22 @@
#!/bin/bash
#!/usr/bin/env bash
# For audible sudo prompts:
unset sudoFlags
if [[ -x /etc/audibleprompt.sh ]]; then
export SUDO_ASKPASS=/etc/audibleprompt.sh
export sudoFlags=("-A")
fi
trap cleanup EXIT
cleanup() {
popd &> /dev/null
if ! [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then
echo "Initial setup is not complete."
echo "To continue setup, please run:"
echo "sudo configure-stormux"
fi
}
export SUDO_ASKPASS=/etc/audibleprompt.sh
trap 'popd &> /dev/null' EXIT
if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then
pushd /opt/configure-stormux
@@ -9,54 +24,116 @@ if [[ -x /opt/configure-stormux/configure-stormux.sh ]]; then
exit 0
fi
if [[ ! -d /opt/configure-stormux ]]; then
# Offer to switch fenrir layout.
echo "Would you like to switch Fenrir to laptop layout? (y/n)"
export DIALOGOPTS='--insecure --no-lines --visit-items'
set_timezone() {
# Get the list of timezones
mapfile -t regions < <(timedatectl --no-pager list-timezones | cut -d '/' -f1 | sort -u)
# Use the same text twice here and just hide the tag field.
region=$(dialog --backtitle "Please select your Region" \
--no-tags \
--menu "Use up and down arrows or page-up and page-down to navigate the list, and press 'Enter' to make your selection." 0 0 0 \
$(for i in ${regions[@]} ; do echo "$i";echo "$i";done) --stdout)
mapfile -t cities < <(timedatectl --no-pager list-timezones | grep "$region" | cut -d '/' -f2 | sort -u)
# Use the same text twice here and just hide the tag field.
city=$(dialog --backtitle "Please select a city near you" \
--no-tags \
--menu "Use up and down arrow or page-up and page-down to navigate the list." 0 0 10 \
$(for i in ${cities[@]} ; do echo "$i";echo "$i";done) --stdout)
# Set the timezone
if [[ -f /etc/localtime ]]; then
rm /etc/localtime
fi
ln -sf /usr/share/zoneinfo/${region}/${city} /etc/localtime
timedatectl set-ntp true
}
# Offer to switch fenrir layout.
echo "Would you like to switch Fenrir to laptop layout?"
echo "Press y for yes or n for no followed by enter."
read -r continue
continue="${continue::1}"
if [[ "${continue,}" == "y" ]];then
sed -i 's/=desktop/=laptop/' /etc/fenrirscreenreader/settings/settings.conf
clear
systemctl restart fenrirscreenreader.service
fi
# Check for possible resize
diskSource="$(df --output='source' / | tail -1)"
diskSize="$(df -h --output='size' / | tail -1 | tr -cd '[:digit:].')"
diskSize=${diskSize%.*}
if [[ $diskSize -le 7 ]]; then
echo "$diskSource is only $diskSize gigs, which means it probably needs to be resized. Would you like to do this now?"
echo "Press y for yes or n for no followed by enter."
read -r continue
continue="${continue::1}"
if [[ "${continue,}" == "y" ]];then
sed -i 's/=desktop/=laptop/' /etc/fenrirscreenreader/settings/settings.conf
systemctl restart fenrirscreenreader.service
clear
sudo "${sudoFlags[@]}" growpartfs $diskSource
fi
if ! ping -c1 stormux.org &> /dev/null ; then
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 "In desktop layout this is done by pressing Fenrir+numpad asterisk."
echo "That is the key just above numpad 9."
echo "In laptop mode, press Fenrir+y."
echo "In desktop mode the Fenrir key is numpad insert."
echo "In laptop mode the Fenrir key is the Super key, sometimes called the Windows key."
echo "Press enter to continue."
read -r continue
nmtui-connect
fi
# Check for internet connectivity
if ping -qc1 -W 1 stormux.org &> /dev/null; then
echo "Updating the clock to prevent certificate errors..."
# Get current date and time
date_time=$(curl -s http://worldtimeapi.org/api/ip | grep -oP '(?<="datetime":")[^"]*')
echo "Current date and time: $date_time"
# set date and time
date -s "$date_time"
else
echo "Please connect to the internet and run ${0##*/} again."
exit 1
fi
echo "Installing configure-stormux..."
git -C /opt clone -q https://git.stormux.org/storm/configure-stormux || exit 1
fi
if ! ping -c1 stormux.org &> /dev/null ; then
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 "In desktop layout this is done by pressing Fenrir+numpad asterisk."
echo "That is the key just above numpad 9."
echo "In laptop mode, press Fenrir+y."
echo "In desktop mode the Fenrir key is numpad insert."
echo "In laptop mode the Fenrir key is the Super key, sometimes called the Windows key."
echo "After connecting to the internet, remember to go back to cursor mode."
echo "It is the same key used to switch to highlight mode."
echo "Press enter to continue."
read -r continue
nmtui-connect
fi
# Check for internet connectivity
if ping -qc1 -W 1 stormux.org &> /dev/null; then
echo "Updating the clock to prevent certificate errors..."
# Get current date and time
date_time=$(curl -s http://worldtimeapi.org/api/ip | grep -oP '(?<="datetime":")[^"]*')
echo "Current date and time: $date_time"
# set date and time
date -s "$date_time"
echo "If your Pi does not have a CMOS battery and is powered off regularly, it may take a while for the time to be set correctly after boot."
echo "Stormux provides a service to sync the time after internet connection is established."
read -rp "Would you like the time to sync as soon as the Pi connects to the internet? " answer
answer="${answer:0:1}"
if [[ "${answer,,}" == "y" ]]; then
systemctl enable time_sync_at_boot.service
else
echo "Time sync at boot skipped."
echo "If you change your mind later, simply type:"
echo "sudo systemctl enable time_sync_at_boot.service"
fi
set_timezone
else
echo "Please connect to the internet and run ${0##*/} again."
exit 1
fi
echo "Installing configure-stormux..."
git -C /opt clone -q https://git.stormux.org/storm/configure-stormux || exit 1
echo
echo "Initial setup is complete."
echo
echo "If you would like more options, run configure-stormux,"
echo "The default passwords are stormux for the stormux user"
echo "and root for the root user. It is highly recommended to change them."
echo "To change the password for stormux, run:"
echo "passwd"
echo "To change the password for root, run:"
echo "sudo passwd"
echo
echo "For more configuration options, run configure-stormux,"
echo "or you may configure your system manually."
echo
echo "Thank you for choosing Stormux."
echo
echo "Removing first run script..."
exit 0

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
date_time=$(curl -s http://worldtimeapi.org/api/ip | grep -oP '(?<="datetime":")[^"]*')
date -s "$date_time"