From: Christian Heller Date: Thu, 31 Oct 2024 00:51:02 +0000 (+0100) Subject: Update raspi setup. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D/day?a=commitdiff_plain;h=67db4b362d658068e59ecd320f1a8d6ea9b465fa;p=config Update raspi setup. --- diff --git a/many_releases/aptmark/raspi b/many_releases/aptmark/raspi index c8b8c57..6db4efe 100644 --- a/many_releases/aptmark/raspi +++ b/many_releases/aptmark/raspi @@ -9,9 +9,13 @@ sway pulseaudio # for setting console keyboard via /etc/default/keyboard console-setup +# for setting system time +ntpsec-ntpdate +# basic usage +mpv +firefox-esr # for convenience +foot sudo vim ack -foot -mpv diff --git a/many_releases/etc/all/locale.conf b/many_releases/etc/all/locale.conf new file mode 100644 index 0000000..dd6eee3 --- /dev/null +++ b/many_releases/etc/all/locale.conf @@ -0,0 +1 @@ +LANG="en_US.UTF-8" diff --git a/many_releases/home/desktop/.config/sway/config b/many_releases/home/desktop/.config/sway/config new file mode 100644 index 0000000..ccd2b50 --- /dev/null +++ b/many_releases/home/desktop/.config/sway/config @@ -0,0 +1,4 @@ +include /etc/sway/config +output * background #551199 solid_color +bindsym $mod+Shift+p exec swaynag -t warning -m 'Really exit sway/end Wayland session?' -B 'Yes, exit sway' 'swaymsg exit' +input * xkb_layout "de" diff --git a/many_releases/home/user/.config/sway/config b/many_releases/home/user/.config/sway/config deleted file mode 100644 index ccd2b50..0000000 --- a/many_releases/home/user/.config/sway/config +++ /dev/null @@ -1,4 +0,0 @@ -include /etc/sway/config -output * background #551199 solid_color -bindsym $mod+Shift+p exec swaynag -t warning -m 'Really exit sway/end Wayland session?' -B 'Yes, exit sway' 'swaymsg exit' -input * xkb_layout "de" diff --git a/many_releases/scripts/_misc.sh b/many_releases/scripts/_misc.sh index c48602d..98b486f 100755 --- a/many_releases/scripts/_misc.sh +++ b/many_releases/scripts/_misc.sh @@ -95,3 +95,63 @@ upgrade_from_older_release() { apt -y -o Dpkg::Options::='--force-confnew' full-upgrade apt -y autoremove } + +add_my_public_key() { + # NB: vars expected to be pulled in from caller previously calling constants.sh! + apt update + apt -y install wget + wget "${URL_PUBLIC_KEY}" + cat "${FILENAME_PUBLIC_KEY}" >> "${PATH_AUTHORIZED_KEYS}" + rm "${FILENAME_PUBLIC_KEY}" +} + +setup_for_desktop() { + # NB: vars expected to be pulled in from caller previously calling constants.sh! + + # on installing console-setup, will guide it to do the right thing (including + # re-writing /etc/default/keyboard) + echo 'XKBLAYOUT=de' > /etc/default/keyboard + + # properly configure apt and reduce system to minimum that satisfies our own + # aptmark/ package lists + for root in "${PATH_MANY}" '..'; do + copy_dirtree "${root}${PATH_REL_ETC}/all" '/etc/apt' apt + done + apt update + mark_nonrequireds_auto + for root in "${PATH_MANY}" '..'; do + install_for_modules "${root}${PATH_REL_APTMARK}" all $@ + done + apt -y --purge autoremove + for root in "${PATH_MANY}" '..'; do + copy_dirtree "${root}${PATH_REL_ETC}" '/etc' all $@ + done + + # Ensure our desired locale is available. + locale-gen + + # Set Berlin localtime. + ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime + ntpdate-debian + + # so Sway won't complain about failing to access non-existant background image file + sed -i '/^output \* bg/ s/^/#/' /etc/sway/config + + # Set up root environment. + for root in "${PATH_MANY}" '..'; do + copy_dirtree "${root}${PATH_REL_HOME}" '/root' all root + done + + # Set up user and their environment. + adduser --disabled-password --gecos "" "${USERNAME}" + usermod -a -G sudo "${USERNAME}" + for root in "${PATH_MANY}" '..'; do + copy_dirtree "${root}${PATH_REL_HOME}" "${PATH_USER_HOME}" all desktop $@ + done + cp -a "${PATH_REPO}" "${PATH_USER_HOME}" + mkdir "${PATH_USER_SSH}" + cp "${PATH_AUTHORIZED_KEYS}" "${PATH_USER_SSH}" + chown -R "${USERNAME}:${USERNAME}" "${PATH_USER_HOME}" + passwd "${USERNAME}" + rm "${PATH_AUTHORIZED_KEYS}" +} diff --git a/testing/etc/all/locale.conf b/testing/etc/all/locale.conf deleted file mode 100644 index dd6eee3..0000000 --- a/testing/etc/all/locale.conf +++ /dev/null @@ -1 +0,0 @@ -LANG="en_US.UTF-8" diff --git a/testing/scripts/setup_raspi.sh b/testing/scripts/setup_raspi.sh index 791bf51..995a822 100755 --- a/testing/scripts/setup_raspi.sh +++ b/testing/scripts/setup_raspi.sh @@ -1,66 +1,18 @@ -#!/bin/sh +#!/bin/sh set -e set -x . ../../constants.sh . "${PATH_MANY_MISC}" # ensure we can log in +add_my_public_key # (alternatively, or preceding this to reduce non-remote typing, TEMPORARILY # (!) set password login:) # passwd # echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config -apt update -apt -y install wget -wget "${URL_PUBLIC_KEY}" -cat "${FILENAME_PUBLIC_KEY}" >> "${PATH_AUTHORIZED_KEYS}" -rm "${FILENAME_PUBLIC_KEY}" +# migrate to testing upgrade_from_older_release -# on installing console-setup, will guide it to do the right thing (including -# re-writing /etc/default/keyboard) -echo 'XKBLAYOUT=de' > /etc/default/keyboard - -# properly configure apt and reduce system to minimum that satisfies our own -# aptmark/ package lists -for root in "${PATH_MANY}" '..'; do - # copy_dirtree "${root}${PATH_REL_ETC}" '/etc' all raspi - copy_dirtree "${root}${PATH_REL_ETC}/all" '/etc/apt' apt - copy_dirtree "${root}${PATH_REL_ETC}/raspi" '/etc/apt' apt -done -apt update -mark_nonrequireds_auto -for root in "${PATH_MANY}" '..'; do - install_for_modules "${root}${PATH_REL_APTMARK}" all raspi -done -apt -y --purge autoremove -for root in "${PATH_MANY}" '..'; do - copy_dirtree "${root}${PATH_REL_ETC}" '/etc' all raspi -done - -# Ensure our desired locale is available. -locale-gen - -# Set Berlin localtime. -ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime - -# so Sway won't complain about failing to access non-existant background image file -sed -i '/^output \* bg/ s/^/#/' /etc/sway/config - -# Set up root environment. -for root in "${PATH_MANY}" '..'; do - copy_dirtree "${root}${PATH_REL_HOME}" '/root' all root -done - -# Set up user and their environment. -adduser --disabled-password --gecos "" "${USERNAME}" -usermod -a -G sudo "${USERNAME}" -for root in "${PATH_MANY}" '..'; do - copy_dirtree "${root}${PATH_REL_HOME}" "${PATH_USER_HOME}" all user raspi -done -cp -a "${PATH_REPO}" "${PATH_USER_HOME}" -mkdir "${PATH_USER_SSH}" -cp "${PATH_AUTHORIZED_KEYS}" "${PATH_USER_SSH}" -chown -R "${USERNAME}:${USERNAME}" "${PATH_USER_HOME}" -passwd "${USERNAME}" -rm "${PATH_AUTHORIZED_KEYS}" +# actual setup +setup_for_desktop raspi