organize / cleanup
authorIan Kelling <iank@fsf.org>
Sun, 28 Jan 2018 19:37:49 +0000 (14:37 -0500)
committerIan Kelling <iank@fsf.org>
Sun, 28 Jan 2018 19:37:49 +0000 (14:37 -0500)
btrbk-run
distro-begin
mail-setup
mount-latest-subvol
pkgs

index 5ff83260022c20d1eeec2217ae8392b61653b69d..a1c6963a926b445454ca1d27634a56737e2d34da 100755 (executable)
--- a/btrbk-run
+++ b/btrbk-run
@@ -81,7 +81,7 @@ echo -e "$0: options: conf_only=$conf_only\ndry_run=$dry_run\nresume_arg=$resume
 # set default targets
 if [[ ! -v targets ]]; then
     case $HOSTNAME in
-        x2|fz)
+        x2|kw)
             if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
                 targets=($HOME_DOMAIN)
             fi
index 6ce91c45041c0a8a0d61d573b984db316911e586..e77ff04a5827f1d7200b35718cb2205276613ad0 100755 (executable)
@@ -323,37 +323,62 @@ if has_p; then
     lnf -T /i/k/mboxes ~/mail
 fi
 
-### begin setup for keyboard and redshift ###
-case $(distro-name) in
-    trisquel|ubuntu|debian)
-        if has_x; then
+
+
+
+##### install xinput
+if has_x; then
+    case $(distro-name) in
+        trisquel|ubuntu|debian)
             pi xinput
+            ;;
+        fedora)
+            pi xinput_calibrator
+            ;;
+        arch)
+            pi xorg-xinput
+            ;;
+    esac
+
+    #### install redshift
+    case $(distro-name) in
+        trisquel|ubuntu|debian)
             # recommends gets us geoclue (for darkening automatically at night i assume),
             # which recommends modemmanager, which is annoying to fix for the model01 keyboard.
             pi --no-install-recommends gtk-redshift
-        fi
-        ;;&
-    fedora)
-        p -y groupinstall development-tools c-development books admin-tools
-        pi wget man-pages
-        if has_x; then
+            ;;&
+        fedora)
             pi redshift-gtk
-        fi
-        ;;&
+            ;;&
+        arch)
+            pi redshift
+            ;;&
+    esac
+fi
+
+
+#### arch specific early packages
+case $(distro-name) in
     arch)
-        # like apt-cache
+        # pkgfile is like apt-cache
         pi pkgfile
         s pkgfile --update
-        if has_x; then
-            pi xorg-server redshift xorg-xinput
-        fi
-        ;;&
+        ;;
 esac
-### end setup for keyboard and redshift ###
 
-# enables trim for volume delete, other rare commands.
-sudo $sed -ri 's/( *issue_discards\b).*/\1 = 1/' /etc/lvm/lvm.conf
+#### fedora specific packages
+case $(distro-name) in
+    fedora)
+        # todo, this could probably come later
+        p -y groupinstall development-tools c-development books admin-tools
+        pi man-pages
+        ;;
+    # other distros unknown
+esac
 
+#### enable trim
+# enable trim for volume delete, other rare commands
+sudo $sed -ri 's/( *issue_discards\b).*/\1 = 1/' /etc/lvm/lvm.conf
 if encrypted; then
     if isdeb; then
         sudo cp /usr/share/doc/util-linux/examples/fstrim.{service,timer} /etc/systemd/system
@@ -362,22 +387,20 @@ if encrypted; then
     sudo systemctl enable fstrim.timer
 fi
 
+##### make extra dirs
 dirs=(/mnt/{1,2,3,4,5,6,7,8,9} /nocow/t)
 s mkdir -p "${dirs[@]}"
 s chown $USER:$USER  "${dirs[@]}"
 
-
+###### setup /i
 tu /etc/fstab <<'EOF'
 /i/w  /w  none  bind,noauto  0 0
 /i/k  /k  none  bind,noauto  0 0
 EOF
-
-
 if ! mountpoint /kr; then
     s mkdir -p /kr
     s chown $USER:traci /kr
 fi
-
 if home_network; then
     if [[ $HOSTNAME == frodo ]]; then
         tu /etc/fstab <<'EOF'
@@ -389,17 +412,14 @@ frodo:/k  /kr  nfs  noauto  0 0
 EOF
     fi
 fi
