various fixes and improvements
[distro-setup] / distro-end
index cd3de8162f962c058b7c3b5f7c06c4777df25251..8d1a580f3ac2cd3f03c1a1bed2691dcb5a6d8c65 100755 (executable)
@@ -1,8 +1,7 @@
 #!/bin/bash -l
 # Copyright (C) 2016 Ian Kelling
 # This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
+errcatch
 
 set -x
 
@@ -32,6 +31,7 @@ esac
 pup
 
 simple_packages=(
+    htop
     mailutils
     nmon
     ruby
@@ -40,36 +40,41 @@ simple_packages=(
     vim
 )
 
-if [[ $HOSTNAME != lj && $HOSTNAME != lk ]]; then
-    # universal packages
-    simple_packages+=(
-        apache2
-        bwm-ng
-        chromium
-        duplicity
-        evince
-        fdupes
-        filelight
-        gdb
-        gnome-screenshot
-        jq
-        locate
-        meld
-        offlineimap
-        p7zip
-        paprefs
-        pavucontrol
-        pdfgrep
-        pianobar
-        pidgin
-        rdiff-backup
-        slock
-        squashfs-tools
-        tcpdump
-        transmission-remote-gtk
-        vlc
-    )
-fi
+case $HOSTNAME in
+    lj|li) : ;;
+    *)
+        # universal packages
+        # swh-plugins is for karaoke pulsaudio filter.
+        simple_packages+=(
+            apache2
+            bwm-ng
+            chromium
+            duplicity
+            evince
+            fdupes
+            filelight
+            gdb
+            gnome-screenshot
+            jq
+            locate
+            meld
+            offlineimap
+            p7zip
+            paprefs
+            pavucontrol
+            pdfgrep
+            pianobar
+            pidgin
+            rdiff-backup
+            slock
+            squashfs-tools
+            swh-plugins
+            tcpdump
+            transmission-remote-gtk
+            vlc
+        )
+        ;;
+esac
 
 
 
@@ -230,28 +235,26 @@ fi
 
 
 case $HOSTNAME in
-    lj|lk)
+    lj|li)
 
         pi "${simple_packages[@]}"
-        $src/homepage-setup
-        $src/
-
-#         start=' *<source lang="bash"> *'
-#         end=' *<\/source> *'
-#         ruby <<'EOF' | sed -rn "/^$start$/,/^$end$/{s/^$start|$end$/# \0/;p}" | bash
-# require 'json'
-# puts JSON.parse(`curl 'https://ofswiki.org/w/api.php?\
-# action=query&titles=Mediawiki_Setup_Guide&prop=revisions&rvprop=content&\
-# format=json'`.chomp)['query']['pages'].values[0]['revisions'][0]['*']
-# EOF
-#         nginx-site iankelling.org
+        case $HOSTNAME in
+            lj) domain=iank.bid ;;
+            li) domain=iankelling.org ;;
+        esac
+        homepage-setup $domain
+        s rld /a/h/_site/ /var/www/$domain/html
+
+        curl https://$domain/git/?p=mediawiki-setup/.git;a=blob_plain;f=mw-setup-script;hb=HEAD | bash
+        $src/phab-setup
+
 
         echo "$0: $(date): ending now)"
         exit 0
         ;;
 esac
 
-########### end section including lj ###############
+########### end section including li/lj ###############
 
 
 case $distro in
@@ -364,6 +367,11 @@ if ! getent passwd debian-transmission > /dev/null; then
     esac
 fi
 
+# dunno why it's there, but get rid of it
+case $HOSTNAME in
+    li|lj) s rm -rf /home/linode ;;
+esac
+
 # arch had a default config,
 # debian had nothing until you start it.
 # With a little trial an error, here is a minimal config
@@ -373,7 +381,6 @@ fi
 # only settings I set were
 # hostname
 # auto-connect
-#
 for f in /home/*; do
     d=$f/.config/transmission-remote-gtk
     u=${f##*/}
@@ -416,7 +423,8 @@ case $distro in
         ser disable openvpn@client
         ser disable openvpn
         ;;
-    *) pi openvpn ;;
+    # suggests because we want the resolvconf package
+    *) pi --install-suggests openvpn;;
 esac
 
 pi wget
@@ -426,13 +434,14 @@ case $HOSTNAME in
             debian|ubuntu)
                 log=$(mktemp)
                 cd /a/opt
-                wget -N https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
-                set +e
-                s dpkg -i google-chrome-stable_current_amd64.deb &> $log
+                wget -nv -N https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
+                errallow
+                s dpkg -i google-chrome-stable_current_amd64.deb |& tee $log
                 code=$?
-                set -e
+                errcatch
                 case $code in
-                    1)
+                    0) : ;;
+                    *)
                         if grep '^dpkg: dependency problems prevent configuration of' \
                                 $log &>/dev/null; then
                             s apt-get -fy install
@@ -440,8 +449,6 @@ case $HOSTNAME in
                             exit 1
                         fi
                         ;;
-                    0) : ;;
-                    *) exit $code
                 esac
                 ;;
             arch)
@@ -810,12 +817,10 @@ EOF
                 # deal with mismatching unison compilers, but I dont
                 # see any reason to revert it, since it only installs
                 # a single package which is primarily a single binary
-                pi unison-gtk/testing unison/testing
-                ;;
-            testing)
-                piunison unison-gtk
                 ;;
         esac
+        pi unison/testing
+        pi unison-gtk/testing # after to make it the default unison
         ;;
     arch)
         pi unison gtk2