various fixes and improvements
[distro-setup] / distro-end
index 660d556ea2363d9220ab9859c09fc3d2b4403f97..9f06366c8f3a1b0efde3830d45ea2d2484a74df4 100755 (executable)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+### setup
 errcatch
+src="${BASH_SOURCE%/*}"
+source $src/pkgs
 
 set -x
-
 exec &> >(sudo tee -a /var/log/distro-end)
 echo "$0: $(date): starting now)"
-
-src="${BASH_SOURCE%/*}"
-
-source $src/pkgs
-
 # see example of usage to understand.
 end_msg() {
     local y
     IFS= read -r -d '' y  ||:
     end_msg_var+="$y"
 }
-
 spa() { # simple package add
     simple_packages+=($@)
 }
-
 distro=$(distro-name)
-
 pending_reboot=false
 sed="sed --follow-symlinks"
-
 # template
 case $distro in
 esac
 
+#### initial packages
 pup
 if isdeb; then
     pi aptitude
 fi
 
-simple_packages=(${p3[@]})
-
-case $HOSTNAME in
-    lj|li) : ;;
-    *)
-        simple_packages+=(${p4[@]})
-        spa $(apt-cache search ruby[.0-9]+-doc| awk '{print $1}')
-        ;;
-esac
-
-
 ########### begin section including li ################
+pi ${p3[@]} $($src/distro-pkgs)
 
 conflink
 
 case $distro in
-    arch)
-        # ubuntu 14.04 uses b-cron,
-        # but its not maintained in arch.
-        # of the ones in the main repos, cronie is only one maintained.
-        # fcron appears abandoned software.
-        pi cronie
-        sgo cronie
-        ;;
-    *) : ;; # other distros come with cron.
+    arch) sgo cronie ;;
 esac
 
-
-
 case $distro in
-    *) pi at ;;&
     arch) sgo atd ;;
 esac
 
 
 case $distro in
-    debian|trisquel|ubuntu) pi curl;;
-    arch) : ;;
-    # fedora: unknown
-esac
-
-case $distro in
-    # tk for gitk
-    arch) spa git tk ;;
-    *) spa git ;;
-esac
-
-case $distro in
-    arch) spa the_silver_searcher ;;
-    debian|trisquel|ubuntu) spa silversearcher-ag ;;
-    # fedora unknown
-esac
-
-case $distro in
-    debian|trisquel|ubuntu) spa ntp;;
-    arch)
-        pi ntp
-        sgo ntpd
-        ;;
-    # others unknown
+    arch) sgo ntpd ;;
 esac
 
 
 # no equivalent in other distros:
 case $distro in
     debian|trisquel|ubuntu)
-        pi aptitude
         if ! dpkg -s apt-file &>/dev/null; then
             # this condition is just a speed optimization
             pi apt-file
             s apt-file update
         fi
-        # for debconf-get-selections
-        spa debconf-utils
         ;;
 esac
 
 
-case $distro in
-    arch|debian|trisquel|ubuntu)
-        spa bash-completion
-        ;;
-    # others unknown
-esac
-
-
-
-
-
 # disable motd junk.
 case $distro in
     debian)
@@ -169,14 +105,8 @@ if isdebian; then
     setup-debian-auto-update
 fi
 
-# we've got a few dependencies later on, so install them now.
-pi eatmydata; PI_PREFIX=eatmydata
-pi "${simple_packages[@]}"
-simple_packages=()
-
 
 ### begin docker install ####
-
 if isdeb; then
     # https://store.docker.com/editions/community/docker-ce-server-debian?tab=description
     pi  software-properties-common apt-transport-https
@@ -249,7 +179,6 @@ esac
 # website setup
 case $HOSTNAME in
     lj|li)
-
         case $HOSTNAME in
             lj) domain=iank.bid; exit 0 ;;
             li) domain=iankelling.org ;;
@@ -622,28 +551,11 @@ EOF
         ;;
 esac
 
-
-# needed for checkrestart
-if isdeb; then
-    spa debian-goodies
-fi
-
-
-
 ########### end section including li/lj ###############
 
-case $distro in
-    debian) spa gnome-session-flashback ;;
-    # flidas is missing dependency gnome-panel. others unknown
-esac
-
+pi ${p4[@]} $(apt-cache search ruby[.0-9]+-doc| awk '{print $1}')
 
 
-case $distro in
-    trisquel|ubuntu|debian) spa ack-grep ;;
-    arch|fedora) spa ack ;;
-    # fedora unknown
-esac
 
 
 
@@ -661,20 +573,6 @@ EOF
         ;;
 esac
 
-case $distro in
-    debian)
-        spa cpio-doc ;;
-    # not packaged in flidas. others unknown. gfdl nonfree issue
-esac
-
-
-
-
-case $distro in
-    fedora) spa unrar ;;
-    *) spa unrar-free ;;
-esac
-
 
 ### begin home vpn server setup
 
