set -x
+exec &> >(sudo tee -a /var/log/distro-end)
+echo "$0: $(date): starting now)"
+
end_msg() {
= local y
IFS= read -r -d '' y ||:
distro=$(distro-name)
+pending_reboot=false
# template
case $distro in
smartmontools
squashfs-tools
tcpdump
+ transmission-remote-gtk
tree
vim
)
esac
fi
-# from /var/lib/dpkg/info/transmission-daemon.postinst
+# adapted from /var/lib/dpkg/info/transmission-daemon.postinst
if ! getent passwd debian-transmission > /dev/null; then
- s adduser --quiet \
- --system \
- --group \
- --no-create-home \
- --disabled-password \
- --home /var/lib/transmission-daemon \
- debian-transmission
+ case $distro in
+ arch)
+ s useradd \
+ --system \
+ --create-home \
+ --home-dir /var/lib/transmission-daemon \
+ --shell /bin/false \
+ debian-transmission
+ ;;
+ *)
+ s adduser --quiet \
+ --system \
+ --group \
+ --no-create-home \
+ --disabled-password \
+ --home /var/lib/transmission-daemon \
+ debian-transmission
+ ;;
+ esac
fi
-case $distro in
- debian|ubuntu) pi transmission-remote-gtk ;;
- arch) pi transmission-remote-gtk2 ;;
-esac
# arch had a default config,
# debian had nothing until you start it.
# With a little trial an error, here is a minimal config
ser disable openvpn@client
ser disable openvpn
;;
- *) pi openvpn ;;
-esac
+ *) pi openvpn ;;
+ esac
-case $HOSTNAME in
- tp|frodo)
- case $distro 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
- code=$?
- set -e
- case $code in
- 1)
- if grep '^dpkg: dependency problems prevent configuration of' \
- $log &>/dev/null; then
- s apt-get -fy install
- else
- exit 1
- fi
- ;;
- 0) : ;;
- *) exit $code
- esac
- ;;
- arch)
- pi google-chrome
- ;;
- esac
- ;;
-esac
+ case $HOSTNAME in
+ tp|frodo)
+ case $distro 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
+ code=$?
+ set -e
+ case $code in
+ 1)
+ if grep '^dpkg: dependency problems prevent configuration of' \
+ $log &>/dev/null; then
+ s apt-get -fy install
+ else
+ exit 1
+ fi
+ ;;
+ 0) : ;;
+ *) exit $code
+ esac
+ ;;
+ arch)
+ pi google-chrome
+ ;;
+ esac
+ ;;
+ esac
-case $distro in
- # ubuntu unknown. probably the same as debian, just check if the
- # init scripts come with the package.
- debian)
- # copied from arch
- s dd of=/etc/systemd/system/synergys@.service <<'EOF'
+ case $distro in
+ # ubuntu unknown. probably the same as debian, just check if the
+ # init scripts come with the package.
+ debian)
+ # copied from arch, but moved to etc
+ s dd of=/etc/systemd/user/synergys.service <<'EOF'
[Unit]
Description=Synergy Server Daemon
After=network.target
[Install]
WantedBy=multi-user.target
EOF
- s dd of=/etc/systemd/system/synergys@.socket <<'EOF'
+ s dd of=/etc/systemd/user/synergys.socket <<'EOF'
[Unit]
Conflicts=synergys@.service
[Install]
WantedBy=sockets.target
EOF
- ;;&
- *)
- pi synergy
- s dd of=/etc/systemd/system/synergyc@.service <<'EOF'
+ ;;&
+ *)
+ pi synergy
+ # taken from arch wiki.
+ s dd of=/etc/systemd/system/synergyc@.service <<'EOF'
[Unit]
Description=Synergy Client
After=network.target
[Install]
WantedBy=multi-user.target
EOF
- case $HOSTNAME in
- frodo)
- sgo synergyc@ian
- sgo synergys@ian.socket
- ;;
- treetowl) sgo synergys@ian.socket ;;
- esac
- ;;
-esac
+ case $HOSTNAME in
+ frodo)
+ sgo synergyc@ian
+ systemctl --user start synergys
+ systemctl --user enable synergys
+ ;;
+ treetowl) systemctl --user enable synergys ;;
+ esac
+ ;;
+ esac
-case $distro in
- # tk for gitk
- arch) spa git tk ;;
- *) spa git ;;
-esac
+ case $distro in
+ # tk for gitk
+ arch) spa git tk ;;
+ *) spa git ;;
+ esac
-case $distro in
- arch) spa the_silver_searcher ;;
- debian|ubuntu) spa silversearcher-ag ;;
- # fedora unknown
-esac
+ case $distro in
+ arch) spa the_silver_searcher ;;
+ debian|ubuntu) spa silversearcher-ag ;;
+ # fedora unknown
+ esac
-# printer
-case $distro in
- arch)
- pi cups ghostscript gsfonts # from arch wiki cups page
- pi hplip # from google
- s gpasswd -a $USER sys # from arch wiki
- sgo org.cups.cupsd.service
- # goto http://127.0.0.1:631
- # administration tab, add new printer button.
- # In debian, I could use hte recommended driver,
- # in arch, I had to pick out the 6L driver.
- ;;
- debian|ubuntu)
- spa hplip
- ;;
- # other distros unknown
-esac
+ # printer
+ case $distro in
+ arch)
+ pi cups ghostscript gsfonts # from arch wiki cups page
+ pi hplip # from google
+ s gpasswd -a $USER sys # from arch wiki
+ sgo org.cups.cupsd.service
+ # goto http://127.0.0.1:631
+ # administration tab, add new printer button.
+ # In debian, I could use hte recommended driver,
+ # in arch, I had to pick out the 6L driver.
+ ;;
+ debian|ubuntu)
+ spa hplip
+ ;;
+ # other distros unknown
+ esac
-case $distro in
- ubuntu|debian) spa ack-grep ;;
- arch|fedora) spa ack ;;
- # fedora unknown
-esac
-case $distro in
- ubuntu|debian) pi --no-install-recommends mairix notmuch ;;
- fedora|arch) spa mairix notmuch ;;
-esac
-case $distro in
- arch) spa nfs-utils ;;
- ubuntu|debian) spa nfs-client ;;
-esac
-case $distro in
- ubuntu|debian) spa par2 ;;
- arch|fedora) spa par2cmdline ;;
-esac
+ case $distro in
+ ubuntu|debian) spa ack-grep ;;
+ arch|fedora) spa ack ;;
+ # fedora unknown
+ esac
+ case $distro in
+ ubuntu|debian) pi --no-install-recommends mairix notmuch ;;
+ fedora|arch) spa mairix notmuch ;;
+ esac
+ case $distro in
+ arch) spa nfs-utils ;;
+ ubuntu|debian) spa nfs-client ;;
+ esac
+ case $distro in
+ ubuntu|debian) spa par2 ;;
+ arch|fedora) spa par2cmdline ;;
+ esac
-# needed for my tex resume
-case $distro in
- ubuntu|debian) spa texlive-full ;;
- arch) spa texlive-most ;;
- # fedora unknown
-esac
+ # needed for my tex resume
+ case $distro in
+ ubuntu|debian) spa texlive-full ;;
+ arch) spa texlive-most ;;
+ # fedora unknown
+ esac
-case $distro in
- ubuntu)
- # flash, unrar, codecs, ms fonts.
- # This has a manual prompt.
- spa ubuntu-restricted-extras
- ;;
- fedora)
- pi yum-utils
- # rpm fusion recommended codecs
- s su -c "yum localinstall -y --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
- pi gstreamer-plugins-ugly gstreamer-plugins-bad gstreamer-ffmpeg\
- xine-lib-extras-freeworld
- ;;
-esac
+ case $distro in
+ ubuntu)
+ # flash, unrar, codecs, ms fonts.
+ # This has a manual prompt.
+ spa ubuntu-restricted-extras
+ ;;
+ fedora)
+ pi yum-utils
+ # rpm fusion recommended codecs
+ s su -c "yum localinstall -y --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm"
+ pi gstreamer-plugins-ugly gstreamer-plugins-bad gstreamer-ffmpeg\
+ xine-lib-extras-freeworld
+ ;;
+ 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
+ # optional dep for firefox for h.264 video
+ arch) spa gst-libav ;;
+ # other distros, probably come by default
+ esac
-case $distro in
- fedora|ubuntu|debian) spa gnupg-agent ;;
- arch) : ;;
-esac
+ case $distro in
+ fedora|ubuntu|debian) spa gnupg-agent ;;
+ arch) : ;;
+ esac
-case $distro in
- fedora) spa pinentry-gtk ;;
- *) : ;; # comes default or with other packages
-esac
+ case $distro in
+ fedora) spa pinentry-gtk ;;
+ *) : ;; # comes default or with other packages
+ esac
-case $distro in
- arch) spa firefox pulseaudio;;
- *) : ;; # comes default or with other packages
-esac
+ case $distro in
+ arch) spa firefox pulseaudio;;
+ *) : ;; # comes default or with other packages
+ esac
-case $distro in
- arch|debian|ubuntu)
- spa bash-completion
- ;;
- # others unknown
-esac
+ case $distro in
+ arch|debian|ubuntu)
+ spa bash-completion
+ ;;
+ # others unknown
+ esac
-case $distro in
- arch) spa ttf-dejavu;;
- debian|ubuntu) spa fonts-dejavu ;;
- # others unknown
-esac
+ case $distro in
+ arch) spa ttf-dejavu;;
+ debian|ubuntu) spa fonts-dejavu ;;
+ # others unknown
+ esac
-case $distro in
- debian|ubuntu) spa ntp;;
- arch)
- pi ntp
- sgo ntpd
- ;;
- # others unknown
-esac
+ case $distro in
+ debian|ubuntu) spa ntp;;
+ arch)
+ pi ntp
+ sgo ntpd
+ ;;
+ # others unknown
+ esac
-case $distro in
- arch) spa xorg-xev;;
- debian|ubuntu) spa x11-utils ;;
- # others unknown
-esac
+ case $distro in
+ arch) spa xorg-xev;;
+ debian|ubuntu) spa x11-utils ;;
+ # others unknown
+ esac
-case $distro in
- arch) pi virt-install;;&
- debian|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 ian traci; do s usermod -a -G libvirt $x; done
+ case $distro in
+ arch) pi virt-install;;&
+ debian|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 ian traci; do s usermod -a -G libvirt $x; done
# bridge networking as user fails. google lead here, but it doesn't work:
# oh well, I give up.
# http://wiki.qemu.org/Features-Done/HelperNetworking
case $distro in
arch)
# cdrkit for cloud-init isos
- # dnsmasq for nat networking in libvirt
+ # dnsmasq & ebtables for nat networking in libvirt
# qemu for qemu-img, bind-tools for dig
- pi unzip wget xorg-xmodmap \
+ # dmidecode just because syslog complains
+ pi unzip wget 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.
# https://bbs.archlinux.org/viewtopic.php?id=206206
# # this should prolly go in the wiki
sgo virtlogd.socket
- sgo virtlogd.service
+ # guessing this is not needed
+ #sgo virtlogd.service
+ sgo libvirtd
+
;;
esac
pi cronie
sgo cronie
;;
- *) : ;; # other distros come with cron.
+ *) : ;; # other distros come with cron.
esac
ser stop postfix
n=/q/postfix-`distro-name``debian-archive`
if [[ -e $n ]]; then
- echo "$0: error: /q/postfix exists but not the link to it"
- exit 1
+ echo "$0: warning: $n already exists before we do the link, removing it"
+ rm -rf $n
fi
s mv /var/spool/postfix $n
s lnf -T $n /var/spool/postfix
pi nfs-server
;;
arch)
- pi nfs-utils
+ pi nfs-utils || pending_reboot=true
sgo rpcbind
+ # this failed until I rebooted
sgo nfs-server
;;
esac
pi samba
# note samba re-reads it's config every 1 minute
-
+case $distro in
+ arch) s cp /etc/samba/smb.conf.default /etc/samba/smb.conf ;;
+esac
# add 2 lines after workgroup option
s sed -ri '/^\s*encrypt passwords\s*=/d' /etc/samba/smb.conf
# Do this again because it occasionally has changes and
# it can be run outside initial isntall.
s /a/bin/fai/fai/config/distro-install-common/end
+
+if $pending_reboot; then
+ echo "$0: pending reboot and then finished. doing it now."
+ s reboot now
+else
+ echo "$0: $(date): ending now)"
+fi