2 # Copyright (C) 2019 Ian Kelling
3 # SPDX-License-Identifier: AGPL-3.0-or-later
5 # shellcheck source=/a/bin/ds/.bashrc
6 export LC_USEBASHRC
=t
; if [[ -s ~
/.bashrc
]];then . ~
/.bashrc
;fi
9 source /a
/bin
/errhandle
/err
10 src
="$(readlink -f -- "${BASH_SOURCE[0]}")"; src
=${src%/*} # directory of this file
12 if [[ $EUID == 0 ]]; then
13 echo "$0: error: run as regular user" >&2
18 echo 1 >~
/.local
/distro-end
21 # shellcheck source=./pkgs
24 echo "$0: $(date) starting now)"
25 # see example of usage to understand.
28 IFS
= read -r -d '' y ||
:
33 echo 0 >~
/.local
/distro-end
34 if $pending_reboot; then
35 echo "$0: pending reboot and then finished. doing it now."
36 echo "exiting with status 0"
39 echo "$0: $(date): ending now)"
40 echo "exiting with status 0"
46 printf "$pre %s\n" "$*"
47 SUDOD
="$PWD" command sudo
"$@";
49 m
() { printf "$pre %s\n" "$*"; "$@"; }
50 e
() { printf "$pre %s\n" "$*"; }
52 codename
=$
(debian-codename
)
53 codename_compat
=$
(debian-codename-compat
)
55 sed="sed --follow-symlinks"
57 # when we schroot, it will fail if we are in a directory that doesnt exist in the chroot
67 # get sudo pass cached right away
68 if ! sudo
-nv 2>/dev
/null
; then
74 # old repo. remove when all machines updated
75 sudo
rm -fv /etc
/apt
/sources.list.d
/wireguard-ubuntu-wireguard-bionic.list
77 sudo
rm -fv /etc
/apt
/preferences.d
/minetest
86 sudo debconf-set-selections
<<EOF
87 popularity-contest popularity-contest/participate boolean true
90 ########### begin section including vps ################
98 # no equivalent in other distros:
99 if isdeb
&& pcheck apt-file
; then
100 # this condition is just a speed optimization
109 # allows me to pipe with ssh -t, and gets rid of spam
110 # http://forums.debian.net/viewtopic.php?f=5&t=85822
111 # i'd rather disable the service than comment the init file
112 # this says disabling the service, it will still get restarted
113 # but this script doesn't do anything on restart, so it should be fine
114 sudo truncate
-s0 /var
/run
/motd.dynamic
117 # this isn't a complete solution. It still shows me when updates are available,
118 # but it's no big deal.
119 sudo
rm -fv /etc
/update-motd.d
/10-help-text /etc
/update-motd.d
/00-header
128 # dogcam setup. not using atm
131 # /a/bin/webcam/install-server
134 # /a/bin/webcam/install-client
139 ## not actually using prometheus just yet
140 # # office is not exposed to internet yet
141 # if [[ $HOSTNAME != kw ]]; then
142 # ## prometheus node exporter setup
143 # web-conf -f 9100 -p 9101 apache2 $(hostname -f) <<'EOF'
144 # #https://httpd.apache.org/docs/2.4/mod/mod_authn_core.html#authtype
145 # # https://stackoverflow.com/questions/5011102/apache-reverse-proxy-with-basic-authentication
149 # AuthName "Authentication Required"
150 # # setup one time, with root:www-data, 640
151 # AuthUserFile "/etc/prometheus-htpasswd"
159 ######### begin universal pinned packages ######
160 case $
(debian-codename
) in
162 sudo
rm -fv /etc
/apt
/preferences.d
/etiona-buster
163 sd
/etc
/apt
/preferences.d
/trisquel-debian
<<EOF
164 Explanation: Debian* includes Debian + Debian Backports
166 Pin: release o=Debian*
170 # needed for debootstrap scripts for fai since fai requires debian
173 #curl http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg | s apt-key add -
174 sd
/etc
/apt
/preferences.d
/flidas-xenial
<<EOF
176 Pin: release a=xenial
180 Pin: release a=xenial-updates
184 Pin: release a=xenial-security
188 Pin: release n=xenial
191 sd
/etc
/apt
/sources.list.d
/xenial.list
2>/dev
/null
<<EOF
192 deb http://us.archive.ubuntu.com/ubuntu/ xenial main
193 deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main
194 deb http://us.archive.ubuntu.com/ubuntu/ xenial-security main
197 if ! apt-key list |
grep /C0B21F32
&>/dev
/null
; then
199 #sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
200 sd
/etc
/apt
/preferences.d
/flidas-bionic
<<EOF
202 Pin: release a=bionic
206 Pin: release a=bionic-updates
210 Pin: release a=bionic-security
215 # better to run btrfs-progs which matches our kernel version
216 # (note, renamed from btrfs-tools)
217 sd
/etc
/apt
/preferences.d
/btrfs-progs
<<EOF
218 Package: btrfs-progs libzstd1
219 Pin: release a=bionic
222 Package: btrfs-progs libzstd1
223 Pin: release a=bionic-updates
226 Package: btrfs-progs libzstd1
227 Pin: release a=bionic-security
234 deb http://us.archive.ubuntu.com/ubuntu/ bionic main
235 deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main
236 deb http://us.archive.ubuntu.com/ubuntu/ bionic-security main
238 f
=/etc
/apt
/sources.list.d
/bionic.list
239 if ! diff -q $t $f; then
245 # no special reason, but its better for btrfs-progs to
246 # be closer to our kernel version
249 if [[ ! -e /usr
/share
/debootstrap
/scripts
/xenial
]]; then
252 m aptitude download debootstrap
/xenial
254 sudo
cp .
/usr
/share
/debootstrap
/scripts
/* /usr
/share
/debootstrap
/scripts
257 sd
/etc
/apt
/preferences.d
/flidas-etiona
<<EOF
259 Pin: release a=etiona
263 Pin: release a=etiona-updates
267 Pin: release a=etiona-security
271 Pin: release a=etiona-backports
277 deb http://mirror.fsf.org/trisquel/ etiona main
278 deb http://mirror.fsf.org/trisquel/ etiona-updates main
279 deb http://archive.trisquel.info/trisquel/ etiona-security main
280 deb http://mirror.fsf.org/trisquel/ etiona-backports main
282 f
=/etc
/apt
/sources.list.d
/etiona.list
283 if ! diff -q $t $f; then
289 sd
/etc
/apt
/preferences.d
/debian-goodies
<<EOF
290 Package: debian-goodies
291 Pin: release n=etiona
296 # dont use buster because it causes dist-upgrade to think its downgrading
297 # packages while really just reinstalling the same version.
298 f
=/etc
/apt
/apt.conf.d
/01iank
300 # # stupid buster uses some key algorithm not supported by flidas gpg that apt uses.
301 # sd /etc/apt/apt.conf.d/01iank <<'EOF'
302 # Acquire::AllowInsecureRepositories "true";
305 f
=/etc
/apt
/sources.list.d
/buster.list
308 # newer version needed for false positive in checkrestart.
309 # I did buster at first, but other problem above with having
310 # buster repos. not sure if the false positive exists in etiona.
313 sd
/etc
/apt
/preferences.d
/shellcheck
<<EOF
315 Pin: release a=etiona
319 Pin: release a=etiona-updates
323 Pin: release a=etiona-security
327 sd
/etc
/apt
/preferences.d
/bash
<<EOF
329 Pin: release a=etiona
333 Pin: release a=etiona-updates
337 Pin: release a=etiona-security
345 #p install --no-install-recommends minetest/buster libleveldb1d/buster libncursesw6/buster libtinfo6/buster
347 for n
in buster bullseye
; do
348 f
=/etc
/apt
/sources.list.d
/$n.list
353 deb http://http.us.debian.org/debian buster main
354 deb-src http://http.us.debian.org/debian buster main
356 deb http://security.debian.org/ buster/updates main
357 deb-src http://security.debian.org/ buster/updates main
359 deb http://http.us.debian.org/debian buster-updates main
360 deb-src http://http.us.debian.org/debian buster-updates main
362 deb http://http.debian.net/debian buster-backports main
363 deb-src http://http.debian.net/debian buster-backports main
370 deb http://deb.debian.org/debian bullseye main
371 deb-src http://deb.debian.org/debian bullseye main
373 deb http://deb.debian.org/debian-security/ bullseye-security main
374 deb-src http://deb.debian.org/debian-security/ bullseye-security main
376 deb http://deb.debian.org/debian bullseye-updates main
377 deb-src http://deb.debian.org/debian bullseye-updates main
379 deb http://http.debian.net/debian bullseye-backports main
380 deb-src http://http.debian.net/debian bullseye-backports main
385 if ! diff -q $t $f; then
392 curl
-s https
://ftp-master.debian.org
/keys
/archive-key-10-security.asc | sudo apt-key add
-
393 curl
-s https
://ftp-master.debian.org
/keys
/archive-key-10.asc | sudo apt-key add
-
397 if [[ ! -e /usr
/share
/debootstrap
/scripts
/bullseye
]]; then
400 m aptitude download debootstrap
/bullseye
402 sudo
cp .
/usr
/share
/debootstrap
/scripts
/* /usr
/share
/debootstrap
/scripts
407 sd
/etc
/apt
/preferences.d
/focal
<<'EOF'
409 Pin: release n=focal,o=Ubuntu
413 sd
/etc
/apt
/preferences.d
/spamassassin
<<'EOF'
414 Package: spamassassin sa-compile spamc
415 Pin: release n=focal,o=Ubuntu
418 sd
/etc
/apt
/preferences.d
/spamassassin
<<'EOF'
419 Package: spamassassin sa-compile spamc
420 Pin: release n=focal,o=Ubuntu
423 sd
/etc
/apt
/preferences.d
/psd
<<'EOF'
424 Package: profile-sync-daemon
425 Pin: release n=focal,o=Ubuntu
429 f
=/etc
/apt
/sources.list.d
/focal.list
432 deb http://us.archive.ubuntu.com/ubuntu/ focal main universe
433 deb http://us.archive.ubuntu.com/ubuntu/ focal-updates main universe
434 deb http://us.archive.ubuntu.com/ubuntu/ focal-security main universe
436 if ! diff -q $t $f; then
437 sudo
dd if=$t of
=$f 2>/dev
/null
443 sd
/etc
/apt
/preferences.d
/nabia-etiona
<<'EOF'
445 Pin: release n=nabia*,o=Trisquel
449 f
=/etc
/apt
/sources.list.d
/nabia.list
452 deb http://mirror.fsf.org/trisquel/ nabia main
453 deb-src http://mirror.fsf.org/trisquel/ nabia main
455 deb http://mirror.fsf.org/trisquel/ nabia-updates main
456 deb-src http://mirror.fsf.org/trisquel/ nabia-updates main
458 deb http://archive.trisquel.info/trisquel/ nabia-security main
459 deb-src http://archive.trisquel.info/trisquel/ nabia-security main
461 # Uncomment this lines to enable the backports optional repository
462 deb http://mirror.fsf.org/trisquel/ nabia-backports main
463 deb-src http://mirror.fsf.org/trisquel/ nabia-backports main
465 if ! diff -q $t $f; then
466 sudo
dd if=$t of
=$f 2>/dev
/null
470 # duplicated in fai. Pin for bionic + ubuntu so that ppas dont get
472 sd
/etc
/apt
/preferences.d
/etiona-bionic
<<'EOF'
474 Pin: release n=bionic,o=Ubuntu
477 Pin: release n=bionic,o=Ubuntu
481 sd
/etc
/apt
/preferences.d
/etiona-sa
<<'EOF'
483 Pin: release n=bionic,o=Ubuntu
490 pi debian-goodies shellcheck
497 case $codename_compat in
499 sd
/etc
/apt
/preferences.d
/nabia-btrfs-progs
<<'EOF'
501 Pin: release a=buster-backports
504 p
install btrfs-progs
509 # 2020-03-03 old file
510 s
rm -fv /etc
/apt
/preferences.d
/radicale
511 ######### end universal pinned packages ######
516 sd
/etc
/apt
/preferences.d
/obs
<<EOF
518 Pin: release n=bionic
521 sd
/etc
/apt
/preferences.d
/chromium
<<EOF
523 Pin: release n=bionic
532 ##### begin automatic upgrades (after checkrestart has been installed) ####
533 # if apt-config-auto-update is installed,
534 # it also has similar config, in a file 10something,
535 # but i think his overrides it since its higher number.
536 # This file was part of the automatic-updates package,
537 # and it has a configu option to not get new package lists,
538 # which seems pretty stupid to me, you cant actually upgrade
539 # anything if you dont have the new package list.
540 sd
/etc
/apt
/apt.conf.d
/20auto-upgrades
<<'EOF'
541 APT::Periodic::Update-Package-Lists "1";
542 APT::Periodic::Download-Upgradeable-Packages "1";
543 APT::Periodic::AutocleanInterval "7";
544 APT::Periodic::Unattended-Upgrade "1";
547 # fyi: default file has comments about available options,
548 # you may want to read that, do pkx unattended-upgrades
549 # default is just security updates. this list found from reading
550 # match_whitelist_string() in $(which unattended-upgrades)
551 sd
/etc
/apt
/apt.conf.d
/50unattended
-upgrades <<EOF
552 Unattended-Upgrade::Mail "root";
553 Unattended-Upgrade::MailOnlyOnError "true";
554 Unattended-Upgrade::Remove-Unused-Dependencies "true";
555 Unattended-Upgrade::Origins-Pattern {
556 "o=*,l=*,a=*,c=*,site=*,n=*";
561 sudo
rm -f /etc
/cron.d
/unattended-upgrade-reboot
/usr
/local
/bin
/zelous-unattended-reboot
/etc
/cron.d
/myupgrade
563 # myupgrade cron exists in /etc/cron.d/ian
565 ##### end automatic upgrades ####
568 # commented in case i want to use this sometime later
569 # sd /etc/apt/preferences.d/buster-backports <<EOF
571 # Pin: release a=buster-backports
575 if [[ -e /etc
/wireguard
/wghole.conf
]]; then
579 ###### begin website setup
583 f
=/var
/lib
/bind
/db.b8.nz
584 if [[ ! -e $f ]]; then
591 # i just dont feel like setting up a special purpose ssh key to do this automatically.
593 # run this once for bk on local machine:
594 # only used for old openvpn setup
595 /a/exe/vpn-mk-client-cert -c bk.b8.nz -b expertpath -n mail li.iankelling.org
604 m
/a
/h
/setup.sh iankelling.org
606 # start mumble only when im going to use it, since i dont use it much
607 pi-nostart mumble-server
608 sudo
$sed -ri "s/^ *(serverpassword=).*/\1$(< /a/bin/bash_unpublished/mumble_pass)/" /etc
/mumble-server.ini
610 # do certificate to avoid warning about unsigned cert,
611 # which is overkill for my use, but hey, I'm cool, I know
613 m web-conf apache2 mumble.iankelling.org
614 sudo
rm -fv /etc
/apache
2/sites-enabled
/mumble.iankelling.org
616 # general vpn for as needed use
617 vpn-server-setup
-d -r -4 10.5.5 -p 443 -n hole
619 # todo: consider if this should exist for the
621 teeu
/etc
/openvpn
/server
/hole.conf
<<'EOF'
626 sd
/etc
/openvpn
/client-config-hole
/sd8
<<'EOF'
627 ifconfig-push 10.5.5.41 255.255.255.0
630 sd
/etc
/openvpn
/client-config-hole
/hd8
<<'EOF'
631 ifconfig-push 10.5.5.42 255.255.255.0
634 sd
/etc
/openvpn
/client-config-hole
/onep9
<<'EOF'
635 ifconfig-push 10.5.5.14 255.255.255.0
637 sd
/etc
/openvpn
/client-config-hole
/sy
<<'EOF'
638 ifconfig-push 10.5.5.12 255.255.255.0
640 sd
/etc
/openvpn
/client-config-hole
/kw
<<'EOF'
641 ifconfig-push 10.5.5.9 255.255.255.0
643 sd
/etc
/openvpn
/client-config-hole
/x3
<<'EOF'
644 ifconfig-push 10.5.5.8 255.255.255.0
646 sd
/etc
/openvpn
/client-config-hole
/x2
<<'EOF'
647 ifconfig-push 10.5.5.7 255.255.255.0
649 sd
/etc
/openvpn
/client-config-hole
/wclient
<<'EOF'
650 ifconfig-push 10.5.5.6 255.255.255.0
652 sd
/etc
/openvpn
/client-config-hole
/frodo
<<'EOF'
653 ifconfig-push 10.5.5.5 255.255.255.0
655 sd
/etc
/openvpn
/client-config-hole
/amy
<<'EOF'
656 ifconfig-push 10.5.5.3 255.255.255.0
658 sd
/etc
/openvpn
/client-config-hole
/kd
<<'EOF'
659 ifconfig-push 10.5.5.2 255.255.255.0
662 # for adding to current system:
663 #vpn-mk-client-cert -s "" -n hole 72.14.176.105
664 # adding to remove system 107,
665 #vpn-mk-client-cert -s "" -n hole -c 10.2.0.107 -b hd8 iankelling.org
667 # for wireguard hole vpn
670 # requested from linode via a support ticket.
671 # https://www.linode.com/docs/networking/an-overview-of-ipv6-on-linode/
672 # ipv6 stuff pieced together
673 # via slightly wrong information from
674 # https://github.com/angristan/openvpn-install/blob/master/openvpn-install.sh
675 # https://community.openvpn.net/openvpn/wiki/IPv6
678 # This uses a public /64, but afaik, that is not needed for my
679 # current use case, since I'm doing ipv6 nat, they could be private
680 # and nat to a public address. I'm doing ipv6 nat in order to have 2
681 # vpn clients that externally share the same ip when sending so they
682 # share ip reputation. Note, the eth0 and tunx needed to be
683 # different subnets. On the same, I saw some neighbor packet go
684 # unanswered, tcpdump showed packets getting lost. I tried splitting the
685 # /64, it didn't work but I didn't investigate closely.
688 # not starting as i intend to replace it
689 m vpn-server-setup
-s -i tunmail
-n mail -d -6 2600:3c00
:e002
:3800::/64 2600:3c00
:e002
:3800::1/64
690 sudo
tee /etc
/openvpn
/client-config-mail
/mailclient
<<'EOF'
691 ifconfig-push 10.8.0.4 255.255.255.0
692 ifconfig-ipv6-push 2600:3c00:e002:3800::4/64
694 sudo
tee /etc
/openvpn
/client-config-mail
/expertpath
<<'EOF'
695 ifconfig-push 10.8.0.5 255.255.255.0
696 ifconfig-ipv6-push 2600:3c00:e002:3800::5/64
700 sudo
dd of
=/etc
/systemd
/system
/vpn-mail-forward.service
<<'EOF'
702 Description=Turns on iptables mail nat
703 BindsTo=openvpn-server@mail.service
708 ExecStart=/a/bin/distro-setup/vpn-mail-forward tunmail start
709 ExecStop=/a/bin/distro-setup/vpn-mail-forward tunmail stop
712 RequiredBy=openvpn-server@mail.service
717 # needed for li's local mail delivery.
718 tu
/etc
/hosts
<<<"10.8.0.4 mx.iankelling.org"
720 # wgmail handles this.
721 #sgo vpn-mail-forward.service
723 #sgo openvpn-server@mail
726 # setup let's encrypt cert
727 m web-conf apache2 mail.iankelling.org
728 # TODO, i expanded the above cert manually to mx.iankelling.org, this should be captured
729 # in the automation here. We use mail.iankelling.org as our ehlo name when sending mail
730 # but our mx record is mx.iankelling.org. Initially I was just using mail.iankelling.org,
731 # but the problem is I want multiple ips to be able to identify as mail.iankelling.org,
732 # but a subset to be mx.iankelling.org. Afaik, there is no problem with having
733 # our mail cert be for mail.iankelling.org, and have people connect to mx.ian...,
734 # but it doesn't make logical sense to do this.
735 sudo rm -fv /etc/apache2/sites-enabled/mail.iankelling.org{,-redir}.conf
738 a2enmod -q proxy proxy_http
739 domain=cal.iankelling.org
740 web-conf -f 10.8.0.4:5232 - apache2 $domain <<'EOF'
741 # https://radicale.org/2.1.html
742 #https://httpd.apache.org/docs/2.4/mod/mod_authn_core.html#authtype
743 # https://stackoverflow.com/questions/5011102/apache-reverse-proxy-with-basic-authentication
744 <Location /radicale/>
745 Options +FollowSymLinks +Multiviews +Indexes
748 AuthName "Authentication Required"
749 # setup one time, with root:www-data, 640
750 AuthUserFile "/etc/caldav-htpasswd"
752 RequestHeader set X-Script-Name /radicale/
753 RequestHeader set X-Remote-User expr=%{REMOTE_USER}
754 ProxyPass "http://10.8.0.4:5232/" retry=0
755 ProxyPassReverse "http://10.8.0.4:5232/"
758 # nginx version of above would be:
759 # auth_basic "Not currently available";
760 # auth_basic_user_file /etc/nginx/caldav/htpasswd;
764 ###### begin znc setup #####
767 # https://wiki.znc.in/FAQ seems to imply that znc doesn\'t need restart after cert change.
768 # to get into the web interface,
769 # then use non-main browser or else it doebsn't allow it based on ocsp stapling from my main site.
770 # https://iankelling.org:12533/
771 # login as ian, pass is in pass store, the part after :
773 # znc config generated by doing
775 # selected port is also used in erc config
776 # comma separated channel list worked.
777 # while figuring things out, running znc -D for debug in foreground.
778 # to exit and save config:
779 # /msg *status shutdown
780 # configed auth on freenode by following
781 # https://wiki.znc.in/Sasl:
785 # Set MyNickservName pa$$w0rd
786 # created the system service after, and had to do
787 # mv /home/iank/.znc/* /var/lib/znc
788 # sed -i 's,/home/iank/.znc/,/var/lib/znc,' /var/lib/znc/config/znc.conf
789 # and made a copy of the config files into /p/c
790 # /msg *status LoadMod --type=global log -sanitize
791 # todo: in config file AllowWeb = true should be false. better security if that is off unless we need it.
792 # /msg *status LoadMod --type=network perform
793 # /query *perform add PRIVMSG ChanServ :invite #fsf-office
794 # /msg *perform add JOIN #fsf-office
795 # /msg *status LoadMod NickServ
798 # also ran /znc LoadMod clearbufferonmsg
799 # it would be nice if erc supported erc query buffers by doing
800 # /msg *status clearbuffer <name of the query/receiver
802 # an example seems to be here: https://github.com/zenspider/elisp/blob/master/rwd-irc.el
803 # if that was the case i could remove the module clearbufferonmsg
804 # also would be nice if erc supported
805 # https://wiki.znc.in/self-message
806 # https://wiki.znc.in/Query_buffers \
808 if ! getent passwd znc > /dev/null; then
809 sudo useradd --create-home -d /var/lib/znc --system --shell /sbin/nologin --comment "Account to run ZNC daemon" --user-group znc
811 sudo chmod 700 /var/lib/znc
812 sudo chown -R znc:znc /var/lib/znc
813 # Avoid restarting if possible, reconnecting to irc is annoying.
814 # The unit file was made active with conflink.
815 # Note, avoid using ser here because we wrap sudo to prints the command first.
816 if [[ $(systemctl is-active znc) != active ]]; then
819 ###### stop znc setup #####
824 ###### end website setup
826 ########### end section including li/lj ###############
831 ### system76 things ###
834 # note, i stored the initial popos packages at /a/bin/data/popos-pkgs
835 if [[ ! -e /etc/apt/sources.list.d/system76.list ]]; then
836 # https://blog.zackad.dev/en/2017/08/17/add-ppa-simple-way.html
837 sd /etc/apt/sources.list.d/system76.list <<EOF
838 deb http://ppa.launchpad.net/system76-dev/stable/ubuntu $codename_compat main
839 deb-src http://ppa.launchpad.net/system76-dev/stable/ubuntu $codename_compat main
841 # ubuntu keyserver is prone to intermittent failures
842 for (( i=0; i <= 4 ; i++ )); do
843 s apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5D1F3A80254F6AFBA254FED5ACD442D1C8B7748B && break
847 # https://support.system76.com/articles/install-ubuntu/
848 # but i'm hoping this is not needed
849 # sd /etc/apt/preferences.d/system76 <<'EOF'
851 # Pin: release o=LP-PPA-system76-dev-stable
854 pi system76-driver system76-firmware-cli
855 # if you get a notice about a firmware update, the notifier on i3
856 # is too dumb to do anything when you click it. so to see
858 # /var/cache/system76-firmware-daemon
859 # extract the xz files there, one will contain a changelog.
860 # then to install an update:
861 # s system76-firmware-cli schedule
869 # ppa:obsproject/obs-studio
870 if [[ ! -d /etc/apt/sources.list.d/obs.list ]]; then
871 # https://blog.zackad.dev/en/2017/08/17/add-ppa-simple-way.html
872 sd /etc/apt/sources.list.d/obs.list <<EOF
873 deb http://ppa.launchpad.net/obsproject/obs-studio/ubuntu $codename_compat main
874 deb-src http://ppa.launchpad.net/obsproject/obs-studio/ubuntu $codename_compat main
876 for (( i=0; i <= 4 ; i++ )); do
877 s apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BC7345F522079769F5BBE987EFC71127F425E228 && break
885 case $codename_compat in
887 # mate-indicator-applet and beyond are msc things I noticed diffing a
888 # standard install with mine.
889 pi xorg lightdm mate-desktop-environment mate-desktop-environment-extras mate-indicator-applet anacron
895 # todo: figure out mate for buster
896 # pi task-gnome-desktop
899 # i had installing mate-indicator-applet, but im not sure why so i removed
900 pi xorg lightdm mate-desktop-environment mate-desktop-environment-extras anacron
903 # # apt-get update periodically fails with an appstream error.
904 # # this removes gnome-core, but its just a package for dependencies
905 # p -y remove appstream
908 # by default, it sleeps when not logged in to x/wayland and on ac power.
910 if id -u gdm &>/dev/null; then
911 sudo -u gdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
912 m systemctl --user stop gvfs-daemon
913 m systemctl --user disable gvfs-daemon
917 # lightdm startup fails without this. on etiona, we got unity-greeter installed automatically,
918 # it would probably work on nabia too, but google just lead me to this and it works fine.
919 pi lightdm-gtk-greeter
920 # ok, this is really weird
921 # normally this file has
922 sd /etc/X11/Xsession.d/99x11-common_start <<'EOF'
924 # this file normally just has: exec $STARTUP
925 # but then ~/.xsession-errors
926 # says $STARTUP is not found, which appears to be the real
927 # error, but normal bash doesnt operate that way.
928 # https://bugs.launchpad.net/ubuntu/+source/im-config/+bug/1879352
931 # also, gdm wayland was default, had to do
932 # dpkg-reconfigure gdm3
933 # and choose lightdm.
939 if [[ $codename_compat == flidas ]]; then
940 # doesnt exist in newer
949 # firefox would work here too, apt would select abrowser.
950 # and the update-alternatives thing i think is becuz firefox is
951 # generally available before abrowser and this helps fix things
952 # up when we have both.
954 s update-alternatives --set x-www-browser /usr/bin/abrowser
966 # newer distros just use adb for package name it seems
967 case $codename_compat in
969 pi android-tools-adbd
973 case $codename_compat in
975 pi libext2fs-dev libzstd-dev
976 cd /a/opt/btrfs-progs
981 case $codename_compat in
990 # not packaged in newer distros it seems
991 case $codename_compat in
992 bionic|buster|stretch)
998 # TODO: some of the X programs can be removed from pall when using wayland
1000 # depends gcc is a way to install suggests. this is apparently the only
1001 # way to install suggests even if the main package is already
1002 # installed. reinstall doesn't work, uninstalling can cause removing
1003 # dependent packages.
1004 pi ${pall[@]} $(apt-cache search ruby[.0-9]+-doc| awk '{print $1}') $($src/distro-pkgs)
1007 # commented, not worth the hassle i think.
1013 sudo rm -fv /etc/systemd/resolved.conf.d/iank.conf
1015 # website is dead june 14 2019. back in october, but meh
1016 sudo rm -fv /etc/apt/sources.list.d/iridium-browser.list
1021 # wget -qO - https://downloads.iridiumbrowser.de/ubuntu/iridium-release-sign-01.pub|sudo apt-key add -
1024 # deb [arch=amd64] https://downloads.iridiumbrowser.de/deb/ stable main
1025 # #deb-src https://downloads.iridiumbrowser.de/deb/ stable main
1027 # f=/etc/apt/sources.list.d/iridium-browser.list
1028 # if ! diff -q $t $f; then
1033 # pi iridium-browser
1038 ### begin home vpn server setup
1041 # # this section done initially to make persistent keys.
1042 # # Also note, I temporarily set /etc/hosts so my host was
1043 # # b8.nz when running this, since the vpn client config
1044 # # generator assumes we need to go to that server to get
1046 # vpn-server-setup -rds
1047 # s cp -r --parents /etc/openvpn/easy-rsa/keys /p/c/filesystem
1048 # s chown -R 1000:1000 /p/c/filesystem/etc/openvpn/easy-rsa/keys
1049 # # kw = kgpe work machine.
1050 # for host in x2 x3 kw; do
1051 # vpn-mk-client-cert -b $host -n home b8.nz 1196
1052 # dir=/p/c/machine_specific/$host/filesystem/etc/openvpn/client
1054 # s bash -c "cp /etc/openvpn/client/home* $dir"
1055 # # note: /etc/update-resolv-conf-home also exists for all systems with /p
1058 # key already exists, so this won't generate one, just the configs.
1059 # m vpn-server-setup -rds
1060 # sudo tee -a /etc/openvpn/server/server.conf <<'EOF'
1061 # push "dhcp-option DNS 10.0.0.1"
1062 # push "route 10.0.0.0 255.255.0.0"
1063 # client-connect /a/bin/distro-setup/vpn-client-connect
1065 # sudo sed -i --follow-symlinks 's/10.8./10.9./g;s/^\s*port\s.*/port 1196/' /etc/openvpn/server/server.conf
1067 # if [[ $HOSTNAME == tp ]]; then
1068 # if [[ -e /lib/systemd/system/openvpn-server@.service ]]; then
1069 # vpn_service=openvpn-server@server
1071 # vpn_service=openvpn@server
1075 ### end vpn server setup
1078 if mountpoint /p &>/dev/null; then
1079 # note, see bashrc for more documentation.
1081 sd /etc/systemd/system/rss2email.service <<'EOF'
1083 Description=rss2email
1084 After=multi-user.target
1089 # about 24 hours of failures
1090 # it copies over its files without respecting symlinks, so
1091 # we pass options to use different location.
1092 ExecStart=/usr/local/bin/sysd-mail-once -288 rss2email r2e -d /p/c/rss2email.json -c /p/c/rss2email.cfg run
1094 sd /etc/systemd/system/rss2email.timer <<'EOF'
1096 Description=rss2email
1099 # for initial run. required.
1101 # for subsequent runs.
1102 OnUnitInactiveSec=300
1105 WantedBy=timers.target
1107 sudo systemctl daemon-reload
1111 ######### begin irc periodic backup #############
1112 if [[ $HOSTNAME == frodo ]]; then
1113 sd /etc/systemd/system/ircbackup.service <<'EOF'
1115 Description=irc li backup
1116 After=multi-user.target
1121 ExecStart=/usr/local/bin/sysd-mail-once irc-backup rsync -rlptDhSAX root@iankelling.org:/var/lib/znc/moddata/log/iank/freenode/ /k/irclogs
1123 sd /etc/systemd/system/ircbackup.timer <<'EOF'
1125 Description=irc li backup hourly
1131 WantedBy=timers.target
1133 sudo systemctl daemon-reload
1138 ######### end irc periodic backup #############
1142 # pi-nostart does not disable
1146 if [[ -e /p/c/gen-fsf-vpn ]]; then
1150 if [[ -e /p/c/machine_specific/$HOSTNAME/filesystem/etc/openvpn/client/hole.crt ]]; then
1151 sgo openvpn-client@hole
1154 if [[ $HOSTNAME == frodo ]]; then
1155 vpn-mk-client-cert -b frodo -n hole iankelling.org
1158 ############# begin syncthing setup ###########
1159 if [[ $HOSTNAME == frodo ]]; then
1160 # It\'s simpler to just worry about running it in one place for now.
1161 # I assume it would work to clone it\'s config to another non-phone
1162 # and just run it in one place instead of the normal having a
1163 # separate config. I lean toward using the same config, since btrfs
1164 # syncs between comps.
1165 # testing has relatively up to date packages
1166 if ! isdebian-testing; then
1167 # based on error when doing apt-get update:
1168 # E: The method driver /usr/lib/apt/methods/https could not be found.
1169 pi apt-transport-https
1170 # google led me here:
1171 # https://apt.syncthing.net/
1172 curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
1173 s="deb http://apt.syncthing.net/ syncthing release"
1174 if [[ $(cat /etc/apt/sources.list.d/syncthing.list) != "$s" ]]; then
1175 echo "$s" | sd /etc/apt/sources.list.d/syncthing.list
1180 m lnf -T /w/syncthing /home/iank/.config/syncthing
1181 ser daemon-reload # syncthing likely not properly packaged
1182 sgo syncthing@iank # runs as iank
1184 # these things persist in ~/.config/syncthing, which I save in
1185 # /w/syncthing (not in /p, because syncthing should continue to
1186 # run on home server even when using laptop as primary device)
1187 # open http://localhost:8384/
1188 # change listen address from default to tcp://:22001,
1189 # this is because we do port forward so it doesn\'t have to use
1190 # some external server, but the syncthing is broken for port forward,
1191 # you get a message, something "like connected to myself, this should not happen"
1192 # when connecting to other local devices, so I bump the port up by 1,
1194 # https://forum.syncthing.net/t/connected-to-myself-should-not-happen/1763/19.
1195 # Without this, it was being stuck syncing at 0%.
1196 # Set gui username and password.
1198 # install syncthing via f-droid,
1199 # folder setting, turn off send only.
1200 # on phone, add device, click bar code icon
1201 # on dekstop, top right, actions, device id
1202 # after adding, notification will appear on desktop to confirm
1204 # syncing folder. from phone to desktop: select desktop in the
1205 # folder on phone\'s sync options, notification will appear in
1206 # desktop\'s web ui within a minute. For the reverse, the
1207 # notification will appear in android\'s notifications, you have to
1208 # swipe down and tap it to add the folder. It won\'t appear in the
1209 # syncthing ui, which would be intuitive, but don\'t wait for it
1210 # there. The notification may not work, instead open the web gui
1211 # from in the app, there should be a notification within there.
1213 # On phone, set settings to run syncthing all the time, and
1214 # show no notification.
1216 # Folder versioning would make sense if I didn\'t already use btrfs
1217 # for backups. I would choose staggered, or trash can for more space.
1219 # if needed to install on a remote comp:
1220 # ssh -L 8384:localhost:8384 -N frodo
1221 # open http://localhost:8384/
1223 # Note, the other thing i did was port forward port 22000,
1224 # per https://docs.syncthing.net/users/firewall.html
1227 ############# end syncthing setup ###########
1231 ####### begin misc packages ###########
1240 sudo update-alternatives --set pinentry /usr/bin/pinentry-gtk-2
1243 # sakura config is owned by ian
1246 m sudo -u user2 -i reset-konsole
1247 # user2 xscreensaver we don't want to reset
1248 m reset-xscreensaver
1251 # this would install from cabal for newer / consistent version across os, but it screws up xmonad, so disabled for now.
1252 # this is also in primary-setup
1253 # pi libxss-dev # dependency based on build failure
1255 # cabal install --upgrade-dependencies --force-reinstalls arbtt
1256 # also, i assume syncing this between machines somehow messed up the data.
1257 if mountpoint /p &>/dev/null; then
1261 # same as seru enable arbtt, but works over ssh when systemctl --user causes error:
1262 # Failed to connect to bus: No such file or directory
1263 lnf -T /a/bin/ds/subdir_files/.config/systemd/user/arbtt.service /home/iank/.config/systemd/user/default.target.wants/arbtt.service
1265 seru start arbtt ||:
1273 if [[ ! -e ~/.linphonerc && -e /p/.linphonerc-initial ]]; then
1274 m cp /p/.linphonerc-initial ~/.linphonerc
1277 # linphone in t10 wont do dns with systemd-resolved or something
1278 s teeu /etc/hosts <<'EOF'
1279 74.94.156.215 watson.fsf.org
1284 ### begin spd install
1285 if mountpoint /p &>/dev/null; then
1286 pi libswitch-perl libdigest-md5-file-perl libgnupg-interface-perl
1288 m wget -O $t http://mirror.fsf.org/fsfsys-trisquel/fsfsys-trisquel/pool/main/s/spd-perl/spd-perl_0.2-1_amd64.deb
1291 # this guesses at the appropriate directory, adjust if needed
1292 perldir=(/usr/lib/x86_64-linux-gnu/perl/5.*)
1293 m sudo ln -sf ../../../perl/5.18.2/SPD/ ${perldir[0]}
1294 # newer distro had gpg2 as default, older one, flidas, need to make it that way
1295 gpgpath=$(which gpg2) ||:
1296 if [[ $gpgpath ]]; then
1297 sudo mkdir -p /usr/local/spdhackfix
1298 s lnf -T $gpgpath /usr/local/spdhackfix/gpg
1304 # nagstamon setting which were set through the ui
1305 # monitor url https://klaxon.fsf.org/cgi-bin
1306 # monitor url cgi https://klaxon.fsf.org/cgi-bin
1308 # all unknown services
1309 # all warning services
1310 # acknowledged hosts & services
1311 # hosts & services down for maintenence
1312 # services on down hosts
1313 # services on hosts in maintenece
1314 # services on unreachable osts
1315 # hosts in soft state
1316 # services in soft state
1317 # in display tab: fullscreen
1319 # these translate to these settings I think
1320 # filter_acknowledged_hosts_services = True
1321 # filter_all_unknown_services = True
1322 # filter_all_warning_services = True
1323 # filter_hosts_in_soft_state = True
1324 # filter_hosts_services_maintenance = True
1325 # filter_services_in_soft_state = True
1326 # filter_services_on_down_hosts = True
1327 # filter_services_on_hosts_in_maintenance = True
1328 # filter_services_on_unreachable_hosts = True
1329 # notify_if_up = False
1330 # statusbar_floating = False
1332 # but i'm just going to rely on the webpage plus sms for now.
1335 # it asks if it should make users in it's group capture packets without root,
1336 # which is arguably more secure than running wireshark as root. default is no,
1337 # which is what i prefer, since I plan to use tcpdump to input to wireshark.
1338 s DEBIAN_FRONTEND=noninteractive pi wireshark-gtk
1340 # /run and /dev/shm are listed as required for pulseaudio. All 4 in the group
1341 # listed in the default config as suggested.
1342 # /run/usr/1000 i noticed was missing for pulseaudio
1343 # /run/user/0 just seemed like a not bad idea, given the above
1344 tu /etc/schroot/desktop/fstab <<'EOF'
1345 /p /p none rw,bind 0 0
1346 /a /a none rw,bind 0 0
1347 /run /run none rw,bind 0 0
1348 /run/lock /run/lock none rw,bind 0 0
1349 /dev/shm /dev/shm none rw,bind 0 0
1350 /run/shm /run/shm none rw,bind 0 0
1351 /run/user/1000 /run/user/1000 none rw,bind 0 0
1352 /run/user/1001 /run/user/1001 none rw,bind 0 0
1353 /run/user/0 /run/user/0 none rw,bind 0 0
1356 sd /etc/systemd/system/schrootupdate.service <<'EOF'
1358 Description=schrootupdate
1359 After=multi-user.target
1363 ExecStart=/usr/local/bin/sysd-mail-once schrootupdate /a/bin/distro-setup/schrootupdate
1365 sd /etc/systemd/system/schrootupdate.timer <<'EOF'
1367 Description=schrootupdate
1370 OnCalendar=*-*-* 04:20:00
1373 WantedBy=timers.target
1376 sgo schrootupdate.timer
1383 m mkschroot -s /a/bin/fai/fai/config/files/etc/apt/sources.list.d/bullseye.list/BULLSEYE_FREE \
1384 debian bullseye firefox-esr pulseaudio chromium anki
1385 case $(debian-codename) in
1387 # we have a lot of t8 stuff, useful to have
1388 m mkschroot -s /a/bin/fai/fai/config/files/etc/apt/sources.list.d/flidas.list/FLIDAS \
1390 tu /nocow/schroot/flidas/etc/sudoers <<EOF
1391 $USER ALL=(ALL) NOPASSWD: ALL
1392 Defaults env_keep += SUDOD
1393 Defaults always_set_home
1396 sd /nocow/schroot/flidas//etc/locale.gen <<'EOF'
1399 s schroot -c flidas locale-gen
1400 s schroot -c flidas update-locale LANG=en_US.UTF-8
1409 sudo mkdir -p /nocow/user
1410 sudo chown $USER:$USER /nocow/user
1414 ####### begin transmission
1424 tdir=/nocow/user/tor
1430 # adapted from /var/lib/dpkg/info/transmission-daemon.postinst
1431 # 450 seems likely to be unused. we need to specify one or else
1432 # it won't be stable across installs.
1433 if ! getent passwd debian-transmission > /dev/null; then
1434 sudo groupadd -g 450 debian-transmission
1435 sudo adduser --quiet \
1440 --disabled-password \
1441 --home /var/lib/transmission-daemon \
1444 # We want group writable stuff from transmission.
1445 # However, after setting this, I learn that transmission sets it's
1446 # own umask based on it's settings file. Well, no harm leaving this
1447 # so it's set right from the beginning.
1448 sudo chfn debian-transmission -o umask=0002
1450 # note i had to do this, which is persistent:
1452 # s chgrp debian-transmission torrents partial-torrents
1454 # syslog says things like
1455 # 'Failed to set receive buffer: requested 4194304, got 425984'
1456 # google suggets giving it even more than that
1457 tu /etc/sysctl.conf<<'EOF'
1458 net.core.rmem_max = 67108864
1459 net.core.wmem_max = 16777216
1463 # some reason it doesn\'t seem to start automatically anyways
1464 pi-nostart transmission-daemon
1465 # be extra sure its not started
1466 ser disable transmission-daemon
1467 ser stop transmission-daemon
1469 # the folder was moved here after an install around 02/2017.
1470 # it contains runtime data,
1471 # plus a simple symlink to the config file which it\'s
1472 # not worth separating out.
1473 # between comps, the uid can change
1475 f=$tdir/transmission-daemon
1476 for d in $tdir/partial-torrents $tdir/torrents $f; do
1477 if [[ ! -d $d ]]; then
1480 sudo chown -R debian-transmission:user2 $d
1482 s lnf -T $f /var/lib/transmission-daemon/.config/transmission-daemon
1483 s lnf -T /etc/transmission-daemon/settings.json $f/settings.json
1484 sudo chown -R debian-transmission:debian-transmission $f
1485 sudo chown -R debian-transmission:debian-transmission /var/lib/transmission-daemon
1487 # config file documented here, and it\'s the same config
1488 # for daemon vs client, so it\'s documented in the gui.
1489 # https://trac.transmissionbt.com/wiki/EditConfigFiles#Options
1491 # I originaly setup rpc-whitelist, but after using
1492 # routing to a network namespace, it doesn\'t see the
1493 # real source address, so it\'s disabled.
1495 # Changed the cache-size to 256 mb, reduces disk use.
1496 # It is a read & write cache.
1499 p = '/etc/transmission-daemon/settings.json'
1500 File.write(p, JSON.pretty_generate(JSON.parse(File.read(p)).merge({
1501 'rpc-whitelist-enabled' => false,
1502 'rpc-authentication-required' => false,
1503 'incomplete-dir' => '$tdir/partial-torrents',
1504 'incomplete-dir-enabled' => true,
1505 'download-dir' => '$tdir/torrents',
1506 "speed-limit-up" => 800,
1507 "speed-limit-up-enabled" => true,
1508 "peer-port" => 61486,
1509 "cache-size-mb" => 256,
1510 "ratio-limit" => 5.0,
1511 "ratio-limit-enabled" => false,
1515 ####### end transmission
1519 # to persist upload/dl metadata. initially, moved all the stuff
1520 # in /var/lib/transmission-daemon to /d/tor
1521 s usermod --home /d/tor debian-transmission
1522 sgo transmission-daemon-nn
1528 ######### begin transmission client setup ######
1530 if [[ -e /p/transmission-rpc-pass ]]; then
1531 # arch had a default config,
1532 # debian had nothing until you start it.
1533 # With a little trial an error, here is a minimal config
1534 # taken from the generated one, plus changes that the
1535 # settings ui does, without a bunch of ui crap settings.
1537 # only settings I set were
1542 # the password is randomly generated on first run, i copied it out
1543 # so it could be used by other hosts.
1546 p = '/etc/transmission-daemon/settings.json'
1547 s = JSON.parse(File.read(p))
1548 s["rpc-password"] = File.read("/p/transmission-rpc-pass").chomp
1549 # default is 0022 (18 in decimal)
1551 File.write p, JSON.pretty_generate(s)
1554 rpc_pass=$(</p/transmission-rpc-pass)
1555 for f in /home/*; do
1557 uid=$(id -u $u 2>/dev/null) || continue
1558 if [[ ! $uid -ge 1000 ]]; then
1561 d=$f/.config/transmission-remote-gtk
1562 sudo -u $u mkdir -p $d
1563 # i tried setting hostname to transmission.b8.nz, so i could dynamically change where
1564 # this connects to, but it said some 421 denied error when I did that. Then it
1565 # froze X when i ran it under strace. Whatever.
1566 sudo -u $u dd of=$d/config.json <<EOF
1570 "profile-name" : "Default",
1571 "hostname" : "10.173.0.2",
1572 "rpc-url-path" : "/transmission/rpc",
1574 "password" : "$rpc_pass",
1575 "auto-connect" : true,
1579 "update-active-only" : false,
1580 "activeonly-fullsync-enabled" : false,
1581 "activeonly-fullsync-every" : 2,
1582 "update-interval" : 3,
1583 "min-update-interval" : 3,
1584 "session-update-interval" : 60,
1585 "exec-commands" : [],
1590 "add-options-dialog" : false
1595 ######### end transmission client setup ######
1601 sudo gpasswd -a $USER lpadmin # based on ubuntu wiki
1602 # goto http://127.0.0.1:631
1603 # administration tab, add new printer button.
1604 # In debian, I could use hte recommended driver,
1605 # in arch, I had to pick out the 6L driver.
1608 # bridge networking as user fails. google lead here, but it doesn\'t work:
1609 # oh well, I give up.
1610 # http://wiki.qemu.org/Features-Done/HelperNetworking
1612 # f=/etc/qemu/bridge.conf
1616 # #s chown root:qemu $f # debian has somethig like qemu-libvirt. equivalent?
1619 # general known for debian/ubuntu, not for fedora
1621 m /a/bin/buildscripts/go
1622 m /a/bin/buildscripts/rust
1623 m /a/bin/buildscripts/misc
1624 m /a/bin/buildscripts/pithosfly
1625 m /a/bin/buildscripts/alacritty
1627 pi-nostart virtinst virt-manager
1629 # i cant if this is whats causing it to start even though
1630 # its disabled. note: it leaves around dnsmasq instances even
1631 # if you stop it. what the hell systemd?
1633 # allow user to run vms, from debian handbook. libvirt-qemu
1634 # based on https://www.whonix.org/wiki/KVM#First-time_User.3F
1635 for x in iank user2; do s usermod -a -G libvirt,kvm,libvirt-qemu $x; done
1638 pi --no-install-recommends kdeconnect
1639 ### kdeconnect for gnome. started in /a/bin/distro-setup/desktop-20-autostart.sh
1640 ### but gnome + xmonad not working in flidas, so i disabled it
1641 # pi libgtk-3-dev python3-requests-oauthlib valac cmake python-nautilus libappindicator3-dev
1642 # cd /a/opt/indicator-kdeconnect
1645 # cmake .. -DCMAKE_INSTALL_PREFIX=/usr
1648 # # we can start it manually with /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd
1649 # # it seems, according to
1650 # # /etc/xdg/autostart/kdeconnectd.desktop
1651 # # I'm not seeing the icon, but the clipboard replication is working
1654 ### model 01 arduino support ###
1655 # https://github.com/keyboardio/Kaleidoscope/wiki/Install-Arduino-support-on-Linux
1656 # also built latest arduino in /a/opt/Arduino, (just cd build; ant build; ant run )
1657 # set arduino var in bashrc,
1658 # have system config file setup too.
1659 sudo adduser $USER dialout
1661 # this is for the mail command too. update-alternatives is kind of misleading
1662 # since at least it's main commands pretend mail does not exist.
1663 # bsd's mail got pulled in on some dumb dependency, i dunno how.
1664 sudo update-alternatives --set mailx /usr/bin/mail.mailutils
1666 ######### end misc packages #########
1669 # packages I once used before and liked, but don\'t want installed now for
1671 # python-sqlite is used for offlineimap
1672 # lxappearance python-sqlite dolphin paman dconf-editor
1678 # todo, finish configuring smart.
1681 # mostly from https://wiki.archlinux.org/index.php/S.M.A.R.T.
1682 # turn on smart. background on options:
1683 # first line, -a = test everyting on all devices.
1684 # -S on, turn on disk internal saving of vendor specific info,
1685 # from google, seems like this is usually already on and fairly standard.
1686 # -o on, turn on 4 hour period non-performance degrading testing.
1687 # short test daily 2-3am, extended tests Saturdays between 3-4am:
1688 sched="-s (S/../.././02|L/../../6/03)"
1689 sudo sed -i --follow-symlinks "s#^[[:space:]]*DEVICESCAN.*#\
1690 DEVICESCAN -a -o on -S on -n standby,q $sched \
1691 -m root@mail.iankelling.org -M exec /usr/local/bin/smart-notify#" /etc/smartd.conf
1693 # in the default configuration of at least ubuntu 14.04, resolvconf is
1694 # configured to order any nameservers associated with tun* or tap*
1695 # before the normal internet interfaces, which means they are always
1696 # consulted first. This is often slower and undesirable, ie. local dns
1697 # queries go from 0ms to 10+ or 100+ ms. To reverse the ordering, you
1699 #sudo sed -i --follow-symlinks '/tun\*\|tap\*/d' /etc/resolvconf/interface-order
1700 # however, this breaks dns lookup for hosts on the openvpn lan.
1701 # I can\'t figure out why hosts on the normal lan would not be
1702 # broken under the default ordering, except the host I was
1703 # testing with previously had an entry in /etc/hosts.
1705 ############# end unfinished
1707 ########### misc stuff
1709 if [[ $HOSTNAME != frodo ]]; then
1710 s cedit hole /etc/hosts <<EOF ||:
1711 10.5.5.3 amy amy.b8.nz
1712 10.5.5.5 frodo frodo.b8.nz
1713 10.5.5.6 wclient wclient.b8.nz
1717 if [[ ! -e ~/.local/bin/pip ]]; then
1719 wget -O$tmp https://bootstrap.pypa.io/get-pip.py
1725 ### begin timetrap setup
1726 if mountpoint /p &>/dev/null; then
1727 mkdir -p ~/.timetrap/
1728 ln -sf /a/opt/timetrap_formatters ~/.timetrap/formatters
1729 if ! type -p t &>/dev/null; then
1730 pi ruby-dev libsqlite3-dev
1731 gem install --user timetrap
1734 ### end timetrap setup
1736 # leftover cleanup for t9
1740 # needed for debootstrap scripts for fai since fai requires debian
1743 pi-nostart network-manager
1744 # i hate networkmanager. noo, of course disabling it doesnt work
1745 # unless you add a hack. found this by doing
1746 # systemd-analyze dot > x.dot
1750 soff NetworkManager-wait-online.service
1751 # make networkmanager use resolvconf instead of its own dnsmasq which
1752 # conflicts with the normal dnsmasq package.
1753 f=/etc/NetworkManager/NetworkManager.conf
1755 sudo sed -ri '/ *\[main\]/,/^ *\[[^]]+\]/{/^\s*dns[[:space:]=]/d}' $f
1756 sudo sed -ri '/ *\[main\]/a dns=default' $f
1757 if [[ $m != $(md5sum $f) ]]; then
1758 srestart NetworkManager
1760 # networkmanager has this nasty behavior on flidas: if the machine
1761 # crashes with dnsmasq running, on subsequent boot, it adds an entry to
1762 # resolvconf for 127.0.0.1 in some stupid attempt to restore
1764 # This can be manually fixed by stoping dnsmasq,
1765 # then based on whats in /run/dnsmasq/, i see we can run
1766 # s resolvconf -d NetworkManager
1767 # oh ya, and stoping NetworkManager leaves this crap behind without cleaning it up.
1768 ser disable NetworkManager
1772 # I have no use for avahi,
1773 # had to run this twice when doing manually, i dunno why
1774 soff avahi-daemon ||:
1778 # make my /etc/fonts/conf.d/ get used.
1779 # I have a new sans-serif font there because the default one
1780 # displays l and I as the same char, grrrrr.
1783 pi desktop-file-utils
1784 m /a/bin/distro-setup/mymimes
1787 sgo dynamicipupdate.timer
1790 # stop autopoping windows when i plug in an android phone.
1791 # dbus-launch makes this work within an ssh connection, otherwise you get this message,
1792 # with still 0 exit code.
1793 # dconf-WARNING **: failed to commit changes to dconf: Cannot autolaunch D-Bus without X11 $DISPLAY
1794 m dbus-launch gsettings set org.gnome.desktop.media-handling automount-open false
1797 # on grub upgrade, we get prompts unless we do this
1799 for dev in $(s btrfs fil show /boot | sed -nr 's#.*path\s+(\S+)$#\1#p'); do
1800 devs+=("$(devbyid $dev),")
1802 devs[-1]=${devs[-1]%,} # jonied by commas
1803 sudo debconf-set-selections <<EOF
1804 grub-pc grub-pc/install_devices multiselect ${devs[*]}
1808 sgo btrfsmaint.timer
1809 sgo btrfsmaintstop.timer
1811 sgo systemstatus.timer
1814 if grep -xFq $HOSTNAME /a/bin/ds/machine_specific/btrbk.hosts; then
1817 # note: to see when it was last run,
1827 In mate settings settings, change scrolling to two-finger,
1828 because the default edge scroll doesn\'t work. Originally found this in debian.
1831 # Remove dep that came in with desktop to fix associations.
1832 m pu transmission-gtk
1836 lnf -T /d/vidshare /home/iank/Videos
1840 # # Based on guix manual instructions, also added code to profile.
1841 # # disabled since i'm not using it now.
1843 # if ! type -p guix >/dev/null; then
1845 # wget https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh
1846 # # added some stuff to envonment.sh for profile based on
1847 # # manual instructions
1848 # # wget https://sv.gnu.org/people/viewgpg.php?user_id=15145 -qO - | gpg --import -
1849 # # echo is to get past prompt
1850 # yes | sudo -E HOME=$HOME bash guix-install.sh || [[ $? == 141 ]]
1851 # guix install glibc-utf8-locales
1852 # guix package --install guile
1858 m /a/bin/buildscripts/tor-browser
1859 # one root command needed to install
1860 s ln -sf /a/opt/tor-browser_en-US/Browser/start-tor-browser /usr/local/bin
1864 pi-nostart nfs-kernel-server
1866 if [[ $HOSTNAME == tp ]]; then
1867 sd /etc/wireguard/wg0.conf <<EOF
1869 PrivateKey = $(cat /p/c/machine_specific/tp/filesystem/root/wg.key)
1870 Address = 10.3.0.2/24, fdfd::2/64
1873 PresharedKey = $(cat /p/c/machine_specific/tp/filesystem/root/wg.psk)
1874 PublicKey = 9RnAsJB+ISrA/9lmDKBoT08oBiKwzA64exBBj+rO+ng=
1875 Endpoint = b8.nz:26000
1876 AllowedIPs = 10.3.0.1/24, fdfd::1/64
1877 PersistentKeepalive = 20
1879 sudo systemctl enable wg-quick@wg0
1880 sudo systemctl start wg-quick@wg0
1884 if [[ $HOSTNAME == kw ]]; then
1885 # hosts 1-199. 200+ are dynamic, avoid those
1886 tu /etc/exports <<'EOF'
1887 /root/.ianktrisquel_9/.iank/e/e 192.168.0.0/25(rw,no_root_squash,async,no_subtree_check) 192.168.0.128/26(rw,no_root_squash,async,no_subtree_check) 192.168.0.192/29(rw,no_root_squash,async,no_subtree_check)
1888 /home/iank/.iank/e/e 192.168.0.0/25(rw,no_root_squash,async,no_subtree_check) 192.168.0.128/26(rw,no_root_squash,async,no_subtree_check) 192.168.0.192/29(rw,no_root_squash,async,no_subtree_check)
1896 # if I was going to create a persistent vm, i might do it like this:
1897 # variant=something # from: virt-install --os-variant list
1898 # s virt-install --noautoconsole --graphics spice,listen=0.0.0.0 \
1899 # --disk=/a/images/some_name.qcow2,bus=virtio --vcpus 2 -r 4096 -w bridge=br0 \
1900 # -n some_name --import --os-variant $variant --cpu host-model-only
1903 # for brother HL-2270DW, this worked:
1904 # https://askubuntu.com/questions/1067234/cant-use-wireless-brother-printer-2270dw-ubuntu-18-04
1905 # /a/opt/linux-brprinter-installer-2.2.2-1
1906 # answer n when it asks about uri.
1907 # Then go to cups, delete the existing printer, added on with dnssd url. browsed to
1908 # ppd at /usr/share/ppd/HL2270DW.ppd, which is duplicated at /usr/share/cups/model/HL2270DW.ppd
1909 # ppd file got installed from bash -x ./usr/local/Brother/Printer/HL2270DW/cupswrapper/cupswrap,
1910 # which I downloaded from their driver. but dont do that again, i copied it to /a/opt/HL2270DW.ppd,
1913 # I had to reset it to use wired instead of wifi. it only uses 1 at a time. boot with go button held, after lights turn off, tap go 6 times.
1914 # Then it was already configured, but if i needed to, go to its web ui, default pass is "access".
1916 ######### begin stuff belonging at the end ##########