From: Ian Kelling Date: Tue, 12 Jul 2016 16:14:37 +0000 (-0700) Subject: various fixes and improvements X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=d2a47c0cb8dd83d90b1062d0513d1719d5a15b9c various fixes and improvements --- diff --git a/distro-begin b/distro-begin index 1857f61..ce71c83 100755 --- a/distro-begin +++ b/distro-begin @@ -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 < -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=' * *' -# 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 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 -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 diff --git a/homepage-setup b/homepage-setup index 091a50a..bea0126 100755 --- a/homepage-setup +++ b/homepage-setup @@ -2,36 +2,49 @@ # Copyright (C) 2016 Ian Kelling # This program is under GPL v. 3 or later, see -# 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 <