X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=distro-begin;h=fee2249fcbf3146d824bcfc8db489a7e8683adba;hb=b6c42f4134e3825cfa5980901187dad527991d43;hp=833ab0b0c829605aa06bb4b4be07464701146866;hpb=318c3e403eeab1ec2a507ec6d43881672ff6922f;p=distro-setup
diff --git a/distro-begin b/distro-begin
index 833ab0b..fee2249 100755
--- a/distro-begin
+++ b/distro-begin
@@ -2,6 +2,10 @@
# Copyright (C) 2016 Ian Kelling
# This program is under GPL v. 3 or later, see
+# todo. dunno why, but original bootstrap of timezone is not sticking.
+# fixed manually with:
+# s dpkg-reconfigure tzdata
+
# for bootstrapping a new machine
@@ -65,14 +69,19 @@ umask 0002
####### end command line parsing
-
if encrypted; then
# I tried making a service which was dependent on reboot.target,
# but it happened too late in the shutdown process.
sudo dd of=/etc/systemd/system/keyscripton.service <<'EOF'
[Unit]
Description=Turn on automatic decryption of drives on boot
-After=multi-user.target
+# tried using graphical.target, but it made my display manager restart before rebooting.
+# generally, I don't think targets order shutdown like they do startup.
+# So, I did systemd-analyze plot > something.svg, and picked a reliably started
+# service that happens late in the game.
+After=postfix.service
+DefaultDependencies=no
+Conflicts=reboot.target
[Service]
Type=oneshot
@@ -81,9 +90,11 @@ ExecStart=/bin/true
ExecStop=/a/bin/keyscript-on
[Install]
-WantedBy=multi-user.target
+WantedBy=keyscriptoff.service
EOF
- sudo systemctl start keyscripton.service
+ sudo systemctl daemon-reload # needed if the file was already there
+ sudo systemctl stop keyscripton.service
+ # sudo systemctl start keyscripton.service
sudo systemctl enable keyscripton.service
sudo dd of=/etc/systemd/system/keyscriptoff.service <<'EOF'
@@ -97,6 +108,7 @@ ExecStart=/a/bin/keyscript-off
[Install]
WantedBy=multi-user.target
EOF
+ sudo systemctl daemon-reload # needed if the file was already there
sudo systemctl enable keyscriptoff.service
sudo systemctl start keyscriptoff.service
fi
@@ -156,10 +168,11 @@ fi
# link files
-lnf /a/c/* /a/bin ~
-
for x in /a/c/repos/bash/!(.git); do
- lnf "$x" ~
+ for homedir in /home/*; do
+ sudo chown -R ian:ian $homedir
+ lnf "$x" $homedir
+ done
sudo -i <$x
sudo dd of=/etc/pacman.conf if=$x; rm $x
@@ -265,7 +281,6 @@ pi trash-cli
###### link files ###########
# convenient to just do all file linking in one place
-lnf /a/* ~
s lnf /a/sdx{,d} /
# if it wasn't set already, we could set hostname here
@@ -291,13 +306,14 @@ fi
s lnf /a/c/.inputrc /a/c/.vim /a/c/.vimrc /a/c/.gvimrc /root
-if [[ $HOSTNAME == htpc ]]; then
- lnf -T /i/Videos ~/Downloads
-fi
+# machine is going away
+# if [[ $HOSTNAME == htpc ]]; then
+# lnf -T /i/Videos ~/Downloads
+# fi
if has_p; then
# for dovecot
- lnf -T /i/mboxes ~/mail
+ lnf -T /i/k/mboxes ~/mail
fi
@@ -357,30 +373,57 @@ if encrypted; then
sudo systemctl enable fstrim.timer
fi
-if has_p; then
- # relatime is default, but it still significantly increases writes
- # in comparison because it writes on the first read after each
- # write.
- #
- dirs=(/i /mnt/{1,2,3,4,5,6,7,8,9})
- if ! frodo; then
- dirs+=(/q)
- fi
- s mkdir -p "${dirs[@]}"
- s chown ian:ian "${dirs[@]}"
- # ssh and probably some other things care about parent directory
- # ownership, and ssh doesn\'t allow any group writable parent
- # directories, so we are forced to use a directory structure similar
- # to home directories
- s chown root:ian /q
- s chmod 755 /q
+dirs=(/mnt/{1,2,3,4,5,6,7,8,9})
+s mkdir -p "${dirs[@]}"
+s chown ian:ian "${dirs[@]}"
+if [[ $HOSTNAME == treetowl ]]; then
+ tu /etc/fstab <<'EOF'
+UUID=3f7b31cd-f299-40b4-a86b-7604282e2715 /i btrfs noatime 0 2
+EOF
+else
+ tu /etc/fstab <<'EOF'
+/q/i /i none bind 0 0
+EOF
+fi
+
+tu /etc/fstab <<'EOF'
+/i/w /w none bind 0 0
+/i/k /k none bind 0 0
+EOF
+if ! mountpoint /kfrodo; then
+ s mkdir -p /kfrodo
+ s chown ian:traci /kfrodo
fi
+if [[ $HOSTNAME == frodo ]]; then
+ tu /etc/fstab <<'EOF'
+/k /kfrodo none bind 0 0
+EOF
+else
+ tu /etc/fstab <<'EOF'
+frodo:/k /kfrodo nfs defaults 0 0
+EOF
+fi
+
+for x in i w k; do
+ s mount /$i || [[ $? == 32 ]] # 32 = already mounted
+done
+
+
+# ssh and probably some other things care about parent directory
+# ownership, and ssh doesn\'t allow any group writable parent
+# directories, so we are forced to use a directory structure similar
+# to home directories
+s chown root:ian /q
+s chmod 755 /q
/a/bin/conflink
+# propogate /etc/udev/hwdb.d
+s systemd-hwdb update
+ser restart systemd-udev-trigger
# work desktop doesnt need gpg stuff, but it doesnt hurt
s dd of=/etc/profile.d/environment.sh <<'EOF'
@@ -538,21 +581,25 @@ PATH="$PATH:$HOME/.cabal/bin"
# see /a/bin/old-unused/xmonad-cabal.sh
# trying out the distro's versions newer distros
- pi xmonad
- if isarch; then
- # for displaying error messages.
- # optional dependency in arch, standard elsewhere.
- pi xorg-xmessage xmonad-contrib xorg-xsetroot xorg-xinit
-
- # https://wiki.archlinux.org/index.php/Xinitrc
- cp /etc/X11/xinit/xinitrc ~/.xinitrc
- sed -ri '/^ *twm\b/,$d' ~/.xinitrc
- echo "source /a/bin/xinitrc" >> ~/.xinitrc
- else
- pi suckless-tools
- fi
+pi xmonad
+if isarch; then
+ # for displaying error messages.
+ # optional dependency in arch, standard elsewhere.
+ pi xorg-xmessage xmonad-contrib xorg-xsetroot xorg-xinit
+
+ # https://wiki.archlinux.org/index.php/Xinitrc
+ for homedir in /homme/*; do
+ cp /etc/X11/xinit/xinitrc $homedir/.xinitrc
+ sed -ri '/^ *twm\b/,$d' $homedir/.xinitrc
+ echo "source /a/bin/xinitrc" | tee -a $homedir/.xinitrc
+ done
+else
+ pi suckless-tools
+fi
pi dmenu
if isdeb && (tp || x2); then
pi task-laptop
fi
+
+sudo chown -R traci:traci /home/traci