diff --git a/pi3/build/build-stormux.sh b/pi3/build/build-stormux.sh index 5c9f7ab..a160aa3 100755 --- a/pi3/build/build-stormux.sh +++ b/pi3/build/build-stormux.sh @@ -112,7 +112,7 @@ fi # make sure the needed tools are installed if [[ "$(uname -m)" == "x86_64" ]]; then -if ! pacman -Q qemu-user-static &> /dev/null ; then + if ! pacman -Q qemu-user-static &> /dev/null ; then echo "Please install qemu-user-static and qemu-user-static-binfmt before continuing." exit 1 fi @@ -121,7 +121,7 @@ if ! pacman -Q qemu-user-static &> /dev/null ; then exit 1 fi fi -for i in dosfstools parted wget ; do +for i in arch-install-scripts dosfstools parted wget ; do if ! pacman -Q $i &> /dev/null ; then echo "Please install $i before continuing." exit 1 @@ -167,10 +167,13 @@ pacman -Su --needed --noconfirm \ bluez \ bluez-utils \ brltty \ + cloud-utils \ cronie \ dbus-broker \ espeak-ng \ + fake-hwclock \ git \ + go \ magic-wormhole \ man \ man-pages \ @@ -180,11 +183,18 @@ pacman -Su --needed --noconfirm \ pipewire-alsa \ pipewire-jack \ pipewire-pulse \ + poppler \ + python-pyudev \ + python-daemonize \ + python-evdev \ + python-dbus \ + python-pyte \ raspberrypi-firmware \ realtime-privileges \ rhvoice-voice-bdl \ rng-tools \ rsync \ + screen \ sox \ w3m \ wget \ @@ -215,30 +225,41 @@ echo -e "stormux\nstormux" | passwd "stormux" sudo -iu stormux # Create desktop, downloads, music, and other directories. xdg-user-dirs-update -# Install the yay package manager -git clone https://aur.archlinux.org/yay.git -cd yay -makepkg -si --noconfirm -cd ~ -rm -rf yay -yay -S --removemake --noconfirm fenrir-git growpartfs log2ram -rm -rf .cache/yay -/usr/share/fenrirscreenreader/tools/configure_pipewire.sh +# Build AUR packages +export aurPackages=(fenrir-git \ + growpartfs \ + log2ram \ + yay) +export PKGDEST=~/packages +for p in "\${aurPackages[@]}" ; do + git clone https://aur.archlinux.org/\${p}.git + cd ~/\${p} + makepkg -A + cd ~ + rm -rf \${p} +done exit +# Install built packages +for p in /home/stormux/packages/* ; do + pacman -U --noconfirm \${p} +done +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 wireplumber.service +systemctl --global enable dbus-broker.service 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 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 fenrirscreenreader.service log2ram.service NetworkManager.service ntpd.service +systemctl enable brltty.path cronie.service dbus-broker.service fake-hwclock.service fenrirscreenreader.service log2ram.service NetworkManager.service ntpd.service systemctl disable dbus.service # Cleanup packages pacman -Sc --noconfirm +pacman -R --noconfirm go # Update fstab for Raspberry Pi 4. Not needed until linux-aarch64 works. # [[ $imageVersion -eq 4 ]] && sed -i 's/mmcblk0/mmcblk1/g' /etc/fstab @@ -249,6 +270,7 @@ cp -rv ../files/boot/* /mnt/boot cp -rv ../files/etc/* /mnt/etc cp -rv ../files/var/* /mnt/var cp -rv ../files/usr/* /mnt/usr +find ../files/etc/skel/ -mindepth 1 -exec cp -rv "{}" /mnt/home/stormux/ \; # Exiting calls the cleanup function to unmount. exit 0 diff --git a/pi3/files/etc/skel/.bash_aliases b/pi3/files/etc/skel/.bash_aliases new file mode 100644 index 0000000..4a06ced --- /dev/null +++ b/pi3/files/etc/skel/.bash_aliases @@ -0,0 +1 @@ +alias sudo='sudo ' diff --git a/pi3/files/etc/skel/.bash_functions b/pi3/files/etc/skel/.bash_functions new file mode 100644 index 0000000..c4d13a6 --- /dev/null +++ b/pi3/files/etc/skel/.bash_functions @@ -0,0 +1,21 @@ +memuse() { + ps axo rss,comm,pid \ + | awk '{ proc_list[$2] += $1; } END \ + { for (proc in proc_list) { printf("%d\t%s\n", proc_list[proc],proc); }}' \ + | sort -n | tail -n 10 | sort -rn \ + | awk '{$1/=1024;printf "%.0fMB\t",$1}{print $2}' +} + + +pdf() +{ + if [[ $# -ne 1 ]]; then + echo 'Usage: pdf ' >&2 + else + local dir=$(mktemp -d -p /tmp pdf_conversion.XXXXXX) + local outFile="${1##*/}" + local outFile="${outFile%.*}" + pdftohtml -noframes -i -s "$1" "${dir}/${outFile}.html" + w3m -s "${dir}/${outFile}.html" + fi +} diff --git a/pi3/files/etc/skel/.bashrc b/pi3/files/etc/skel/.bashrc new file mode 100644 index 0000000..65f57bd --- /dev/null +++ b/pi3/files/etc/skel/.bashrc @@ -0,0 +1,24 @@ +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +#Change directories without using cd +shopt -s autocd + +# Keep bash history in screen +export HISTFILE="${HISTFILE}${WINDOW:+.${WINDOW}}" + +# load Aliases and functions +[[ -f ".bash_aliases" ]] && source .bash_aliases +[[ -f ".bash_functions" ]] && source .bash_functions +#Invironment variables +PS1='[\u@\h \W] \$ ' +export DIALOGOPTS='--no-lines --visit-items' +GPG_TTY=$(tty) +export GPG_TTY +# Don't put commands prefixed with space, or duplicate commands in history +export HISTCONTROL=ignoreboth + diff --git a/pi3/files/etc/skel/.inputrc b/pi3/files/etc/skel/.inputrc new file mode 100644 index 0000000..0dcf6ea --- /dev/null +++ b/pi3/files/etc/skel/.inputrc @@ -0,0 +1,6 @@ +# Reload changes with control+x followed by control+r +set echo-control-characters off + +# History searching with up and down arrows. +"\e[A": history-search-backward +"\e[B": history-search-forward diff --git a/pi3/files/etc/skel/.screenrc b/pi3/files/etc/skel/.screenrc new file mode 100644 index 0000000..bd20ce3 --- /dev/null +++ b/pi3/files/etc/skel/.screenrc @@ -0,0 +1,18 @@ +vbell off +bell_msg "" +hardstatus off +startup_message off +defscrollback 4096 +bind ! select 10 +bind @ select 11 +bind \# select 12 +bind $ select 13 +bind % select 14 +bind ^ select 15 +bind & select 16 +bind * select 17 +bind ( select 18 +bind ) select 19 +bind b eval "writebuf" 'exec !!! xclip -selection "clipboard" -i /tmp/screen-exchange' +#termcapinfo xterm|xterms|xs|rxvt ti@:te@ +termcapinfo xterm* ti@:te@ diff --git a/pi3/files/usr/local/bin/configure-stormux b/pi3/files/usr/local/bin/configure-stormux index e5b3675..057ed66 100755 --- a/pi3/files/usr/local/bin/configure-stormux +++ b/pi3/files/usr/local/bin/configure-stormux @@ -1,14 +1,16 @@ #!/bin/bash trap 'popd &> /dev/null' EXIT + +export SUDO_ASKPASS=/etc/audibleprompt.sh if [[ ! -d /opt/configure-stormux ]]; then # Offer to switch fenrir layout. echo "Would you like to switch Fenrir to laptop layout? (y/n)" read -r continue continue="${continue::1}" if [[ "${continue,}" == "y" ]];then - sudo sed -i 's/=desktop/=laptop/' /etc/fenrirscreenreader/settings/settings.conf - sudo systemctl restart fenrirscreenreader.service + sudo -A sed -i 's/=desktop/=laptop/' /etc/fenrirscreenreader/settings/settings.conf + sudo -A systemctl restart fenrirscreenreader.service clear fi if ! ping -c1 stormux.org &> /dev/null ; then @@ -24,19 +26,19 @@ if [[ ! -d /opt/configure-stormux ]]; then nmtui-connect fi # Check for internet connectivity -if ping -qc1 -W 1 gnu.org &> /dev/null; then +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 - sudo date -s "$date_time" + sudo -A date -s "$date_time" else echo "Please connect to the internet and run ${0##*/} again." exit 1 fi echo "Installing configure-stormux..." - sudo git -C /opt clone -q https://git.stormux.org/storm/configure-stormux || exit 1 + sudo -A git -C /opt clone -q https://git.stormux.org/storm/configure-stormux || exit 1 fi pushd /opt/configure-stormux