This commit is contained in:
thomas 2022-10-16 18:42:12 +02:00
parent 394ed1bb7a
commit ce7670eccd
36 changed files with 109 additions and 35 deletions

5
make
View File

@ -13,7 +13,4 @@ NEW_VERSION=$(echo $VERSION | awk 'BEGIN { FS="." } { $2++; if ($2 > 99) { $2=0
sed -i -e "s/$(echo $VERSION)/$(echo $NEW_VERSION)/" src/$PROJECT/DEBIAN/control
fakeroot dpkg-deb -Z gzip --build src/$PROJECT alldebfiles/$PROJECT.deb
reprepro --ask-passphrase -Vb repository/ remove tools ${PROJECT%.*}
reprepro --ask-passphrase -Vb repository/ includedeb tools alldebfiles/$PROJECT.deb
rsync --delete -av -e "ssh -A -J lgy.fr " repository/* deb.net.lgy.fr:/var/www/html/
fakeroot dpkg-deb -Z gzip --build src/$PROJECT alldebfiles/${PROJECT}_${NEW_VERSION}.deb

View File

@ -1,5 +1,5 @@
Package: 2sman-client
Version: 1.04
Version: 1.07
Section: base
Priority: optional
Architecture: all

View File

@ -0,0 +1,5 @@
2smanc (0.1) stable; urgency=low
* Create
-- Legay Thomas <thomas@syngate.fr> mar. 28 avril 2020 10:55

View File

@ -0,0 +1,2 @@
/etc/default/2smanc
/etc/2smanc/config/check_process.conf

View File

@ -0,0 +1,8 @@
Package: 2smanc
Version: 0.19
Section: base
Priority: optional
Architecture: all
Depends: wget, ca-certificates, jq
Maintainer: Thomas Legay <thomas@syngate.fr>
Description: Package 2smanc

View File

@ -0,0 +1 @@
/usr/share/2smanc/scripts/check_process

View File

@ -0,0 +1 @@
/usr/share/2smanc/scripts/diskspace

View File

@ -0,0 +1 @@
/usr/share/2smanc/scripts/loadavg

3
src/2smanc/etc/cron.d/2smanc Executable file
View File

@ -0,0 +1,3 @@
SHELL=/bin/bash
PATH=/usr/bin:/bin/
*/5 * * * * root sleep ${RANDOM:0:1}s ; /usr/bin/2smanc run

View File

@ -0,0 +1,2 @@
GOTIFY=
TOKEN=

25
src/2smanc/usr/bin/2smanc Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
. /etc/default/2smanc
[ "$TOKEN" == "" ] && exit
[ "$GOTIFY" == "" ] && exit
case $1 in
run)
[ "$(/usr/bin/find /etc/2smanc/enable/ -type l,f | wc -l)" -eq 0 ] && exit
/usr/bin/wget "${GOTIFY}/message?token=${TOKEN}" --post-data="message=$(/usr/bin/find /etc/2smanc/enable/ -type f,l -exec {} \;| /usr/bin/jq -sr @uri)" -qO - > /dev/null ;;
list)
ls /usr/share/2smanc/scripts/
;;
active)
ls /etc/2smanc/enable/
;;
enable)
[ -e "/usr/share/2smanc/scripts/$2" ] && ln -s "/usr/share/2smanc/scripts/$2" "/etc/2smanc/enable/$2" || echo "scripts do not exists in /usr/share/2smanc/scripts/"
;;
disable)
rm -fr /etc/2smanc/enable/$2
;;
*)
echo "2smanc [list|active|run] [enable|disable] <script>"
esac

View File

@ -0,0 +1,2 @@
#!/bin/bash
cat /etc/2smanc/config/check_process.conf | awk 'BEGIN {printf "{\"check_process\":[" }{ if(a) printf","; print "{\""$1"\":" ; system("ps -C "$1" -o pid | tail -n +2 | wc -l");print "}" ; a++ }END {print"]}";}' | jq

View File

