Skip to content

Commit

Permalink
improve log output of redmatic-pkg upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Mar 24, 2019
1 parent e7597db commit 29f2f0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion addon_files/redmatic/bin/redmatic
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ Stop () {
Start () {
if [ -f $ADDON_DIR/var/do_pkg_upgrade ]; then
echo "Updating Packages"
$ADDON_DIR/bin/redmatic-pkg upgrade >> $ADDON_DIR/var/pkg-upgrade.log 2>&1 && rm $ADDON_DIR/var/do_pkg_upgrade
date +"%b %d %H:%M:%S" >> $ADDON_DIR/var/pkg-upgrade.log
$ADDON_DIR/bin/redmatic-pkg upgrade 2>&1 | tee -a $ADDON_DIR/var/pkg-upgrade.log | logger -t redmatic-pkg -p daemon.info && rm $ADDON_DIR/var/do_pkg_upgrade
sleep 1
fi
if ! grep -Fq "/etc/config/lighttpd/" $LIGHTTPD_CONF
then
Expand Down
7 changes: 4 additions & 3 deletions addon_files/redmatic/bin/redmatic-pkg
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ function install()
if [ -f $ADDON_DIR/lib/node_modules/$PACKAGE/package.json ]; then
CURRENT_VERSION=`jq -r ".version" $ADDON_DIR/lib/node_modules/$PACKAGE/package.json`
if [ $CURRENT_VERSION == $VERSION ]; then
echo "$PACKAGE up-to-date"
echo "Package $PACKAGE $CURRENT_VERSION is up-to-date"
exit 0
else
echo "$PACKAGE $CURRENT_VERSION -> $VERSION"
echo "Package $PACKAGE update $CURRENT_VERSION to $VERSION"
fi
fi

echo "Get $URL"
set -o pipefail
curl $URL -o $ADDON_DIR/tmp/$1.tar.gz --fail --silent --show-error --location || exit 1

rm -r $ADDON_DIR/lib/node_modules/$PACKAGE 2> /dev/null
Expand All @@ -63,7 +64,7 @@ function upgrade()
RESULT=0
for k in $($ADDON_DIR/bin/jq -r '. | to_entries[] | "\(.key)"' $ADDON_DIR/lib/pkg-repo.json); do
if [ -d $ADDON_DIR/lib/node_modules/$k ]; then
$ADDON_DIR/bin/redmatic-pkg install $k 2>&1 || RESULT=1
$ADDON_DIR/bin/redmatic-pkg install $k 2>&1 || RESULT=1
fi
done
exit $RESULT
Expand Down

0 comments on commit 29f2f0b

Please sign in to comment.