@@ -717,6 +615,7 @@ fi
 
 if [[ $HOSTNAME == tp ]]; then
 
+    ##### rss2email
     # note, see bashrc for more documentation.
     pi rss2email
     s dd of=/etc/systemd/system/rss2email.service <<'EOF'
@@ -749,6 +648,7 @@ EOF
     sgo rss2email.timer
 fi
 
+
 ######### begin  pump.io periodic backup #############
 if [[ $HOSTNAME == frodo ]]; then
     s dd of=/etc/systemd/system/pumpbackup.service <<'EOF'
@@ -776,6 +676,7 @@ EOF
 fi
 #########  end  pump.io periodic backup #############
 
+
 case $distro in
     debian|trisquel|ubuntu)
         # suggests because we want the resolvconf package. however, i install it earlier
@@ -802,9 +703,8 @@ lnf /a/opt/.AndroidStudio2.2 ~
 spa lib32stdc++6 default-jdk
 
 
+############# begin syncthing setup ###########
 if [[ $HOSTNAME == frodo ]]; then
-    ############# begin syncthing setup ###########
-
     # It\'s simpler to just worry about running it in one place for now.
     # I assume it would work to clone it\'s config to another non-phone
     # and just run it in one place instead of the normal having a
@@ -876,20 +776,11 @@ if [[ $HOSTNAME == frodo ]]; then
     # Note, the other thing i did was port forward port 22000,
     # per https://docs.syncthing.net/users/firewall.html
 
-    #############  end syncthing setup ###########
 fi
+#############  end syncthing setup ###########
 
 
 
-# no equivalent in other distros:
-case $distro in
-    debian|trisquel|ubuntu)
-        # for gui bug reporting
-        spa python-vte
-        ;;
-esac
-
-
 ####### begin misc packages ###########
 
 reset-sakura
@@ -1251,6 +1142,7 @@ EOF
 EOF
     done
 fi
+######### end transmission client setup ######
 
 # dunno why it\'s there, but get rid of it
 case $HOSTNAME in
@@ -1258,7 +1150,7 @@ case $HOSTNAME in
 esac
 
 
-# printer
+### printer setup
 case $distro in
     arch)
         pi cups ghostscript gsfonts # from arch wiki cups page
@@ -1281,66 +1173,7 @@ case $distro in
     trisquel|ubuntu|debian) pi --no-install-recommends mairix notmuch ;;
     fedora|arch) spa mairix notmuch ;;
 esac
-case $distro in
-    arch) spa nfs-utils ;;
-    trisquel|ubuntu|debian) spa nfs-client ;;
-esac
-case $distro in
-    trisquel|ubuntu|debian) spa par2 ;;
-    arch|fedora) spa par2cmdline ;;
-esac
-
-# needed for my tex resume
-case $distro in
-    trisquel|ubuntu|debian) spa texlive-full ;;
-    arch) spa texlive-most ;;
-    # fedora unknown
-esac
-
-
-case $distro in
-    # optional dep for firefox for h.264 video
-    arch) spa gst-libav ;;
-    # other distros, probably come by default
-esac
 
-case $distro in
-    fedora|trisquel|ubuntu|debian) spa gnupg-agent ;;
-    arch) : ;;
-esac
-
-
-case $distro in
-    fedora) spa pinentry-gtk ;;
-    *) : ;; # comes default or with other packages
-esac
-
-case $distro in
-    arch) spa firefox pulseaudio;;
-    trisquel) spa abrowser ;;
-    *) : ;; # comes default or with other packages, or uknown
-esac
-
-
-case $distro in
-    arch) spa ttf-dejavu;;
-    debian|trisquel|ubuntu) spa fonts-dejavu ;;
-    # others unknown
-esac
-
-
-case $distro in
-    arch) spa xorg-xev;;
-    debian|trisquel|ubuntu) spa x11-utils ;;
-    # others unknown
-esac
-
-case $distro in
-    arch) pi virt-install;;&
-    debian|trisquel|ubuntu) pi virtinst ;;&
-    *) pi virt-manager ;; # creates the libvirt group in debian at least
-    # others unknown
-esac
 # allow user to run vms, from debian handbook
 for x in iank traci; do s usermod -a -G libvirt,kvm $x; done
 # bridge networking as user fails. google lead here, but it doesn\'t work:
@@ -1354,39 +1187,17 @@ for x in iank traci; do s usermod -a -G libvirt,kvm $x; done
 # #s chown root:qemu $f # debian has somethig like qemu-libvirt. equivalent?
 # s chmod 640 $f
 
-
-case $distro in
-    arch) spa cdrkit;;
-    debian|trisquel|ubuntu) spa genisoimage;;
-    # others unknown
-esac
-
-case $distro in
-    arch) spa spice-gtk3 ;;
-    debian|trisquel|ubuntu) spa spice-client-gtk;;
-    # others unknown
-esac
-
 # general known for debian/ubuntu, not for fedora
 
 case $distro in
     debian|trisquel|ubuntu)
