diff --git a/debian/weatherstation-chart.postinst b/debian/weatherstation-chart.postinst new file mode 100644 index 0000000..f84a23f --- /dev/null +++ b/debian/weatherstation-chart.postinst @@ -0,0 +1,26 @@ +#!/bin/sh + +#DEBHELPER# + +if ! getent passwd weatherstation >/dev/null 2>&1; then + echo -n "Creating user/group 'weatherstation'" >&2 + adduser --quiet --system --group --no-create-home \ + --disabled-password --disabled-login \ + --shell /bin/false weatherstation + echo "." +fi + + +if [ -e /etc/weatherstation/frontend.conf ]; then + LINKNAME="/usr/share/weatherstation-frontend/$(grep default_chart_dir /etc/weatherstation/frontend.conf | cut -f 2 -d "'" | cut -f 2 -d '"')" + if [ ! -e $LINKNAME ]; then + LINKTARGET=$(grep dflt_image_location /etc/weatherstation/chart.conf | cut -f2) + if [ -e $LINKTARGET ]; then + echo -n "Lege Link zu den Bildern an ... " + /bin/ln -s -f $LINKTARGET $LINKNAME + echo "done" + fi + fi +fi + + diff --git a/debian/weatherstation-chart.postrm b/debian/weatherstation-chart.postrm new file mode 100644 index 0000000..e9652f0 --- /dev/null +++ b/debian/weatherstation-chart.postrm @@ -0,0 +1,18 @@ +#!/bin/sh + +#DEBHELPER# + +if getent passwd weatherstation >/dev/null 2>&1; then + echo -n "delete user weatherstation ... " + deluser --quiet weatherstation 2>/dev/null || true + echo "done" +fi + +if [ -e /etc/weatherstation/frontend.conf ]; then + LINKNAME="/usr/share/weatherstation-frontend/$(grep default_chart_dir /etc/weatherstation/frontend.conf | cut -f 2 -d "'" | cut -f 2 -d '"')" + if [ -e $LINKNAME ]; then + echo -n "Lösche Bilderlink ... " + /bin/rm -f $LINKNAME + echo "done" + fi +fi diff --git a/debian/weatherstation-chart.prerm b/debian/weatherstation-chart.prerm new file mode 100644 index 0000000..d67fe72 --- /dev/null +++ b/debian/weatherstation-chart.prerm @@ -0,0 +1,13 @@ +#!/bin/sh + +#DEBHELPER# + +IMGDIR=$(grep dflt_image_location /etc/weatherstation/chart.conf | cut -f2) + +FILES=$(ls -Al $IMGDIR | wc -l) + +if [ $FILES -gt 1 ]; then + echo -n "lösche $[$FILES - 1] generierte Bilder ... " + /bin/rm -f $IMGDIR/* + echo "done" +fi diff --git a/debian/weatherstation-checksensor.postinst b/debian/weatherstation-checksensor.postinst new file mode 100644 index 0000000..917bdf1 --- /dev/null +++ b/debian/weatherstation-checksensor.postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +#DEBHELPER# + +if ! getent passwd weatherstation >/dev/null 2>&1; then + echo -n "Creating user/group 'weatherstation'" >&2 + adduser --quiet --system --group --no-create-home \ + --disabled-password --disabled-login \ + --shell /bin/false weatherstation + echo "." +fi diff --git a/debian/weatherstation-checksensor.postrm b/debian/weatherstation-checksensor.postrm new file mode 100644 index 0000000..7813d25 --- /dev/null +++ b/debian/weatherstation-checksensor.postrm @@ -0,0 +1,9 @@ +#!/bin/sh + +#DEBHELPER# + +if getent passwd weatherstation >/dev/null 2>&1; then + echo -n "delete user weatherstation ... " + deluser --quiet weatherstation 2>/dev/null || true + echo "done" +fi diff --git a/debian/weatherstation-frontend.postinst b/debian/weatherstation-frontend.postinst index baced7e..5d1bff6 100644 --- a/debian/weatherstation-frontend.postinst +++ b/debian/weatherstation-frontend.postinst @@ -11,4 +11,17 @@ echo "# nach! #" echo "####################################################" echo "" + +if [ -e /etc/weatherstation/chart.conf ]; then + LINKNAME="/usr/share/weatherstation-frontend/$(grep default_chart_dir /etc/weatherstation/frontend.conf | cut -f 2 -d "'" | cut -f 2 -d '"')" + if [ ! -e $LINKNAME ]; then + LINKTARGET=$(grep dflt_image_location /etc/weatherstation/chart.conf | cut -f2) + if [ -e $LINKTARGET ]; then + echo -n "Lege Link zu den Bildern an ... " + /bin/ln -s -f $LINKTARGET $LINKNAME + echo "done" + fi + fi +fi + #DEBHELPER# diff --git a/debian/weatherstation-frontend.prerm b/debian/weatherstation-frontend.prerm new file mode 100644 index 0000000..a6d1c3e --- /dev/null +++ b/debian/weatherstation-frontend.prerm @@ -0,0 +1,12 @@ +#!/bin/sh + +#DEBHELPER# + +if [ -e /etc/weatherstation/chart.conf ]; then + LINKNAME="/usr/share/weatherstation-frontend/$(grep default_chart_dir /etc/weatherstation/frontend.conf | cut -f 2 -d "'" | cut -f 2 -d '"')" + if [ -e $LINKNAME ]; then + echo -n "Lösche Bilderlink ... " + /bin/rm -f $LINKNAME + echo "done" + fi +fi diff --git a/debian/weatherstation-weatherd.postinst b/debian/weatherstation-weatherd.postinst new file mode 100644 index 0000000..917bdf1 --- /dev/null +++ b/debian/weatherstation-weatherd.postinst @@ -0,0 +1,11 @@ +#!/bin/sh + +#DEBHELPER# + +if ! getent passwd weatherstation >/dev/null 2>&1; then + echo -n "Creating user/group 'weatherstation'" >&2 + adduser --quiet --system --group --no-create-home \ + --disabled-password --disabled-login \ + --shell /bin/false weatherstation + echo "." +fi diff --git a/debian/weatherstation-weatherd.postrm b/debian/weatherstation-weatherd.postrm new file mode 100644 index 0000000..7813d25 --- /dev/null +++ b/debian/weatherstation-weatherd.postrm @@ -0,0 +1,9 @@ +#!/bin/sh + +#DEBHELPER# + +if getent passwd weatherstation >/dev/null 2>&1; then + echo -n "delete user weatherstation ... " + deluser --quiet weatherstation 2>/dev/null || true + echo "done" +fi