aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydra/deploy6
-rwxr-xr-xshare/hydra/import-keys8
-rwxr-xr-xshare/hydra/newkeys7
-rwxr-xr-xshare/hydractl/dist-upgrade7
-rwxr-xr-xshare/hydractl/provision8
-rwxr-xr-xshare/hydractl/provision-raspi2
-rwxr-xr-xshare/hydractl/remove-dep2
-rwxr-xr-xshare/hydractl/sync-backups17
-rwxr-xr-xshare/hydractl/sync-home2
-rwxr-xr-xshare/hydractl/sync-media35
-rwxr-xr-xshare/hydractl/sync-tpc2
11 files changed, 74 insertions, 22 deletions
diff --git a/share/hydra/deploy b/share/hydra/deploy
index b675577..5fabb6c 100755
--- a/share/hydra/deploy
+++ b/share/hydra/deploy
@@ -151,6 +151,9 @@ for node in $NODES; do
# Fix ssl folder ownership
$SUDO chown -R `whoami`: $HYDRA_FOLDER/puppet/ssl
+ # Fix devices folder ownership
+ $SUDO chown -R `whoami`: $HYDRA_FOLDER/puppet/devices
+
# Import keys if needed
if ! $SUDO test -f /root/.ssh/id_rsa || \
! $SUDO test -f /root/.config/borg/hydra/key || \
@@ -300,7 +303,8 @@ if [ -e "$HYDRA_FOLDER/ansible/ansible.cfg" ]; then
if [ "$NODES" == "all" ]; then
hydra $HYDRA ansible-playbook site.yml $ANSIBLE_ARGS
else
- hydra $HYDRA ansible-playbook site.yml $ANSIBLE_ARGS --limit $NODES
+ NODES="`echo $NODES | tr ' ' ','`"
+ hydra $HYDRA ansible-playbook site.yml $ANSIBLE_ARGS --limit "$NODES"
fi
fi
fi
diff --git a/share/hydra/import-keys b/share/hydra/import-keys
index 7339a0d..1811930 100755
--- a/share/hydra/import-keys
+++ b/share/hydra/import-keys
@@ -123,6 +123,14 @@ EOF
}
# Import Borg key
+#
+# Borg does not support using pre-generated keys anymore (as of 2024-05-16).
+#
+# This code is therefore deprecated, but will stay here for a while, as maybe
+# in the long term borg starts to support this again.
+#
+# Check also https://github.com/borgbackup/borg/issues/7047
+# https://borgbackup.readthedocs.io/en/latest/faq.html#how-important-is-the-home-config-borg-directory
function hydra_import_keys_borg {
if [ "`facter fqdn`" != "$hostname" ]; then
echo "-----------------------------------------------------"
diff --git a/share/hydra/newkeys b/share/hydra/newkeys
index deb9b6e..c53dfe7 100755
--- a/share/hydra/newkeys
+++ b/share/hydra/newkeys
@@ -69,6 +69,13 @@ function hydra_newkeys {
done
}
+# Borg does not support using pre-generated keys anymore (as of 2024-05-16).
+#
+# This code is therefore deprecated, but will stay here for a while, as maybe
+# in the long term borg starts to support this again.
+#
+# Check also https://github.com/borgbackup/borg/issues/7047
+# https://borgbackup.readthedocs.io/en/latest/faq.html#how-important-is-the-home-config-borg-directory
function hydra_newkeys_borg {
# Check for borg
#if ! which borg &> /dev/null; then
diff --git a/share/hydractl/dist-upgrade b/share/hydractl/dist-upgrade
index c59a1ae..b5720e2 100755
--- a/share/hydractl/dist-upgrade
+++ b/share/hydractl/dist-upgrade
@@ -105,10 +105,12 @@ function hydra_system_upgrade_prepare {
echo "Updating apt configuration..."
sed -i -e "s/$release/$nextrelease/g" /etc/apt/sources.list
+ # Update APT Preferences with the next debian release
if [ -e "/etc/apt/preferences" ]; then
sed -i -e "s/$release/$nextrelease/g" /etc/apt/preferences
fi
+ # Disable backports during the upgrade
sed -i -e 's|^deb http://backports.debian.org/debian-backports|#deb http://backports.debian.org/debian-backports|' /etc/apt/sources.list
# These will be generated by puppet and can be safely removed
@@ -121,6 +123,11 @@ function hydra_system_upgrade_prepare {
apt-get remove colord -y
fi
+ # Handles component migration
+ if [ "$nextrelease" == "bookworm" ]; then
+ sed -i -e 's|main contrib non-free$|main contrib non-free non-free-firmware|' /etc/apt/sources.list
+ fi
+
# Set next state
hydra_system_upgrade_stage download
}
diff --git a/share/hydractl/provision b/share/hydractl/provision
index d318aaf..7d224e3 100755
--- a/share/hydractl/provision
+++ b/share/hydractl/provision
@@ -118,16 +118,16 @@ function hydra_provision_config {
hydra_user_config interactive y "Interactive mode? (y/n)"
hydra_user_config device /dev/sdb "Physical device(s) (more than one auto sets RAID mode)"
hydra_user_config swap_size 2000 "Swap size (in MB, 0 to not create it)"
- hydra_user_config root_size 20G "Size of root partition (-1 for all free space)"
+ hydra_user_config root_size 40G "Size of root partition (-1 for all free space)"
if [ "$root_size" != "-1" ]; then
- hydra_user_config home_size 20G "Size of home partition (0 to not create it, -1 for all free space)"
+ hydra_user_config home_size 40G "Size of home partition (0 to not create it, -1 for all free space)"
else
home_size="0"
fi
if [ "$root_size" != "-1" ] && [ "$home_size" != "-1" ]; then
- hydra_user_config var_size 20G "Size of var partition (0 to not create it, -1 for all free space)"
+ hydra_user_config var_size 40G "Size of var partition (0 to not create it, -1 for all free space)"
else
var_size="0"
fi
@@ -633,7 +633,7 @@ $APT_INSTALL linux-image-$kernel_arch -y
echo "Creating initramfs..."
if [ "$initramfs" == "initramfs-tools" ]; then
- $APT_INSTALL initramfs-tools -y
+ $APT_INSTALL initramfs-tools cryptsetup-initramfs -y
cat <<-EOF | $SUDO tee $WORK/etc/initramfs-tools/modules > /dev/null
dm-mod
diff --git a/share/hydractl/provision-raspi b/share/hydractl/provision-raspi
index 8444186..d437ce0 100755
--- a/share/hydractl/provision-raspi
+++ b/share/hydractl/provision-raspi
@@ -26,7 +26,7 @@ function hydra_provision_config {
hydra_user_config device /dev/mmcblk0 "Destination device"
hydra_user_config hostname machine "Hostname"
hydra_user_config domain example.org "Domain"
- hydra_user_config arch armel "System arch"
+ hydra_user_config arch armhf "System arch"
hydra_user_config version stretch "Distro version"
hydra_user_config mirror https://deb.debian.org/debian/ "Debian mirror"
diff --git a/share/hydractl/remove-dep b/share/hydractl/remove-dep
index 5e1a732..709cda2 100755
--- a/share/hydractl/remove-dep
+++ b/share/hydractl/remove-dep
@@ -38,3 +38,5 @@ fi
$sudo aptitude markauto $(apt-cache showsrc "$1" \
| grep Build-Depends \
| perl -p -e 's/(?:[\[(].+?[\])]|Build-Depends:|,|\|)//g')
+
+$sudo apt autoremove --purge
diff --git a/share/hydractl/sync-backups b/share/hydractl/sync-backups
index 844d630..63e11b4 100755
--- a/share/hydractl/sync-backups
+++ b/share/hydractl/sync-backups
@@ -7,12 +7,21 @@
BASENAME="`basename $0`"
VOLUME="$1"
MEDIA="/media/$VOLUME"
-BWLIMIT=${BWLIMIT:=32000}
+BWLIMIT=${BWLIMIT:=0}
IMAGES="/var/data/crypt/"
-RSYNC="ionice -c 3 nice -n 19 rsync -avH --delete --bwlimit=$BWLIMIT"
CP="ionice -c 3 nice -n 19 cp"
WHOAMI="`whoami`"
+# Set bandwidth limit
+if [ "$BWLIMIT" != "0" ]; then
+ BWLIMIT="--bwlimit=$BWLIMIT"
+else
+ BWLIMIT=""
+fi
+
+# Build rsync command line
+RSYNC="ionice -c 3 nice -n 19 rsync -avH --delete $BWLIMIT"
+
# Sync backups for a node.
function sync_backups_node {
if [ ! -z "$NODE" ]; then
@@ -75,13 +84,13 @@ fi
# Check volume name
if [ "$VOLUME" == "`hostname -f`" ]; then
- echo "volume is the hostname, cannot sync to myself"
+ echo "$BASENAME: volume is the hostname, cannot sync to myself"
exit 1
fi
# Check if it is mounted
if ! mount | grep -q $MEDIA; then
- echo "volume $MEDIA is not mounted"
+ echo "$BASENAME: volume $MEDIA is not mounted"
exit 1
fi
diff --git a/share/hydractl/sync-home b/share/hydractl/sync-home
index a0460e9..b2cd85f 100755
--- a/share/hydractl/sync-home
+++ b/share/hydractl/sync-home
@@ -4,7 +4,7 @@
#
# Parameters
-BASENAME="$0"
+BASENAME="`basename $0`"
TPC="$1"
DEST="/media/$1"
MEDIA="$DEST/var/cache/$TPC/media"
diff --git a/share/hydractl/sync-media b/share/hydractl/sync-media
index 88c8901..0976c68 100755
--- a/share/hydractl/sync-media
+++ b/share/hydractl/sync-media
@@ -67,8 +67,8 @@ function sync_media_add_metadata {
find -name metadata.pdf.lua.old -exec git add {} \;
# Darktable sidecar files
- find -name '*.xmp' -type l ! -path '*.git' -exec git annex unlock {} \;
- find -name '*.xmp' ! -path '*.git' -exec git add {} \;
+ find -name '*.xmp' -type l -not -path '*.git*' -exec git annex unlock {} \;
+ find -name '*.xmp' -not -path '*.git*' -exec git add {} \;
}
# If there is a playlists folder, make sure mpd user can write to it
@@ -136,7 +136,7 @@ function sync_media_ensure_remote {
local remote="$1"
local path="$2"
- if [ -z "$remote" ] || [ "$remote" == "local" ] || [ -z "$path" ]; then
+ if [ -z "$remote" ] || [ "$remote" == "local" ] || [ "$remote" == "localhost" ] || [ -z "$path" ]; then
return
fi
@@ -171,12 +171,16 @@ if echo $OPTIONS | grep -q -- "--dropunused"; then
fi
# Set drive config
-# Ingore drive/volume if it's set to "local"
-if [ ! -z "$REMOTE" ] && [ "$REMOTE" != "local" ]; then
+# Ignore drive/volume if it's set to "local"
+if [ ! -z "$REMOTE" ] && [ "$REMOTE" != "local" ] && [ "$REMOTE" != "localhost" ]; then
# Check storage media
MOUNT="`mount | grep $VOLUME`"
+
if [ ! -z "$MOUNT" ]; then
DRIVE="$(basename `echo $MOUNT | awk '{ print $1 }'`)"
+ #else
+ # echo "$BASENAME: volume $MEDIA is not mounted"
+ # exit 1
fi
fi
@@ -219,9 +223,12 @@ for folder in $REPOSITORIES; do
# Ensure the repository is identified
sync_media_identity
+ # Disable automatic syncing of content
+ git config annex.synccontent false
+
# Sync before changing anything, to make sure the history does not have
# conflicts with other remotes
- git annex sync
+ git annex sync --no-content
# Fix any playlist permissions
sync_media_playlist_perms
@@ -233,7 +240,7 @@ for folder in $REPOSITORIES; do
sync_media_add
# Sync everything again
- git annex sync
+ git annex sync --no-content
# Get all that needs to be got
sync_media_getall $CACHE/$folder
@@ -241,6 +248,8 @@ for folder in $REPOSITORIES; do
# Repository maintenance
sync_media_fsck
sync_media_dropunused
+ git prune
+ git gc
)
fi
@@ -299,11 +308,17 @@ if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
sync_media_ensure_remote $HOST $CACHE/$folder
sync_media_identity
sync_media_add
- git annex sync
+
+ # Disable automatic syncing of content
+ git config annex.synccontent false
+
+ git annex sync --no-content
sync_media_get $VOLUME/$MEDIA/$folder
sync_media_getall $VOLUME/$MEDIA/$folder
sync_media_fsck
sync_media_dropunused
+ git gc
+ git prune
#git annex drop --auto --numcopies=2
)
elif [ -d "$CACHE/$folder" ] && [ ! -d "$CACHE/$folder/.git" ]; then
@@ -375,7 +390,7 @@ if [ ! -z "$DRIVE" ] && [ -d "$VOLUME/$MEDIA" ]; then
fi
fi
done
-elif [ ! -z "$REMOTE" ] && [ "$REMOTE" != "local" ]; then
+elif [ ! -z "$REMOTE" ] && [ "$REMOTE" != "local" ] && [ "$REMOTE" != "localhost" ]; then
# Try to copy to a remote
for folder in `ls $CACHE`; do
if [ -d "$CACHE/$folder/.git/annex" ]; then
@@ -388,7 +403,7 @@ elif [ ! -z "$REMOTE" ] && [ "$REMOTE" != "local" ]; then
(
cd $CACHE/$folder
git annex copy . --to $REMOTE
- git annex sync
+ git annex sync --no-content
)
else
echo "Syncing $CACHE/$folder with ssh://$REMOTE.$DOMAIN/$CACHE/$folder..."
diff --git a/share/hydractl/sync-tpc b/share/hydractl/sync-tpc
index c739c5a..0a72866 100755
--- a/share/hydractl/sync-tpc
+++ b/share/hydractl/sync-tpc
@@ -4,7 +4,7 @@
#
# Parameters
-BASENAME="$0"
+BASENAME="`basename $0`"
TPC="$1"
DEST="/media/$1"
MEDIA="$DEST/var/cache/$TPC/media"