home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 29 Sep 2025 09:25:24 +0000 (11:25 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 29 Sep 2025 09:25:24 +0000 (11:25 +0200)
14 files changed:
trixie/aptmark/catgirl [deleted symlink]
trixie/aptmark/ircplom [new file with mode: 0644]
trixie/copy/catgirl [deleted symlink]
trixie/copy/ircplom/etc/systemd/system/encrypt_ircplom_logs.service [new file with mode: 0644]
trixie/copy/ircplom/etc/systemd/system/encrypt_ircplom_logs.timer [new file with mode: 0644]
trixie/copy/ircplom/etc/systemd/system/ircplom.service [new file with mode: 0644]
trixie/copy/ircplom/home/plom/.bashrc.ircplom [new file with mode: 0644]
trixie/copy/ircplom/home/plom/.config/ircplom/ircplom.toml [new file with mode: 0644]
trixie/copy/ircplom/home/plom/.local/bin/encrypt_ircplom_logs [new file with mode: 0755]
trixie/copy/ircplom/home/plom/.plomlib/abort.sh [new symlink]
trixie/copy/ircplom/home/plom/.plomlib/expect_n_args.sh [new symlink]
trixie/copy/ircplom/home/plom/.plomlib/prefixed_msg.sh [new symlink]
trixie/scripts/setup_catgirl.sh [deleted symlink]
trixie/scripts/setup_ircplom.sh [new file with mode: 0755]

diff --git a/trixie/aptmark/catgirl b/trixie/aptmark/catgirl
deleted file mode 120000 (symlink)
index 3e1bdbd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../bookworm/aptmark/catgirl
\ No newline at end of file
diff --git a/trixie/aptmark/ircplom b/trixie/aptmark/ircplom
new file mode 100644 (file)
index 0000000..17e89f6
--- /dev/null
@@ -0,0 +1,9 @@
+# ircplom 
+
+# to run in venv 
+pyvenv
+# for detachable sessions
+dtach
+# for logs encryption
+age
+#
diff --git a/trixie/copy/catgirl b/trixie/copy/catgirl
deleted file mode 120000 (symlink)
index dc216f8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../bookworm/copy/catgirl
\ No newline at end of file
diff --git a/trixie/copy/ircplom/etc/systemd/system/encrypt_ircplom_logs.service b/trixie/copy/ircplom/etc/systemd/system/encrypt_ircplom_logs.service
new file mode 100644 (file)
index 0000000..cfbde9e
--- /dev/null
@@ -0,0 +1,8 @@
+[Unit]
+Description=Run script for encrypting ircplom logs.
+
+[Service]
+Type=oneshot
+User=plom
+ExecStart=/bin/sh -cl 'encrypt_ircplom_logs'
+
diff --git a/trixie/copy/ircplom/etc/systemd/system/encrypt_ircplom_logs.timer b/trixie/copy/ircplom/etc/systemd/system/encrypt_ircplom_logs.timer
new file mode 100644 (file)
index 0000000..d76de40
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=Run service for encrypting ircplom logs once every day.
+
+[Timer]
+OnCalendar=*-*-* 01:00:00
+
+[Install]
+WantedBy=timers.target
+
diff --git a/trixie/copy/ircplom/etc/systemd/system/ircplom.service b/trixie/copy/ircplom/etc/systemd/system/ircplom.service
new file mode 100644 (file)
index 0000000..9c6105a
--- /dev/null
@@ -0,0 +1,17 @@
+[Unit]
+Description=ircplom dtached
+After=network.target
+
+[Service]
+Type=simple
+User=plom
+WorkingDirectory=/home/plom
+ExecStart=/bin/sh -lc "dtach -n /tmp/dtach_ircplom && while true; do sleep 1; test ! -e /tmp/dtach_ircplom && break; done"
+ExecStop=/bin/sh -lc "rm /tmp/dtach_ircplom"
+Environment=TERM=linux
+Restart=on-success
+RestartSec=10
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/trixie/copy/ircplom/home/plom/.bashrc.ircplom b/trixie/copy/ircplom/home/plom/.bashrc.ircplom
new file mode 100644 (file)
index 0000000..34ffeaf
--- /dev/null
@@ -0,0 +1 @@
+alias attach_ircplom='dtach -a /tmp/dtach_ircplom -e "^t"'
diff --git a/trixie/copy/ircplom/home/plom/.config/ircplom/ircplom.toml b/trixie/copy/ircplom/home/plom/.config/ircplom/ircplom.toml
new file mode 100644 (file)
index 0000000..ce6bce6
--- /dev/null
@@ -0,0 +1,12 @@
+to_highlight = ['plom', 'plomlompom']
+
+[[server]]
+hostname = 'irc.libera.chat'
+nickname = 'plomtest'
+password = 'REPLACE_WITH_IRC_PASSWORD'
+channels = [
+  '#plomtest',
+  '##plomtest',
+  '##newdrama',
+  '#mnt-reform',
+]
diff --git a/trixie/copy/ircplom/home/plom/.local/bin/encrypt_ircplom_logs b/trixie/copy/ircplom/home/plom/.local/bin/encrypt_ircplom_logs
new file mode 100755 (executable)
index 0000000..18ef129
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+set -e
+cd $(dirname "$0")
+. lib/expect_n_args
+
+expect_n_args 0 0 ''
+
+PATH_LOGS="${HOME}/.local/share/ircplom/logs"
+PATH_ENCRYPTED_LOGS="${HOME}/logs_encrypted"
+PATH_ENCRYPTION_KEY="${HOME}/.plomlib/encrypt_with.pub"
+
+TODAY="$(date +'%Y-%m-%d')"
+set +e
+PATHS_LOGFILES="$(ls ${PATH_LOGS}/*/*/*.log 2> /dev/null)"
+set -e
+if [ -z "${PATHS_LOGFILES}" ]; then
+    echo "No log files present, so nothing to do."
+    exit 0
+fi
+for _PATH_LOGFILE in ${PATHS_LOGFILES}; do
+    _FILENAME=$(basename "${_PATH_LOGFILE}")
+    _DATE_OF_LOG=$(echo "${_FILENAME}" | cut -d'.' -f1)
+    _DIRNAME=$(dirname "${_PATH_LOGFILE}")
+    _WINDOW_OF_LOG=$(basename "${_DIRNAME}")
+    _DIRNAME=$(dirname "${_DIRNAME}")
+    _NETWORK_OF_LOG=$(basename "${_DIRNAME}")
+    if ! [ "${_DATE_OF_LOG}" '<' "${TODAY}" ]; then
+        echo "${_PATH_LOGFILE} too young, ignoring."
+    else
+        echo "${_PATH_LOGFILE}: encrypting to ${PATH_ENCRYPTED_LOGS}, deleting original …"
+        _PATH_TARGET="${PATH_ENCRYPTED_LOGS}/${_NETWORK_OF_LOG}/${_WINDOW_OF_LOG}"
+        mkdir -p "${_PATH_TARGET}"
+        age -R "${PATH_ENCRYPTION_KEY}" "${_PATH_LOGFILE}" > "${_PATH_TARGET}/${_FILENAME}.age"
+        rm "${_PATH_LOGFILE}"
+    fi
+done
diff --git a/trixie/copy/ircplom/home/plom/.plomlib/abort.sh b/trixie/copy/ircplom/home/plom/.plomlib/abort.sh
new file mode 120000 (symlink)
index 0000000..45aefdb
--- /dev/null
@@ -0,0 +1 @@
+../../../../../scripts/lib/abort.sh
\ No newline at end of file
diff --git a/trixie/copy/ircplom/home/plom/.plomlib/expect_n_args.sh b/trixie/copy/ircplom/home/plom/.plomlib/expect_n_args.sh
new file mode 120000 (symlink)
index 0000000..9582f5f
--- /dev/null
@@ -0,0 +1 @@
+../../../../../scripts/lib/expect_n_args.sh
\ No newline at end of file
diff --git a/trixie/copy/ircplom/home/plom/.plomlib/prefixed_msg.sh b/trixie/copy/ircplom/home/plom/.plomlib/prefixed_msg.sh
new file mode 120000 (symlink)
index 0000000..e9c316f
--- /dev/null
@@ -0,0 +1 @@
+../../../../../scripts/lib/prefixed_msg.sh
\ No newline at end of file
diff --git a/trixie/scripts/setup_catgirl.sh b/trixie/scripts/setup_catgirl.sh
deleted file mode 120000 (symlink)
index 34e99a8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../bookworm/scripts/setup_catgirl.sh
\ No newline at end of file
diff --git a/trixie/scripts/setup_ircplom.sh b/trixie/scripts/setup_ircplom.sh
new file mode 100755 (executable)
index 0000000..3c39120
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+set -e
+cd $(dirname "$0")
+. lib/constants_user.sh  # PATH_USER_HOME
+. lib/expect_n_args.sh
+. lib/install_tags.sh
+. lib/prefixed_msg.sh
+
+prefixed_msg_init
+prefixed_msg 'starting'
+
+expect_n_args 1 1 'IRC_PASSWORD' $@
+IRC_PASSWORD="$1"
+
+install_tags ircplom 
+URL_REPO='https://plomlompom.com/repos/clone/ircplom'
+cd ~
+git clone "${URL_REPO}"
+cd ircplom
+./install.sh
+
+PATH_USER_CONF_IRCPLOM="${PATH_USER_HOME}/.config/ircplom/ircplom.toml"
+prefixed_msg "Writing provided password into ${PATH_USER_CONF_CATGIRL} …"
+sed -i "s/REPLACE_WITH_IRC_PASSWORD/${IRC_PASSWORD}/g" "${PATH_USER_CONF_IRCPLOM}"
+
+prefixed_msg 'Activating ircplom dtach session …'
+systemctl enable --now ircplom 
+
+prefixed_msg 'Activating ircplom logs encryption service/timer …'
+systemctl enable --now encrypt_ircplom_logs.timer
+
+prefixed_msg_exit