fi
### end options parsing
-# note, this test succeeds if not installed
+# remove path from earlier version of btrbk
+rm -f /usr/sbin/btrbk
+# note, this still works as intended if there is no /usr/bin/btrbk
if [[ /a/opt/btrbk/btrbk -nt /usr/bin/btrbk ]]; then
if [[ -e /b/distro-functions/src/package-manager-abstractions ]]; then
. /b/distro-functions/src/package-manager-abstractions
pi asciidoctor
fi
- # remove path from earlier version of btrbk
- rm -f /usr/sbin/btrbk
cd /a/opt/btrbk
m make
m sudo make install
fi
;;&
kw|x2|x3|sy)
- if $at_work && ping -q -c1 -w1 iank.vpn2.office.fsf.org &>/dev/null; then
- home=iank.vpn2.office.fsf.org
+ if $at_work && ping -q -c1 -w1 iank.vpn.office.fsf.org &>/dev/null; then
+ home=iank.vpn.office.fsf.org
else
home=b8.nz
fi
[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?. PIPESTATUS: ${PIPESTATUS[@]}" >&2' ERR
+source /usr/local/lib/err
shopt -s nullglob
fi
}
+# duplicated in mount-latest-sub
+mapper-dev() {
+ local mapdev
+ local -n devref=$1
+ if [[ $devref == /dev/dm-* ]]; then
+ for mapdev in /dev/mapper/*; do
+ if [[ $(readlink -f $mapdev) == "$devref" ]]; then
+ devref=$mapdev
+ break
+ fi
+ done
+ fi
+}
+
for d; do
if $subvol_path; then
svp=$d
### this is duplicated in mount-latest-subvol
# note, we need $dev because $d might not be mounted, and we do this loop
# because the device in fstab for the rootfs can be different.
- for devx in $(btrfs fil show $dev| sed -rn 's#.*path (/\S+)$#\1#p'); do
+ for devx in $(btrfs fil show $dev| sed -rn 's#.*path (\S+)$#\1#p'); do
+ if [[ $devx == dm-* ]]; then
+ devx=/dev/$devx
+ d mapper-dev $devx
+ mapper-dev devx
+ fi
d devx=$devx
root_dir=$(sed -rn "s,^\s*$devx\s+(\S+).*\bsubvolid=[05]\b.*,\1,p" /etc/mtab /etc/fstab|head -n1)
if [[ $root_dir ]]; then
if isdeb && [[ $(debian-codename) == nabia ]]; then
sudo dd of=/etc/apt/preferences.d/nabia-focal-missing <<'EOF'
Explanation: libilmbase* are needed for emacs
-Package: libilmbase-dev libilmbase24 unrar-free pidgin pidgin-* libpurple0 p7zip mumble lightdm mate-desktop-environment mate-menus mate-panel mate-session-manager ubuntu-mate-default-settings mate-control-center mate-control-center-common lightdm-gtk-greeter firefox libfdk-aac1
+Package: libilmbase-dev libilmbase24 unrar-free pidgin pidgin-* libpurple0 p7zip mumble lightdm liblightdm-gobject-1-0 mate-desktop-environment mate-desktop-environment-* mate-panel mate-panel-* libmate-* mate-menus gir1.2-matemenu-2.0 mate-session-manager ubuntu-mate-default-settings mate-control-center mate-control-center-common lightdm-gtk-greeter firefox libfdk-aac1 mate-media mate-media-common
Pin: release n=focal,o=Ubuntu
Pin-Priority: 500
EOF
conflink
+sudo rm -fv
+
# no equivalent in other distros:
if isdeb && pcheck apt-file; then
# this condition is just a speed optimization
######### begin universal pinned packages ######
case $(debian-codename) in
nabia|etiona|flidas)
- sd /etc/apt/preferences.d/etiona-buster <<EOF
+ sudo rm -fv /etc/apt/preferences.d/etiona-buster
+ sd /etc/apt/preferences.d/trisquel-debian <<EOF
+Explanation: Debian* includes Debian + Debian Backports
Package: *
-Pin: release n=buster
-Pin-Priority: -100
-
-Package: *
-Pin: release n=buster-updates
+Pin: release o=Debian*
Pin-Priority: -100
EOF
;;&
deb http://http.us.debian.org/debian buster-updates main
deb-src http://http.us.debian.org/debian buster-updates main
+
+deb http://http.debian.net/debian buster-backports main
+deb-src http://http.debian.net/debian buster-backports main
EOF
if ! diff -q $t $f; then
curl -s https://ftp-master.debian.org/keys/archive-key-10-security.asc | sudo apt-key add -
;;
esac
+
+
+case $codename_compat in
+ focal)
+ sd /etc/apt/preferences.d/nabia-btrfs-progs <<'EOF'
+Package: btrfs-progs
+Pin: release a=buster-backports
+Pin-Priority: 500
+EOF
+ p install btrfs-progs
+ ;;
+esac
+
+
# 2020-03-03 old file
s rm -fv /etc/apt/preferences.d/radicale
######### end universal pinned packages ######
;;
esac
+case $codename_compat in
+ focal)
+ pi libext2fs-dev libzstd-dev
+ cd /a/opt/btrfs-progs
+ ;;
+esac
+
case $codename_compat in
bionic)
;;
esac
+mkdir -p $tdir
+
# adapted from /var/lib/dpkg/info/transmission-daemon.postinst
# 450 seems likely to be unused. we need to specify one or else
# it won't be stable across installs.
# This overrides the hardcoded proxy setting done by fai.
# Figured I'd leave it as post install so I could adjust the
# detect script easier.
-Acquire::http::Proxy-Auto-Detect "/etc/apt/detect-http-proxy";
+
+# 2021, this has been failing randomly and my attempts at debugging
+# have lead no where. eg:
+
+
+# Err:1 http://http.us.debian.org/debian buster InRelease
+# 500 Connection failure: Address family not supported by protocol [IP: 192.168.0.130 3142]
+# Err:2 http://http.us.debian.org/debian buster-updates InRelease
+# 500 Connection failure: Address family not supported by protocol [IP: 192.168.0.130 3142]
+# Hit:3 http://archive.trisquel.info/trisquel nabia-security InRelease
+# Hit:4 http://mirror.fsf.org/trisquel nabia InRelease
+# Hit:5 http://mirror.fsf.org/trisquel nabia-updates InRelease
+# Get:6 http://security.debian.org buster/updates InRelease [65.4 kB]
+# Hit:7 http://mirror.fsf.org/trisquel nabia-backports InRelease
+# Get:8 http://http.debian.net/debian buster-backports InRelease [46.7 kB]
+# Hit:9 http://archive.ubuntu.com/ubuntu focal InRelease
+# Get:10 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
+# Hit:11 http://ppa.launchpad.net/obsproject/obs-studio/ubuntu focal InRelease
+# Get:12 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
+# Get:13 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
+# Get:14 http://security.debian.org buster/updates/main Sources [188 kB]
+# Get:15 http://security.debian.org buster/updates/main amd64 Packages [293 kB]
+# Get:16 http://http.debian.net/debian buster-backports/main Sources [475 kB]
+# Get:17 http://http.debian.net/debian buster-backports/main amd64 Packages [486 kB]
+# Get:18 http://http.debian.net/debian buster-backports/main Translation-en [409 kB]
+# Get:19 http://http.debian.net/debian buster-backports/main amd64 Contents (deb) [7,151 kB]
+# Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,086 kB]
+# Get:21 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [841 kB]
+# Fetched 11.4 MB in 5s (2,235 kB/s)
+# Reading package lists... Done
+# W: Failed to fetch http://http.us.debian.org/debian/dists/buster/InRelease 500 Connection failure: Address family not supported by protocol [IP: 192.168.0.130 3142]
+# W: Failed to fetch http://http.us.debian.org/debian/dists/buster-updates/InRelease 500 Connection failure: Address family not supported by protocol [IP: 192.168.0.130 3142]
+
+#Acquire::http::Proxy-Auto-Detect "/etc/apt/detect-http-proxy";
# misc settings not worth making another settings file
APT::AutoRemove::SuggestsImportant "false";
smarthost="$mxhost::$mxport"
uhome=$(eval echo ~$u)
+# Somehow on one machine, a file got written with 664 perms.
+# just being defensive here.
+umask 0022
+
source /a/bin/bash_unpublished/source-state
if [[ ! $MAIL_HOST ]]; then
err "\$MAIL_HOST not set"
fi
done
+if ! grep -q "^ncsoft:" /etc/aliases; then
+ echo "ncsoft: graceq2323@gmail.com" |m tee -a /etc/aliases
+fi
+
m gpasswd -a iank adm #needed for reading logs
/^root:/d
EOF
+cat >/etc/exim4/conf.d/rewrite/34_iank_rewriting <<'EOF'
+ncsoft@zroe.org graceq2323@gmail.com hE
+EOF
+
rm -vf /etc/exim4/conf.d/main/000_localmacros # old filename
cat >/etc/exim4/conf.d/main/000_local <<EOF
MAIN_TLS_ENABLE = true
#!/bin/bash
-if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
-shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?. PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
+source /b/errhandle/err
[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
# See the License for the specific language governing permissions and
# limitations under the License.
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+source /usr/local/lib/err
script_dir=$(dirname $(readlink -f "$BASH_SOURCE"))
fi
}
+# duplicated in check-subvol
+mapper-dev() {
+ local mapdev
+ local -n devref=$1
+ if [[ $devref == /dev/dm-* ]]; then
+ for mapdev in /dev/mapper/*; do
+ if [[ $(readlink -f $mapdev) == "$devref" ]]; then
+ devref=$mapdev
+ break
+ fi
+ done
+ fi
+}
+
+
##### begin command line parsing ########
# you can remove this if you do not have options which can have args with spaces or empty.
mnt /mnt/boot2
fi
-mapper-dev() {
- local -n devref=$1
- if [[ $devref == /dev/dm-* ]]; then
- for d in /dev/mapper/*; do
- if [[ $(readlink -f $d) == "$root_dev" ]]; then
- devref=$d
- break
- fi
- done
- fi
-}
-
root_dev=$(awk '$2 == "/" {print $1}' /etc/mtab)
mapper-dev root_dev
### begin getting root_dir
### this is duplicated in check-subvol-stale
+
+ dev=$(sed -rn "s,^\s*([^#]\S*)\s+$d\s.*,\1,p" /etc/fstab /etc/mtab|head -n1)
+ d dev=$dev
# note, we need $dev because $d might not be mounted, and we do this loop
# because the device in fstab for the rootfs can be different.
- for devx in $(btrfs fil show $dev| sed -rn 's#.*path (/\S+)$#\1#p'); do
+ for devx in $(btrfs fil show $dev| sed -rn 's#.*path (\S+)$#\1#p'); do
+ if [[ $devx == dm-* ]]; then
+ devx=/dev/$devx
+ mapper-dev devx
+ fi
d devx=$devx
root_dir=$(sed -rn "s,^\s*$devx\s+(\S+).*\bsubvolid=[05]\b.*,\1,p" /etc/mtab /etc/fstab|head -n1)
if [[ $root_dir ]]; then
if anyof (
header :contains "list-id" "<bbdb-info.lists.sourceforge.net>",
header :contains "list-id" "<bug-bash.gnu.org>",
+ header :contains "list-id" "<h-source-users.nongnu.org>",
header :contains "list-id" "<bug-gnu-emacs.gnu.org>",
header :contains "list-id" "<debian-backports.lists.debian.org>",
header :contains "list-id" "<debian-security-announce.lists.debian.org>",