aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2017-10-25 13:01:03 +0200
committerKarel Kočí <karel.koci@nic.cz>2017-10-25 13:01:03 +0200
commit33083fab3bf2760dbd39cc68711e5e429eae74e7 (patch)
tree31914c07d5810ddcb516ed3802342bd07349664b
parentfefde1459054433d96510faba3103d62d90d667d (diff)
downloadturris-myrepo-33083fab3bf2760dbd39cc68711e5e429eae74e7.tar.gz
turris-myrepo-33083fab3bf2760dbd39cc68711e5e429eae74e7.tar.bz2
turris-myrepo-33083fab3bf2760dbd39cc68711e5e429eae74e7.zip
Update updater-ng-auto package
-rw-r--r--updater-ng-auto/Makefile14
-rw-r--r--updater-ng-auto/files/updater.defaults24
-rwxr-xr-xutils/updater-ng-auto.sh2
3 files changed, 8 insertions, 32 deletions
diff --git a/updater-ng-auto/Makefile b/updater-ng-auto/Makefile
index 945717a..4c1935a 100644
--- a/updater-ng-auto/Makefile
+++ b/updater-ng-auto/Makefile
@@ -60,14 +60,15 @@ ifneq ($(PKG_BRANCH),)
echo "config override 'override'" >> $(1)/etc/config/updater
echo " option branch '$(PKG_BRANCH)'" >> $(1)/etc/config/updater
endif
+
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/pkgupdate/init $(1)/etc/init.d/updater
+ $(INSTALL_DIR) $(1)/etc/cron.d
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/pkgupdate/cron $(1)/etc/cron.d/updater
+
$(INSTALL_DIR) $(1)/etc/ssl
$(INSTALL_DATA) $(PKG_BUILD_DIR)/updater.pem $(1)/etc/ssl/updater.pem
-
- $(INSTALL_DIR) $(1)/etc/uci-defaults
- $(INSTALL_BIN) ./files/updater.defaults $(1)/etc/uci-defaults/updater
endef
define Package/$(PKG_NAME)/conffiles
@@ -79,12 +80,11 @@ endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
[ -n "$$IPKG_INSTROOT" ] || {
-/etc/init.d/updater enable || true
-# Run the uci-defaults now if we are installed at runtime and not flashed
-/etc/uci-defaults/updater && rm /etc/uci-defaults/updater
+ /etc/init.d/updater enable || true
}
+
# Remove morphered syntax from auto.lua
-# This matches all Install and Package commands not follwed by brackets. Whole
+# This matches all Install and Package commands not followed by brackets. Whole
# line is enclosed with brackets and between strings and tables are added commas.
AUTOTMP="$$(mktemp)"
sed -E '/^(Install|Package) +[^(]/{
diff --git a/updater-ng-auto/files/updater.defaults b/updater-ng-auto/files/updater.defaults
deleted file mode 100644
index 951558a..0000000
--- a/updater-ng-auto/files/updater.defaults
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-# We want to generate some "random" time when the updater is run, every 12 hours.
-# The time when the router is first booted or the updater is installed for
-# the first time is as good source of the time as any.
-#
-# With date +%l we get time in interval 1-12. Substracting 1 gives us 0-11, and
-# the next run is 12-23 by adding 12. We may take the minutes as they are.
-#
-# We need to take care not to have leading zeroes, since tools tend to take that
-# as octal. We don't want to study which tools are OK with it, so we simply
-# don't have them.
-
-HOUR=$(($(date +%I | sed -e 's/^0*\(..*\)/\1/') - 1)) # We want 12-hour interval. And no leading zeroes (except for a lone 0)
-HOUR_NEXT=$(($HOUR + 12))
-MINUTE=$(date +%M | sed -e 's/^0*\(..*\)/\1/')
-
-# Generate the cron script
-(
- echo 'MAILTO=""'
- echo "$MINUTE $HOUR,$HOUR_NEXT * * * root /usr/bin/updater.sh >/dev/null 2>&1 &"
- echo "0 0 * * * root /usr/bin/updater-unstuck.sh >/dev/null 2>&1"
-) >/etc/cron.d/updater
-chmod 0600 /etc/cron.d/updater
diff --git a/utils/updater-ng-auto.sh b/utils/updater-ng-auto.sh
index ac3c6c7..23eea64 100755
--- a/utils/updater-ng-auto.sh
+++ b/utils/updater-ng-auto.sh
@@ -19,7 +19,7 @@ else
fi
# Get info
HASH="$(git $GIT_ARGS rev-parse HEAD)"
-VERSION="$(git $GIT_ARGS describe --abbrev=0 --tags).99999"
+VERSION="$(git $GIT_ARGS describe --abbrev=0 --tags | sed 's/^v//').99999"
RELEASE="$(($(git $GIT_ARGS rev-list --count $VERSION..HEAD) + 1))"
# Now replace stuff in Makefile