@ -0,0 +1 @@
echo { \"date\" : { \"date\" : $(date +%s)}}

View File

@ -0,0 +1,2 @@
#!/bin/bash
df -h | tail -n +2 | awk 'BEGIN {printf "{\"diskspace\":[" }{ if(a) printf","; print "{\"mount\":\"" $6 "\",\"size\":\"" $2 "\",\"used\":\"" $3 "\",\"avail\":\"" $4 "\",\"use\":\"" $5 "\"}"; a++; }END {print"]}";}'

View File

@ -0,0 +1,2 @@
#!/bin/bash
dpkg -l | tail -n +6 | awk 'BEGIN {printf "{\"dpkg\":[" }{ if(a) printf","; print "{\"status\":\"" $1 "\",\"name\":\"" $2 "\",\"version\":\"" $3"\"}"; a++; }END {print"]}";}'

View File

@ -0,0 +1,2 @@
#!/bin/bash
cat /proc/loadavg | awk '{printf"{\"loadavg\":{\"1\":"$1",\"5\":\"$2\",\"15\":"$3",\"process\":"$5"}}"}'

View File

@ -0,0 +1 @@
echo { \"systemd-detect-virt\" : { \"systemd-detect-virt\" : $(systemd-detect-virt)}}

View File

@ -1,5 +1,5 @@
Package: amp-base
Version: 1.18
Version: 1.21
Section: base
Priority: optional
Architecture: all

View File

@ -0,0 +1,3 @@
Acquire::http {
Proxy "http://apt-cacher.net.lgy.fr:3142";
};

View File

@ -1,5 +1,5 @@
Package: amp-prefered-config
Version: 1.04
Version: 1.06
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-proxmox-utils
Version: 1.14
Version: 1.22
Section: base
Priority: optional
Architecture: all

View File

@ -1,6 +1,7 @@
#!/usr/bin/env bash
for tmp in $(pct list | grep run | cut -c 1-3)
do
<<<<<<< HEAD
echo ------------------------------------------------------
echo $tmp
echo ------------------------------------------------------
@ -9,4 +10,13 @@ do
pct exec $tmp amp-full-upgrade
pct exec $tmp apt clean
=======
echo ------------------------------------------------------
echo $tmp
echo ------------------------------------------------------
pct exec $tmp wget -o /tmp/install.sh https://deb.lgy.fr/install.sh
pct exec $tmp bash /tmp/install.sh
pct exec $tmp amp-full-upgrade
pct exec $tmp apt clean
>>>>>>> d281ea2 (update)
done

View File

@ -3,21 +3,27 @@ SRC_DEBOOTSTRAP=/usr/share/debootstrap/scripts
IMAGE=$1
URL=$2
TARBALL=$1-$(date +%Y%m%d).tar.gz
if [ -f $SRC_DEBOOTSTRAP/$IMAGE ] ;
then
TARGET=$(tempfile)
rm $TARGET
mkdir $TARGET
echo create rootfs in temporary folder $TARGET
debootstrap $IMAGE $TARGET $URL > /dev/null
echo create archive $TARBALL
tar -C $TARGET -zcvf $TARBALL . > /dev/null
echo Remove temporary folder
rm -fr $TARGET
chmod ugo+r $TARBALL
echo lxc image available in $TARBALL
then
TARGET=$(mktemp)
rm $TARGET
mkdir $TARGET
echo create rootfs in temporary folder $TARGET
debootstrap $IMAGE $TARGET $URL > /dev/null
cat <<-EOF > $TARGET/etc/apt/apt.conf.d/99aptlight
APT::Install-Recommends "false";
APT::Install-Suggests "false";
EOF
chroot $TARGET /usr/bin/apt clean
echo create archive $TARBALL
tar -C $TARGET -zcvf $TARBALL . > /dev/null
echo Remove temporary folder
rm -fr $TARGET
chmod ugo+r $TARBALL
echo lxc image available in $TARBALL
else
echo $(basename $0) \<version\> [\<url\>]
echo $(basename $0) focal http://archive.ubuntu.com/ubuntu
ls $SRC_DEBOOTSTRAP
echo $(basename $0) \<version\> [\<url\>]
echo $(basename $0) focal http://archive.ubuntu.com/ubuntu
ls $SRC_DEBOOTSTRAP
fi

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-airsonic
Version: 1.01
Version: 1.03
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-baikal
Version: 1.01
Version: 1.03
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-bitwardenrs
Version: 1.02
Version: 1.04
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-ejabberd
Version: 1.05
Version: 1.07
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-element-web
Version: 1.02
Version: 1.04
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-golang
Version: 1.01
Version: 1.03
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-gotify
Version: 1.02
Version: 1.04
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-phpmyadmin
Version: 1.02
Version: 1.04
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-roundcube
Version: 1.01
Version: 1.03
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-upgrade-unifi
Version: 1.01
Version: 1.03
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: amp-webdav
Version: 1.01
Version: 1.03
Section: base
Priority: optional
Architecture: all

View File

@ -1,5 +1,5 @@
Package: logveillance
Version: 1.17
Version: 1.19
Section: base
Priority: optional
Architecture: all