]> gitweb.morketsmerke.org Git - e5270.git/commitdiff
Dodanie immudex-updates do testów.
authorxf0r3m <jakubstasinski@protonmail.com>
Sat, 15 Mar 2025 09:41:58 +0000 (10:41 +0100)
committerxf0r3m <jakubstasinski@protonmail.com>
Sat, 15 Mar 2025 09:41:58 +0000 (10:41 +0100)
base.sh
immudex-motd2
immudex-updates [new file with mode: 0755]
immudex_updates.service [new file with mode: 0644]

diff --git a/base.sh b/base.sh
index a14366dab86678496efecc89807f262d7b15d145..87eba563de3f95e6e299fb9634d2b94b9bf814f6 100644 (file)
--- a/base.sh
+++ b/base.sh
@@ -132,6 +132,7 @@ cp -vv ~/immudex/tools/sbin/immudex-crypt /usr/local/sbin;
 cp -vv ~/immudex/tools/sbin/immudex-hostname /usr/local/sbin;
 cp -vv ~/immudex/tools/sbin/immudex-install /usr/local/sbin;
 cp -vv ~/immudex/tools/sbin/immudex-upgrade /usr/local/sbin;
+cp -vv ~/e5270/immudex-updates /usr/local/sbin;
 chown root:root /usr/local/sbin/*;
 chmod 544 /usr/local/sbin/*;
 
@@ -149,7 +150,7 @@ if [ -f /usr/share/applications/qmmp.desktop ]; then
   ln -s /usr/share/applications/qmmp.desktop /usr/share/applications/qmmp-1.desktop;
 fi
 #cp -vv ~/immudex/files/immudex_hostname.service /etc/systemd/system;
-
+cp -vv ~/e5270/immudex_updates.service /etc/systemd/system;
 
 tar -xf ~/immudex/files/mozilla.tgz -C /etc/skel;
 wget  https://ftp.morketsmerke.org/librewolf/librewolf.tgz -O /tmp/librewolf.tgz;
@@ -159,7 +160,7 @@ wget https://ftp.morketsmerke.org/librewolf/16844254192.desktop -O /etc/skel/.co
 
 #Wyłączenie dla mnie immudex_hostname, ze względu na VPN
 #systemctl enable immudex_hostname.service;
-
+systemctl enable immudex_updates.service;
 
 cat >> /etc/bash.bashrc << EOL
 if [ ! -f /tmp/.motd ]; then
index b15b2b5609e829fc00601d7eb25a493c3a918a95..ac5936c8c323130ae13fa8dbb18cbe615a58f30e 100755 (executable)
@@ -45,6 +45,6 @@ fi
 echo -e " \t$(uptime | grep -o "load.*$" | tr '[a-z]' '[A-Z]')";
 echo;
 echo -e "morketsmerke.org @ 2025 https://github.com/xf0r3m/immudex";
-#source /usr/local/bin/immudex-updates;
+cat /tmp/immudex-updates.txt;
 echo;
 echo "====================================================================";
diff --git a/immudex-updates b/immudex-updates
new file mode 100755 (executable)
index 0000000..8343618
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+RED="\e[31m";
+GREEN="\e[32m";
+YELLOW="\e[33m";
+ENDCOLOR="\e[0m";
+
+FILE="/tmp/immudex-updates.txt";
+
+function getVerFromRSSFeed() {
+  URL=$1;
+  echo $(curl $URL 2> /dev/null | grep '<title>' | sed -n '2p' | sed -e 's/<title>//g' -e 's,</title>,,g' | awk '{printf $1}')
+}
+echo "Obtaining updates information:" > $FILE;
+echo "  |" >> $FILE ;
+if [ -x /usr/bin/librewolf ]; then
+  URL="https://codeberg.org/librewolf/source/releases.rss";
+  newLibrewolfVer=$(getVerFromRSSFeed $URL);
+  currentLibrewolfVer=$(apt list --installed 2>/dev/null | grep 'librewolf' | awk '{printf $2}');
+  if ! [ "$currentLibrewolfVer" = "$newLibrewolfVer" ]; then
+    echo -e "  \`- New Librewolf version (${GREEN}${newLibrewolfVer}${ENDCOLOR}) is available." >> $FILE;
+    echo "  |" >> $FILE;
+  fi
+fi
+
+if [ -x /usr/local/bin/ncspot ]; then
+  URL="https://github.com/hrkfdn/ncspot/releases.atom";
+  newNcspotVer=$(getVerFromRSSFeed $URL);
+  currentNcspotVer=$(ncspot -V | awk '{printf $2}');
+  if ! [ "$currentNcspotVer" = "$newNcspotVer" ]; then
+    echo -e "  \`- New ncspot version (${GREEN}${newNcspotVer}${ENDCOLOR}) is available." >> $FILE;
+    echo "  |" >> $FILE;
+  fi
+fi
+
+if [ -x /usr/local/bin/nu ]; then
+  URL="https://github.com/nushell/nushell/releases.atom";
+  newNushellVer=$(getVerFromRSSFeed $URL);
+  currentNushellVer=$(nu -v | awk '{printf $1}');
+  if ! [ "$currentNushellVer" = "$NewNushellVer" ]; then
+    echo -e "  \`- New nushell version (${GREEN}${newNushellVer}${ENDCOLOR}) is available." >> $FILE;
+    echo "  |";
+  fi
+fi
+
+debianVersion=$(cut -d "." -f 1 /etc/debian_version);
+URL="https://micronews.debian.org/feeds/feed.rss";
+newDebianVersion=$(curl $URL 2>/dev/null | grep -o "Updated Debian ${debianVersion}: ${debianVersion}.[0-9]*" | sed -n '1p' | awk '{printf $4}');
+if ! [ "$newDebianVersion" = "$(cat /etc/debian_version)" ]; then
+  echo -e "  \`- New Debian version (${YELLOW}${newDebianVersion}${ENDCOLOR})." >> $FILE;
+  echo "  |" >> $FILE;
+fi
+
+apt update > /dev/null 2>&1;
+packagesToUpdate=$(expr $(apt list --upgradable 2> /dev/null | wc -l) - 1);
+if [ $packagesToUpdate -lt 0 ]; then packagesToUpdate=0; fi
+
+if [ $packagesToUpdate -lt 10 ]; then color=${GREEN};
+elif [ $packagesToUpdate -lt 50 ]; then color=${YELLOW};
+else color=${RED};
+fi
+
+echo -e "  \`- ${color}${packagesToUpdate}${ENDCOLOR} packages ready to update." >> $FILE; 
diff --git a/immudex_updates.service b/immudex_updates.service
new file mode 100644 (file)
index 0000000..84083a6
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=Refresh Debian packages list
+After=network-online.target
+Wants=network-online.target
+Before=display-manager.service
+[Service]
+Type=OneShot
+ExecStart=/usr/local/sbin/immudex-updates
+RemainAfterExit=yes
+[Install]
+WantedBy=multi-user.target