various fixes and improvements
authorIan Kelling <ian@iankelling.org>
Tue, 12 Jul 2016 16:14:37 +0000 (09:14 -0700)
committerIan Kelling <ian@iankelling.org>
Tue, 16 Aug 2016 08:17:27 +0000 (01:17 -0700)
distro-begin
distro-end
dsfull [deleted file]
homepage-setup

index 1857f61d0c5d1659b71c372e765423d49e191678..ce71c83de81bf5d4b4056ff2d36b469f3cdbfaf1 100755 (executable)
@@ -11,7 +11,7 @@
 # for bootstrapping a new machine
 
 # to make ssh run better, first run this:
-sudo bash -c 'source /a/c/repos/bash/.bashrc && source /a/bin/ssh-emacs-setup'
+sudo bash -c 'source /a/c/repos/bash/.bashrc && source /a/exe/ssh-emacs-setup'
 
 
 # see t.org for OS installer notes
@@ -60,12 +60,12 @@ if [[ $1 ]]; then
     export HOSTNAME=$1
 fi
 
-for f in iank-dev htpc treetowl x2 frodo tp lj lk; do
+for f in iank-dev htpc treetowl x2 frodo tp li lj; do
     eval "$f() { [[ $HOSTNAME == $f ]]; }"
 done
-has_p() { iank-dev || x2 || frodo; }
-has_x() { ! lj && ! lk; }
-encrypted() { has_p || tp; }
+has_p() { iank-dev || x2 || frodo || tp; }
+has_x() { ! { lj || li; }; }
+encrypted() { has_p; }
 
 shopt -s extglob
 export GLOBIGNORE=*/.:*/..
@@ -74,6 +74,7 @@ umask 0002
 
 ####### end command line parsing
 
+PATH="/a/exe:$PATH"
 if encrypted; then
     # I tried making a service which was dependent on reboot.target,
     # but it happened too late in the shutdown process.
@@ -92,7 +93,7 @@ Conflicts=reboot.target
 Type=oneshot
 RemainAfterExit=yes
 ExecStart=/bin/true
-ExecStop=/a/bin/keyscript-on
+ExecStop=/a/exe/keyscript-on
 
 [Install]
 WantedBy=keyscriptoff.service
@@ -108,7 +109,7 @@ Description=Turn off automatic decryption of drives on boot
 
 [Service]
 Type=oneshot
-ExecStart=/a/bin/keyscript-off
+ExecStart=/a/exe/keyscript-off
 
 [Install]
 WantedBy=multi-user.target
@@ -119,7 +120,7 @@ EOF
 fi
 
 
-/a/bin/install-myqueue
+install-myqueue
 
 if iank-dev; then
     desktop=$(ssh root@iankelling.org grep desktop /etc/hosts | grep -o "^.* ")
@@ -139,15 +140,7 @@ fi
 # todo, it would be nice to cut down on some of the output
 
 