-        pi golang-go
         # a bit of googling, and added settings to bashrc
         go get -u github.com/mvdan/fdroidcl/cmd/fdroidcl
         ;;
-    # others unknown
 esac
 
-
 case $distro in
     arch)
-        # cdrkit for cloud-init isos
-        # dnsmasq & ebtables for nat networking in libvirt
-        # qemu for qemu-img, bind-tools for dig
-        # dmidecode just because syslog complains
-        pi unzip xorg-xmodmap dmidecode ebtables\
-           bridge-utils dnsmasq qemu bind-tools
         # otherwise we get error about accessing kvm module.
         # seems like there might be a better way, but google was a bit vague.
         s $sed -ri '/^ *user *=/d' /etc/libvirt/qemu.conf
@@ -1397,41 +1208,9 @@ case $distro in
         # guessing this is not needed
         #sgo virtlogd.service
         sgo libvirtd
-
         ;;
 esac
 
-case $distro in
-    arch) pi virtviewer ;;
-    *) : ;; # other distros have it as a dependency afaik.
-esac
-
-
-
-case $distro in
-    fedora) cabal install shellcheck ;;
-    *) spa shellcheck ;;
-    # unknown for older ubuntu
-esac
-
-
-case $distro in
-    arch|debian|trisquel|ubuntu) spa pumpa ;;
-    # others unknown. do have a buildscript:
-    # /a/bin/buildscripts/pumpa ;;
-esac
-
-
-case $distro in
-    debian) pi adb ;;
-    debian|trisquel|ubuntu) spa android-tools-adbd ;;
-    # todo: not sure this is needed anymore, or if trisqel etc works even
-    #    debian) spa android-tools-adbd/unstable ;;
-    arch) spa android-tools ;;
-    # other distros unknown
-esac
-
-
 
 case $distro in
     fedora)
@@ -1457,28 +1236,6 @@ case $distro in
 esac
 
 
-case $distro in
-    debian)
-        pi task-mate-desktop
-        # in settings, change scrolling to two-finger,
-        # because the default edge scroll doesn\'t work.
-        pu transmission-gtk
-        ;;
-    trisquel)
-        # mate-indicator-applet and beyond are msc things I noticed diffing a
-        # standard install with mine.
-        pi xorg lightdm mate-desktop-environment mate-desktop-environment-extras mate-indicator-applet anacron
-        ;;
-    # others unknown
-esac
-
-case $distro in
-    arch) spa apg  ;;
-    # already in debian
-esac
-
-
-
 
 
 # note this failed running at the beginning of this file,
@@ -1717,7 +1474,6 @@ esac
 # esac
 cd /a/opt/btrbk
 s make install
-spa pv # for progress bar when running interactively.
 
 # ian: temporarily disabled while hosts are in flux.
 # if [[ $HOSTNAME == tp ]]; then
@@ -1728,20 +1484,29 @@ spa pv # for progress bar when running interactively.
 # fi
 
 
+end_msg <<'EOF'
+In mate settings settings, change scrolling to two-finger,
+because the default edge scroll doesn\'t work. Originally found this in debian.
+EOF
+
+case $distro in
+    debian)
+        # remove dep that came in with desktop
+        pu transmission-gtk
+        ;;
+    esac
 
 
 case $distro in
     debian|trisquel|ubuntu) s gpasswd -a iank adm ;; #needed for reading logs
 esac
 
-# tor
+#### tor
 case $distro in
     # based on
     # https://www.torproject.org/docs/rpms.html.en
     # https://www.torproject.org/docs/debian.html.en
     # todo: figure out if the running service needs to be restarted upon updates
-
-
     # todo on fedora: setup non-dev packages
     fedora)
         s dd of=/etc/yum.repos.d/torproject.repo <<'EOF'
@@ -1839,12 +1604,7 @@ fi
 e "$end_msg_var"
 
 
-# persistent virtual machines
-case $distro in
-    debian|trisquel|ubuntu)
-        pi libosinfo-bin;
-        ;;
-esac
+
 # if I was going to create a persistent vm, i might do it like this:
 # variant=something  # from: virt-install --os-variant list
 # s virt-install --noautoconsole --graphics spice,listen=0.0.0.0 \
@@ -1856,17 +1616,6 @@ esac
 ######### begin stuff belonging at the end    ##########
 
 
-case $distro in
-    ubuntu|debian)
-        spa spacefm-gtk3 ;;
-    arch)
-        spa spacefm ;;
-esac
-
-
-pi "${simple_packages[@]}"
-
-
 if $pending_reboot; then
     echo "$0: pending reboot and then finished. doing it now."
     s reboot now