X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=distro-end;h=d7fa65831328beb8567ffdaa65a57e54afba90d6;hb=HEAD;hp=805b51282a32f6e30c868d9fc806d010b79de6da;hpb=07fbcf11a78d2ee20697eb98f5b7eeaa2475f1d1;p=distro-setup diff --git a/distro-end b/distro-end index 805b512..d8a6cc5 100755 --- a/distro-end +++ b/distro-end @@ -1,6 +1,6 @@ #!/bin/bash -# Program to setup Ian's computers +# Setup Ian's computers # Copyright (C) 2024 Ian Kelling # This program is free software: you can redistribute it and/or modify @@ -18,8 +18,9 @@ # SPDX-License-Identifier: GPL-3.0-or-later -# shellcheck source=/a/bin/ds/.bashrc -export LC_USEBASHRC=t; if [[ -s ~/.bashrc ]]; then . ~/.bashrc; fi +# shellcheck disable=SC2317 # false positive +export LC_USEBASHRC=t +source /a/bin/ds/.bashrc ### setup source /a/bin/bash-bear-trap/bash-bear @@ -167,8 +168,6 @@ EOF t=$(mktemp) case $n in bookworm) - cat >$t <<'EOF' -EOF cat >$t <= 1 )); then - rm -f ${files[@]} - fi - ngreset - for host in ${!vpn_ips[@]}; do - sd /etc/openvpn/client-config-hole/$host </etc/X11/xorg.conf.d/20-intel.conf <<'EOF' +# iank: +# https://forums.linuxmint.com/viewtopic.php?f=208&t=224942#p1197049 +# prevents konsole from being borderline unusable on system76 intel graphics + i3 +Section "Device" + Identifier "Intel Graphics" + Driver "intel" + Option "TearFree" "true" +EndSection +EOF + ;; + esac + ;; + noble) + pi xinit ;; esac @@ -893,6 +947,32 @@ case $distro in esac ;; ubuntu) + case $codename in + noble) + if pcheck ubuntu-system-adjustments; then + # mint firefox has a dependency which is totally not really + # needed, just some mint branding and maybe a random firefox + # setting. + tmpdir="$(mktemp -d)" + # it puts the deb in .., so use a subdir to stay contained + mkdir $tmpdir/sub + cd "$tmpdir/sub" + # edited from output of equivs-control ubuntu-system-adjustments + cat >ubuntu-system-adjustments <<'EOF' +Section: misc +Priority: optional +Version: 2030 +Standards-Version: 3.9.2 +Package: ubuntu-system-adjustments +Description: ubuntu-system-adjustments-dummy +EOF + equivs-build ubuntu-system-adjustments + sudo dpkg -i ../ubuntu-system-adjustments_2030_all.deb + cd + rm -r "$tmpdir" + fi + ;; + esac pi firefox ;; debian) @@ -932,6 +1012,19 @@ case $codename_compat in esac +case $codename_compat in + aramo|buster) + # https://wiki.archlinux.org/title/bluetooth + pi pavucontrol paprefs pulseaudio-module-bluetooth pulsemixer + ;; + noble|bookworm) + pi pipewire-audio + # having pipewire installed prevents the recommends in these from installing pulse + pi pulsemixer pavucontrol + ;; +esac + + # TODO: some of the X programs can be removed from pall when using wayland # depends gcc is a way to install suggests. this is apparently the only @@ -945,19 +1038,21 @@ pi ${pall[@]} $(apt-cache search ruby[.0-9]+-doc| awk '{print $1}') $($src/distr # I dont want that. pi-nostart schroot +## note: this bug doesn't exist in t12+ # fix systemd unit failure. i dont know of any actual impact # other than systemd showing in degraded state. So, we dont bother # fixing the current state, let it fix on the next reboot. # https://gitlab.com/cjwatson/binfmt-support/-/commit/54f0e1af8a -tmp=$(systemctl cat binfmt-support.service | grep ^After=) -if [[ $tmp != *systemd-binfmt.service* ]]; then - s u /etc/systemd/system/binfmt-support.service.d/override.conf <tox <<'EOF' +case $(debian-codename) in + aramo) + if pcheck tox; then + tmpdir="$(mktemp -d)" + cd "$tmpdir" + # edited from output of equivs-control tox + cat >tox <<'EOF' Section: python Priority: optional Standards-Version: 3.9.2 Package: tox Description: tox-dummy EOF - equivs-build tox - sudo dpkg -i tox_1.0_all.deb - rm -rf ./tox* - pi beets python3-discogs-client - cd - rm -r "$tmpdir" -fi + equivs-build tox + sudo dpkg -i tox_1.0_all.deb + rm -rf ./tox* + pi beets + cd + rm -r "$tmpdir" + fi + ;; +esac # get rid of annoying message s sed -ri "s/^([[:space:]]*ui.print_\('Playing)/#\1/" /usr/share/beets/beetsplug/play.py @@ -1839,9 +1952,10 @@ case $HOSTNAME in # Font awesome is needed for the alertmanager ui. pi prometheus-alertmanager prometheus fonts-font-awesome /c/roles/prom/files/simple/usr/local/bin/fsf-install-prometheus + # make it available for other machines rsync -a /usr/local/bin/amtool /a/opt/bin - web-conf -p 9091 -f 9090 - apache2 i.b8.nz <<'EOF' + web-conf -p 9091 -f 9090 - apache2 b8.nz <<'EOF' AuthType Basic AuthName "basic_auth" @@ -1852,7 +1966,7 @@ Require valid-user EOF - web-conf -p 9094 -f 9093 - apache2 i.b8.nz <<'EOF' + web-conf -p 9094 -f 9093 - apache2 b8.nz <<'EOF' AuthType Basic AuthName "basic_auth" @@ -1888,10 +2002,9 @@ EOF ;; esac -# cleanup old files. 2023-02 -x=(/var/lib/prometheus/node-exporter/*.premerge) -if [[ -e ${x[0]} ]]; then - s rm /var/lib/prometheus/node-exporter/* +# user specific file isn't installed until the user exists +if [[ ! -e /etc/prometheus/ssl/prom_node_key.pem ]]; then + conflink fi @@ -1902,10 +2015,11 @@ case $HOSTNAME in # listen on the wireguard interface *) - wgip=$(command sudo sed -rn 's,^ *Address *= *([^/]+).*,\1,p' /etc/wireguard/wghole.conf) - # old filename. remove once all hosts are updated. - s rm -fv /etc/apache2/sites-enabled/${HOSTNAME}wg.b8.nz.conf - web-conf -i -a $wgip -p 9101 -f 9100 - apache2 ${HOSTNAME}wg.b8.nz <<'EOF' + if [[ -e /etc/wireguard/wghole.conf ]]; then + wgip=$(command sudo sed -rn 's,^ *Address *= *([^/]+).*,\1,p' /etc/wireguard/wghole.conf) + # old filename. remove once all hosts are updated. + s rm -fv /etc/apache2/sites-enabled/${HOSTNAME}wg.b8.nz.conf + s bash -x web-conf -i -a $wgip -p 9101 -f 9100 - apache2 ${HOSTNAME}wg.b8.nz <<'EOF' AuthType Basic AuthName "basic_auth" @@ -1915,14 +2029,14 @@ AuthUserFile "/etc/prometheus-export-htpasswd" Require valid-user EOF - # For work, i think we will just use the firewall for hosts in the main data center, and - # vpn for hosts outside it. + # For work, i think we will just use the firewall for hosts in the main data center, and + # vpn for hosts outside it. - # TODO: figure out how to detect the ping failure and try again. + # TODO: figure out how to detect the ping failure and try again. - # Binding to the wg interface, it might go down, so always restart, and wait for it on boot. - s mkdir /etc/systemd/system/apache2.service.d - sd /etc/systemd/system/apache2.service.d/restart.conf < - Options FollowSymLinks - DirectoryIndex index.php index.html - AllowOverride AuthConfig - # - # The default Debian nagios4 install sets use_authentication=0 in - # /etc/nagios4/cgi.cfg, which turns off nagos's internal authentication. - # This is insecure. As a compromise this default apache2 configuration - # only allows private IP addresses access. - # - # The ... below shows how you can secure the nagios4 - # web site so anybody can view it, but only authenticated users can issue - # commands (such as silence notifications). To do that replace the - # "Require all granted" with "Require valid-user", and use htdigest - # program from the apache2-utils package to add users to - # /etc/nagios4/htdigest.users. - # - # A step up is to insist all users validate themselves by moving - # the stanza's in the .. into the . - # Then by setting use_authentication=1 in /etc/nagios4/cgi.cfg you - # can configure which people get to see a particular service from - # within the nagios configuration. - # - AuthDigestDomain "Nagios4" - AuthDigestProvider file - AuthUserFile "/etc/nagios4-htdigest.users" - AuthGroupFile "/etc/group" - AuthName "Nagios4" - AuthType Digest - Require valid-user - - - - Options +ExecCGI - -EOF - ;; -esac - -# when you alter a service through the web, it changes vars in /var/lib/nagios4/status.dat. for example: -# notifications_enabled=1 -# note, the same variable exists in the correspdonding "define service {" - -# in the default config, we have these definitions - -# 11 define command { -# 2 define contact { -# 1 define contactgroup { -# 9 define host { -# 4 define hostgroup { -# 23 define service { -# 5 define timeperiod { - - -# on klaxon - -# klaxon:/etc/nagios3 # grep -rho '^ *define [^{ ]*' | sort | uniq -c -# 76 define command -# 11 define contact -# 6 define contactgroup -# 162 define host -# 1 define hostextinfo -# 16 define hostgroup -# 3040 define service -# 2 define servicedependency -# 6 define timeperiod - - - - -### end nagios ### - -### begin bitcoin ### - -case $HOSTNAME in - sy|kd) - sudo install -m 0755 -o root -g root -t /usr/bin /a/opt/bitcoin-26.0/bin/* - # Note: i leave it to system-status to start and stop bitcoin. - # note: the bitcoin user & group are setup in fai - sudo usermod -a -G bitcoin iank - # todo: make bitcoin have a stable uid/gid - sudo mkdir -p /var/lib/bitcoind - sudo chown bitcoin:bitcoin /var/lib/bitcoind - # 710 comes from the upstream bitcoin unit file - sudo chmod 710 /var/lib/bitcoind - # note, there exists - # /a/bin/ds/disabled/bitcoin - ;; -esac +# disabled +# ### begin bitcoin ### + +# case $HOSTNAME in +# sy|kd|so) +# sudo install -m 0755 -o root -g root -t /usr/bin /a/opt/bitcoin-27.0/bin/* +# # Note: i leave it to system-status to start and stop bitcoin. +# # note: the bitcoin user & group are setup in fai +# sudo usermod -a -G bitcoin iank +# # todo: make bitcoin have a stable uid/gid +# sudo mkdir -p /var/lib/bitcoind +# sudo chown bitcoin:bitcoin /var/lib/bitcoind +# # 710 comes from the upstream bitcoin unit file +# sudo chmod 710 /var/lib/bitcoind +# # note, there exists +# # /a/bin/ds/disabled/bitcoin +# ;; +# esac -### end bitcoin +# ### end bitcoin ### begin live streaming ### @@ -2120,6 +2136,7 @@ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo ### end gh #### + # remove trisquel banner. it is cool but takes up too much space. sudo rm -f /etc/update-motd.d/01-banner @@ -2209,6 +2226,27 @@ EOF sudo exportfs -rav fi +# very temporary fix. +# should be gone in a few days +# https://bugs.launchpad.net/ubuntu/+source/fail2ban/+bug/2055114 +case $codename_compat in + noble) + if [[ ! -e ~/fail2ban_1.1.0-1_all.deb ]]; then + cd + wget https://launchpad.net/ubuntu/+source/fail2ban/1.1.0-1/+build/28291332/+files/fail2ban_1.1.0-1_all.deb + sudo dpkg -i fail2ban_1.1.0-1_all.deb + fi + ;; +esac + +case $codename_compat in + noble) + # this fails on startup. i don't use resolvconf, so it is totally pointless. + soff unbound-resolvconf.service + ;; +esac + +host-info-update # if I was going to create a persistent vm, i might do it like this: # variant=something # from: virt-install --os-variant list