From 14bd0b7b91c9d536b8faf8eef46a83f76a1372bc Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 9 Mar 2021 20:54:23 +0100 Subject: [PATCH] - cst/hd2: rework var_update.sh --- skel-root/general/scripts/var_update.sh | 108 ++++++++++-------------- 1 file changed, 43 insertions(+), 65 deletions(-) diff --git a/skel-root/general/scripts/var_update.sh b/skel-root/general/scripts/var_update.sh index 43b0107a..00a23be0 100644 --- a/skel-root/general/scripts/var_update.sh +++ b/skel-root/general/scripts/var_update.sh @@ -4,77 +4,55 @@ SHOWINFO "force some symlinks from var-partition" -ln -sf /var/etc/exports /etc/exports -ln -sf /var/etc/hostname /etc/hostname -ln -sf /var/etc/passwd /etc/passwd -ln -sf /var/etc/resolv.conf /etc/resolv.conf -ln -sf /var/etc/wpa_supplicant.conf /etc/wpa_supplicant.conf -ln -sf /var/etc/network/interfaces /etc/network/interfaces +SYMLINKS=" \ + /etc/exports \ + /etc/hostname \ + /etc/passwd \ + /etc/resolv.conf \ + /etc/wpa_supplicant.conf \ + /etc/network/interfaces \ +" + +for s in $SYMLINKS; do + ln -sf /var${s} ${s} +done SHOWINFO "start update of var-partition" -# do always upgrade update.urls -cp -a /var_init/etc/update.urls /var/etc/update.urls -# and migration.sh too -cp -a /var_init/tuxbox/config/migration.sh /var/tuxbox/config/migration.sh - -# cleanup (remove me in the future...) -rm -f /var/etc/.cooliptv - -# cleanup my mess... -rm -f /var/etc/passwd- -rm -f /var/etc/shadow- -rm -f /var/etc/shadow - -# cleanup -rm -f /var/etc/localtime && cp /var_init/etc/localtime /var/etc -rm -f /var/etc/interfaces - -SHOWINFO "add some new files to var-partition" - -mkdir -p /var/root - -# autofs -if [ ! -e /var/etc/auto.master ]; then - cp -a /var_init/etc/auto.master /var/etc/auto.master -fi -if [ ! -e /var/etc/auto.net ]; then - cp -a /var_init/etc/auto.net /var/etc/auto.net -fi - -if [ ! -e /var/tuxbox/config/rssreader.conf ]; then - cp -a /var_init/tuxbox/config/rssreader.conf /var/tuxbox/config/rssreader.conf -fi -if [ ! -e /var/tuxbox/config/shellexec.conf ]; then - cp -a /var_init/tuxbox/config/shellexec.conf /var/tuxbox/config/shellexec.conf -fi -if [ ! -e /var/tuxbox/config/webtv_usr.xml ]; then - cp -a /var_init/tuxbox/config/webtv_usr.xml /var/tuxbox/config/webtv_usr.xml -fi -if [ ! -e /var/tuxbox/config/webradio_usr.xml ]; then - cp -a /var_init/tuxbox/config/webradio_usr.xml /var/tuxbox/config/webradio_usr.xml -fi -if [ ! -e /var/tuxbox/config/myservices.xml ]; then - cp -a /var_init/tuxbox/config/myservices.xml /var/tuxbox/config/myservices.xml -fi -if [ ! -e /var/etc/inadyn.conf ]; then - cp -a /var_init/etc/inadyn.conf /var/etc/inadyn.conf -fi +FORCE_FILES=" \ + /var/etc/update.urls \ + /var/tuxbox/config/migration.sh \ +" +for f in $FORCE_FILES; do + cp -a ${f//\/var/\/var_init} ${f} +done -mkdir -p /var/xupnpd -for f in cfg feeds playlist; do - if [ ! -e /var/xupnpd/xupnpd_${f}.lua ]; then - cp -a /var_init/xupnpd/xupnpd_${f}.lua /var/xupnpd +SHOWINFO "add some new dirs and files to var-partition" + +NEW_DIRS=" \ + /var/root \ + /var/xupnpd \ +" +mkdir -p $NEW_DIRS + +NEW_FILES=" \ + /var/etc/auto.master \ + /var/etc/auto.net \ + /var/etc/inadyn.conf \ + /var/tuxbox/config/myservices.xml \ + /var/tuxbox/config/rssreader.conf \ + /var/tuxbox/config/shellexec.conf \ + /var/tuxbox/config/webradio_usr.xml \ + /var/tuxbox/config/webtv_usr.xml \ + /var/xupnpd/xupnpd_cfg.lua \ + /var/xupnpd/xupnpd_feeds.lua \ + /var/xupnpd/xupnpd_playlist.lua \ +" +for f in $NEW_FILES; do + if [ ! -e ${f} ]; then + cp -a ${f//\/var/\/var_init} ${f} fi done -# force new root default password "ni" as of 29.06.2017 -grep "root::0:0::" /var/etc/passwd && cp -af /var_init/etc/passwd /var/etc/passwd - -# change shell for root -sed -i '/^root/ s:/bin/bash:/bin/sh:g' /var/etc/passwd -cd /var/root -test -e .bash_history && mv .bash_history .ash_history - SHOWINFO "done" mv $0 $0.done