-
 s mkdir -p /q /i/{w,k}
 for dir in /{i,w,k}; do
     if mountpoint $dir; then continue; fi # already mounted
     s mkdir -p $dir
     s chown $USER:$USER $dir
 done
-
 # not needed for all hosts, but rather just keep it uniform
 s mkdir -p /mnt/iroot
-
 # debian auto mounting of multi-disk encrypted btrfs is busted.  It is
 # in jessie, and in stretch as of 11/26/2016 I have 4 disks in cryptab,
 # based on 3 of those, it creates .device units for /dev/mapper/dev...
@@ -448,6 +468,8 @@ EOF
     sudo systemctl start imount.service
 fi
 
+##### setup /nocow.
+# a nocow dir that is common to multiple distros installed onthe same system
 dir=/nocow
 if has_btrfs; then
     if ! mountpoint $dir; then
@@ -470,14 +492,8 @@ else
     sudo mkdir -p $dir
 fi
 
-# 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:$USER /q
-s chmod 755 /q
-
 
+###### fix mouse on jessie
 #  it comes with stretch and arch, but not jessie.
 # propogate /etc/udev/hwdb.d
 if which systemd-hwdb; then
@@ -486,24 +502,21 @@ if which systemd-hwdb; then
 fi
 
 
+##### setup email
 if isdeb; then
-    # I\'ve had problems with postfix on debian:
-    # on stretch, a startup ordering issue caused all mail to fail.
-    # postfix changed defaults to only use ipv6 dns, causing all my mail to fail.
-    # exim4 is default on debian, so I assume it would
-    # be packaged better to avoid these types of things.
-    # I haven\'t gotten around to getting a non-debian exim
-    # setup.
     mail-setup exim4
 else
+    # todo: probably broken
     mail-setup postfix
 fi
 
+#### ubuntu nicety
 if isubuntu; then
     # disable crash report annoying dialogs.
     s dd of=/etc/default/apport <<<'enabled=0'
 fi
 
+###### setup time zone
 # fai sets this an old way that doesn't work for stretch.
 # no harm in setting it universally here.
 # using debconf-set-selection, the area gets reset to ETC
@@ -529,21 +542,16 @@ exit
 EOF
 
 
+##### install  emacs
 if has_x; then
     if isarch; then
-        # install so it's build dependencies don't get removed.
-
-        # emacs git build is currently broken
-        if false; then
-            x=$(mktemp -d)
-            pushd $x
-            aurex emacs-git
-            makepkg -si --noconfirm
-            popd
-            rm -rf $x
-        else
-            pi emacs
-        fi
+        # emacs git build was broken last time i checked,
+        x=$(mktemp -d)
+        pushd $x
+        aurex emacs-git
+        makepkg -si --noconfirm
+        popd
+        rm -rf $x
         pi hunspell hunspell-en
     else
         if $recompile; then
@@ -552,41 +560,42 @@ if has_x; then
             /a/bin/buildscripts/emacs --no-r || /a/bin/buildscripts/emacs
         fi
     fi
+fi
 
-    # todo, figure this out for arch if we ever try out gnome.
-    if ! isarch; then
-        # install for multiple display managers in case we use one
-        if isdeb; then
-            dir=/etc/gdm3
-        elif isfedora; then
-            # fedora didn\'t have the 3.
-            dir=/etc/gdm
-        fi
-        s mkdir -p $dir/PostLogin
-        s command cp /a/bin/distro-setup/desktop-20-autostart.sh $dir/PostLogin/Default
-        s mkdir /etc/lightdm/lightdm.conf.d
-        s dd of=/etc/lightdm/lightdm.conf.d/12-iank.conf <<'EOF'
-[SeatDefaults]
-session-setup-script=/a/bin/distro-setup/desktop-20-autostart.sh
-EOF
-    fi
+##### install laptop hardware packages
+if tp || x2; then
+    case $distro in
+        debian)
+            pi task-laptop
+            ;;
+        ubuntu|trisquel)
+            # the exact packages that task-laptop would install, since ubuntu
+            # doesn\'t have this virtual in practice package.
+            pi avahi-autoipd bluetooth powertop iw wireless-tools wpasupplicant
+            ;;
+        # todo: other distros unknown
+    esac
+fi
 
 
+##### install xmonad
+if has_x; then
     pi ${p2[@]}
