diff --git a/README.md b/README.md index deed830..a9ef855 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,13 @@ _____ 5. [Uninstall](#uninstall-) ## Install +### With APT (recommended) + echo "deb http://packages.azlux.fr/debian/ buster main" | sudo tee /etc/apt/sources.list.d/azlux.list` + wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add -` + apt update` + apt install log2ram` +### Manually curl -Lo log2ram.tar.gz https://github.com/azlux/log2ram/archive/master.tar.gz tar xf log2ram.tar.gz cd log2ram-master diff --git a/build-packages.sh b/build-packages.sh new file mode 100644 index 0000000..f3a263f --- /dev/null +++ b/build-packages.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Exit the script if any of the commands fail +set -e +set -u +set -o pipefail + +# Set working directory to the location of this script +cd "$(dirname "${BASH_SOURCE[0]}")" + +STARTDIR="$(pwd)" +DESTDIR="$STARTDIR/pkg" +OUTDIR="$STARTDIR/deb" + +# Remove potential leftovers from a previous build +rm -rf "$DESTDIR" "$OUTDIR" + + +## log2ram +# Create directory +install -Dm 644 "$STARTDIR/log2ram.service" "$DESTDIR/etc/systemd/system/log2ram.service" +install -Dm 755 "$STARTDIR/log2ram" "$DESTDIR/usr/local/bin/log2ram" +install -Dm 644 "$STARTDIR/log2ram.conf" "$DESTDIR/etc/log2ram.conf" +install -Dm 644 "$STARTDIR/uninstall.sh" "$DESTDIR/usr/local/bin/uninstall-log2ram.sh" + +# cron +install -Dm 755 "$STARTDIR/log2ram.cron" "$DESTDIR/etc/cron.daily/log2ram" +install -Dm 644 "$STARTDIR/log2ram.logrotate" "$DESTDIR/etc/logrotate.d/log2ram" + +# Build .deb +mkdir "$DESTDIR/DEBIAN" "$OUTDIR" +cp "$STARTDIR/debian/"* "$DESTDIR/DEBIAN/" +dpkg-deb --build "$DESTDIR" "$OUTDIR" +reprepro -b /var/www/repos/apt/debian includedeb buster "$OUTDIR"/*.deb +reprepro -b /var/www/repos/apt/debian includedeb stretch "$OUTDIR"/*.deb + diff --git a/debian/conffiles b/debian/conffiles new file mode 100644 index 0000000..004b211 --- /dev/null +++ b/debian/conffiles @@ -0,0 +1 @@ +/etc/log2ram.conf diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..65e1cc6 --- /dev/null +++ b/debian/control @@ -0,0 +1,9 @@ +Package: log2ram +Version: 1.4 +Section: net +Priority: optional +Architecture: all +Maintainer: Azlux +Description: ramlog like for systemd (Put log into a ram folder) +Homepage: https://github.com/azlux/log2ram +Bugs: https://github.com/azlux/log2ram/issues diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..e7153ad --- /dev/null +++ b/debian/postinst @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +systemctl enable log2ram +echo "##### Reboot to activate log2ram #####" +echo "##### edit /etc/log2ram.conf to configure options ####" \ No newline at end of file diff --git a/debian/preinst b/debian/preinst new file mode 100644 index 0000000..586f927 --- /dev/null +++ b/debian/preinst @@ -0,0 +1,5 @@ +#!/bin/bash +set -euo pipefail + +systemctl -q is-active log2ram && systemctl stop log2ram +rm -rf /var/hdd.log diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..7b84e1e --- /dev/null +++ b/debian/prerm @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +systemctl stop log2ram.service