summaryrefslogtreecommitdiff
path: root/updater-ng
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2020-03-12 16:30:44 +0100
committerKarel Kočí <karel.koci@nic.cz>2020-03-12 16:30:44 +0100
commit1e203d8ca01b54e9adae820670cd5e4d9e29eaf8 (patch)
treef0569d85a2a6f74028eba495ef4472b2e2b42c71 /updater-ng
parentaed5dab7d11ef64eef354a64b672f533a4961678 (diff)
downloadopenwrt-personal-pkgs-1e203d8ca01b54e9adae820670cd5e4d9e29eaf8.tar.gz
openwrt-personal-pkgs-1e203d8ca01b54e9adae820670cd5e4d9e29eaf8.tar.bz2
openwrt-personal-pkgs-1e203d8ca01b54e9adae820670cd5e4d9e29eaf8.zip
updater-ng: fix missing file
Diffstat (limited to 'updater-ng')
-rw-r--r--updater-ng/Makefile2
-rwxr-xr-xupdater-ng/files/update_alternatives.sh23
2 files changed, 24 insertions, 1 deletions
diff --git a/updater-ng/Makefile b/updater-ng/Makefile
index 3e172b9..25098bf 100644
--- a/updater-ng/Makefile
+++ b/updater-ng/Makefile
@@ -37,7 +37,7 @@ define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/pkgupdate $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/pkgtransaction $(1)/usr/bin/
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/update_alternatives.sh $(1)/usr/bin/
+ $(INSTALL_BIN) ./files/update_alternatives.sh $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/updater
$(INSTALL_CONF) $(PKG_BUILD_DIR)/src/pkgupdate/configs/conf.lua $(1)/etc/updater
diff --git a/updater-ng/files/update_alternatives.sh b/updater-ng/files/update_alternatives.sh
new file mode 100755
index 0000000..c93ae45
--- /dev/null
+++ b/updater-ng/files/update_alternatives.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+set -e
+
+if [ $# -gt 0 ]; then
+ echo "This script is part of updater and allows user to manually fix alternative links in system." >&2
+ exit 0
+fi
+
+if [ ! -d /usr/lib/opkg/info ]; then
+ echo "OPKG info directory not located. This is OpenWrt system, isn't it?" >&2
+ exit 1
+fi
+
+# Fist install all busybox applets and then overwite them with alternatives
+
+busybox --install /bin
+
+sed -n 's/^Alternatives://p' /usr/lib/opkg/info/*.control | \
+ tr , '\n' | \
+ sort -n | \
+ while IFS=: read PRIO TRG SRC; do
+ ln -sf "$SRC" "$TRG"
+ done