-for x in /a/bin/bash-programs-by-ian/repos/{errhandle,tee-unique,lnf}/*-function; do
-    # output is below so shellcheck can verify sources
-    echo "# shellcheck source=$x";
-    # shellcheck source=/a/bin/bash-programs-by-ian/repos/errhandle/bash-trace-function
-    # shellcheck source=/a/bin/bash-programs-by-ian/repos/errhandle/errallow-function
-    # shellcheck source=/a/bin/bash-programs-by-ian/repos/errhandle/errcatch-function
-    # shellcheck source=/a/bin/bash-programs-by-ian/repos/errhandle/errexit-function
-    # shellcheck source=/a/bin/bash-programs-by-ian/repos/tee-unique/teeu-function
-    # shellcheck source=/a/bin/bash-programs-by-ian/repos/lnf/lnf-function
+for x in /a/bin/errhandle/*-function; do
     source $x
 done
 
@@ -179,7 +172,7 @@ case $distro in
         sudo bash -c ". /a/bin/fai/fai-wrapper && /a/bin/fai/fai/config/scripts/GRUB_PC/11-ian"
         ;;
     *)
-        sudo bash -c ". /a/bin/fai-wrapper &&
+        sudo bash -c ". /a/bin/fai/fai-wrapper &&
 /a/bin/fai/fai/config/distro-install-common/end"
         ;;
 esac
@@ -202,7 +195,7 @@ lnf-home() {
     done
     lnf ${opts[@]} "$1" /home/ian/$2
     sudo -u traci -i <<EOF
-source /a/bin/bash-programs-by-ian/repos/lnf/lnf-function
+PATH="/a/exe:$PATH"
 lnf ${opts[@]} "$1" /home/traci/$2
 EOF
 }
@@ -210,7 +203,7 @@ EOF
 for x in /a/c/repos/bash/!(.git); do
     lnf-home "$x"
     sudo -i <<EOF
-source /a/bin/bash-programs-by-ian/repos/lnf/lnf-function
+PATH="/a/exe:$PATH"
 lnf $x /root
 EOF
 done
@@ -328,17 +321,18 @@ pi trash-cli
 # todo: reconcile ~/.ssh/config work/home
 s lnf -T /q/p /p
 s lnf -T /a/bin /b
-/a/bin/conflink
+conflink
 
 if has_p; then
     lnf -T /p/offlineimap ~/Maildir
     lnf -T /p/News ~/News
     # don't use /* because I don't want to require it to be mounted
-    s lnf /q/root/.editor-backups /q/root/.undo-tree-history \
-      /a/opt /a/c/.emacs.d /root
 fi
 
-/a/bin/rootsshsync
+s lnf /q/root/.editor-backups /q/root/.undo-tree-history \
+  /a/opt /a/c/.emacs.d $HOME/mw_vars /k/backup /root
+
+rootsshsync
 
 s lnf /a/c/.inputrc /a/c/.vim /a/c/.vimrc /a/c/.gvimrc /root
 
@@ -616,7 +610,7 @@ fi
 
 # work desktop doesnt need gpg stuff, but it doesnt hurt
 s dd of=/etc/profile.d/environment.sh <<'EOF'
-# IAN: EDIT THIS FROM /a/bin/distro-begin
+# IAN: EDIT THIS FROM /a/bin/distro-setup/distro-begin
 
 if [ -f $HOME/path_add-function ]; then
     . $HOME/path_add-function
@@ -680,7 +674,7 @@ EOF
 
 
 
-/a/bin/postfix-setup
+postfix-setup
 
 if isubuntu; then
     # disable crash report annoying crap
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
diff --git a/dsfull b/dsfull
deleted file mode 100755 (executable)
index 69185d9..0000000
--- a/dsfull
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/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 $?" >&2' ERR
-
-host=$1
-
-if [[ ! $host || $host == -h ]]; then
-    echo "$0: error: expected 1 arg of hostname"
-    exit 1
-fi
-
-set -x
-ssh $host sudo reboot ||:
-pxe-server fai $host
-while ! ssh $host :; do
-      sleep 5
-done
-dsremote $host
index 091a50ac1e95ae98cdc86e666449d73c00c8d6ca..bea012657ec35109461fff669ad1735c523b8831 100755 (executable)
@@ -2,36 +2,49 @@
 # Copyright (C) 2016 Ian Kelling
 # This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
 
-# lj is test server
-case $HOSTNAME in
-    lj)
-        domain=iankelling.org
-        ;;
-    lk)
-        domain=iank.bid
-        ;;
-esac
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
+domain=$1
+
+if [[ ! $1 ]]; then
+    echo "$0: error: expected domain argument"
+    exit 1
+fi
+
+gitroot=/a/bin/githtml
+
+type -P a2enmod &>/dev/null || pi apache2
+
+acme-tiny-wrapper $domain
 
 # debian has the package gitweb, which seems to mainly
 # have some example apache config, and a minimal gitweb config.
 # I'll just use the config as example and not use the package.
 # It's example apache config seems to say we can use cgi or cgid,
 # and googling cgid it seems a newer faster alternative.
-s a2enmod cgid
+sudo a2enmod cgid
 
+# so, highlight is not highlighting my
+pi highlight
+
+# additional settings from browsing https://git-scm.com/docs/gitweb.conf
 s dd of=/etc/gitweb.conf <<EOF
-\$projectroot = "$gitroot";
+\$feature{'highlight'}{'default'} = [1];
+# highlighting doesn't work on files without extension.
+# I noticed in terminal "highlight file" won't do it (unknown file type)
+# hightlight < file will do it, and it's online documentation
+# suggests it reads shebang. Todo: file a bug for gitweb
+# to make highlight read shebangs.
+our \$projectroot = "$gitroot";
 # not documented at https://git-scm.com/docs/gitweb.conf,
 # but it's in the debian conf, so use it.
 # directory to use for temp files.
 \$git_temp = "/tmp";
+push @git_base_url_list, "https://$domain/git";
 EOF
 
 
-git_root=/a/bin/githtml
-
-
 apache-site - $domain <<EOF
 # to run python script on my site:
 <Directory /var/www/$domain/html>