update and rename migration script; execute migration script before loading config

Origin commit data
------------------
Branch: ni/coolstream
Commit: dceffe31f0
Author: vanhofen <vanhofen@gmx.de>
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
This commit is contained in:
vanhofen
2018-11-22 00:00:28 +01:00
parent 98443e66fc
commit 0de0cc45a2
5 changed files with 34 additions and 21 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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");
}