-    # todo, also note for work comp, scp opt/org-mode bin/build-scripts
-
-    # use the package manger version to install the cabal version
-    cabal update
-    PATH="$PATH:$HOME/.cabal/bin"
-
-    # todo, on older ubuntu I used cabal xmonad + xfce,
-    # see /a/bin/old-unused/xmonad-cabal.sh
-
+    # note: on older ubuntu I used cabal xmonad + xfce, using cabal versin
+    # see /w/archive/programming/xmonad-cabal.sh
     if isarch; then
-        # for displaying error messages.
+        # xorg-xmessage for displaying error messages.
         # optional dependency in arch, standard elsewhere.
-        pi xorg-xmessage xmonad-contrib xorg-xsetroot xorg-xinit
+        pi xorg-server xorg-xmessage xmonad-contrib xorg-xsetroot xorg-xinit
+    else
+        pi suckless-tools
+    fi
+fi
+
 
+##### setup X autostart
+if has_x; then
+    if isarch; then
         # https://wiki.archlinux.org/index.php/Xinitrc
         for homedir in /home/*; do
             cp /etc/X11/xinit/xinitrc $homedir/.xinitrc
@@ -597,27 +606,30 @@ xsetroot -cursor_name left_ptr
 exec xmonad
 EOF
         done
-    else
-        pi suckless-tools
-    fi
-    pi dmenu
-
-    if tp || x2; then
-        case $distro in
-            debian)
-                pi task-laptop
-                ;;
-            ubuntu|trisquel)
-                # the exact packages that task-laptop would install, since ubuntu
-                # doesn\'t have this virtual in practice package.
-                pi avahi-autoipd bluetooth powertop iw wireless-tools wpasupplicant
-                ;;
-            # todo: other distros unknown
-        esac
+        else
+        # todo, figure this out for arch if we ever try out gnome.
+        # install for multiple display managers in case we use one
+        if isdeb; then
+            dir=/etc/gdm3
+        elif isfedora; then
+            # fedora didn\'t have the 3.
+            dir=/etc/gdm
+        fi
+        s mkdir -p $dir/PostLogin
+        s command cp /a/bin/distro-setup/desktop-20-autostart.sh $dir/PostLogin/Default
+        s mkdir /etc/lightdm/lightdm.conf.d
+        s dd of=/etc/lightdm/lightdm.conf.d/12-iank.conf <<'EOF'
+[SeatDefaults]
+session-setup-script=/a/bin/distro-setup/desktop-20-autostart.sh
+EOF
     fi
 fi
 
+
+#### refix interactive ssh terminal
 # the first pup command can kill off our /etc/ mod, so rerun this
 /a/exe/ssh-emacs-setup
+
+
 echo "$0: $(date): ending now"
 exit 0
index c7f29337e30eeb11777b8f5b3fecd4f5c5995876..fdb4c219d4eb2b9154c500c93fe6d751fe962113 100755 (executable)
@@ -27,6 +27,13 @@ Setup exim4 / postfix / dovecot
 
 The minimal assumption we have is that /etc/mailpass exists
 
+
+I\'ve had problems with postfix on debian:
+on stretch, a startup ordering issue caused all mail to fail.
+postfix changed defaults to only use ipv6 dns, causing all my mail to fail.
+I haven\'t gotten around to getting a non-debian exim
+setup.
+
 -h|--help  Print help and exit.
 EOF
     exit $1
index be239ed139de5c2405125612ebeeaf374227224d..d7be613c763d122d0259b5a434ca4a161f599627 100644 (file)
@@ -117,10 +117,14 @@ EOF
 
 shopt -s nullglob
 
+# 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
 f=(/mnt/root/btrbk/q.*)
 if [[ -e $f ]]; then
     fstab <<EOF
-$first_root_crypt  /q  btrfs  noatime,subvol=q  0 0
+$first_root_crypt  /q  btrfs  noatime,subvol=q,gid=1000  0 0
 /q/p  /p  none  bind  0 0
 EOF
 fi
diff --git a/pkgs b/pkgs
index 524849e8ff650cd2f9310ab63ffad039780b3398..1c1ce85cfe2db474e7f9ab0182067b6c566ad9c7 100644 (file)
--- a/pkgs
+++ b/pkgs
@@ -9,9 +9,10 @@ p1=(
 p2=(
     # 2nd
     ghc
-    sakura
+    konsole
     xmonad
     cabal-install
+    dmenu
 )
 p3=(
     htop
@@ -117,6 +118,7 @@ p4=(
     python3-doc
     qrencode
     reportbug
+    sakura
     schroot
     sqlite3-doc
     squashfs-tools