diff --git a/plugin/nut-2.8.0.plg b/plugin/nut-2.8.0.plg index adbffc89..1e36ebef 100644 --- a/plugin/nut-2.8.0.plg +++ b/plugin/nut-2.8.0.plg @@ -36,6 +36,12 @@ - add: implement battery replacement notification in settings Thanks to forum member Rysz for the PR. +###2023.06.03 +- Add Small footer style thanks ich777 for the PR. +###2023.02.14 +-6.12 Dashboard support +-PHP8 fixes +-Refresh option. ###2022.03.20 -fix for filetree top level -update nut footer @@ -249,10 +255,16 @@ sum1=$(/usr/bin/md5sum &plgPATH;/&plgNAME;.txz) sum2=$(/usr/bin/cat &plgPATH;/&plgNAME;.md5) if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then echo "Wrong 'plugin' package md5 hash." - rm &plgPATH;/&plgNAME;.txz - rm &plgPATH;/&plgNAME;.md5 + rm -f &plgPATH;/&plgNAME;.txz + rm -f &plgPATH;/&plgNAME;.md5 exit 1 else + # if upgrading on live system, stop the services here + # to release any remaining file locks before patching + if [ -x /etc/rc.d/rc.nut ]; then + /etc/rc.d/rc.nut stop 2>/dev/null + fi + # nut-2.7.4 and nut plugin expects: # Config: /etc/nut # Pid : /var/run/nut/upsmon.pid @@ -264,12 +276,12 @@ else if [ ! -d /etc/nut ]; then # Link nut-2.8.0 config to nut-2.7.4 config mkdir /etc/nut - cp /etc/ups/* /etc/nut + cp -f /etc/ups/* /etc/nut rm -rf /etc/ups - ln -s /etc/nut /etc/ups + ln -sf /etc/nut /etc/ups # Link nut-2.7.4 pid to nut-2.8.0 pid mkdir /var/run/nut - ln -s /var/run/upsmon.pid /var/run/nut/upsmon.pid + ln -sf /var/run/upsmon.pid /var/run/nut/upsmon.pid fi # upgrade plugin package @@ -327,7 +339,13 @@ rm -f &plgPATH;/*.txz \ # Remove links for nut-2.8.0 vs nut-2.7.4 rm -rf /etc/nut -rm /etc/ups +rm -f /etc/ups +rm -rf /var/run/nut + +# clean up folders after the removed installation +# in case of re-installation of package on live system +rm -rf /etc/nut +rm -rf /etc/ups rm -rf /var/run/nut echo "" diff --git a/plugin/nut.plg b/plugin/nut.plg index ac12dc09..5364a05b 100755 --- a/plugin/nut.plg +++ b/plugin/nut.plg @@ -243,10 +243,16 @@ sum1=$(/usr/bin/md5sum &plgPATH;/&plgNAME;.txz) sum2=$(/usr/bin/cat &plgPATH;/&plgNAME;.md5) if [ "${sum1:0:32}" != "${sum2:0:32}" ]; then echo "Wrong 'plugin' package md5 hash." - rm &plgPATH;/&plgNAME;.txz - rm &plgPATH;/&plgNAME;.md5 + rm -f &plgPATH;/&plgNAME;.txz + rm -f &plgPATH;/&plgNAME;.md5 exit 1 else + # if upgrading on live system, stop the services here + # to release any remaining file locks before patching + if [ -x /etc/rc.d/rc.nut ]; then + /etc/rc.d/rc.nut stop 2>/dev/null + fi + # upgrade plugin package upgradepkg --install-new &plgPATH;/&plgNAME;.txz @@ -300,6 +306,12 @@ rm -rf &plgPATH;/ups rm -f &plgPATH;/*.txz \ &plgPATH;/*.md5 +# clean up folders after the removed installation +# in case of re-installation of package on live system +rm -rf /etc/nut +rm -rf /etc/ups +rm -rf /var/run/nut + echo "" echo "-----------------------------------------------------------" echo " &name; has been removed." diff --git a/source/nut/etc/rc.d/rc.nut b/source/nut/etc/rc.d/rc.nut index 09f821e3..c449e071 100755 --- a/source/nut/etc/rc.d/rc.nut +++ b/source/nut/etc/rc.d/rc.nut @@ -205,7 +205,7 @@ write_config() { mkdir $PLGPATH/ups fi - cp -f /etc/nut/* $PLGPATH/ups + cp -f /etc/nut/* $PLGPATH/ups >/dev/null 2>&1 # update permissions if [ -d /etc/nut ]; then @@ -214,6 +214,8 @@ write_config() { chmod 640 /etc/nut/* chown root:nut /var/run/nut chmod 0770 /var/run/nut + chown root:nut /var/state/ups + chmod 0770 /var/state/ups #chown -R 218:218 /etc/nut #chmod -R 0644 /etc/nut fi diff --git a/source/nut/install/doinst.sh b/source/nut/install/doinst.sh index d940ea66..de236a52 100644 --- a/source/nut/install/doinst.sh +++ b/source/nut/install/doinst.sh @@ -17,7 +17,7 @@ chmod +0755 $DOCROOT/scripts/* \ /usr/sbin/nut-notify # copy the default -cp -nr $DOCROOT/default.cfg $BOOT/nut.cfg +cp -nr $DOCROOT/default.cfg $BOOT/nut.cfg >/dev/null 2>&1 # remove nut symlink if [ -L /etc/nut ]; then @@ -25,16 +25,21 @@ if [ -L /etc/nut ]; then mkdir /etc/nut fi +# create nut directory +if [ ! -d /etc/nut ]; then + mkdir /etc/nut +fi + # prepare conf backup directory on flash drive, if it does not already exist if [ ! -d $BOOT/ups ]; then mkdir $BOOT/ups fi # copy default conf files to flash drive, if no backups exist there -cp -nr $DOCROOT/nut/* $BOOT/ups +cp -nr $DOCROOT/nut/* $BOOT/ups >/dev/null 2>&1 # copy conf files from flash drive to local system, for our services to use -cp -f $BOOT/ups/* /etc/nut +cp -f $BOOT/ups/* /etc/nut >/dev/null 2>&1 # update permissions if [ -d /etc/nut ]; then diff --git a/source/nut/usr/local/emhttp/plugins/nut/NUTdetails.page b/source/nut/usr/local/emhttp/plugins/nut/NUTdetails.page index 158f3ac9..53f8ca64 100644 --- a/source/nut/usr/local/emhttp/plugins/nut/NUTdetails.page +++ b/source/nut/usr/local/emhttp/plugins/nut/NUTdetails.page @@ -32,6 +32,8 @@ table.tablesorter tbody tr:nth-child(even) { Please wait, retrieving UPS information... +
Save Diagnostics
+