X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=distro-end;h=f8419aa886069d35d5760902ceecf542cbd53ab5;hb=32a1673064cfd9eaa165b4ea62fa416f02f3dfd2;hp=cd3de8162f962c058b7c3b5f7c06c4777df25251;hpb=d314b216046098f4b520cc14946c5d7c00f2089a;p=distro-setup
diff --git a/distro-end b/distro-end
index cd3de81..f8419aa 100755
--- a/distro-end
+++ b/distro-end
@@ -1,195 +1,372 @@
#!/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 $?"' ERR
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: AGPL-3.0-or-later
-set -x
+### setup
+source /a/bin/errhandle/err
+src="$(readlink -f -- "${BASH_SOURCE[0]}")"; src=${src%/*} # directory of this file
-exec &> >(sudo tee -a /var/log/distro-end)
-echo "$0: $(date): starting now)"
+if [[ $EUID == 0 ]]; then
+ echo "$0: error: run as regular user" >&2
+ exit 1
+fi
-src="${BASH_SOURCE%/*}"
+_errcatch_cleanup() {
+ echo 1 >~/.local/distro-end
+}
+# shellcheck source=./pkgs
+source $src/pkgs
+
+exec &> >(sudo tee -a /var/log/distro-end)
+echo "$0: $(date): starting now)"
+# see example of usage to understand.
end_msg() {
- = local y
- IFS= read -r -d '' y ||:
- end_msg_var+="$y"
+ local y
+ IFS= read -r -d '' y ||:
+ end_msg_var+="$y"
}
-
-spa() { # simple package add
- simple_packages+=($@)
+end() {
+ e "$end_msg_var"
+ echo 0 >~/.local/distro-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
+ exit 0
}
-
+pre="${0##*/}:"
+s() {
+ printf "s %s\n" "$*"
+ SUDOD="$PWD" sudo -i "$@";
+}
+sd() {
+ s dd of="$1" 2>/dev/null
+}
+m() { printf "$pre %s\n" "$*"; "$@"; }
+e() { printf "$pre %s\n" "$*"; }
+err() { echo "[$(date +'%Y-%m-%d %H:%M:%S%z')]: $0: $*" >&2; }
distro=$(distro-name)
-
+codename=$(debian-codename)
+codename_compat=$(debian-codename-compat)
pending_reboot=false
-
+sed="sed --follow-symlinks"
# template
case $distro in
esac
+#### initial packages
pup
-
-simple_packages=(
- mailutils
- nmon
- ruby
- ruby-rest-client
- tree
- 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
- )
+if isdeb; then
+ pi aptitude
fi
+# avoid prompts
+s debconf-set-selections <
+# AllowOverride None
+# AuthType basic
+# AuthName "Authentication Required"
+# # setup one time, with root:www-data, 640
+# AuthUserFile "/etc/prometheus-htpasswd"
+# Require valid-user
+#
+# EOF
+# fi
+
+
+######### begin flidas pinned packages ######
+case $(debian-codename) in
+ # needed for debootstrap scripts for fai since fai requires debian
+ flidas)
+ curl http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg | s apt-key add -
+ sd /etc/apt/preferences.d/flidas-xenial </dev/null </dev/null; then
+ s apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
+ sd /etc/apt/preferences.d/flidas-bionic <$t <$t <$t < /tmp/x
-fi
+ sudo dd of=/etc/systemd/system/vpnmail.service <
+ Options +FollowSymLinks +Multiviews +Indexes
+ AllowOverride None
+ AuthType basic
+ AuthName "Authentication Required"
+ # setup one time, with root:www-data, 640
+ AuthUserFile "/etc/caldav-htpasswd"
+ Require valid-user
+
+EOF
+ # nginx version of above would be:
+ # auth_basic "Not currently available";
+ # auth_basic_user_file /etc/nginx/caldav/htpasswd;
-case $HOSTNAME in
- lj|lk)
-
- pi "${simple_packages[@]}"
- $src/homepage-setup
- $src/
-
-# start=' *