From 0de0cc45a269f05c89163e394358d4aa6da754f8 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 22 Nov 2018 00:00:28 +0100 Subject: [PATCH] update and rename migration script; execute migration script before loading config Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/dceffe31f0736fd870b3cb2b50e9fb393a112887 Author: vanhofen Date: 2018-11-22 (Thu, 22 Nov 2018) Origin message was: ------------------ - update and rename migration script; execute migration script before loading config ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/neutrino-scripts/Makefile.am | 10 ++++------ data/neutrino-scripts/migration.sh | 24 ++++++++++++++++++++++++ data/neutrino-scripts/ni-migration.sh | 9 --------- src/global.h | 2 +- src/neutrino.cpp | 10 +++++----- 5 files changed, 34 insertions(+), 21 deletions(-) create mode 100644 data/neutrino-scripts/migration.sh delete mode 100644 data/neutrino-scripts/ni-migration.sh diff --git a/data/neutrino-scripts/Makefile.am b/data/neutrino-scripts/Makefile.am index da7ce1a02..51eb1003c 100644 --- a/data/neutrino-scripts/Makefile.am +++ b/data/neutrino-scripts/Makefile.am @@ -1,10 +1,8 @@ - installdir = $(CONFIGDIR) -install_DATA = flash.start -#NI -install_DATA += \ - ni-migration.sh \ +install_DATA = \ + flash.start \ + migration.sh \ movieplayer.start \ movieplayer.end \ recording.start \ @@ -14,7 +12,7 @@ install_DATA += \ install-data-hook: chmod 0755 $(DESTDIR)$(CONFIGDIR)/flash.start - chmod 0755 $(DESTDIR)$(CONFIGDIR)/ni-migration.sh + chmod 0755 $(DESTDIR)$(CONFIGDIR)/migration.sh chmod 0755 $(DESTDIR)$(CONFIGDIR)/movieplayer.start chmod 0755 $(DESTDIR)$(CONFIGDIR)/movieplayer.end chmod 0755 $(DESTDIR)$(CONFIGDIR)/recording.start diff --git a/data/neutrino-scripts/migration.sh b/data/neutrino-scripts/migration.sh new file mode 100644 index 000000000..99ed19a06 --- /dev/null +++ b/data/neutrino-scripts/migration.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +cd /var/tuxbox/config +if [ -e neutrino.conf ]; then + # remove NG leftovers + sed -i 's|ng_netfs_\(.*\)|netfs_\1|' neutrino.conf + + # webradio_usr.xml was moved + sed -i "s|/var/tuxbox/config/webradio_usr.xml|/var/tuxbox/webradio/webradio_usr.xml|" neutrino.conf + mkdir -p /var/tuxbox/webradio/ + if [ -e /var/tuxbox/config/webradio_usr.xml -a ! -e /var/tuxbox/webradio/webradio_usr.xml ]; then + mv /var/tuxbox/config/webradio_usr.xml /var/tuxbox/webradio/ + fi + + # webtv_usr.xml was moved + sed -i "s|/var/tuxbox/config/webtv_usr.xml|/var/tuxbox/webtv/webtv_usr.xml|" neutrino.conf + mkdir -p /var/tuxbox/webtv/ + if [ -e /var/tuxbox/config/webtv_usr.xml -a ! -e /var/tuxbox/webtv/webtv_usr.xml ]; then + mv /var/tuxbox/config/webtv_usr.xml /var/tuxbox/webtv/ + fi + + sort neutrino.conf > neutrino.sort + mv neutrino.sort neutrino.conf +fi diff --git a/data/neutrino-scripts/ni-migration.sh b/data/neutrino-scripts/ni-migration.sh deleted file mode 100644 index 46175d716..000000000 --- a/data/neutrino-scripts/ni-migration.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -cd /var/tuxbox/config -if [ -e neutrino.conf ]; then - sed -i 's|ng_netfs_\(.*\)|netfs_\1|' neutrino.conf - - sort neutrino.conf > neutrino.sort - mv neutrino.sort neutrino.conf -fi diff --git a/src/global.h b/src/global.h index a4198b284..91f5b27cd 100644 --- a/src/global.h +++ b/src/global.h @@ -43,7 +43,7 @@ #define MOVIEPLAYER_END_SCRIPT CONFIGDIR "/movieplayer.end" #define NEUTRINO_ENTER_FLASH_SCRIPT CONFIGDIR "/flash.start" #define NEUTRINO_APP_START_SCRIPT CONFIGDIR "/neutrino.start" -#define NEUTRINO_NI_MIGRATION_SCRIPT CONFIGDIR "/ni-migration.sh" //NI +#define NEUTRINO_CONF_MIGRATION_SCRIPT CONFIGDIR "/migration.sh" #define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf" #define NEUTRINO_PARENTALLOCKED_FILE DATADIR "/neutrino/.plocked" diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c7f04c13a..3f21b9281 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -338,6 +338,11 @@ int CNeutrinoApp::loadSetup(const char * fname) char cfg_value[20]; //NI mode_icons_flag int erg = 0; + // execute migration script before loading configfile + puts("[neutrino.cpp] executing " NEUTRINO_CONF_MIGRATION_SCRIPT "."); + if (my_system(NEUTRINO_CONF_MIGRATION_SCRIPT) != 0) + perror(NEUTRINO_CONF_MIGRATION_SCRIPT " failed"); + configfile.clear(); // load settings; setup defaults if (!configfile.loadConfig(fname)) @@ -5685,9 +5690,4 @@ void CNeutrinoApp::migrateConfig(const char *fname) configfile.deleteKey(from); } /* more complex migration, including converting values etc. could be done here */ - - //NI - puts("[neutrino.cpp] executing " NEUTRINO_NI_MIGRATION_SCRIPT "."); - if (my_system(NEUTRINO_NI_MIGRATION_SCRIPT) != 0) - perror(NEUTRINO_NI_MIGRATION_SCRIPT " failed"); }