diff options
author | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-08-18 04:11:57 (GMT) |
---|---|---|
committer | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-08-18 04:11:57 (GMT) |
commit | a1521d388a79d6792af788406224c3963e77c765 (patch) | |
tree | 2bda56e29a3b5f7ff7621f4b1df9d2eca405aba0 /abs/mv-core | |
parent | 4a416bea72be751fe503edebe21c8708c0e5dce4 (diff) | |
parent | 9800bb0789a9b3655a679e996841bdb51a609d22 (diff) | |
download | linhes_pkgbuild-a1521d388a79d6792af788406224c3963e77c765.zip linhes_pkgbuild-a1521d388a79d6792af788406224c3963e77c765.tar.gz linhes_pkgbuild-a1521d388a79d6792af788406224c3963e77c765.tar.bz2 |
Merge branch 'HEAD' of ssh://cesman@knoppmyth.net/mount/repository/LinHES-PKGBUILD
Diffstat (limited to 'abs/mv-core')
-rwxr-xr-x | abs/mv-core/MythVantage-config/PKGBUILD | 83 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/checkout_MythVantage.sh | 3 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/file_time_offset.py | 39 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/install_functions.sh | 525 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/install_proxy.sh | 616 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_advanced.py | 384 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_common.py | 200 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_config.py | 14 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_hostype.py | 219 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_install.py | 1433 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_ir.py | 330 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_misc.py | 180 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_network.py | 504 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_screensaver.py | 199 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_smolt.py | 59 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_software.py | 41 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/mv_webuser.py | 21 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/myth_user_call.py | 159 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/systemconfig.py | 243 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/systemconfig.sh | 1269 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/timezip.py | 8 | ||||
-rwxr-xr-x | abs/mv-core/MythVantage-config/xconfig.sh | 109 | ||||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/bb | bin | 177017 -> 176817 bytes | |||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/bbcmd | bin | 149244 -> 149012 bytes | |||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/bbdigest | bin | 192338 -> 192018 bytes | |||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/bbhostgrep | bin | 184578 -> 184354 bytes | |||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/bbhostshow | bin | 146205 -> 145965 bytes | |||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/clientupdate | bin | 180919 -> 180695 bytes | |||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/hobbitlaunch | bin | 167359 -> 167103 bytes | |||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/logfetch | bin | 217231 -> 216887 bytes | |||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/msgcache | bin | 169865 -> 169641 bytes | |||
-rwxr-xr-x | abs/mv-core/hobbit-client/client/bin/orcahobbit | bin | 173135 -> 172935 bytes | |||
-rw-r--r-- | abs/mv-core/mp_all.sh | 31 | ||||
-rwxr-xr-x | abs/mv-core/myth/release-fixes/compile-plugins.sh | 17 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/Midnight-blue/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/Midnight-blue/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/Midnight-wide/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/Midnight-wide/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/MythVanage-mythmenu/MythVantage-menu/HOST_SETTINGS.xml (renamed from abs/mv-core/myth/release-fixes/MythVanage-mythmenu/MythVantage-menu/HOST_SETTINGS.xml) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/MythVanage-mythmenu/MythVantage-menu/util_menu.xml (renamed from abs/mv-core/myth/release-fixes/MythVanage-mythmenu/MythVantage-menu/util_menu.xml) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/MythVanage-mythmenu/MythVantage-menu/util_menu.xml.mv (renamed from abs/mv-core/myth/release-fixes/MythVanage-mythmenu/MythVantage-menu/util_menu.xml.mv) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/MythVanage-mythmenu/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/MythVanage-mythmenu/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/basic-amber/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/basic-amber/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/basic-blue/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/basic-blue/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/basic-green/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/basic-green/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/basic-purple/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/basic-purple/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/basic-red/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/basic-red/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mp_all.sh | 30 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mytharchive/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mytharchive/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythbrowser/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythbrowser/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythcontrols/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythcontrols/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythflix/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythflix/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythgallery/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythgallery/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythgame/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythgame/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythmovietime/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythmovietime/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythmusic/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythmusic/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythmusic/music_flac.patch (renamed from abs/mv-core/myth/release-fixes/plugins/mythmusic/music_flac.patch) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythnews/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythnews/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythphone/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythphone/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythsmolt/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythsmolt/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythtv-release-fixes/3466-v1.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/3466-v1.patch) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythtv-release-fixes/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/PKGBUILD) | 2 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/dbconfig.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/dbconfig.patch) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/debug_uitypes.cpp.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/debug_uitypes.cpp.patch) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/debug_xmlparse.cpp.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/debug_xmlparse.cpp.patch) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/jump_snapshot.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/jump_snapshot.patch) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythtv-release-fixes/myth.find_orphans.pl (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/myth.find_orphans.pl) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythtv-release-fixes/myth.sh (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/myth.sh) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythtv-release-fixes/mythbackend (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/mythbackend) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythtv-release-fixes/mythbackend.sh (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/mythbackend.sh) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/myththemedmenu.cpp.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/myththemedmenu.cpp.patch) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/myththemedmenu.h.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/myththemedmenu.h.patch) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythtv-release-fixes/mythtv.install (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/mythtv.install) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/pop_be_restart.cpp.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/pop_be_restart.cpp.patch) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/pop_be_restart.h.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/pop_be_restart.h.patch) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/reload.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/reload.patch) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/screenshot_jump.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/screenshot_jump.patch) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/screenshots.diff (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/screenshots.diff) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/screenshots2.diff (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/screenshots2.diff) | 0 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythtv-release-fixes/smolt_jump.patch (renamed from abs/mv-core/myth/release-fixes/mythtv-release-fixes/smolt_jump.patch) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythtv-themes/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/mythtv-themes/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythvideo/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythvideo/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/myth/stable/mythweather/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythweather/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythweb/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/plugins/mythweb/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythweb/dblogininit.inc (renamed from abs/mv-core/myth/release-fixes/plugins/mythweb/dblogininit.inc) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythweb/mythweb.install (renamed from abs/mv-core/myth/release-fixes/plugins/mythweb/mythweb.install) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/mythweb/mythweblighttpd.patch (renamed from abs/mv-core/myth/release-fixes/plugins/mythweb/mythweblighttpd.patch) | 0 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/syth-lacquer-clean/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/syth-lacquer-clean/PKGBUILD) | 4 | ||||
-rwxr-xr-x | abs/mv-core/myth/stable/syth-lacquer-wide/PKGBUILD (renamed from abs/mv-core/myth/release-fixes/syth-lacquer-wide/PKGBUILD) | 4 | ||||
-rw-r--r-- | abs/mv-core/mythvantage-live/PKGBUILD | 2 | ||||
-rw-r--r-- | abs/mv-core/openssh/PKGBUILD | 63 | ||||
-rwxr-xr-x | abs/mv-core/openssh/sshd | 40 | ||||
-rw-r--r-- | abs/mv-core/openssh/sshd.confd | 4 | ||||
-rw-r--r-- | abs/mv-core/openssh/sshd.pam | 10 | ||||
-rw-r--r-- | abs/mv-core/syslog-ng/PKGBUILD | 6 |
93 files changed, 4647 insertions, 2296 deletions
diff --git a/abs/mv-core/MythVantage-config/PKGBUILD b/abs/mv-core/MythVantage-config/PKGBUILD index 70c3029..8d6766e 100755 --- a/abs/mv-core/MythVantage-config/PKGBUILD +++ b/abs/mv-core/MythVantage-config/PKGBUILD @@ -1,31 +1,66 @@ pkgname=MythVantage-config pkgver=3.2 -pkgrel=153 +pkgrel=163 pkgdesc="The Gui-installer" -depends=(bc mysql-python expect curl dnsutils sg3_utils parted) + +depends=(bc libstatgrab mysql-python expect curl dnsutils parted + sg3_utils nmbscan system-templates rsync python-parted + ddcxinfo python-pexpect python-netifaces python-iplib mythinstall) + arch=('i686') -source=(mythinstall.bin install-ui.xml bpopup-ui.xml mythbeselect.bin install_proxy.sh install_functions.sh startx systemconfig.sh install_db_chroot.sh restore_default_settings.sh live-install.sh xconfig.sh timezip.py soundconfig.sh mythvantage-release issue autocard.py MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh myth_user_call ) -install=live.install -build() { +source=(mythinstall.bin + install-ui.xml + bpopup-ui.xml + mythbeselect.bin + install_proxy.sh + install_functions.sh + startx systemconfig.sh + install_db_chroot.sh + restore_default_settings.sh + live-install.sh + xconfig.sh + timezip.py + soundconfig.sh + mythvantage-release + issue autocard.py + MythVantage.sh + create_master.sh + build_diskless.sh + networkconfig.sh + myth_user_call + mv_advanced.py + mv_common.py + mv_config.py + mv_ir.py + mv_misc.py + mv_network.py + mv_screensaver.py + mv_smolt.py + mv_software.py + mv_webuser.py + mv_hostype.py + systemconfig.py + myth_user_call.py + mv_install.py) + +install=live.install +build() { mkdir -p $startdir/pkg/etc mkdir -p $startdir/pkg/usr/share/mythtv/themes/default - -# new stuff MVDIR=$startdir/pkg/usr/MythVantage - mkdir $startdir/pkg/etc/profile.d - install -m 0755 MythVantage.sh $startdir/pkg/etc/profile.d/MythVantage.sh - mkdir -p $startdir/pkg/root/ + mkdir $startdir/pkg/etc/profile.d + install -m 0755 MythVantage.sh $startdir/pkg/etc/profile.d/MythVantage.sh + mkdir -p $startdir/pkg/root/ mkdir -p $MVDIR/bin mkdir -p $MVDIR/templates mkdir -p $MVDIR/etc #copy in all the installer specific stuff - #cp -rp ../templates $MVDIR/ rsync -r --exclude=.svn ../templates $MVDIR/ - install -m0700 myth_user_call $MVDIR/bin/myth_user_call + install -m0700 myth_user_call $MVDIR/bin/myth_user_call install -m 0755 install_proxy.sh $MVDIR/bin/install_proxy.sh install -m 0755 install_functions.sh $MVDIR/bin/install_functions.sh install -m 0755 systemconfig.sh $MVDIR/bin/systemconfig.sh @@ -38,9 +73,23 @@ build() { install -m 0755 autocard.py $MVDIR/bin/autocard.py install -m 0755 soundconfig.sh $MVDIR/bin/soundconfig.sh install -m 0755 networkconfig.sh $MVDIR/bin/networkconfig.sh - install -m 0755 create_master.sh $MVDIR/bin/create_master.sh - install -m 0755 build_diskless.sh $MVDIR/bin/build_diskless.sh - + install -m 0755 create_master.sh $MVDIR/bin/create_master.sh + install -m 0755 build_diskless.sh $MVDIR/bin/build_diskless.sh + install -m 0755 timezip.py $MVDIR/bin/timezip.py + install -m 0755 autocard.py $MVDIR/bin/autocard.py + install -m 0755 mv_config.py $MVDIR/bin/mv_config.py + install -m 0755 mv_install.py $MVDIR/bin/mv_install.py + install -m 0755 mv_advanced.py $MVDIR/bin/ + install -m 0755 mv_common.py $MVDIR/bin/ + install -m 0755 mv_ir.py $MVDIR/bin/ + install -m 0755 mv_misc.py $MVDIR/bin/ + install -m 0755 mv_network.py $MVDIR/bin/ + install -m 0755 mv_screensaver.py $MVDIR/bin/ + install -m 0755 mv_smolt.py $MVDIR/bin/ + install -m 0755 mv_software.py $MVDIR/bin/ + install -m 0755 mv_webuser.py $MVDIR/bin/ + install -m 0755 mv_hostype.py $MVDIR/bin/ + install -m 0755 systemconfig.py $MVDIR/bin/ #copy in the branding stuff install -m 0755 mythvantage-release $startdir/pkg/etc/mythvantage-release @@ -57,10 +106,6 @@ build() { ln -s MythVantage mythinstall cd - install -g mythtv -m 4750 mythbeselect.bin $MVDIR/bin/mythbeselect - - #install -g mythtv -m 750 mythinstall.bin $MVDIR/bin/mythinstall -# mkdir -p $startdir/pkg/usr/share/templates - #cp -rp ../templates $startdir/pkg/usr/share/ install -m 0755 startx $startdir/pkg/root/startx install -m 0755 live-install.sh $startdir/pkg/root/live-install.sh } diff --git a/abs/mv-core/MythVantage-config/checkout_MythVantage.sh b/abs/mv-core/MythVantage-config/checkout_MythVantage.sh index 54fad7e..9fbab15 100755 --- a/abs/mv-core/MythVantage-config/checkout_MythVantage.sh +++ b/abs/mv-core/MythVantage-config/checkout_MythVantage.sh @@ -1,7 +1,7 @@ #!/bin/bash MYDIR=`pwd` MYTHPATH="\/data\/LinHES-PKGBUILD\/abs\/core-testing\/mythtv\/stable\/mythtv\/src\/mythtv-0.21" -MYTHPATH="\/data\/LinHES-PKGBUILD\/abs\/mv-core\/myth\/release-fixes\/mythtv-release-fixes\/src\/mythtv" +MYTHPATH="\/data\/LinHES-PKGBUILD\/abs\/mv-core\/myth\/stable\/mythtv-release-fixes\/src\/mythtv" function setup_links { rm mythinstall.bin @@ -38,6 +38,7 @@ git checkout master dl_repo sed -i "s/^MYTHPATH.*$/MYTHPATH\=\"$MYTHPATH\"/g" $MYDIR/src/MythVantage-app/mythinstall/mythinstall.pro +sed -i "s/^MYTHPATH.*$/MYTHPATH\=\"$MYTHPATH\"/g" $MYDIR/src/MythVantage-app/mythbeselect/mythberestart.pro sed -i "s/\/\/#define __MVAPP__/#define __MVAPP__/g" $MYDIR/src/MythVantage-app/mythinstall/mv_common.h sed -i "s/LinHES/mythvantage/g" $MYDIR/src/MythVantage-app/mythinstall/mv_common.h diff --git a/abs/mv-core/MythVantage-config/file_time_offset.py b/abs/mv-core/MythVantage-config/file_time_offset.py new file mode 100755 index 0000000..f2973d0 --- /dev/null +++ b/abs/mv-core/MythVantage-config/file_time_offset.py @@ -0,0 +1,39 @@ +#!/usr/bin/python + + +import time +import os +import glob +import getopt +import sys +def main(argv): + filecount=0 +# root = "/tmp" +# offset = 4 + now = int(time.time()) + + + try: + opts, args = getopt.getopt(argv, "hs:d:") + except getopt.GetoptError: + sys.exit(2) + for opt, arg in opts: + if opt in ("-h", "--help"): + print "-s seconds -d /testdir" + print "default if 4 seconds" + sys.exit() + elif opt in ( "-s" ): + offset = int(arg) + elif opt in ("-d"): + root = arg + + for item in glob.glob(root+"/*"): + lastmodDate = os.path.getmtime(item) + tdiff= now-lastmodDate + #print tdiff, offset + + if tdiff > offset: + filecount+=1 + print filecount +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/abs/mv-core/MythVantage-config/install_functions.sh b/abs/mv-core/MythVantage-config/install_functions.sh index 1d217e9..0bc0591 100755 --- a/abs/mv-core/MythVantage-config/install_functions.sh +++ b/abs/mv-core/MythVantage-config/install_functions.sh @@ -1,5 +1,6 @@ #!/bin/bash . /etc/profile + disk=$2 mountpoint=new_boot @@ -10,9 +11,11 @@ CMDLINE=$(cat /proc/cmdline) hostname=`hostname` MYSQLCMD_C="mysql -u$MYTHDBUSER -p$MYTHTVPASSWD mythconverg -B --exec" BASE="" +found_remote=1 function update_db_settings () { + printhl " setting database value $1 to $2 for $hostname" $MYSQLCMD_C "delete from settings where value='${1}' and hostname=\"$hostname\";" $MYSQLCMD_C "REPLACE INTO settings set value='${1}', data='${2}' , hostname=\"$hostname\";" } @@ -29,13 +32,34 @@ theme=($THEMES) # Read into array variable. num_themes=${#theme[*]} # Count how many elements. pick=${theme[$((RANDOM%num_themes))]} -echo "Selected $pick as the theme" +printhl " Selected $pick as the theme" update_db_settings Theme "$pick" } +function parse_cmdline_2_db(){ + echo $CMDLINE | grep -q displayres + if [ $? -eq 0 ] + then + TEMPVAR=${CMDLINE#*displayres=} + update_db_settings HostXres $TEMPVAR + fi + +} + + +function bootsplash_setup (){ + echo $CMDLINE | grep -q splash=silent + if [ $? -eq 0 ] + then + update_db_settings Hostbootsplash 1 + else + update_db_settings Hostbootsplash 0 + fi +} + function setupremote { - mv $BASE/etc/lircd.conf $BASE/etc/lircd.conf.`date +%Y-%m-%d-%H-%M` + [ -e $BASE/etc/lircd.conf ] && mv -f $BASE/etc/lircd.conf $BASE/etc/lircd.conf.`date +%Y-%m-%d-%H-%M` if [ -d $TEMPLATES/remotes/$Remotetype ] then cd $TEMPLATES/remotes/$Remotetype @@ -43,110 +67,162 @@ function setupremote { do cat $i >> $BASE/etc/lircd.conf done - cp lircrc $BASE/etc/lircrc - chmod 755 /etc/lircrc + cp -f lircrc* $BASE/etc/lircrc 2> /dev/null + [ -e /etc/lircrc ] && chmod 755 /etc/lircrc update_db_settings HostRemoteType "$Remotetype" - /usr/sbin/lircd -d /dev/lirc0 - mkdir /root/.mythtv - ln -s /etc/lircrc /root/.mythtv/lircrc - else + #special case for special remote + printhl "Starting with support for $Remotetype" + if [ "$Remotetype" == "dvico" ] + then + /usr/sbin/lircd -d /dev/usb/hiddev0 --driver=dvico + elif [ "$Remotetype" == "Dvico-Dual-Digital4-rev2" ] + then + /usr/sbin/lircd -d /dev/input/irremote --driver=devinput + else + /usr/sbin/lircd -d /dev/lirc0 + fi + [ -e /root/.mythtv ] || mkdir /root/.mythtv 2>/dev/null + ln -s /etc/lircrc /root/.mythtv/lircrc 2>/dev/null + else echo "Couldn't open directory $TEMPLATES/remotes/$Remotetype" fi } function scan_for_hpg_receiver() { -echo "Scanning for Hauppauge receiver" +printhl " Scanning for Hauppauge receiver" for hpgid in `lspci -nm -d4444: |cut -d" " -f6- |tr -d '"'|tr " " :` do line=`grep $hpgid $TEMPLATES/remotes/i2c.id` - if [ $? = 0 ] + if [ $? -eq 0 ] then modprobe lirc_i2c FoundReceiverType=`echo "$line"|cut -d"|" -f2` Remotetype=`echo "$line"|cut -d"|" -f4` statusline=`echo "$line"|cut -d"|" -f2,4` - echo "Found $statusline , $Remotetype" + #echo "Found $statusline , $Remotetype" + echo "Found Hauppauge" + echo "-------------------" + echo " 1) Hauppauge black" + echo " 2) Hauppauge silver" + echo " 3) hauppauge-grey-g3" + echo "" + read -p "Which Hauppauge remote (5 sec): " -t 5 ans + echo + if [ "$?" != "0" ]; then + echo + echo "Using default $Remotetype" + else + case $ans in + 1) Remotetype="hauppauge-black";; + 2) Remotetype="hauppauge-silver";; + 3) Remotetype="hauppauge-grey-g3" ;; + *) echo "Using default $Remotetype";; + esac + fi update_db_settings HostReceiverType $FoundReceiverType + found_remote=0 setupremote break fi - done } + function scan_for_usb_remote () { -echo "Scanning for usb receiver/remote" +#found_remote=1 +printhl " Scanning for usb receiver/remote" while read line do - USBID=`echo "$line"|cut -f1` + USBID=`echo "$line"|cut -d"|" -f1` lsusb -d "$USBID" > /dev/null 2>/dev/null - if [ $? = 0 ] + if [ $? -eq 0 ] then - # Remotetype=`echo "$line"|cut -f2` - Remotetype=`echo "$line"|cut -d"|" -f2` - echo "found $Remotetype" + Remotetype=`echo "$line"|cut -d"|" -f2` + printhl "Found $Remotetype" setupremote + found_remote=0 break fi done <$BASE/$TEMPLATES/remotes/receiver_usb.id -scan_for_hpg_receiver +if [ $found_remote -eq 1 ] +then + scan_for_hpg_receiver +fi +printhl " Scanning for TatIR" +if lsusb | grep 04d8:0004 > /dev/null 2>/dev/null +then + /usr/bin/PyroUsb.py > /dev/null 2>&1 & +fi + +if [ $found_remote -eq 1 ] +then +#No remote found_remote + update_db_settings HostRemoteType "no_remote" +fi + } function rest_of_network () { #netmask - echo $CMDLINE | grep -q netmask - if [ $? = 0 ] + echo $CMDLINE | grep -q cnetmask + if [ $? -eq 0 ] then - TEMPVAR=${CMDLINE#*netmask=} + TEMPVAR=${CMDLINE#*cnetmask=} NETMASK=${TEMPVAR%% *} /sbin/ifconfig eth0 $IP netmask $NETMASK nm=`/usr/bin/nmconv.py -obits $NETMASK` NETMASK="/$nm $NETMASK" - echo $NETMASK + #echo $NETMASK update_db_settings HostNETMASK${MYTHDEFAULT} "$NETMASK" else - echo "netmask not found" + printhl " Netmask not found" fi #gateway - echo $CMDLINE | grep -q gateway - if [ $? = 0 ] + echo $CMDLINE | grep -q cgateway + if [ $? -eq 0 ] then - TEMPVAR=${CMDLINE#*gateway=} + TEMPVAR=${CMDLINE#*cgateway=} GATEWAY=${TEMPVAR%% *} /sbin/route add default gw $GATEWAY update_db_settings HostGW${MYTHDEFAULT} "$GATEWAY" - - else - echo "gateway not found" + else + printhl " Gateway not found" fi #dns - echo $CMDLINE | grep -q dns - if [ $? = 0 ] + echo $CMDLINE | grep -q cdns + if [ $? -eq 0 ] then - TEMPVAR=${CMDLINE#*dns=} + TEMPVAR=${CMDLINE#*cdns=} DNS=${TEMPVAR%% *} echo "nameserver $DNS" >> /etc/resolv.conf update_db_settings HostDNS${MYTHDEFAULT} "$DNS" else - echo "DNS not found" + printhl " DNS not found" + fi + echo $CMDLINE | grep -q chostname + if [ $? -eq 0 ] + then + TEMPVAR=${CMDLINE#*chostname=} + MYHOST=${TEMPVAR%% *} + update_db_settings HostMyhostname "$MYHOST" + else + printhl " hostname not found" fi } function init_network { - echo $CMDLINE |grep -q netdev - if [ $? = 0 ] + echo $CMDLINE |grep -q cnetdev + if [ $? -eq 0 ] then - TEMPVAR=${CMDLINE#*netdev=} + TEMPVAR=${CMDLINE#*cnetdev=} MYTHDEFAULT=${TEMPVAR%% *} else MYTHDEFAULT="eth0" fi - - echo $CMDLINE | grep -q ip - if [ $? = 0 ] + if [ $? -eq 0 ] then update_db_settings HostDefaulteth0 0 update_db_settings HostDefault${MYTHDEFAULT} 1 @@ -155,9 +231,9 @@ function init_network { update_db_settings HostActiveonboot${MYTHDEFAULT} 1 update_db_settings HostNetDevice ${MYTHDEFAULT} - TEMPVAR=${CMDLINE#*ip=} + TEMPVAR=${CMDLINE#*cip=} IP=${TEMPVAR%% *} - if [ x$IP = xdhcp ] + if [ "$IP" == "dhcp" ] then /sbin/dhcpcd $MYTHDEFAULT update_db_settings HostUseDHCP${MYTHDEFAULT} 0 @@ -168,11 +244,74 @@ function init_network { rest_of_network fi fi + + + + +} + +function dev_up_check(){ + /sbin/ifconfig $1 1>/dev/null 2>/dev/null + status=$? + if [ $status -eq 1 ] + then + return 0 + else + devip=`/sbin/ifconfig | grep -C1 $1| grep inet|grep -v inet6 | cut -d: -f2 | awk '{ print $1}'` + if [ "x$devip" = "x" ] + then + return 1 + else + return 0 + fi + fi +} + +function request_dhcp(){ + echo $CMDLINE |grep -q cnetdev + if [ $? -eq 0 ] + then + TEMPVAR=${CMDLINE#*cnetdev=} + MYTHDEFAULT_NET=${TEMPVAR%% *} + else + MYTHDEFAULT_NET="eth0" + fi + for ndev in eth0 eth1 wlan0 wlan1 ath0 + do + dev_up_check $ndev + status=$? + if [ $status -eq 1 ] + then + #interface is down, lets see if dhcp responds + dhcpcd -Td -t2 $ndev -h "" > /tmp/dhcpinfo.$ndev + #check for hostname here + + TEMPVAR=`grep new_ip_address /tmp/dhcpinfo.$ndev |cut -d\= -f2` + if [ ! x$TEMPVAR = x ] + then + update_db_settings HostIP$ndev "$TEMPVAR" + TEMPVAR=`grep new_subnet_mask /tmp/dhcpinfo.$ndev |cut -d\= -f2` + nm=`/usr/bin/nmconv.py -obits $TEMPVAR` + TEMPVAR="/$nm $TEMPVAR" + update_db_settings HostNETMASK$ndev "$TEMPVAR" + TEMPVAR=`grep new_routers /tmp/dhcpinfo.$ndev |cut -d\= -f2` + update_db_settings HostGW$ndev "$TEMPVAR" + TEMPVAR=`grep new_domain_name_servers /tmp/dhcpinfo.$ndev |cut -d\= -f2` + update_db_settings HostDNS$ndev "$TEMPVAR" + fi + fi + done + TEMPVAR=`grep new_host_name /tmp/dhcpinfo.$MYTHDEFAULT_NET |cut -d\= -f2` + if [ ! x$TEMPVAR = x ] + then + update_db_settings HostMyhostname "$TEMPVAR" + fi + } function init_remote { echo $CMDLINE | grep -q remoteport - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remoteport=} REMOTEPORT=${TEMPVAR%% *} @@ -190,7 +329,7 @@ function init_remote { fi echo $CMDLINE | grep -q remote - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remote=} Remotetype=${TEMPVAR%% *} @@ -202,302 +341,4 @@ function init_remote { #----------------------- -#set -x - -partition_it () { -ROOT=$1 -DATA=$2 -SWAP=$3 - -if [ ! x$SWAP = xNO ] - then - SWAPLINE=",$SWAP,S" - MKSWAPCMD="mkswap /dev/${disk}2" - else - SWAPLINE=",0,0" - MKSWAPCMD="" - fi - -if [ x$DATA = xALL ] -then - DATALINE=",,," - EXTRALINE="" -else - DATALINE=",$DATA,," - EXTRALINE=",0,," -fi -sfdisk /dev/$disk -uM << EOF -,$1,,* -$SWAPLINE -$DATALINE -$EXTRALINE -; -EOF - -$MKSWAPCMD -#sfdisk -l /dev/$disk -} - - -function fscmd () { - -case $1 in - reiserfs) FSCMDC="mkreiserfs -q -l ROOT" - ;; - - xfs) FSCMDC="mkfs -t $1 -f" - ;; - ext3) FSCMDC="mkfs.ext3" - ;; - jfs) FSCMDC="mkfs.jfs -q " - ;; - *) FSCMDC="echo $1" - ;; - -esac -} - -format_it () { - fscmd $1 - $FSCMDC /dev/${disk}1| tr -s [:cntrl:] \\n - fscmd $2 - $FSCMDC /dev/${disk}3| tr -s [:cntrl:] \\n -} - -mount_it () { - if [ ! -d \/$mountpoint ] - then - mkdir \/$mountpoint - fi - mount /dev/${disk}1 \/$mountpoint - mkdir \/$mountpoint/data - mount /dev/${disk}3 \/$mountpoint/data -} - -unmount_it () { - umount /dev/${disk}1 - umount /dev/${disk}3 -} - -#linux-live version of copy_it -# copy_it () { -# #rsync -rvp --exclude=/mnt --exclude=\/$mountpoint / \/$mountpoint -# lzmdir=`find /mnt/live/mnt -name data.lzm -execdir pwd \;| tail -1` -# cd $lzmdir -# if [ x$1 = xALL ] -# then -# LIST=`ls *.lzm` -# else -# LIST=`echo $1 | tr , " " ` -# fi -# -# for i in $LIST -# do -# echo "Transferring $i" -# lzm2dir $i \/$mountpoint -# done -# for i in sys proc dev tmp -# do -# mkdir /$mountpoint/$i -# -# done -# chmod 777 /$mountpoint/tmp -# mknod /$mountpoint/dev/null c 1 3 -# mknod /$mountpoint/dev/null c 1 5 -# mknod /$mountpoint/dev/console c 5 1 -# chmod +s /$mountpoint/usr/bin/Xorg -# chmod +s /$mountpoint/usr/bin/crontab -# chmod +s /$mountpoint/usr/bin/sudo -# chmod +s /$mountpoint/bin/mount -# -# } - -copy_it () { - - if [ x$1 = xALL ] - then - echo "Transferring system" - unsquashfs -f -d /$mountpoint /.livesys/medium/system.sqf - else - echo "Upgrading system" - unsquashfs -e $1 -f -d /$mountpoint /.livesys/medium/system.sqf - fi - - for i in sys proc dev tmp - do - mkdir /$mountpoint/$i - - done - chmod 777 /$mountpoint/tmp - mknod /$mountpoint/dev/null c 1 3 - mknod /$mountpoint/dev/null c 1 5 - mknod /$mountpoint/dev/console c 5 1 - chmod +s /$mountpoint/usr/bin/Xorg - chmod +s /$mountpoint/usr/bin/crontab - chmod +s /$mountpoint/usr/bin/sudo - chmod +s /$mountpoint/bin/mount - -} - - -device_node () { - cd /dev - mknod hda b 3 0 - mknod hda1 b 3 1 - mknod hda2 b 3 2 - mknod hda3 b 3 3 - mknod hda4 b 3 4 - mknod hda5 b 3 5 - mknod hda6 b 3 6 - mknod hda7 b 3 7 - mknod hda8 b 3 8 - mknod sda b 8 0 - mknod sda1 b 8 1 - mknod sda2 b 8 2 - mknod sda3 b 8 3 - mknod sda4 b 8 4 - mknod sda5 b 8 5 - mknod sda6 b 8 6 - mknod sda7 b 8 7 - mknod sda8 b 8 8 - mknod sdb b 8 16 - mknod sdb1 b 8 17 - mknod sdb2 b 8 18 - mknod sdb3 b 8 19 - mknod sdb4 b 8 20 - mknod sdb5 b 8 21 - mknod sdb6 b 8 22 - mknod sdb7 b 8 23 - mknod sdb8 b 8 24 - cd - - } - - -function create_fstab() -{ -echo "creating fstab" -cat > /$mountpoint/etc/fstab << EOF -# <file system> <dir> <type> <options> <dump> <pass> -none /dev/pts devpts defaults 0 0 -none /dev/shm tmpfs defaults 0 0 -/dev/cdrom /media/cdrom auto ro,user,noauto,unhide 0 0 -/dev/dvd /media/dvd auto ro,user,noauto,unhide 0 0 -UUID=ROOTUID / auto defaults 0 1 -UUID=DATAUID /data auto defaults 0 1 -UUID=SWAPUID swap swap defaults 0 0 -EOF - - -} - - -function find_uuid() { - uuid=`blkid -s UUID /dev/$1 |cut -d= -f2|cut -d\" -f2` - echo $uuid for $1 - FOUNDUUID=$uuid - -} - - -case $1 in - partition_it ) - #drive ROOT DATA(ALL) SWAP(NO) - for i in `mount | grep $disk | awk ' { print $1 } '` - do - umount $i - done - swap=`cat /etc/fstab |grep $disk|grep swap|awk ' { print $1 } '` - swapoff $swap - partition_it $3 $4 $5 - exit 0 - - ;; - format_it ) - device_node - - format_it $3 $4 - exit 0 - ;; - mount_it ) - mount_it - ;; - copy_it ) - copy_it $3 - - ;; - - - fstab_fix_it) - echo $@ >> /tmp/fstab.input - if [ ! -f /$mountpoint/etc/fstab ] - then - create_fstab - fi - - if [ x$3 = xUPGRADE ] - then - echo "copying old fstab" - cp -f /tmp/etc/fstab /$mountpoint/etc/fstab - FOUNDUUID="" - find_uuid ${2}1 - ROOTUUID=$FOUNDUUID - sed -i -e "s/.*\/\ .*$/UUID=$ROOTUUID \/ auto defaults,noatime 0 1/g" /$mountpoint/etc/fstab - else - #search for UUID - FOUNDUUID="" - find_uuid ${2}1 - ROOTUUID=$FOUNDUUID - - echo "--" - echo $ROOTUUID - echo "--" - - FOUNDUUID="" - find_uuid ${2}2 - SWAPUUID=$FOUNDUUID - - FOUNDUUID="" - find_uuid ${2}3 - DATAUUID=$FOUNDUUID - sed -i -e "s/.*\/\ .*$/UUID=$ROOTUUID \/ auto defaults,noatime 0 1/g" /$mountpoint/etc/fstab - sed -i -e "s/.*\/data\ .*$/UUID=$DATAUUID \/data auto defaults,noatime 0 1/g" /$mountpoint/etc/fstab - sed -i -e "s/.*swap\ .*$/UUID=$SWAPUUID swap swap defaults 0/g" /$mountpoint/etc/fstab - fi - - ;; - - grub_it ) - #linux-live - #grub-install --recheck --no-floppy --root-directory=/$mountpoint /dev/$disk - grub-install --recheck --no-floppy --root-directory=/$mountpoint "(hd0)" - - - #fixing fstab -# if [ ! -f /$mountpoint/etc/fstab ] -# then -# cp -f /$mountpoint/etc/fstab.install /$mountpoint/etc/fstab -# fi -# sed -e s/hda/$disk/g /$mountpoint/etc/fstab > /tmp/newfstab -# cp -f /tmp/newfstab /$mountpoint/etc/fstab - - #fixing grub/menu.1st - FOUNDUUID="" - find_uuid ${disk}1 - ROOTUUID=$FOUNDUUID -# sed -e s/hda/$disk/g /$mountpoint/boot/grub/menu.lst > /tmp/menu.lst - - sed -i -e "s/root=.\S*/root=\/dev\/disk\/by-uuid\/$ROOTUUID/g" /$mountpoint/boot/grub/menu.lst - - -#cp -f /tmp/menu.lst /$mountpoint/boot/grub/menu.lst - #cp /etc/X11/xorg.conf /$mountpoint/etc/X11/xorg.conf - mkinitcpio -g /$mountpoint/boot/kernel26.img - ;; - umount_it) - - umount \/$mountpoint/data - umount \/$mountpoint -esac - - diff --git a/abs/mv-core/MythVantage-config/install_proxy.sh b/abs/mv-core/MythVantage-config/install_proxy.sh index 9019349..71b675b 100755 --- a/abs/mv-core/MythVantage-config/install_proxy.sh +++ b/abs/mv-core/MythVantage-config/install_proxy.sh @@ -1,6 +1,6 @@ #!/bin/bash -#chroot and /tmp -MVHOSTNAME=mvi +export TERM=vt100 +MVHOSTNAME=larch5 . /etc/profile TEMP_TEMPLATES=/tmp/templates disk=$2 @@ -14,475 +14,177 @@ run=$MV_ROOT/bin/install_functions.sh . /etc/systemconfig 2>/dev/null . $MV_ROOT/bin/networkconfig.sh CMDLINE=$(cat /proc/cmdline) - -#TEMPNET="Hostip"$default_interface -#eval MYTHIP=\$${TEMPNET} +BACKUPFILE="/myth/backup/mythconverg.sql.gz" progress () { -mypercent=`echo "$1" | cut -d. -f1` -if [ x$mypercent = x ] -then -echo "" > /tmp/.install_percent -else -echo "${mypercent}% complete" > /tmp/.install_percent -fi - - -} - -function apply_new_auth () { -#check if file is present - if [ -f /root/myth_user_call.out ] - then - #read in file, running each command in chroot - exec 4</root/myth_user_call.out - while read LINE <&4 - do - if [ ! x"$LINE" = x ] - then - #run commands in chroot - chroot "$mountpoint" $MV_ROOT/bin/myth_user_call -i $LINE > /tmp/user_auth.update - fi - done - rm -f /root/myth_user_call.out - else - echo "No new password changes to apply" - fi -} - - - -full_install () { - if [ -f /tmp/.this_is_upgrade ] - then - rm /tmp/.this_is_upgrade - fi - echo "Partitioning $disk" > /tmp/.install_state - progress 1 - sleep 1 - $run partition_it $disk $rootsize $datasize $swapsize - - echo "Formatting $disk" > /tmp/.install_state - progress 2 - sleep 1 - $run format_it $disk $rootfs $datafs - - echo "Preparing $disk" > /tmp/.install_state - progress 3 - sleep 1 - $run mount_it $disk - - startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "` - - echo "STARTSIZE=$startsize">/tmp/.startsize.io - echo "Installing data" > /tmp/.install_state - - sleep 1 - $run copy_it $disk ALL - rm $mountpoint/etc/fstab - $run fstab_fix_it $disk $rootfs $datafs FULL_INSTALL - - progress 99 - sleep 1 - $run grub_it $disk - - - echo "Configuring system" > /tmp/.install_state - progress 100 - sleep 1 - cp -f /etc/systemconfig "$mountpoint"/etc - #run save syssettings to save settings, then copy to new mountpoint - $MV_ROOT/bin/restore_default_settings.sh -c save -t syssettings -h $MVHOSTNAME -d 127.0.0.1 - SE=$TEMPLATES/settings/syssettings - mkdir -p ${mountpoint}$SE - cp -rp $SE/* ${mountpoint}$SE/ - chown root:mythtv "$mountpoint"/etc/systemconfig - chown -R mythtv:mythtv ${mountpoint}$SE - - chmod -R 775 ${mountpoint}$SE - chmod 775 "$mountpoint"/etc/systemconfig - #copy over any updates that might have occured - cp -f $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/ - chmod -R 755 ${mountpoint}/root - cp /etc/mtab "$mountpoint"/etc/mtab - apply_new_auth - mkdir -p $mountpoint/var/log/func - mkdir -p $mountpoint/var/log/certmaster - - if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] + mypercent=`echo "$1" | cut -d. -f1` + if [ x$mypercent = x ] then - #installing DB to local machine - #turn off old live database, so the chroot one can start - /etc/rc.d/mysqld stop - mount --bind /dev "$mountpoint/dev" - chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" > /tmp/chrootdb.out - chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,this_is_install - echo "stopping mysql in chroot" - chroot "$mountpoint" /etc/rc.d/mysqld stop - umount "$mountpoint/dev" - - #/etc/rc.d/mysqld start + echo "" > /tmp/.install_percent else - #update remotedb with this host settings - chroot "$mountpoint" DISPLAY=127.0.0.1:0 /usr/local/bin/MythVantage -t restore,default_1 - chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings - if [ ! $? = 0 ] - then - touch $mountpoint/tmp/.dbsysfailed - chmod 777 $mountpoint/tmp/.dbsysfailed - else - #Run second time - chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,this_is_install - chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL - fi + echo "${mypercent}% complete" > /tmp/.install_percent fi - chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced - echo "Done" > /tmp/.install_state - cp /tmp/mythvantage_install.log $mountpoint/var/log/ - $run unmount_it $disk -} - -function createsquashlist(){ -if [ -f $1 ] -then - rm -f -$1 -fi -for i in bin boot etc home lib opt root sbin usr var -do -echo $i >> $1 -done - - } - - -function upgrade () { - touch /tmp/.this_is_upgrade - - if [ ! x$rootfs = "xDo_not_format" ] - then - echo "Formatting $disk" > /tmp/.install_state - progress 2 - sleep 1 - $run format_it $disk $rootfs NO - fi - echo "Preparing $disk" > /tmp/.install_state - progress 3 - sleep 1 - $run mount_it $disk - startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "` - echo "STARTSIZE=$startsize">/tmp/.startsize.io - echo "Installing data" > /tmp/.install_state - sleep 1 - cp -rf /tmp/etc /new_boot/etc.old - cp -rf /tmp/oss /new_boot/var/lib/oss.old - #$run copy_it $disk bin.lzm,boot.lzm,etc.lzm,home.lzm,lib.lzm,opt.lzm,root.lzm,sbin.lzm,usr.lzm,var.lzm - SQUASHLIST="/tmp/.squashlist" - createsquashlist $SQUASHLIST - $run copy_it $disk $SQUASHLIST - #copy back ssh keys - - cp -rp /data/var/cache/pacman/pkg/* /new_boot/data/var/cache/pacman/pkg/ - cp -fp /new_boot/etc.old/ssh/*.pub /new_boot/etc/ssh/ - cp -fp /new_boot/etc.old/ssh/*.key /new_boot/etc/ssh/ - cp -fp /new_boot/etc.old/ssh/*key /new_boot/etc/ssh/ - - #funckeys - cadir=/etc/pki/func/ca - mv /new_boot/etc/pki /new_boot/etc/pki.new - cp -rp /new_boot/etc.old/pki /new_boot/etc/ - #passwd/shadow/group - cp -fp /new_boot/etc.old/passwd /new_boot/etc/ - cp -fp /new_boot/etc.old/shadow /new_boot/etc/ - cp -fp /new_boot/etc.old/group /new_boot/etc/ - - if [ x$rootfs = "xDo_not_format" ] - then - #rootfs=`grep ${disk}1 /tmp/etc/fstab |awk ' { print $3 } '` - rootfs=`grep \/\ /tmp/etc/fstab |awk ' { print $3 } '` - fi -# #datafs=`grep ${disk}3 /tmp/etc/fstab |awk ' { print $3 } '` -# datafs=`grep \/data /tmp/etc/fstab |awk ' { print $3 } '|head 1` - $run fstab_fix_it $disk UPGRADE - - echo "Writing boot sector" > /tmp/.install_state - progress 99 - sleep 1 - $run grub_it $disk - - - echo "Configuring system" > /tmp/.install_state - progress - sleep 1 - cp /etc/mtab "$mountpoint"/etc/mtab - cp -f /etc/systemconfig "$mountpoint"/etc - cp -f $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/ - chmod -R 755 ${mountpoint}/root - chown root:mythtv "$mountpoint"/etc/systemconfig - chmod 775 "$mountpoint"/etc/systemconfig - mkdir -p $mountpoint/var/log/func - mkdir -p $mountpoint/var/log/certmaster - #mount /proc and /dev - mount --bind /dev "$mountpoint/dev" - mount --bind /proc "$mountpoint/proc" - - chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,this_is_install - #wrap this in a network check_network, no need to update the db if the import worked. -##### do I need to start mysql? - chroot "$mountpoint" DISPLAY=127.0.0.1:0 /usr/local/bin/MythVantage -t restore,default_1 - chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings - # - #Run second time - chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,this_is_install - chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,this_is_install - apply_new_auth - umount "$mountpoint/dev" - umount "$mountpoint/proc" - echo "Done" > /tmp/.install_state - cp /tmp/mythvantage_install.log $mountpoint/var/log/ - - $run unmount_it $disk -} - -function netboot-full_install () { - TEMPVAR=${CMDLINE#*nfsroot=} - NFSROOT=${TEMPVAR%% *} - NFSROOT=`echo $NFSROOT|cut -d: -f1` - MAC=`/sbin/ifconfig eth0|grep HWaddr| cut -d: -f2-|awk '{ print $3}'|tr : -` - URL="http://$NFSROOT:1337/diskless.py?HOSTNAME=$hostname&MAC=$MAC" - echo "calling $URL" - echo "Starting" > /tmp/.install_state - curl $URL - ${MV_ROOT}/bin/xconfig.sh -} - -function killdhcp () { -if [ -f /etc/dhcpc/dhcpcd-eth0.pid ] - then - pid=`cat /etc/dhcpc/dhcpcd-eth0.pid` - kill -9 $pid - rm -f /etc/dhcpc/dhcpcd-eth0.pid - rm -f /var/run/dhcpcd* - fi -if [ -f /var/run/dhcpcd-eth0.pid ] - then - pid=`cat /var/run/dhcpcd-eth0.pid` - kill -9 $pid - rm -f /var/run/dhcpcd-eth0.pid* - fi -ip address flush dev eth0 -} - - -# function vnc_check() { -# CMDLINE=$(cat /proc/cmdline) -# echo $CMDLINE |grep -q vnc -# USEVNC=$? -# echo $CMDLINE |grep -q nfsroot -# NETBOOT=$? -# echo $USEVNC -# if [ ! x$USEVNC = x0 ] -# then -# echo "not using vnc" -# if [ ! x$NETBOOT = x0 ] -# then -# echo "not using netboot" -# else -# echo "using netboot" -# USEVNC=0 -# fi -# -# else -# echo " using vnc" -# fi -# } - - -# function network_setup () { -# DEVICE=eth0 -# if [ ! -f /etc/systemconfig ] -# then -# exit 1 -# fi -# -# if [ ! x$USEVNC = x0 ] -# then -# echo "Resetting the network" -# killdhcp -# if [ $UseDHCP = 0 ] -# then -# /sbin/dhcpcd $DEVICE -# if [ ! $? = 0 ] -# then -# exit 2 -# fi -# fi -# else -# echo "using vnc/netboot, will not reset network" -# echo "nameserver $nameserver" > /etc/resolv.conf -# return 0 -# fi -# -# if [ $UseDHCP = 1 ] -# then -# -# /sbin/ifconfig $DEVICE $ip -# /sbin/route add default gw $route -# echo "nameserver $nameserver" > /etc/resolv.conf -# -# fi -# -# -# } - -function SANE_SYSETTINGS () { -sed -e '/HOSTrootfstype/d' \ - -e '/HOSTrootfstype/d' \ - -e '/HOSTdatafstype/d' \ - -e '/HOSTOSsize/d' \ - -e '/HostUseALLdata/d' \ - -e '/HOSTDATAsize/d' \ - -e '/HOSTuprootfstype/d' \ - -e '/HostUseSWAP/d' \ - -e '/HOSTSWAPsize/d ' /tmp/templates/settings/syssettings/settings.txt > /tmp/settings.new - mv /tmp/settings.new /tmp/templates/settings/syssettings/settings.txt -} - case $1 in - full_install_it ) full_install ;; - - NETBOOT) -echo "-----------------------------------------------------------------------3-----" - netboot-full_install ;; - - find_update) - #TRY TO mount first partition of drive - #copy /etc/systemconfig to live, import settings into db - #umount drive - $run mount_it $disk - if [ -f /new_boot/etc/systemconfig ] - then - ###########ADD templates - mkdir -p $TEMP_TEMPLATES - cp -pr /new_boot/$TEMPLATES $TEMP_TEMPLATES - SANE_SYSETTINGS - cp -rp $TEMP_TEMPLATES/settings $TEMPLATES/ - - - cp /new_boot/etc/systemconfig /etc/systemconfig - cp -rf /new_boot/etc /tmp/etc - cp -rf /new_boot/var/lib/oss /tmp/oss - - $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings -h $MVHOSTNAME -d 127.0.0.1 - fi - $run umount_it $disk + full_install_it ) + mv_install.py --rootdisk=$disk --rootfs=$rootfs --rootsize=$rootsize --datafs=$datafs --datasize=$datasize --datadisk=$disk --swapsize=$swapsize -c full_install + rc=$? + echo "mv_install.py exit code $rc" + if [ $rc != 0 ] + then + echo "mv_install error" >> /tmp/.install_error + fi + exit $rc ;; - upgrade_it) - #"$MV_ROOT/bin/install_proxy.sh upgrade_it " + install_drive + " " + rootfs + "&" - upgrade - + NETBOOT) + echo "-----------------------------------------------------------------------3-----" + netboot-full_install ;; - disk_model_it) - model="unknown" - size="xxx" - case $2 in - - h* ) - model=`cat /proc/ide/$2/model` - ;; - s*) model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '` - ;; - esac - size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' ` - - - echo ""$model" $size " >/tmp/model + find_update) + mv_install.py --rootdisk=$disk -c find_upgrade ;; - network_check_it) - #Should never return from check_network - case $2 in - setup_network) - vnc_check - install_network_setup - ;; - - check_self) - myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'` - ping -c 1 $myipdefault - if [ ! $? = 0 ] - then - exit 3 - #can't ping yourself - fi - ;; - check_gw) - #check gateway - mygwdefault=`/sbin/route |grep $default_interface|grep UG|awk '{ print $2}'` - if [ ! x$mygwdefault = x ] - then - ping -c 1 $mygwdefault - if [ ! $? = 0 ] - then - exit 4 - fi - fi - ;; - check_ns) - #check nameserver - mydns=`cat /etc/resolv.conf|grep nameserver|head -1|awk '{ print $2}'` - ping -c 1 $mydns - if [ ! $? = 0 ] - then - exit 5 - fi - ;; - check_names) - host google.com - if [ ! $? = 0 ] - then - exit 6 - fi - ;; - host_names) - #if host is found, then check to see if it's online - #if not online, assume it's ok to use this hostname - - hout=`host $hostname` - status=$? - #found host, now grab the ip - if [ $status = 0 ] - then - hoip=`echo $hout|awk '{print $4}'` - ping -c 1 $hoip - if [ $? = 0 ] - then - status=0 - else - status=1 - fi - fi - if [ $status = 0 ] - then - exit 7 - fi - - - ;; + upgrade_it) + mv_install.py --rootdisk=$disk --rootfs=$rootfs -c upgrade + ;; - esac - exit 0 + disk_model_it) + model="unknown" + size="xxx" + case $2 in + h* ) + model=`cat /proc/ide/$2/model` + ;; + s*) model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '` + ;; + esac + size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' ` + echo ""$model" $size " >/tmp/model ;; + network_check_it) + #Should never return from check_network + case $2 in + setup_network) + vnc_check + install_network_setup + ;; + + check_self) + myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'` + echo "network check myself" + ifconfig + ping -c 1 $myipdefault + if [ ! $? = 0 ] + then + exit 3 + #can't ping yourself + fi + ;; + check_gw) + #check gateway + echo "network check gateway" + /sbin/route -n + mygwdefault=`/sbin/route -n |grep $default_interface|grep UG|awk '{ print $2}'` + echo "Default gateway seems to be $mygwdefault" + if [ ! x$mygwdefault = x ] + then + sleep 2 + ping -c 5 $mygwdefault + if [ ! $? = 0 ] + then + exit 4 + fi + fi + ;; + check_ns) + #check nameserver + echo " network check nameserver" + mydns=`cat /etc/resolv.conf|grep nameserver|head -1|awk '{ print $2}'` + ping -c 1 $mydns + if [ ! $? = 0 ] + then + exit 5 + fi + ;; + check_names) + echo "network check resolve names" + host google.com + if [ ! $? = 0 ] + then + exit 6 + fi + ;; + host_names) + #if host is found, then check to see if it's online + #if hoip matchs my ip assume it's ok + echo "network check my hostname $hostname" + hout=`host $hostname|head -n1` + status=$? + hoip=`echo $hout|awk '{print $4}'` + if [ $hoip = found: ] + then + status=1 + fi + + if [ $hoip = "out;" ] + then + #;; connection timed out; no servers could be reached + echo "DNS servers not found" + status=1 + fi + + unkownhost=`host unkown.linhes.org |head -n1 ` + unkownhostip=`echo $unkownhost |awk '{print $4}'` + + #found host, now grab the ip + if [ $status = 0 ] + then + hoip=`echo $hout|awk '{print $4}'` + /sbin/ifconfig -a |grep -q $hoip + if [ $? = 0 ] + then + echo "DNS ip matches on of my ips $hoip" + status=0 + else + if [ $unkownhostip = $hoip ] + then + echo "Bad DNS returning false hits" + echo "Assuming hostname is OK" + echo "DNS unknown: $unkownhostip" + echo " HOSTDNS: $hoip " + /sbin/ifconfig -a |grep "inet addr" + else + echo "IP in DNS but doesn't match mine, hostname is not safe to use" + echo "DNS:$hoip" + echo "HOST: " + /sbin/ifconfig -a |grep "inet addr" + status=7 + fi + fi + else + echo "Couldn't find hostname in DNS, must be safe to use" + status=0 + fi + exit $status + ;; + + esac + exit 0 + ;; - * ) - state=`cat /tmp/.install_state` + * ) + if [ -f /tmp/.install_state ] + then + state=`cat /tmp/.install_state` + else + state=" " + fi if [ x"${state}" = "xConfiguring system" ] then progress "" @@ -490,7 +192,7 @@ echo "-----------------------------------------------------------------------3-- if [ -f /tmp/.startsize.io ] then - . /tmp/.startsize.io + . /tmp/.startsize.io #finding the drive ddrive=`df | grep $mountpoint | head -n1 | awk -F/ ' { print $3 } ' | cut -d" " -f 1|cut -b1,2,3 ` used=`statgrab -M disk.|grep ${ddrive}.write_bytes|cut -d= -f 2|tr -d " "` @@ -509,10 +211,14 @@ echo "-----------------------------------------------------------------------3-- total=$TOTALSIZE fi percent=`echo "scale=2 ; ($used/$total) * 100 " |bc ` - cond2=$(echo "$percent > 100" |bc ) + cond2=$(echo "$percent > 98" |bc ) if [ $cond2 -eq 1 ] then - percent=100 + percent=98 + fi + if [ x"${state}" = "xDone" ] + then + percent=100 fi cond3=$(echo "$percent < 3" |bc ) if [ $cond3 -eq 0 ] @@ -521,7 +227,7 @@ echo "-----------------------------------------------------------------------3-- fi fi fi - ;; + ;; esac diff --git a/abs/mv-core/MythVantage-config/mv_advanced.py b/abs/mv-core/MythVantage-config/mv_advanced.py new file mode 100755 index 0000000..2b53d04 --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_advanced.py @@ -0,0 +1,384 @@ +# -*- coding: utf-8 -*- +import logging, os, re +import mv_common + +def setup_pacman(create_link): + if create_link: + logging.info(" Creating pacman link") + #LOOK + #This is not implmented yet, below is the bash code for reference + #if [ ! x$1 = x ] + #then + #ln -s ${BASE}/data/var ${BASE}/data/srv/httpd/htdocs/repo + #echo "creating the link for the pacman repo mirror" + #fi + + #for i in mv-core mv-core-testing mv-extra mv-extra-testing + #do + #echo "[$i]" > ${BASE}/etc/pacman.d/$i + ##add mirror if needed + #if [ x$PKG_MIRROR = x1 ] + #then + #echo " Server = http://$dbhost/repo/$i " >> ${BASE}/etc/pacman.d/$i + #fi + ##add user templates + #USERTEMPLATES="/data/home/mythtv/templates" + #if [ -f $USERTEMPLATES/sources/$i ] + #then + #echo "Adding user $i" + #cat $USERTEMPLATES/sources/$i >> ${BASE}/etc/pacman.d/$i + #fi + #cat $TEMPLATES/sources/$i >> ${BASE}/etc/pacman.d/$i + #echo "setting local mirror to $dbhost for $i " + #done + else: + logging.info(" Pacman link will not be created") + return + +def setup_ncid_client(dbhost,templatefile): + #This always runs + logging.debug(" Configuring ncid client with server %s",dbhost) + cmd = '''sed -e "s/^set Host.*$/set Host %s /" %s >/etc/ncid/ncid.conf''' %(dbhost, templatefile) + return + +def setup_ncid_daemon(port,templatefile,Runncidd): + logging.info(" Configuring callerid daemon") + if Runncidd == "1": + logging.debug(" Port: %s",port) + mv_common.cp_and_log("/etc/ncid/ncidd.conf",templatefile) + cmd = '''sed -e "s/.*set ttyport.*$/set ttyport = \/dev\/%s /" %s >/etc/ncid/ncidd.conf''' %(port,templatefile) + mv_common.runcmd(cmd) + mv_common.pacinstall("ncidd") + mv_common.add_service("ncidd") + else: + logging.debug(" Callerid will not run") + mv_common.pacremove("ncidd") + mv_common.remove_service("ncidd") + return + +def setup_splash(Usebootsplash): + if Usebootsplash == "1": + logging.info(" Enabling splash") + cmd = ''' sed -i "s/^default.*0/default 1/g" /boot/grub/menu.lst''' + mv_common.runcmd(cmd) + else: + logging.info(" Disabling splash") + cmd = ''' sed -i "s/^default.*1/default 0/g" /boot/grub/menu.lst''' + mv_common.runcmd(cmd) + return +def setup_rrd(UseRRD): + if UseRRD == "1": + logging.info(" Enabling rrd_stats") + mv_common.pacinstall("rrd_stats") + else: + logging.info(" Disabling rrd_stats") + mv_common.pacremove("rrd_stats") + + +def setup_hobbit(UseHobbit,SystemType,dbhost): + if UseHobbit == "1": + if SystemType == "Standalone" or SystemType == "Master_backend": + logging.info(" Installing hobbit server") + mv_common.pacinstall("hobbitserver") + mv_common.add_service("hobbit") + else: + logging.info(" Installing hobbit client") + mv_common.pacinstall("hobbit-client") + setup_hobbit_client(dbhost) + mv_common.add_service("hobbit-client") + + else: + logging.info(" Removing Hobbit") + mv_common.pacremove("hobbit") + mv_common.pacremove("hobbit-client") + mv_common.remove_service("hobbit-client") + mv_common.remove_service("hobbitserver") + cmd = "rm -f /data/srv/httpd/htdocs/hobbit/index.html" + mv_common.runcmd(cmd) + return + +def setup_hobbit_client(dbhost): + logging.info(" Configuring hobbit client") + logging.debug(" hobbit server is %s:", dbhost) + cmd='''sed -i "s/^BBDISP.*$/BBDISP=%s/g" /data/srv/hobbit/client/etc/hobbitclient.cfg ''' %dbhost + mv_common.runcmd(cmd) + return + +def setup_evrouter(UseEvrouter,EvrouterConfig,template): + if UseEvrouter == "1": + logging.info(" Configuring everouter") + logging.debug(" EvrouterConfig is %s:",EvrouterConfig) + if EvrouterConfig == "tinker": + logging.debug(" tinker mode, not changing the config") + return + mv_common.pacinstall("evrouter") + mv_common.pacinstall("Xvfb") + mv_common.cp_and_log(template+"/evrouter/"+EvrouterConfig,"/etc/evrouter.cfg") + mv_common.add_service("evrouter") + mv_common.add_service("Xvfb") + else: + logging.info(" Not using evrouter") + mv_common.pacremove("evrouter") + mv_common.remove_service("evrouter") + mv_common.remove_service("Xvfb") + + return + +def setup_DNSmasq(RunDHCP,ip,gw,nameserver): + if RunDHCP == "1": + logging.info(" Configuring dhcp server(dnsmasq)") + logging.debug(" ip: %s", ip) + logging.debug(" gw: %s", gw) + logging.debug(" ns: %s", nameserver) + mv_common.pacinstall("dnsmasq") + mv_common.pacinstall("mvpmc") + mv_common.add_service("dnsmasq") + logging.debug(" Setting default route to my gw: %s",gw) + try: + f = open("/etc/dnsmasq.conf",'r') + dnsconf = f.readlines() + f.close() + except: + logging.info(" Couldn't open dnsmasq.conf") + return + for line in dnsconf: + outline = line + if re.match("^dhcp-option=3",line): + logging.debug(" Setting default route to my gw: %s",gw) + outline = "dhcp-option=3,%s\n" %gw + if re.match("^dhcp-option=6",line): + logging.debug(" Setting dns to my ip: %s",ip) + outline = "dhcp-option=6,%s\n" %ip + f.write(outline) + f.close() + + logging.debug(" change nfsroot to my ip:%s",ip) + cmd = '''sed -i "s/nfsroot=.*:/nfsroot=%s:/g" /data/srv/tftp/pxelinux.cfg/default''' %ip + mv_common.runcmd(cmd) + + logging.debug(" Adding 127.0.0.1 to resolv.conf") + logging.debug(" other nameserver is %s",nameserver) + try: + f = open("/etc/resolv.conf",'r') + dns = f.readlines() + f.close() + except: + dns='' + logging.debug(" Couldn't open resolv.conf for reading") + try: + f = open("/etc/resolv.conf",'w') + line="search lan\n" + f.write(line) + line="nameserver 127.0.0.1\n" + f.write(line) + line="nameserver %s\n" %nameserver + f.write(line) + for line in dns: + f.write(line) + f.close() + except: + logging.debug(" Couldn't open resolv.conf for writing") + + logging.debug(" setup dongle.config") + cmd = ''' sed -i "s/mvpmc -f .*/mvpmc -f \/etc\/helvR10.fon -s %s \& /" /data/srv/tftp/dongle.bin.config ''' %ip + #COMMAND="%s/mvpmc -f .*/mvpmc -f \/etc\/helvR10.fon -s ${ip} \& /" + #ex ${BASE}/data/srv/tftp/dongle.bin.config <<EOF + mv_common.runcmd(cmd) + else: + logging.info(" removing dhcp server(dnsmasq)") + mv_common.pacremove("dnsmasq") + mv_common.pacremove("mvpmc") + mv_common.remove_service("dnsmasq") + return + +def setup_mythweb(UseMythWEB): + if UseMythWEB == "1": + logging.info(" Activating mythweb") + mv_common.pacinstall("lighttpd") + mv_common.pacinstall("mythweb") + mv_common.add_service("lighttpd") + else: + logging.info(" Removing mythweb") + mv_common.pacremove("lighttpd") + mv_common.pacremove("mythweb") + mv_common.remove_service("lighttpd") + return + +def setup_samba(systemconfig,data_config): + mythhome = data_config.MYTHHOME + if systemconfig["UseSamba"] == "1": + logging.info(" Activating windows file sharing") + usersamba=mythhome+"/templates/smb.conf" + mv_common.pacinstall("samba") + if not os.path.exists("/etc/samba"): + logging.debug(" Creating directory /etc/samba") + try: + os.makedirs("/etc/samba") + except: + pass + + if os.path.exists(usersamba): + logging.debug(" Using user provided config file %s",usersamba) + cmd = "install -D -m755 %s /etc/samba/smb.conf" %usersamba + mv_common.runcmd(cmd) + else: + Samba_media = systemconfig["Samba_media"] + Samba_home = systemconfig["Samba_home"] + if systemconfig["Samba_mediareadonly"] == "1": + smreadonly = "yes" + else: + smreadonly = "no" + + if systemconfig["Samba_homereadonly"] == "1": + shreadonly = "yes" + else: + shreadonly = "no" + domain = systemconfig["Samba_domain"] + servername = systemconfig["hostname"] + + try: + f = open(systemconfig["TEMPLATES"]+"/samba/smb.conf.template",'r') + t_smbconf = f.readlines() + f.close() + except: + logging.info(" Couldn't open samba template file") + return + + try: + f = open("/etc/samba/smb.conf",'w') + except: + logging.info(" Couldn't open samba file") + return + + for line in t_smbconf: + outline = line + if re.match("^.*workgroup", line): + logging.debug(" Setting workgroup to %s",domain) + outline="workgroup = %s\n" %domain + logging.debug(" %s",outline) + if re.match("^.* server string",line): + logging.debug(" Setting server name to %s",servername) + outline="server string = %s\n" %servername + logging.debug(" %s",outline) + f.write(outline) + outline="include = %s/templates/user.shares \n" %mythhome + f.write(outline) + if Samba_media == "1": + outline="include = /etc/samba/smb.conf.media\n" + f.write(outline) + if Samba_home == "1": + outline="include = /etc/samba/smb.conf.home\n" + f.write(outline) + f.close() + logging.info(" Writing smb.conf.media") + try: + f = open("/etc/samba/smb.conf.media","w") + except: + logging.info(" Couldn't open smb.conf.media") + return + medialines=''' +[%s] +path = %s +public = yes +only guest = yes +writeable = %s +printable = no +force user = mythtv +force group = mythtv +create mask = 0755''' %(data_config.SMEDIA,data_config.DATAMOUNT,smreadonly) + f.write(medialines) + f.close + logging.debug(" %s",medialines) + logging.info(" Writing smb.conf.home") + try: + f = open("/etc/samba/smb.conf.home","w") + except: + logging.info(" Couldn't open smb.conf.home") + return + homelines=''' +[home] +path = %s +public = yes +only guest = yes +writeable = %s +printable = no +force user = mythtv +force group = mythtv +create mask = 0755 ''' %(data_config.MYTHHOME,shreadonly) + f.write(homelines) + f.close + logging.debug(" %s",homelines) + + + mv_common.add_service("nmbd") + mv_common.add_service("smbd") + else: + logging.info(" Removing windows file sharing") + mv_common.remove_service("smbd") + mv_common.remove_service("nmbd") + mv_common.pacremove("samba") + mv_common.pacinstall("smbclient") + return + +def setup_NFSshares(UseNFS,templatefile): + if UseNFS == "1": + logging.info(" Activating NFS server") + mv_common.pacinstall("nfs-utils") + mv_common.pacinstall("portmap") + cmd = '''sed -e "s/REPLACEME/*/g" %s >/etc/exports''' %templatefile + mv_common.add_service("nfsd") + mv_common.add_service("nfs-utils") + mv_common.add_service("portmap") + else: + logging.info(" Removing NFS server") + mv_common.remove_service("nfsd") + return + +def setup_dyndns(DDnsEnable): + if DDnsEnable == "1": + logging.info(" Installing Dynamic DNS client") + mv_common.pacinstall("inadyn") + mv_common.add_service("inadyn") + else: + logging.info(" Removing Dynamic DNS client") + mv_common.pacremove("inadyn") + mv_common.remove_service("inadyn") + + +def setup_advanced(systemconfig,data_config): + logging.info("____Start of advanced configuration____") + create_link = False + if systemconfig["SystemType"] == "Master_backend": + create_link = True + setup_pacman(create_link) + setup_ncid_client(systemconfig["dbhost"], + systemconfig["TEMPLATES"]+"/ncid.conf.template") + + setup_ncid_daemon(systemconfig["nciddSerialPort"], + systemconfig["TEMPLATES"]+"/ncidd.conf.template", + systemconfig["Runncidd"]) + + setup_splash(systemconfig["Usebootsplash"]) + if data_config.SYSTEMTYPE == "MythVantage": + setup_hobbit(systemconfig["UseHobbit"], + systemconfig["SystemType"], + systemconfig["dbhost"]) + if data_config.SYSTEMTYPE == "LinHES": + setup_rrd(systemconfig["UseRRD"]) + + setup_evrouter(systemconfig["UseEvrouter"], + systemconfig["EvrouterConfig"], + systemconfig["TEMPLATES"]) + + setup_DNSmasq(systemconfig["RunDHCP"], + systemconfig["mythip"], + systemconfig["mythgw"], + systemconfig["mythdns"]) + + setup_mythweb(systemconfig["UseMythWEB"]) + setup_samba(systemconfig,data_config) + setup_NFSshares(systemconfig["UseNFS"], + systemconfig["TEMPLATES"]+"/exports.template") + + setup_dyndns(systemconfig["DDnsEnable"]) + logging.info("__End of advanced configuration\n") diff --git a/abs/mv-core/MythVantage-config/mv_common.py b/abs/mv-core/MythVantage-config/mv_common.py new file mode 100755 index 0000000..f18e02b --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_common.py @@ -0,0 +1,200 @@ +# -*- coding: utf-8 -*- +import logging, os, time +import commands +config_file = "mv_config" +data_config = __import__(config_file, globals(), locals(), []) + +def runcmd(cmd): + if data_config.NOOPDEBUG=="FALSE": + pass + else: + cmd = "echo "+cmd + logging.debug(" %s",cmd) + cmdout = commands.getstatusoutput(cmd) + logging.debug(" %s",cmdout) + return cmdout[0] + +def runcmd_output(cmd): + if data_config.NOOPDEBUG=="FALSE": + pass + else: + cmd = "echo "+cmd + logging.debug(" %s",cmd) + cmdout = commands.getstatusoutput(cmd) + logging.debug(" %s",cmdout) + return cmdout[1] + +def services(systemconfig): + logging.debug("______Start of services______") + logging.debug("__End services") + +def cp_and_log(srcfile,destfile): + #return + if not os.path.exists(srcfile): + logging.info("%s is not present, skipping...",srcfile) + else: + cmd = ("rsync -arhp %s %s") %(srcfile,destfile) + runcmd(cmd) + + +def add_service(daemon): + logging.info(" Adding service %s",daemon) + cmd = "add_service.sh %s" %daemon + runcmd(cmd) + +def remove_service(daemon): + logging.info(" Removing service %s",daemon) + cmd = "remove_service.sh %s" %daemon + runcmd(cmd) + +def start_service(daemon): + logging.info(" start service %s",daemon) + cmd = "sv start %s" %daemon + runcmd(cmd) + +def stop_service(daemon): + logging.info(" stop service %s",daemon) + cmd = "sv stop %s" %daemon + runcmd(cmd) + +def restart_service(daemon): + logging.info(" Restarting service %s",daemon) + if daemon == "lcdd": + stop_service(daemon) + logging.debug(" killing all lcdd") + cmd = "killall -9 LCDd" + runcmd(cmd) + time.sleep(2) + start_service(daemon) + else: + cmd = "sv restart %s" %daemon + runcmd(cmd) + +def hup_service(daemon): + logging.info(" hup service %s",daemon) + cmd = "sv hup %s" %daemon + runcmd(cmd) + + + +def pkg_blacklist_check(pkg): + cmd = '''grep -q %s /etc/blacklist.package''' %pkg + rc = runcmd(cmd) + if rc == 0: + return True + else: + return False + +def pkg_installed_check(pkg): + logging.debug(" Checking if %sis installed",pkg) + cmd = "pacman -Q %s " %pkg + rc = runcmd(cmd) + if rc == 0: + return True + else: + return False + + +def pacinstall(pkg): + logging.info(" Checking %s for install",pkg) + #extra pkg check + if pkg == "xine": + pacinstall("xine-ui") + elif pkg == "dvdcss": + pacinstall("libdvdcss") + elif pkg == "webmin": + add_service("webmin") + elif pkg == "fuppes": + pacinstall("fuppes-svn") + + if not pkg_blacklist_check(pkg): + if pkg_installed_check(pkg): + logging.info(" %s is already installed, will not install",pkg) + else: + logging.info(" Installing %s",pkg) + cmd ='''pacman --noconfirm -Sf %s ''' %pkg + runcmd(cmd) + else: + logging.info(" %s is blacklisted, will not install",pkg) + +def pacremove(pkg): + logging.info(" Checking %s for removal",pkg) + if pkg == "xine": + pacremove("xine-ui") + elif pkg == "dvdcss": + pacremove("libdvdcss") + elif pkg == "webmin": + remove_service("webmin") + + if not pkg_blacklist_check(pkg): + if not pkg_installed_check(pkg): + logging.info(" %s is not installed, will not remove",pkg) + else: + logging.info(" Removing %s",pkg) + cmd ='''pacman --noconfirm -R %s ''' %pkg + runcmd(cmd) + else: + logging.info(" %s is blacklisted, will not remove",pkg) + +def getpid(process): + return commands.getoutput('pidof %s' % process) + +def remove_file(filename): + logging.debug(" Removing %s", filename) + try: + os.remove(filename) + except: + logging.debug("* Could not remove %s", filename) + + +def restartLCD(RESTART_LCD): + if RESTART_LCD : + logging.info(" Restarting lcd server") + cmd = "killall -9 mythlcdserver" + runcmd(cmd) + else: + logging.debug(" Not restarting MYTHLCD server") + + +def reloadfe(dbhost,RESTART_LCD): + logging.debug("____Start of reloadfe____") + if data_config.SYSTEMTYPE == "MythVantage": + logging.info(" Clearing Backend cache") + cmd = '''/usr/bin/backend_control.sh clearcache behost %s''' %dbhost + runcmd(cmd) + + restartLCD(RESTART_LCD) + for pid in getpid("mythfrontend"): + cmd = ''' kill -s USR1 %s ''' %pid + #runcmd(cmd) + logging.info(" Reloading frontend with pid of %s",pid) + + logging.debug("__End of reloadfe\n") + + +def restartfe(RESTART_LCD): + logging.debug("____Start of restartfe____") + if data_config.SYSTEMTYPE=="LinHES": + logging.debug(" LinHES seems to be running will not restartfe") + return + logging.info(" Restarting frontend") + restartLCD(RESTART_LCD) + cmd="killall -9 mythfrontend" + runcmd(cmd) + cmd="killall -9 welcome" + runcmd(cmd) + logging.debug("__End of restartfe\n") + + +def udev_trigger(): + logging.info(" Triggering udev") + cmd = "udevadm settle" + runcmd(cmd) + cmd = "udevadm trigger" + runcmd(cmd) + cmd = "udevadm settle" + runcmd(cmd) + cmd = "udevadm trigger" + runcmd(cmd) + + diff --git a/abs/mv-core/MythVantage-config/mv_config.py b/abs/mv-core/MythVantage-config/mv_config.py new file mode 100755 index 0000000..9ce29f1 --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_config.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +SYSTEMTYPE="MythVantage" +MVHOSTNAME="mvi" +MOUNTPOINT="/new_boot" +DATAMOUNT="/data" +MYTHHOME="/data/home/mythtv" +SQUASHFILE="/tmp/.squashlist" +SQUASHLIST=("bin","boot","etc","home","lib","opt","root","sbin","usr","var","data") +NOOPDEBUG="FALSE" +BACKUPFILE="mythconverg.sql.gz" +BACKUPPATH="/data/backup/" +TEMP_TEMPLATES="/tmp/templates" +SMEDIA="media" + diff --git a/abs/mv-core/MythVantage-config/mv_hostype.py b/abs/mv-core/MythVantage-config/mv_hostype.py new file mode 100755 index 0000000..5d033fa --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_hostype.py @@ -0,0 +1,219 @@ +# -*- coding: utf-8 -*- +import logging, mv_common +import os + +config_file = "mv_config" +data_config = __import__(config_file, globals(), locals(), []) + +def setup_ntp(usepool,ntpserver): + if usepool: + logging.info("Setting ntp server to %s",ntpserver) + print '''sed -i "s/pool.ntp.org/$dbhost/g" ${BASE}/etc/ntp.conf''' + else: + logging.info("Not changing ntp configuration") + +def setup_avahi(templates): + file="/etc/avahi/services/mysql.service" + if not os.path.exists(file): + logging.debug(" copying in mysql.service for avahi") + try: + os.makedirs("/etc/avahi/services") + except: + logging.debug(" Couldn't create /etc/avahi/services") + mv_common.cp_and_log(templates+"/mysql.service",file) + cmd="sudo sv restart avahi" + mv_common.runcmd(cmd) + +def remove_avahi_service(): + file="/etc/avahi/services/mysql.service" + if os.path.exists(file): + logging.debug(" Removing avahi mysql.service file") + cmd="rm -rf %s" %file + mv_common.runcmd(cmd) + cmd="sudo sv restart avahi" + mv_common.runcmd(cmd) + +def setup_db(): + logging.debug(" Setting up the database") + +def setup_mysqlnetwork(EnableNetwork): + logging.debug(" Setting up mysql network") + mysqlconf = "/etc/my.cnf" + cmd = '''grep "#skip-networking" %s ''' %mysqlconf + status = mv_common.runcmd(cmd) + + if EnableNetwork : + logging.debug(" Enabling mysql networking") + if status == 0 : + logging.debug(" Network is already enabled for mysql") + else: + cmd = '''sed -ie "s/^skip-networking/#skip-networking/g" %s ''' %mysqlconf + mv_common.runcmd(cmd) + mv_common.restart_service("mysqld") + else: + logging.debug(" Disabling mysql networking") + if status == 1 : + logging.debug(" Network is already disabled for mysql") + else: + cmd = '''sed -ie "s/#skip-networking/skip-networking/g" %s ''' %mysqlconf + mv_common.runcmd(cmd) + mv_common.restart_service("mysqld") + +def setup_mysql_connection(systemconfig): + logging.info(" Configuring database connection") + mythip = systemconfig["mythip"] + systemtype = systemconfig["SystemType"] + mv_root = systemconfig["MVROOT"] + mysqltxt = "/usr/share/mythtv/mysql.txt" + templates = systemconfig["TEMPLATES"] + mysqltemplate = templates + "/mysql.txt" + dbhost = systemconfig["dbhost"] + + if systemtype == "Master_backend": + logging.debug(" Setting dbhost to %s in systemconfig", mythip) + dbhost = mythip + cmd = '''sed -ei "s/^dbhost=.*$/dbhost=\"%s\"/" /etc/systemconfig ''' %dbhost + mv_common.runcmd(cmd) + logging.debug(" Changing dbhost in settings table for master_backend") + cmd = '''%s/bin/restore_default_settings.sh -c BECONFIG -s master -a %s ''' %(mv_root, dbhost) + mv_common.runcmd(cmd) + + if systemtype == "Slave_backend": + slavehost = mythip + logging.debug(" Changing slave in settings: %s", slavehost) + cmd = '''%s/bin/restore_default_settings.sh -c BECONFIG -s slave -a %s ''' %(mv_root, slavehost) + mv_common.runcmd(cmd) + + if systemtype == "Master_backend": + logging.debug(" changing mysql.txt file to use localhost") + cmd = '''sed -e "s/^DBHostName=.*$/DBHostName="localhost"/" %s > %s ''' %(mysqltemplate, mysqltxt) + mv_common.runcmd(cmd) + else: + logging.debug(" changing mysql.txt file to use %s", dbhost) + cmd = '''sed -e "s/^DBHostName=.*$/DBHostName=%s/" %s > %s ''' %(dbhost, mysqltemplate, mysqltxt) + mv_common.runcmd(cmd) + + delfile = data_config.MYTHHOME + "/.mythtv/mysql.txt" + mv_common.remove_file(delfile) + delfile = mv_root + "/bin/mythtv/.mythtv/mysql.txt" + mv_common.remove_file(delfile) + filecheck = data_config.MYTHHOME + "/templates/mysql.txt" + if os.path.exists(filecheck): + logging.info(" Scrapping all the previous work and using %s for mysql.txt", filecheck) + mv_common.cp_and_log(filecheck, mysqltxt) + + + +def setup_func_key(): + if data_config.SYSTEMTYPE == "MythVantage": + logging.debug(" Grabbing the key for Func") + cmd="/usr/MythVantage/bin/grabkey.py" + mv_common.runcmd(cmd) + +def setup_func_minion(dbhost): + logging.info(" Setting up the func minion:") + logging.debug(" certmaster is %s:",dbhost) + cmd='''sed -i "s/^certmaster.*$/certmaster = %s/" /etc/func/minion.conf ''' %dbhost + mv_common.runcmd(cmd) + +def setup_syslog(dbhost): + logging.debug(" Setting syslog to log to %s",dbhost) + cmd ='''sed -i "s/^destination d_remote.*$/destination d_remote \{tcp\(\"%s\" port\(514\)\) \;\} \;/" /etc/syslog-ng.conf''' %dbhost + return + +def hostypeprint(systemconfig): + logging.info("______Start of hostype config_____") + mv_common.services(systemconfig) + install_list='' + remove_list='' + daemon_list='' + daemon_remove_list='' + run_mysqlnetwork = False + + if systemconfig["SystemType"] == "Standalone": + logging.info("Stand alone system being configured") + setup_ntp(False,"null") + remove_avahi_service() + EnableNetwork = False + run_mysqlnetwork = True + if systemconfig["hostypec"]: + setup_db() + install_list=["mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"] + daemon_list=["mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd"] + + elif systemconfig["SystemType"] == "Master_backend": + logging.info("Master backend system being configured") + setup_ntp(False,"null") + setup_avahi(systemconfig["TEMPLATES"]) + install_list=["mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"] + daemon_list=["mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd"] + EnableNetwork = True + run_mysqlnetwork = True + if data_config.SYSTEMTYPE == "MythVantage": + install_list.append('func') + install_list.append('certmaster') + daemon_list.append('certmaster') + + elif systemconfig["SystemType"] == "Slave_backend": + logging.info("Slave backend system being configured") + setup_ntp(True,systemconfig["dbhost"]) + remove_avahi_service() + if systemconfig["hostypec"]: + setup_db() + install_list = ["portmap", "nfs-utils", "local-website", "avahi", "libmysqlclient" ] + daemon_list = ["mythbackend", "portmap", "nfs-utils", "netfs", "lighttpd", "avahi" ] + daemon_remove_list=('mysql') + if data_config.SYSTEMTYPE == "MythVantage": + install_list.remove("local-website") + daemon_list.remove("lighttpd") + install_list.append('func') + daemon_list.append('funcd') + remove_list.append("lighttpd") + + + elif systemconfig["SystemType"] == "Frontend_only": + logging.info("Frontend only system being configured") + setup_ntp(True,systemconfig["dbhost"]) + remove_avahi_service() + install_list=["mysql-clients", "libmysqlclient", "avahi", "portmap", "nfs-utils", "local-website"] + remove_list=["mysql"] + daemon_list=["mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd"] + daemon_remove_list=("mysql", "mythbackend") + if data_config.SYSTEMTYPE == "MythVantage": + install_list.remove("local-website") + daemon_list.remove("lighttpd") + install_list.append('func') + daemon_list.append('funcd') + remove_list.append("lighttpd") + + + + for pkg in install_list: + mv_common.pacinstall(pkg) + for pkg in remove_list: + mv_common.pacinstall(pkg) + for daemon in daemon_list: + mv_common.add_service(daemon) + for daemon in daemon_remove_list: + mv_common.remove_service(daemon) + if systemconfig["RunFrontend"] == "1": + logging.debug(" Will run the frontend") + mv_common.add_service("frontend") + mv_common.add_service("hal") + else: + logging.debug(" Will NOT run the frontend") + mv_common.remove_service("frontend") + mv_common.remove_service("hal") + + + if run_mysqlnetwork: + setup_mysqlnetwork(EnableNetwork) + else: + logging.debug(" Not running setup_mysql_connection") + + setup_mysql_connection(systemconfig) + if data_config.SYSTEMTYPE == "MythVantage": + setup_func_minion(systemconfig["dbhost"]) + setup_func_key() + setup_syslog(systemconfig["dbhost"]) + logging.info("__End of hostype config\n") diff --git a/abs/mv-core/MythVantage-config/mv_install.py b/abs/mv-core/MythVantage-config/mv_install.py new file mode 100755 index 0000000..56118c1 --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_install.py @@ -0,0 +1,1433 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import sys, os, commands, glob, time +import getopt, re, MySQLdb +import logging +try: + import parted +except: + print "module parted not found" + +def usage(): + print "help text:" + print "example usage: --rootdisk=sda --rootfs=ext4 --rootsize=34240 --datafs=ext4 --datasize=3400 --datadisk=sda --swapsize=340 -c full_install" + +def clean_upgrade(): + return False + +def error_out(errmsg): + cmd = '''echo %s >> /tmp/.install_error ''' %errmsg + runcmd(cmd) + logging.critical("***********************************") + logging.critical("error: %s",errmsg) + print "***********************************" + print "ERROR: mv_install.py: %s" %errmsg + print "***********************************" + sys.exit(1) + + +def update_db(value, data): + db = MySQLdb.connect(host="localhost", user="mythtv", passwd="mythtv", db="mythconverg") + try: + cursor = db.cursor() + cursor.execute("DELETE FROM settings where value=%s and hostname=%s;", (value, data_config.MVHOSTNAME)) + cursor.execute("REPLACE INTO settings set value=%s, data=%s, hostname=%s;", (value, data, data_config.MVHOSTNAME)) + logging.debug("Updated database with %s, %s", data, value) + except MySQLdb.Error, e: + logging.debug("Unable to update database with %s, %s", data, value) + + +def progress(pgnum): + progressline = str(pgnum) + "% complete" + logging.debug("Progress: %s", pgnum) + f = open('/tmp/.install_percent', 'w') + f.write(progressline) + f.close() + +def update_status(status): + logging.debug("Status: %s", status) + f = open('/tmp/.install_state', 'w') + f.write(str(status)) + f.close() + +def kill_dhcp_chroot(): + logging.debug("Killing off chroot dhcpcd") + stddir = os.getcwd() + piddir = ("%s/var/run/") %data_config.MOUNTPOINT + try: + os.chdir(piddir) + for FILE in glob.glob("dhcpcd-*.pid"): + f = open(FILE, 'r') + pid = f.readline() + f.close() + cmd = "kill -9 %s" %pid + runcmd(cmd) + os.remove(FILE) + os.chdir(stddir) + except: + pass + +def statgrab(disk): + cmd = "statgrab -M disk. |grep %s.write_bytes" % hostoptions["rootdisk"] + out = commands.getoutput(cmd) + try: + prewritebytes = out.split("=")[1].strip() + except: + prewritebytes = "1024" + outline = "STARTSIZE=%s" %prewritebytes + f = open('/tmp/.startsize.io', 'w') + f.write(str(outline)) + f.close() + +def backup_sql_check(): + logging.debug("Searching for backup file") + try: + hostoptions["backupfile"] + except: + logging.debug("Backup file var is empty") + return False + if os.path.exists(data_config.MOUNTPOINT+hostoptions["backupfile"]): + logging.debug("Backup file %s is present", data_config.MOUNTPOINT+hostoptions["backupfile"]) + return True + else: + logging.debug("Backup file %s is NOT present", data_config.MOUNTPOINT+hostoptions["backupfile"]) + return False + +def mdadm_find(PREFIX): + logging.debug("Searching for mdadm.conf") + if os.path.exists(PREFIX+"/etc/KnoppMyth-version"): + mdadmconf = "/etc/mdadm/mdadm.conf" + else: + mdadmconf = "/etc/mdadm.conf" + logging.debug("Using %s for mdadm.conf", mdadmconf) + return mdadmconf + +def mdadm_assemble_all(): + # read mdadm.conf and start the arrays + #ARRAY /dev/md5 uuid=19464854:03f71b1b:e0df2edd:246cc977 + logging.debug("Starting mdadm support") + mdadmconf_file = mdadm_find("/tmp") + cmd = "cdadm --assemble --scan -c /tmp/%s" %mdadmconf_file + runcmd(cmd) + mdadm_contents = '' + try: + f = open(mdadmconf_file, 'r') + mdadm_contents = f.readlines() + f.close() + except: + logging.debug(" Couldn't open mdadmconf file") + for line in mdadm_contents: + if line.startswith("ARRAY"): + logging.debug(" Found MD array: %s", line) + array = line.split()[1] + logging.info(" assembling array: %s", array) + cmd = "mdadm --assemble -c /tmp%s %s" %(mdadmconf_file, array) + runcmd(cmd) + time.sleep(2) + cmd = "fsck -p %s" %array + runcmd + +def copy_updates(): + try: + MVROOT = os.environ["MV_ROOT"] + except: + logging.debug("MVROOT was not defined, using the default value") + MVROOT = "/usr/MythVantage" + cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin", "*.sh") + cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin", "*.py") + +def timezone_to_db(timefile): + logging.info("importing timezone") + try: + f = open(timefile) + timezonecontents = f.readline().strip() + f.close() + except: + logging.debug("Couldn't open /tmp/etc/timezone, will not set the timezone") + return + update_db("HostTimeZone", timezonecontents); + tzsplit = timezonecontents.partition('/') + print tzsplit + if tzsplit[2] == '' : + update_db("HostTimeZoneRegion", tzsplit[0]) + else: + update_db("HostTimeZoneRegion", tzsplit[0]) + tztemp="HostTimeZoneRegion_%s" % tzsplit[0] + update_db(tztemp, tzsplit[2]) + + + +def cp_and_log(srcfile, destfile): + #return + if not os.path.exists(srcfile): + logging.info("%s is not present, skipping...", srcfile) + else: + cmd = ("rsync -arvp %s %s") %(srcfile, destfile) + runcmd(cmd) + +def cp_and_log2(srcfile, destfile, fileglob): + #return + logging.debug("cp_and_log2") + logging.debug("%s, %s, %s", srcfile, destfile, fileglob) + + if not os.path.exists(srcfile): + logging.info("%s is not present, skipping...", srcfile) + else: + if fileglob == '': + cmd = ("rsync -arvp %s %s") %(srcfile, destfile) + runcmd(cmd) + else: + fileglob = "*" + cmd = ("rsync -arvp %s/%s %s") %(srcfile, fileglob, destfile) + runcmd(cmd) + +def runcmd(cmd): + if data_config.NOOPDEBUG == "FALSE": + pass + else: + cmd = "echo "+cmd + logging.debug(" %s", cmd) + cmdout = commands.getstatusoutput(cmd) + logging.debug(" %s", cmdout) + return cmdout + +def mysqldb(cmd, inchroot): + if cmd == "start": + mycmd = " /etc/rc.d/mysqld start" + elif cmd == "stop": + mycmd = " /etc/rc.d/mysqld stop" + if inchroot == "chroot": + mycmd = " chroot /newboot %s" %mycmd + runcmd(mycmd) + + +def mount_bind_chroot(): + logging.debug("Mounting dev/proc/sysfs for chroot") + cmd = " mount --bind /dev %s" %data_config.MOUNTPOINT+"/dev" + runcmd(cmd) + cmd = " mount --bind /dev/pts %s" %data_config.MOUNTPOINT+"/dev/pts" + runcmd(cmd) + cmd = " mount --bind /proc %s" %data_config.MOUNTPOINT+"/proc" + runcmd(cmd) + cmd = " mount -t sysfs none %s" %data_config.MOUNTPOINT+"/sys" + runcmd(cmd) + + +def umount_bind_chroot(): + logging.debug("UnMounting dev/proc/sysfs for chroot") + cmd = " umount -l %s" %data_config.MOUNTPOINT+"/dev/pts" + runcmd(cmd) + cmd = " umount -l %s" %data_config.MOUNTPOINT+"/dev" + runcmd(cmd) + cmd = " umount -l %s" %data_config.MOUNTPOINT+"/proc" + runcmd(cmd) + cmd = " umount -l %s" %data_config.MOUNTPOINT+"/sys" + runcmd(cmd) + + +def blank_table(diskdevice): + logging.debug(" writing new parition table for %s", diskdevice) + logging.debug("parition table before:") + cmd = "fdisk -l %s" %diskdevice + runcmd(cmd) + + cmd = "echo w |fdisk %s" %diskdevice + runcmd(cmd) + + logging.debug("parition table after:") + cmd = "fdisk -l %s" %diskdevice + runcmd(cmd) + +def partitions_removeall(diskdevice, label): + logging.info("Removing all partitions for %s %s", label, diskdevice) + try: + device = parted.getDevice(diskdevice) + partdisk = parted.Disk(device) + partdisk.deleteAllPartitions() + if data_config.NOOPDEBUG == "FALSE": + partdisk.commit() + for partition in partdisk.partitions: + print "type: %s" %partition.type + except: + logging.debug(" Error reading parition table, attempting to write a blank one") + blank_table(diskdevice) + + +def create_partitions(diskdevice, size, ptype, startsector): + logging.debug("_____Create partitions______") + if size == "NO": + logging.info("Size is 0, skipping") + return "NO" + partlist = [] + newstart = 0 + totalused = 0 + device = parted.getDevice(diskdevice) + partdisk = parted.Disk(device) + for partition in partdisk.partitions: + if partition.type != parted.PARTITION_FREESPACE: + partlist.append((partition, + partition.path, + partition.getFlag(parted.PARTITION_BOOT), + partition.geometry.start, + partition.geometry.end, + partition.geometry.length, + partition.type, + partition.fileSystem)) + for slice in partlist: + (usedpartition, usedpath, usedbootable, usedstart, usedend, usedlength, usedtype, usedfs) = slice + #Start the new partition one after the end of last + newstart = usedend+1 + + if startsector == 0: + newstart = 0 + if size == "ALL": + logging.debug(" Using the rest of the disk %s", (device.length-newstart) ) + try: + geom = parted.Geometry(device=device, start=newstart, length=(device.length-newstart)) + except: + logging.info("An error occured, probably invalid parition size") + return + else: + # convert size in MB to a length on the device in sectors + length = (int(size) * (1024 * 1024)) / device.sectorSize + logging.debug("Size is %s", length) + try: + geom = parted.Geometry(device=device, start=newstart, length=length) + except: + logging.info("An error occured, probably invalid parition size") + error_out("invalid parition size") + + #collect device constraint + constraint = device.getConstraint() + # new partition + if ptype == "NORMAL": + newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_NORMAL, geometry=geom) + elif ptype == "SWAP": + newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_NORMAL, geometry=geom) + + #add the partition to the disk and commit changes + partdisk.addPartition(partition=newpart, constraint=constraint) + if data_config.NOOPDEBUG == "FALSE": + partdisk.commit() + logging.info("created partition %s of %dMB and added it to %s" % + (newpart.getDeviceNodeName(), newpart.getSize(), diskdevice)) + return newpart.getDeviceNodeName() + +def set_active_parition(diskdevice): + """ Set the bootable flag for this partition. """ + logging.debug(" Setting active parition") + device = parted.getDevice(diskdevice) + partdisk = parted.Disk(device) + try: + for partition in partdisk.partitions: + partition.setFlag(parted.PARTITION_BOOT) + partdisk.commit() + except: + logging.info(" Couldn't set the active partition") + logging.info(" Depending on your system this may not matter") + + +def partition_disk(): + global hostoptions + logging.info("Partitioning") + logging.debug("____start of partition_disk____") + rootdisk = hostoptions["rootdisk"] + datadisk = hostoptions["datadisk"] + label = "root" + partitions_removeall("/dev/"+rootdisk, label) + label = "data" + partitions_removeall("/dev/"+datadisk, label) + hostoptions["rootpartition"] = create_partitions("/dev/"+rootdisk, hostoptions["rootsize"], "NORMAL", 0) + set_active_parition("/dev/"+rootdisk) + hostoptions["swappartition"] = create_partitions("/dev/"+rootdisk, hostoptions["swapsize"], "SWAP", 1) + if datadisk != rootdisk: + hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "NORMAL", 0) + else: + hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "NORMAL", 1) + time.sleep(5) + +def fscmd(fstype): + fscmds = {"reiserfs":"mkreiserfs -q -l ROOT", "xfs": "mkfs -t xfs -f", "ext3": "mkfs.ext3", "jfs":"mkfs.jfs -q", "ext4":"mkfs.ext4", "Do_not_format":"noformat", "no_format":"noformat"} + try: + rc = fscmds[fstype] + except: + logging.critical(" %s is not a valid fs type, exiting now", fstype) + error_out("Error mvinstall during format") + return rc + + +def format_disk(install_type): + logging.info("______Starting Disk Format______") + rootfs = fscmd(hostoptions["rootfs"]) + datafs = fscmd(hostoptions["datafs"]) + + rootdisk = hostoptions["rootdisk"] + datadisk = hostoptions["datadisk"] + rootpartition = hostoptions["rootpartition"] + datapartition = hostoptions["datapartition"] + if install_type != "upgrade": + swapsize = hostoptions["swapsize"] + swappartition = hostoptions["swappartition"] + + logging.debug(" Format command for rootfs %s : %s ", rootfs, rootpartition) + if ( rootfs != "noformat"): + logging.info("Starting format of %s", rootpartition) + cmd = " %s /dev/%s" %( rootfs, rootpartition) + #os.system(cmd) + runcmd(cmd) + else: + logging.info("Will not format root partition: %s", rootpartition) + + logging.debug(" Format command for datafs %s : %s ", datafs, datapartition) + if (datafs != "noformat"): + logging.info("Starting format of %s", datapartition) + cmd = " %s /dev/%s" %( datafs, datapartition) + #os.system(cmd) + runcmd(cmd) + else: + logging.info("Will not format data partition: %s", datapartition) + + if install_type == "install": + if (hostoptions["swapsize"] != "NO"): + logging.info("Starting format for swap %s", swappartition) + cmd = " mkswap /dev/%s" % swappartition + #os.system(cmd) + runcmd(cmd) + else: + logging.debug(" Swap is set to NO, will not run mkswap") + + logging.debug("_____End of format______") + + +def mount_it(): + logging.info("______Mounting disk______") +# Create mount points + try: + mountpoint = data_config.MOUNTPOINT + mp = mountpoint + logging.info("Creating mountpoints %s", mp) + os.makedirs(mp) + except OSError: + logging.debug(" Could not create %s", mp) + +# Mount root + cmd = "mount /dev/%s %s" %(hostoptions["rootpartition"], mountpoint) + runcmd(cmd) + #logging.debug(cmd) + #cmdout=commands.getoutput(cmd) + #logging.debug(cmdout) +# Mount data +#make mountpoint after mounting / + try: + mountpoint = data_config.MOUNTPOINT + datapoint = data_config.DATAMOUNT + mp = mountpoint+datapoint + logging.info("Creating mountpoints %s", mp) + os.makedirs(mp) + except OSError: + logging.debug(" Could not create %s", mp) + + cmd = "mount /dev/%s %s" %(hostoptions["datapartition"], mp) + runcmd(cmd) + #logging.debug(cmd) + #cmdout=commands.getoutput(cmd) + #logging.debug(cmdout) + +def unmount_it(): + logging.info("______Unmounting disk______") + cmd = "umount %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT) + runcmd(cmd) + time.sleep(2) + + cmd = "swapoff /dev/%s" %(hostoptions["swappartition"]) + runcmd(cmd) + + cmd = "sync" + runcmd(cmd) + + cmd = "umount %s" %(data_config.MOUNTPOINT) + runcmd(cmd) + cmd = "sync" + runcmd(cmd) + + +def create_squashlist(): + logging.debug("Creating squashlist") + squashfile = data_config.SQUASHFILE + f = open(squashfile, 'w') + for i in data_config.SQUASHLIST: + f.write(i) + f.write("\n") + logging.debug(i) + f.close() + + +def copy_it(install_type): + logging.info("______Transferring to disk______") + logging.debug( install_type) + if ( install_type == "install"): + logging.info("Transferring system") + cmd = " unsquashfs -f -d %s /.livesys/medium/system.sqf" %(data_config.MOUNTPOINT) + runcmd(cmd) + #logging.debug(cmd) + #cmdout=commands.getoutput(cmd) + + if ( install_type == "upgrade"): + logging.info("Upgrading system") + create_squashlist() + cmd = " unsquashfs -e %s -f -d %s /.livesys/medium/system.sqf" %(data_config.SQUASHFILE, data_config.MOUNTPOINT) + runcmd(cmd) + #logging.debug(cmd) + #cmdout=commands.getoutput(cmd) +# Create the missing dir + i = ("sys", "proc", "dev", "tmp", "mnt", "media", "media/cdrom", "media/dvd", "var/log/mythtv") + mountpoint = data_config.MOUNTPOINT + for item in i: + try: + mp = mountpoint+"/"+item + logging.info("Creating mountpoints %s", mp) + os.makedirs(mp) + except OSError: + logging.debug(" __Could not create %s", mp) +# General fixup + cmd = "chmod 777 %s/tmp" %(data_config.MOUNTPOINT) + runcmd(cmd) + cmd = "mknod %s/dev/null c 1 5" %(data_config.MOUNTPOINT) + runcmd(cmd) + cmd = "mknod %s/dev/console c 5 1" %(data_config.MOUNTPOINT) + runcmd(cmd) + cmd = "chmod +s %s/usr/bin/Xorg" %(data_config.MOUNTPOINT) + runcmd(cmd) + cmd = "chmod +s %s/usr/bin/crontab" %(data_config.MOUNTPOINT) + runcmd(cmd) + cmd = "chmod +s %s/usr/bin/sudo" %(data_config.MOUNTPOINT) + runcmd(cmd) + cmd = "chmod +s %s/bin/mount" %(data_config.MOUNTPOINT) + runcmd(cmd) + logging.debug("__End of copy_it__") + +def create_fstab(extralines): + logging.debug("______Creating new fstab file_______") + logging.info("Creating new fstab file") + fstabfile = data_config.MOUNTPOINT+"/etc/fstab" + fstab_list = [] + f = open(fstabfile, 'w') + line = '''# <file system> <dir> <type> <options> <dump> <pass> \n''' + fstab_list.append(line) + line = '''none /dev/pts devpts defaults 0 0 \n''' + fstab_list.append(line) + line = '''none /dev/shm tmpfs defaults 0 0\n''' + fstab_list.append(line) + line = '''/dev/cdrom /media/cdrom auto ro,user,noauto,unhide 0 0\n''' + fstab_list.append(line) + line = '''/dev/dvd /media/dvd auto ro,user,noauto,unhide 0 0\n''' + fstab_list.append(line) + line = '''UUID=ROOTUID / auto defaults,noatime 0 1\n''' + fstab_list.append(line) + line = '''UUID=DATAUID %s auto defaults,noatime 0 1\n''' %(data_config.DATAMOUNT) + fstab_list.append(line) + line = '''UUID=SWAPUID swap swap defaults 0 0 \n''' + fstab_list.append(line) + for vline in extralines: + fstab_list.append(vline) + for outline in fstab_list: + logging.debug(outline) + f.write(outline) + f.close() + +def find_uuid(partition): + logging.info("Finding the UUID for %s...", partition) + cmd = "blkid -s UUID /dev/%s" %partition + tmpuuid = runcmd(cmd)[1] + splituuid = tmpuuid.partition("=") + uuid = splituuid[2].replace('"', "") + logging.info("The uuid is %s", uuid) + return uuid.strip() + +def pick_out_vg(): + logging.info("Searching for Volume Groups in old fstab") + vglines = [] + f = open("/tmp/etc/fstab", 'r') + oldfscontents = f.readlines() + for line in oldfscontents: + if line.startswith("/dev/vg"): + vglines.append(line) + templine = line.split() + mdir = templine[1] + if not os.path.exists (mdir): + logging.debug("Creating dir %s for VG mount", mdir) + os.makedirs (mdir) +# Might need to os.chown to mythtv:users + else: + logging.debug("Directory %s for VG mount already present", mdir) + return vglines + +def fstab_it(install_type): + logging.info("______Checking fstab______") + kmvg = [] + fstabfile = data_config.MOUNTPOINT+"/etc/fstab" +# Check for knoppmyth install, if found create new + if install_type == "upgrade": + if os.path.exists("/tmp/etc/KnoppMyth-version"): + logging.debug(" KnoppMyth-Version found, creating new fstab") + kmvg = pick_out_vg() + create_fstab(kmvg) + elif os.path.exists("/tmp/etc/fstab"): + logging.debug(" Upgrade and not Knoppmyth, using old fstab") + cp_and_log("/tmp/etc/fstab", fstabfile) +# Catch all for creating new fstab + if not os.path.exists(data_config.MOUNTPOINT+"/etc"): + os.makedirs(data_config.MOUNTPOINT+"/etc") + if not os.path.exists(fstabfile): + create_fstab(kmvg) + + logging.info("____UUID check for %s", "swap") + swapuuid = find_uuid(hostoptions["swappartition"]) + + logging.info("____UUID check for %s", "data") + datauuid = find_uuid(hostoptions["datapartition"]) + + logging.info("____UUID check for %s", "root") + rootuuid = find_uuid(hostoptions["rootpartition"]) + + fstabfile = data_config.MOUNTPOINT+"/etc/fstab" + logging.info("Correcting UUID's in %s", fstabfile) + f = open(fstabfile, 'r') + oldfscontents = f.readlines() + newfstab = [] + f.close() + for line in oldfscontents: + if line.startswith("UUID"): + templine = line.split() + if ( templine[1] == "/"): + logging.debug(" Found Root fstab line:") + logging.debug( templine) + templine[0] = "UUID=%s" %(rootuuid) + newline = '' + for i in templine: + newline+=i + newline+=" " + newline+="\n" + logging.debug(" New fstab line:") + logging.debug( newline) + newfstab.append(newline) + + if ( templine[1] == data_config.DATAMOUNT): + logging.debug(" Found DATA mount") + logging.debug( templine) + templine[0] = "UUID=%s" %(datauuid) + newline = '' + for i in templine: + newline+=i + newline+=" " + newline+="\n" + logging.debug(" New fstab line:") + logging.debug( newline) + newfstab.append(newline) + + if ( templine[1] == "swap"): + if len(swapuuid) <= 5: + logging.debug(" swapp uuid is to small") + else: + logging.debug(" Found swap partition") + logging.debug( templine) + templine[0] = "UUID=%s" %(swapuuid) + newline = '' + for i in templine: + newline+=i + newline+=" " + newline+="\n" + logging.debug(" New fstab line:") + logging.debug( newline) + newfstab.append(newline) + else: + logging.debug(" Line didn't match, adding to newfstab:") + logging.debug( line) + newfstab.append(line) + logging.info("Writing out newfstab") + logging.debug("______This is the new fstab_____") + f = open(fstabfile, 'w') + for line in newfstab: + logging.debug(line) + f.write(line) + #f.write("\n") + f.close() + +def grub_it(): + logging.info("______Start of grub install______") + cmd = " grub-install --recheck --no-floppy --root-directory=%s \"(hd0)\" " % data_config.MOUNTPOINT + logging.info("Running grub-install") + runcmd(cmd) + rootuuid = find_uuid(hostoptions["rootpartition"]) + cmd = " mkinitcpio -g %s/boot/kernel26.img" % data_config.MOUNTPOINT + logging.info("Running mkinitcpio") + runcmd(cmd) + logging.info("Adding root uuid to grub menu") + grubfile = data_config.MOUNTPOINT+"/boot/grub/menu.lst" + try: + f = open(grubfile, 'r') + oldgrub = f.readlines() + newgrub = [] + f.close() + for line in oldgrub: + if line.startswith("kernel"): + templine = line.split() + logging.debug(" Found kernel Root grubline:") + logging.debug( templine) + templine[2] = "root=/dev/disk/by-uuid/%s" %(rootuuid) + newline = '' + for i in templine: + newline+=i + newline+=" " + newline+="\n" + logging.debug(" New grub menu.lst line:") + logging.debug( newline) + newgrub.append(newline) + else: + logging.debug("Line didn't match, adding to newgrub:") + logging.debug( line) + newgrub.append( line) + logging.info("Writing out new grub file") + logging.debug("______This is the new grub_____") + f = open(grubfile, 'w') + for line in newgrub: + logging.debug(line) + f.write(line) + f.close() + except: + logging.debug("Couldn't open grub file") + +def fix_permissions(): + logging.info("Fixing permissions") + SE = os.environ["TEMPLATES"]+"/settings/syssettings" + cmd = " chmod -R 755 %s" %(data_config.MOUNTPOINT+SE) + runcmd(cmd) + cmd = " chmod 775 %s" %(data_config.MOUNTPOINT+"/etc/systemconfig") + runcmd(cmd) + cmd = " chmod 755 %s" %(data_config.MOUNTPOINT+"/root") + runcmd(cmd) + cmd = " chown root:mythtv %s" %(data_config.MOUNTPOINT+"/etc/systemconfig") + runcmd(cmd) + cmd = " chown -R mythtv:mythtv %s" %(data_config.MOUNTPOINT+SE) + runcmd(cmd) + cmd = " chown -R mythtv:mythtv %s" %(data_config.MOUNTPOINT+"/var/log/mythtv") + runcmd(cmd) + +def apply_new_auth(): + logging.info("_____Applying Password updates_______") + passfile = "/root/myth_user_call.out" + try: + MVROOT = os.environ["MV_ROOT"] + except: + logging.debug("MVROOT was not defined, using the default value") + MVROOT = "/usr/MythVantage" + if data_config.NOOPDEBUG == "FALSE": + cmdprefix = "chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i " + else: + cmdprefix = "echo chroot " + data_config.MOUNTPOINT + " " + MVROOT+"/bin/myth_user_call -i " + try: + f = open(passfile, 'r') + passcmds = f.readlines() + f.close() + for cmd in passcmds: + execmd = cmdprefix+cmd +# Using os.system because runcmd fails + logging.debug(execmd) + os.system(execmd) + except: + logging.debug("Applying password updates failed, couldn't open %s", passfile) + logging.debug + +def add_to_blacklist(module): + rcfile = data_config.MOUNTPOINT + "/etc/rc.conf" + logging.debug(" Attempting to add %s to blacklist", module) + newline='' + try: + f = open(rcfile, 'r') + conflines = f.readlines() + f.close() + except: + logging.critical(" *Couldn't open %s for reading",rcfile) + return + + try: + f = open(rcfile, 'w') + except: + logging.critical(" *Couldn't open %s for reading",rcfile) + return + + for line in conflines: + newline = line + if re.match("MOD_BLACKLIST",line): + logging.debug(line) + try: + lastpar = line.rindex(')') + logging.debug(" found ) at %s", lastpar) + newline = line[:lastpar] +" !" + module + " " + line[lastpar:] + logging.debug(newline) + except: + logging.debug("Couldn't find ending )") + newline = line + f.write(newline) + f.close() + + +def add_to_modulelist(module): + rcfile = data_config.MOUNTPOINT + "/etc/rc.conf" + logging.debug(" Attempting to add %s to modulelist", module) + newline='' + try: + f = open(rcfile, 'r') + conflines = f.readlines() + f.close() + except: + logging.critical(" *Couldn't open %s for reading",rcfile) + return + + try: + f = open(rcfile, 'w') + except: + logging.critical(" *Couldn't open %s for reading",rcfile) + return + + for line in conflines: + newline = line + if re.match("MODULES=",line): + logging.debug(line) + try: + lastpar = line.rindex(')') + logging.debug(" found ) at %s", lastpar) + newline = line[:lastpar] +" " + module + " " + line[lastpar:] + logging.debug(newline) + except: + logging.debug("Couldn't find ending )") + newline = line + f.write(newline) + f.close() + + + +def special_hardware_check(): + logging.info("_____Applying special boot parameters_______") + try: + f = open('/proc/cmdline', 'r') + bootoptions = f.readlines() + f.close() + except: + logging.critical(" *Couldn't open /proc/cmdline") + return + bootoptions = bootoptions[0].split() + logging.debug(" Boot options: %s", bootoptions) + for item in bootoptions: + logging.debug(item) + if re.match("disablemodules",item) != None : + logging.debug(" Found disabledmodules") + modulelist = item.split("=")[1] + for module in modulelist.split(','): + add_to_blacklist(module) + + if re.match("modules",item) != None : + logging.debug(" Found modules") + modulelist = item.split("=")[1] + for module in modulelist.split(','): + add_to_modulelist(module) + + if re.match("type",item) != None : + logging.debug(" Found special hardware type") + try: + typefile = open(data_config.MOUNTPOINT + "/myth/.special_hardware_type", 'w') + typelist = item.split("=")[1] + # there should be only one special hardware type, but this will handle multiples, just in case + for type in typelist.split(','): + typefile.write(type) + typefile.write("\n") + typefile.close() + except: + logging.debug("Couldn't write to file: ", typefile) + + +def swapsearch(): +#currently unused! + partlist = [] + stddir = os.getcwd() + os.chdir("/sys/block") + partitionlist = glob.glob("*") + for item in partitionlist: + try: + newitem = item.strip().rpartition(" ")[2] + if (not newitem == '') and (not newitem.startswith("loop")): + path = "/dev/"+newitem.strip() + path = path.strip() + device = parted.getDevice(path) + (cylinders, heads, sectors) = device.biosGeometry + sizeInBytes = device.length * device.sectorSize + disk = parted.Disk(device) + for partition in disk.partitions: + if partition.type == parted.PARTITION_PROTECTED or \ + partition.type == parted.PARTITION_METADATA or \ + partition.type == parted.PARTITION_FREESPACE: + continue + + partlist.append((partition, + partition.path, + partition.getFlag(parted.PARTITION_BOOT), + partition.geometry.start, + partition.geometry.end, + partition.geometry.length, + partition.type, + partition.fileSystem)) + for slice in partlist: + (partition, path, bootable, start, end, length, type, fs) = slice + if partition.getFlag(parted.PARTITION_SWAP) or fs.type == "linux-swap": + print "found swap" + print path + except: + pass + os.chdir(stddir) + +def sane_settings(file): + #Remove some settings from file_name + removeline = ("HOSTrootfstype", "HOSTrootfstype", "HOSTdatafstype", "HOSTOSsize", "HostUseALLdata", "HOSTDATAsize", "HOSTuprootfstype", "HostUseSWAP", "HOSTSWAPsize") + logging.debug("__Running sane settings") + try: + f = open(file, 'r') + filecontents = f.readlines() + f.close() + except: + logging.debug(" Couldn't find file %s to sane", file) + try: + f = open(file, 'w') + for line in filecontents: + for item in removeline: + if line.startsize(line.strip()): + logging.debug(" Found a line to remove in %s, %s", file, line) + else: + f.write(line) + except: + logging.debug(" Couldn't open file %s for writing", file) + logging.debug(" __End sane settings") + +def restore_default_settings(): + try: + MVROOT = os.environ["MV_ROOT"] + except: + logging.debug(" MVROOT was not defined, using the default value") + MVROOT = "/usr/MythVantage" + logging.info("Saving syssettings") + cmd = "%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT, data_config.MVHOSTNAME) + runcmd(cmd) + SE = os.environ["TEMPLATES"]+"/settings/syssettings/" + cp_and_log(SE, data_config.MOUNTPOINT+SE) + cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab") + copy_updates() + fix_permissions() + +def full_install(hostoptions): + logging.info("______Start of full install______") + try: + MVROOT = os.environ["MV_ROOT"] + except: + logging.debug(" MVROOT was not defined, using the default value") + MVROOT = "/usr/MythVantage" + + try: + os.remove("/tmp/.this_is_upgrade") + except OSError: + logging.debug(" File /tmp/.this_is_upgrade not present, couldn't delete it") + pass +# Partition disk + statusmsg = "Partitioning %s" %( hostoptions["rootdisk"]) + update_status(statusmsg) + progress(1) + if data_config.NOOPDEBUG == "FALSE": + partition_disk() + else: + logging.debug(" Debug mode, skipping partitioning step") + +# Format disk + statusmsg = "Preparing %s" %( hostoptions["rootdisk"]) + update_status(statusmsg) + progress(2) + format_disk("install") + + +# Mount partitions + statusmsg = "Mounting %s" %( hostoptions["rootdisk"]) + update_status(statusmsg) + progress(3) + mount_it() + +# Find number of bytes written to disk before starting copy. This is used +# to have a somewhat decent progress indication. + statgrab( hostoptions["rootdisk"]) + msg = "Creating %s" %(systemconfig["hostname"]) + update_status(msg) + +# Copy system to disk + copy_it("install") +# Remove old fstab so that a new one is created + fstabfile = data_config.MOUNTPOINT+"/etc/fstab" + try: + os.remove(fstabfile) + except OSError: + logging.debug(" ERROR: deleting %s", fstabfile) + fstab_it("full_install") +# Configure system + msg = "Configuring system" + update_status(msg) + progress(98) + grub_it() + special_hardware_check() +# Configuring the system + logging.info("______Configuring system________") + cp_and_log("/etc/systemconfig", data_config.MOUNTPOINT+"/etc/systemconfig") + cp_and_log("/root/xorg.conf.install", data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install") + restore_default_settings() + #try: + #MVROOT=os.environ["MV_ROOT"] + #except: + #logging.debug(" MVROOT was not defined, using the default value") + #MVROOT="/usr/MythVantage" + #logging.info("Saving syssettings") + #cmd="%s/bin/restore_default_settings.sh -c save -t syssettings -h %s -d localhost" %(MVROOT, data_config.MVHOSTNAME) + #runcmd(cmd) + #SE=os.environ["TEMPLATES"]+"/settings/syssettings" + #cp_and_log(SE, data_config.MOUNTPOINT+SE) + #cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab") + #cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin/", "*.sh") + #cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin/", "*.py") + #fix_permissions() + mount_bind_chroot() + apply_new_auth() + umount_bind_chroot() + if ( systemconfig["SystemType"] == "Master_backend" or systemconfig["SystemType"] == "Standalone" ): +# This install will need a DB, so install it + logging.info("______Installing Database in CHROOT________") + mysqldb("stop", '') + mount_bind_chroot() + cmd = " chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT, MVROOT) + runcmd(cmd) + logging.info("Running systemconfig in chroot") + #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + cmd = "chroot %s %s/bin/systemconfig.sh all,this_is_install" %(data_config.MOUNTPOINT, MVROOT) + rc = runcmd(cmd)[0] + if rc != 0 : + error_out("Running systemconfig") + + mysqldb("stop", "chroot") + kill_dhcp_chroot() + logging.info("____End Database in CHROOT____") + mysqldb("start", '') + umount_bind_chroot() + else: + logging.info("______No database required, continuing configuration________") + mount_bind_chroot() + cmd = " chroot %s DISPLAY=127.0.0.1:0 %s/bin/MythVantage -t restore, default 1" %(data_config.MOUNTPOINT, MVROOT) + runcmd(cmd) +# Need to check for to touch /tmp/.dbsysfailed + cmd = " chroot %s %s/bin/restore_default_settings.sh -c restore -t syssettings " %(data_config.MOUNTPOINT, MVROOT) + runcmd(cmd) + if ( 'x' == '1' ): + logging.debug("touching /tmp/.dbsysfailed") + else: + #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + cmd = "chroot %s %s/bin/systemconfig.sh all,this_is_install" %(data_config.MOUNTPOINT, MVROOT) + rc = runcmd(cmd)[0] + if rc != 0 : + error_out("Running systemconfig") + cmd = "chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT, MVROOT) + runcmd(cmd) + umount_bind_chroot() + #cmd = " chroot %s %s/bin/systemconfig.sh advanced, user" %(data_config.MOUNTPOINT, MVROOT) + #runcmd(cmd) + cmd = " touch %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME) + runcmd(cmd) + cmd = " chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME) + runcmd(cmd) + msg = "Done" + update_status(msg) + cp_and_log("/tmp/mythvantage_install.log", data_config.MOUNTPOINT+"/var/log/mythvantage_install.log") + cp_and_log("/tmp/mv_debug.log", data_config.MOUNTPOINT+"/var/log/mv_debug.log") + unmount_it() + logging.debug("_____End of full install_____") + +def find_upgrade(): + logging.info("_____Start of find_upgrade_____") + global hostoptions + #try to mount first partition of disk + #copy old /etc/systemconfig to live, import settings into db + #umount drive. + #check for clean upgrade + if ( clean_upgrade() ): + logging.info("Clean upgrade requested, not using old data") + return + mount_it() + oldbackupfile = data_config.MOUNTPOINT+"/root/backup/"+data_config.BACKUPFILE + newbackupfile = "/tmp/"+data_config.BACKUPFILE + if os.path.exists(oldbackupfile): + logging.debug("Setting backup file to %s", newbackupfile) + hostoptions["backupfile"] = newbackupfile + cp_and_log(oldbackupfile, newbackupfile) + + srcfile = data_config.MOUNTPOINT+"/etc/systemconfig" + logging.info("Searching for systemconfig file %s", srcfile) + if os.path.exists(srcfile): + logging.info("Found systemconfig file %s", srcfile) + TEMPLATES = os.environ["TEMPLATES"]+"/settings/syssettings" + cp_and_log2(data_config.MOUNTPOINT+TEMPLATES, data_config.TEMP_TEMPLATES, '') + sane_settings("/tmp/templates/settings/syssettings/settings.txt") + cp_and_log2(data_config.TEMP_TEMPLATES, TEMPLATES, '') + cp_and_log(srcfile, "/etc/systemconfig") + cp_and_log(data_config.MOUNTPOINT+"/etc/", "/tmp/etc/") + cp_and_log(data_config.MOUNTPOINT+"/var/lib/alsa/", "/tmp/alsa") + cp_and_log(data_config.MOUNTPOINT+"/var/lib/oss/", "/tmp/oss") + cp_and_log("/tmp/etc/mdadm.conf", "/etc/mdadm.conf") + else: + logging.info("Could not find systemconfig file %s", srcfile) + cp_and_log(data_config.MOUNTPOINT+"/etc/", "/tmp/etc/") + cp_and_log(data_config.MOUNTPOINT+"/var/lib/alsa/", "/tmp/alsa") + cp_and_log("/tmp/etc/mdadm.conf", "/etc") + timezone_to_db("/tmp/etc/timezone") + unmount_it() + logging.debug("End of find_upgrade") + +def upgrade_mount_search(): + #Search for data/myth partition based on contents of fstab + logging.debug("______Start of upgrade_mount_search_____") + cmd = "umount %s%s" %(data_config.MOUNTPOINT, data_config.DATAMOUNT) + runcmd(cmd) + fstab_list = [] + fstab_data_mount = '' + try: + f = open("/tmp/etc/fstab", 'r') + oldfscontents = f.readlines() + f.close() + ## ['UUID=', '/myth', 'auto', 'defaults, noatime', '0', '1'] + #for line in oldfscontents: + #mountdir=line.split() + #if mountdir[1] == (data_config.DATAMOUNT): + #fstablist.append(mountdir) + except: + logging.debug(" Couldn't open /tmp/etc/fstab") + for line in oldfscontents: + if line.startswith("#"): + continue + mountdir=line.split() + try: + if mountdir[1] == (data_config.DATAMOUNT): + fstablist.append(mountdir) + except: + continue + #search fstab for data/myth mountpoint + for i in fstab_list: + if i[1] == data_config.DATAMOUNT: + fstab_data_mount = i[0] + break + + #start software raid support if needed + for i in fstab_list: + if i[0].startswith("/dev/md"): + logging.debug(" starting software raid support") + mdadm_assemble_all + + + if re.search("UUID", fstab_data_mount): + fstab_data_uuid = fstab_data_mount.split("=")[1] + cmd = "blkid -t UUID=%s" %fstab_data_uuid + retcode = call(cmd, shell=True) + if retcode != 0: + logging.debug(" Couldn't find uuid %s, starting md support", fstab_data_uuid) + mdadm_assemble_all + #hoping everything is up and running and data/myth will be available for mount + cmd = "mount -U %s %s" %(fstab_data_uuid, data_config.MOUNTPOINT) + runcmd(cmd) + cmd = "blkid -t UUID=%s|cut -d: -f1" %fstab_data_uuid + logging.debug(cmd) + datadisk = commands.getoutput(cmd) + cmd = "basename %s" %datadisk + datadisk = commands.getoutput(cmd) + else: + cmd = "mount %s %s" %(fstab_data_mount, data_config.MOUNTPOINT) + runcmd(cmd) + cmd = "basename %s" %fstab_data_mount + datadisk = commands.getoutput(cmd) + time.sleep(3) +# hostoptions["backupfile"]=data_config.BACKUPPATH+data_config.BACKUPFILE + if not backup_sql_check(): + newbackupfile = "/tmp/"+data_config.BACKUPFILE + if os.path.exists(newbackupfile): + logging.debug("Setting backup file to %s", newbackupfile) + cp_and_log(newbackupfile, data_config.MOUNTPOINT+newbackupfile) + hostoptions["backupfile"] = newbackupfile + else: + logging.info("Couldn't find any database to restore, upgrade will continue with a new database") + + + +def upgrade(hostoptions): + + try: + MVROOT = os.environ["MV_ROOT"] + except: + logging.debug("MVROOT was not defined, using the default value") + MVROOT = "/usr/MythVantage" + logging.info("______Start of upgrade______") + cmd = "touch /tmp/.this_is_upgrade" + runcmd(cmd) + if hostoptions["rootfs"] == "Do_not_format": + logging.info("Will not format root filesystem") + else: + statusmsg = "Preparing %s" %( hostoptions["rootdisk"]) + update_status(statusmsg) + progress(2) + format_disk("upgrade") + #sys.exit(2) + statusmsg = "Mounting %s" %( hostoptions["rootdisk"]) + update_status(statusmsg) + progress(3) + mount_it() + hostoptions["backupfile"] = data_config.BACKUPPATH+data_config.BACKUPFILE + statgrab( hostoptions["rootdisk"]) + msg = "Upgrading %s" %(systemconfig["hostname"]) + update_status(msg) + time.sleep(3) + copy_it("upgrade") + cmd = "rm -rf %s/etc.old" %data_config.MOUNTPOINT + runcmd(cmd) + cmd = "rm -rf %s/alsa.old" %data_config.MOUNTPOINT + runcmd(cmd) + + cp_and_log("/tmp/etc/", data_config.MOUNTPOINT+"/etc.old/") + cp_and_log("/tmp/alsa/", data_config.MOUNTPOINT+"/alsa.old/") + cp_and_log("/tmp/oss", data_config.MOUNTPOINT+"/var/lib/oss.old") + + srcfile = "%s/etc.old/ssh/" %(data_config.MOUNTPOINT) + destfile = "%s/etc/ssh/" %(data_config.MOUNTPOINT) + cp_and_log2(srcfile, destfile, '*.pub') + cp_and_log2(srcfile, destfile, '*.key') + cp_and_log2(srcfile, destfile, '*key') + + mdfile = mdadm_find("/tmp") + cp_and_log("/tmp"+mdfile, data_config.MOUNTPOINT+"/etc") + + srcfile = "%s/etc.old/asound.conf" %(data_config.MOUNTPOINT) + destfile = "%s/etc/asound.conf" %(data_config.MOUNTPOINT) + cp_and_log(srcfile, destfile) + + # R5.5 -> R6 + srcfile = "%s/alsa.old/asound.state" %(data_config.MOUNTPOINT) + destfile = "%s/etc/asound.state" %(data_config.MOUNTPOINT) + cp_and_log(srcfile, destfile) + # R6 -> R6 + srcfile = "%s/etc.old/asound.state" %(data_config.MOUNTPOINT) + destfile = "%s/etc/asound.state" %(data_config.MOUNTPOINT) + cp_and_log(srcfile, destfile) + + srcfile = "%s/etc.old/mplayer/mplayer.conf" %(data_config.MOUNTPOINT) + destfile = "%s/etc/mplayer/mplayer.conf" %(data_config.MOUNTPOINT) + cp_and_log(srcfile, destfile) + + if not os.path.exists("/tmp/etc/KnoppMyth-version"): + logging.debug(" standard upgrade, restoring auth files") + cp_and_log(data_config.MOUNTPOINT+"/etc.old/passwd", data_config.MOUNTPOINT+"/etc/passwd") + cp_and_log(data_config.MOUNTPOINT+"/etc.old/shadow", data_config.MOUNTPOINT+"/etc/shadow") + cp_and_log(data_config.MOUNTPOINT+"/etc.old/group", data_config.MOUNTPOINT+"/etc/group") + msg = "Configuring system" + + update_status(msg) + progress(98) + logging.info("______Configuring system________") + cp_and_log("/etc/systemconfig", data_config.MOUNTPOINT+"/etc/systemconfig") + if not backup_sql_check(): + upgrade_mount_search() + fstab_it("upgrade") + time.sleep(1) + grub_it() + time.sleep(1) + #needed to get around a bug with pacman + special_hardware_check() + cp_and_log("/root/xorg.conf.install", data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install") + cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab") + if clean_upgrade() or os.path.exists("/tmp/etc/KnoppMyth-version"): + logging.debug("clean upgrade or knoppmyth upgrade detected, running restore settings") + restore_default_settings() + if clean_upgrade(): + file = "%s/%s/.kmupgrade" %(data_config.MOUNTPOINT, data_config.MYTHHOME) + cmd = "touch %s && chmod 777 %s" %(file, file) + runcmd(cmd) + copy_updates() + fix_permissions() + mount_bind_chroot() + logging.info("Running systemconfig in chroot") + #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + cmd = "chroot %s %s/bin/systemconfig.sh all,this_is_install" %(data_config.MOUNTPOINT, MVROOT) + rc = runcmd(cmd)[0] + if rc != 0 : + error_out("Running systemconfig") + mysqldb("stop", "") + if ( systemconfig["SystemType"] == "Master_backend" or systemconfig["SystemType"] == "Standalone" ): + if clean_upgrade() or not backup_sql_check(): + logging.info("Installing new database") + cmd = " chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT, MVROOT) + runcmd(cmd) + else: + logging.info("Restoring database") + cmd = " chroot %s %s/bin/restore_km_db_chroot.sh %s|tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT, MVROOT, hostoptions["backupfile"]) + runcmd(cmd) + + if os.path.exists("/tmp/etc/KnoppMyth-version"): + cmd = " chroot %s %s/bin/restore_default_settings.sh -c restore -t hostsettings " %(data_config.MOUNTPOINT, MVROOT) + runcmd(cmd) + logging.debug("Correcting permissions because of km->linhes upgrade") + cmd = " chown -R mythtv:mythtv %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT) + runcmd(cmd) + cmd = " chown -R root:root %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT+"/backup") + runcmd(cmd) + else: + cmd = " chroot %s %s/bin/restore_default_settings.sh -c restore -t syssettings " %(data_config.MOUNTPOINT, MVROOT) + runcmd(cmd) + + logging.info("Running systemconfig in chroot 2nd time") + #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + cmd = "chroot %s %s/bin/systemconfig.sh all,this_is_install" %(data_config.MOUNTPOINT, MVROOT) + rc = runcmd(cmd)[0] + if rc != 0 : + error_out("Running systemconfig") + #logging.info("Running systemconfig in chroot") + #cmd = " chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT, MVROOT) + #runcmd(cmd) + mysqldb("stop", 'chroot') + apply_new_auth() + kill_dhcp_chroot() + umount_bind_chroot() + cp_and_log("/tmp/mythvantage_install.log", data_config.MOUNTPOINT+"/var/log/mythvantage_install.log") + cp_and_log("/tmp/mv_debug.log", data_config.MOUNTPOINT+"/var/log/mv_debug.log") + unmount_it() + msg = "Done" + update_status(msg) + mysqldb("start", '') + + + + +def main(argv): + global hostoptions + try: + opts, args = getopt.getopt(argv, 'c:h', ["help", "rootdisk=", "rootfs=", "rootsize=", "datafs=", "datasize=", "datadisk=", "swapsize=", "datapartition=" ] ) + except getopt.GetoptError, why: + print why + usage() + sys.exit(2) + hostoptions = {"op": 'null'} + for opt, arg in opts: + if opt in ("-h", "--help"): + usage() + sys.exit(0) + elif opt in ( "--rootdisk"): + hostoptions["rootdisk"] = arg + hostoptions["rootpartition"] = arg+str(1) + elif opt in ("--rootfs"): + hostoptions["rootfs"] = arg + elif opt in ("--rootsize"): + hostoptions["rootsize"] = arg + elif opt in ("--datafs"): + hostoptions["datafs"] = arg + elif opt in ("--datasize"): + hostoptions["datasize"] = arg + elif opt in ("--datadisk"): + hostoptions["datadisk"] = arg + elif opt in ("--datapartition"): + hostoptions["datapartition"] = arg + elif opt in ("--swapsize"): + hostoptions["swapsize"] = arg + + elif opt in ("-c"): + validop = ["full_install", "upgrade", "netboot", "find_upgrade"] + if arg not in validop: + logging.critical("-c %s is not a valid option", arg) + sys.exit(2) + else: + hostoptions["op"] = arg + try: + hostoptions["datadisk"] + except: + hostoptions["datadisk"] = hostoptions["rootdisk"] + hostoptions["datapartition"] = hostoptions["datadisk"]+str(3) + try: + hostoptions["datapartition"] + except: + hostoptions["datapartition"] = hostoptions["datadisk"]+str(3) + hostoptions["swappartition"] = hostoptions["rootdisk"] + str(2) + + + if ( hostoptions["op"] == "full_install" ) : + full_install(hostoptions) + elif (hostoptions["op"] == "upgrade" ) : + hostoptions["datafs"] = "no_format" + find_upgrade() + upgrade(hostoptions) + elif (hostoptions["op"] == "find_upgrade" ) : + find_upgrade() + return hostoptions + + +#____________________________________________setup the logging______________________________________________________ +LOG_FILENAME = '/tmp/mv_status.log' +DEBUGLOG = '/tmp/mv_debug.log' +logging.basicConfig(level=logging.DEBUG, + format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', + datefmt='%m-%d %H:%M', + filename=DEBUGLOG, + filemode='a') +# define a Handler which writes INFO messages or higher to the sys.stderr +console = logging.StreamHandler() +console.setLevel(logging.INFO) +# set a format which is simpler for console use +#formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') +formatter = logging.Formatter("%(message)s") +# tell the handler to use this format +console.setFormatter(formatter) +# add the handler to the root logger +logging.getLogger('').addHandler(console) + +#infoformatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") +infoformatter = logging.Formatter("%(message)s") +infofile = logging.FileHandler(LOG_FILENAME, 'w') +infofile.setFormatter(infoformatter) +infofile.setLevel(logging.INFO) +logging.getLogger('').addHandler(infofile) + +#Read in systemconfig +global systemconfig +systemconfig = {} +file_name = "/etc/systemconfig" +try: + config_file = open(file_name) +except: + logging.debug("%s could not be opened", file_name) + config_file = '' + +for line in config_file: + line = line.strip() + if line and line[0] is not "#" and line[-1] is not "=": + var, val = line.rsplit("=", 1) + val = val.strip('"') + systemconfig[var.strip()] = val.strip() + + +if __name__ == "__main__": + config_file = "mv_config" + data_config = __import__(config_file, globals(), locals(), []) + logging.debug("___________START OF DEBUG_________________________") + cmdoptions = main(sys.argv[1:]) + logging.debug("______cmd line options______") + for i in cmdoptions.items(): + logging.debug (i) + logging.debug("______systemconfig______") + for i in systemconfig.items(): + logging.debug(i) + logging.debug("______hostoptions______") + for i in hostoptions.items(): + logging.debug(i) + pass + diff --git a/abs/mv-core/MythVantage-config/mv_ir.py b/abs/mv-core/MythVantage-config/mv_ir.py new file mode 100755 index 0000000..bc1ae37 --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_ir.py @@ -0,0 +1,330 @@ +# -*- coding: utf-8 -*- +import logging, mv_common +import os, re , glob +from time import time, localtime, strftime +import time +import pwd + +def setup_lirc_links(mythhome): + logging.debug(" Creating links for lirc") + try: + mythuid = pwd.getpwnam('mythtv')[2] + mythgid = pwd.getpwnam('mythtv')[3] + except: + logging.critical("* mythuid not found") + mythuid = '1000' + mythgid = '1000' + if not os.path.exists(mythhome+"/.mythtv"): + logging.debug(" Creating %s/.mythtv",mythhome) + try: + os.mkdir(mythhome+"/.mythtv") + except: + logging.debug(" Couldn't create .mythtv ") + return + try: + os.chown(mythhome+"/.mythtv", mythuid, mythgid) + logging.debug("* Couldn't chown of %s", mythhome) + except: + cmd = ''' chown -R mythtv %s/.mythtv''' %mythhome + mv_common.runcmd(cmd) + cmd = ''' chgrp -R mythtv %s/.mythtv''' %mythhome + mv_common.runcmd(cmd) + pass + + if os.path.exists("/etc/lircrc"): + if not os.path.exists(mythhome+"/.mythtv/lircrc"): + logging.debug(" Creating symlink for myth lircrc") + os.symlink("/etc/lircrc",mythhome+"/.mythtv/lircrc") + else: + logging.debug(" %s/lircrc already present",mythhome) + + if not os.path.exists(mythhome+"/.lircrc"): + logging.debug(" Creating symlink for lircrc") + os.symlink("/etc/lircrc",mythhome+"/.lircrc") + else: + logging.debug(" %s/.lircrc already present",mythhome) + else: + logging.debug(" /etc/lircrc does not exisit, can not link it") + +def scrub_modules(filename,module): + logging.debug(" scrubbing %s from %s",module,filename) + cmd = '''sed -i -e '/.*#%s/d' %s''' %(module,filename) + mv_common.runcmd(cmd) + +def add_module(filename,module): + logging.debug(" adding %s to %s",module,filename) + cmd = ''' echo "%s" >> %s ''' %(module,filename) + mv_common.runcmd(cmd) + +def unload_all_lirc(): + logging.debug(" Unloading all lirc modules") + cmd = "sv stop lircd" + mv_common.runcmd(cmd) + cmd = "killall -9 lircd" + mv_common.runcmd(cmd) + cmd = '''modprobe -r $(lsmod |grep ^lirc |awk '{print $1}') ''' + mv_common.runcmd(cmd) + + + +def include_file( incfile,filename): + logging.debug(" including %s within %s",filename,incfile) + try: + f = open( incfile, 'a') + except: + logging.debug(" Couldn't open %s for writing",incfile) + return + line = '''include "%s" ''' %filename + logging.debug(" %s",line) + f.write(line) + f.write("\n") + f.close() + +def setup_ir_remote(Remotetype,templates): + logging.debug(" Setup of remote type %s",Remotetype) + if Remotetype == "no_remote": + mv_common.remove_service("lircd") + elif Remotetype == "tinker": + pass + else: + currenttime = strftime("%b-%d-%Y-%H:%M:%S", localtime()) + cmd = "mv /etc/lircd.conf /etc/lircd.conf-%s" %currenttime + mv_common.runcmd(cmd) + cmd = "mv /etc/lircrc /etc/lircrc-%s" %currenttime + mv_common.runcmd(cmd) + files = templates + "/remotes/" + Remotetype + "/lircd*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircd.conf",filename) + files = templates + "/remotes/" + Remotetype + "/lircrc*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircrc",filename) + cmd = "chmod 755 /etc/lircrc" + mv_common.runcmd(cmd) + mv_common.add_service("lircd") + + +def setup_ir_receiver(ReceiverType,TEMPLATES): + logging.info(" Configuring receiver %s", ReceiverType) + if ReceiverType == "Serial": + scrub_modules("/etc/modules.mythvantage","lirc") + add_module("/etc/modules.mythvantage","lirc_serial #lirc") + cmd = "load-modules-mythvantage.sh" + mv_common.runcmd(cmd) + mv_common.remove_service("igdaemon") + mv_common.remove_service("tatir") + + elif ReceiverType == "Usb-imon": + scrub_modules("/etc/modules.mythvantage","lirc") + add_module("/etc/modules.mythvantage","lirc_imon #lirc") + cmd = "load-modules-mythvantage.sh" + mv_common.runcmd(cmd) + mv_common.remove_service("igdaemon") + mv_common.remove_service("tatir") + + elif ReceiverType == "Hauppauge": + scrub_modules("/etc/modules.mythvantage","lirc") + add_module("/etc/modules.mythvantage","lirc_i2c #lirc") + mv_common.cp_and_log(TEMPLATES+"/modules/lirc_i2c.conf" , + "/etc/modprobe.d/lirc_i2c.conf") + cmd = "rmmod lirc_i2c" + mv_common.runcmd(cmd) + cmd = "load-modules-mythvantage.sh" + mv_common.runcmd(cmd) + mv_common.remove_service("igdaemon") + mv_common.remove_service("tatir") + elif ReceiverType == "pvr150": + scrub_modules("/etc/modules.mythvantage","lirc") + add_module("/etc/modules.mythvantage","lirc_i2c #lirc") + mv_common.cp_and_log(TEMPLATES+"/modules/lirc_i2c.conf" , + "/etc/modprobe.d/lirc_i2c.conf") + cmd = "rmmod lirc_i2c" + mv_common.runcmd(cmd) + cmd = "load-modules-mythvantage.sh" + mv_common.runcmd(cmd) + mv_common.remove_service("igdaemon") + mv_common.remove_service("tatir") + elif ReceiverType == "iguanaIR-usb": + scrub_modules("/etc/modules.mythvantage","lirc") + mv_common.add_service("igdaemon") + mv_common.remove_service("tatir") + + elif ReceiverType == "tatir": + scrub_modules("/etc/modules.mythvantage","lirc") + mv_common.add_service("tatir") + mv_common.remove_service("igdaemon") + + else: + logging.debug(" didn't match receiver, using genric case") + scrub_modules("/etc/modules.mythvantage","lirc") + mv_common.remove_service("igdaemon") + mv_common.remove_service("tatir") + +def setup_blaster_proto(HostBlasterType,Hostnumblaster,TEMPLATES,systemconfig): + logging.debug(" Start of setup_blaster_proto") + logging.debug(" HostBlasterType: %s", HostBlasterType) + logging.debug(" Hostnumblaster: %s" , Hostnumblaster) + if not HostBlasterType == "pvr150" and not HostBlasterType == "None": + for i in range(int(Hostnumblaster)): + try: + proto = systemconfig["HostTransmitproto_"+str(i+1)] + logging.debug(" proto: %s",proto) + except: + logging.info(" unkown proto for %s",i+1) + continue + template=TEMPLATES+"/transmit/%s/lircd.conf" %proto + if os.path.exists(template): + logging.debug(" include blaster template: %s",proto) + include_file("/etc/lircd.conf",template) + else: + logging.debug(" template: %s is not present",template) + logging.info("------NEED TO SETUP CHANGE_CHANNEL------") + + +def setup_blaster_transmiter(HostBlasterType): + logging.debug(" Start of setup_blaster_transmiter") + logging.info(" HostBlasterType : %s", HostBlasterType) + + if HostBlasterType == "Receiver": + logging.info(" Blaster is receiver, skipping module config for Blaster") + return + + if HostBlasterType == "no blaster": + scrub_modules("/etc/modules.mythvantage","blaster") + elif HostBlasterType == "Serial": + scrub_modules("/etc/modules.mythvantage","blaster") + add_module("/etc/modules/.mythvantage","lirc_serial #blaster") + cmd = "load-modules-mythvantage.sh" + mv_common.runcmd(cmd) + elif HostBlasterType == "pvr150": + scrub_modules("/etc/modules.mythvantage", "blaster") + scrub_modules("/etc/modules.mythvantage", "lirc") + add_module("/etc/modules.mythvantage", "lirc_pvr150 #blaster") + add_module("/etc/modules.mythvantage", "lirc_pvr150 #lirc") + cmd = "rmmod lirc_i2c" + mv_common.runcmd(cmd) + cmd = "load-modules-mythvantage.sh" + mv_common.runcmd(cmd) + else: + scrub_modules("/etc/modules.mythvantage","blaster") + +def setup_lcd(LCDtype, TEMPLATES, Remotetype): + logging.debug("____Start of setup_lcd____") + logging.debug(" LCDType: %s", LCDtype) + logging.debug(" Remotetype: %s", Remotetype) + if LCDtype == "tinker": + logging.info(" tinker mode detected") + return + + if LCDtype == "no_lcd": + logging.info(" Disabling LCD support") + cmd = "sv stop lcdd" + mv_common.runcmd(cmd) + #sometimes it doesn't want to die + cmd = "killall -9 LCDd" + mv_common.runcmd(cmd) + cmd = "load-modules-mythvantage.sh UNLOAD LCD" + mv_common.runcmd(cmd) + scrub_modules("/etc/modules.mythvantage", "LCD") + mv_common.remove_service("lcdd") + else: + lcdmodule="%s/LCD/%s/modules" %(TEMPLATES,LCDtype) + if os.path.exists(lcdmodule): + logging.debug(" Adding module for LCD") + scrub_modules("/etc/modules.mythvantage", "LCD") + cmd = "cat %s >> /etc/modules.mythvantage" %lcdmodule + mv_common.runcmd(cmd) + if Remotetype != "tinker": + lcdconf = "%s/LCD/%s/LCDd.conf" %(TEMPLATES,LCDtype) + lcdlirc = "%s/LCD/%s" %(TEMPLATES,LCDtype) + mv_common.pacinstall("lcdproc") + if os.path.exists(lcdconf): + logging.debug(" Copying in lcdconf template file: %s",lcdconf) + mv_common.cp_and_log(lcdconf, "/etc/LCDd.conf") + else: + logging.debug(" %s is not present, will not copy it") + + if os.path.exists(lcdlirc+"/lircrc"): + logging.debug(" LCD seems to support lirc") + #setup the lirc aspect of the lcd + #copied from setup_ir_remote + files = lcdlirc+"/lircd*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircd.conf",filename) + files = lcdlirc+"/lircrc*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircrc",filename) + cmd = "chmod 755 /etc/lircrc" + mv_common.runcmd(cmd) + + mv_common.add_service("lcdd") + mv_common.restart_service("lcdd") + logging.debug("__End of setup_lcd") + +def setup_ir(systemconfig, data_config): + rc = False + logging.info("____Start of IR____") + if systemconfig["Remotetype"] == "tinker": + logging.info(" Tinker mode detected") + else: + if not systemconfig["HostBlasterType"]: + HostBlasterType = "unknown" + Hostnumblaster = "0" + else: + HostBlasterType = systemconfig["HostBlasterType"] + Hostnumblaster = systemconfig["Hostnumblaster"] + + if systemconfig["HostBlasterType"] == "pvr150": + remotetype = "hauppauge-blaster" + logging.debug(" pvr150 blaster selected, setting remote to hauppauge-blaster") + else: + remotetype = systemconfig["Remotetype"] + + setup_ir_remote(remotetype,systemconfig["TEMPLATES"]) + setup_lirc_links(data_config.MYTHHOME) + + if systemconfig["ReceiverType"]: + setup_ir_receiver(systemconfig["ReceiverType"], + systemconfig["TEMPLATES"]) + else: + setup_ir_receiver("unknown", systemconfig["TEMPLATES"]) + unload_all_lirc() + setup_blaster_proto(HostBlasterType, + Hostnumblaster, + systemconfig["TEMPLATES"], + systemconfig) + setup_blaster_transmiter(HostBlasterType) + cmd = "load-modules-mythvantage.sh" + mv_common.runcmd(cmd) + time.sleep(2) + mv_common.udev_trigger() + cmd="sv start lircd" + mv_common.runcmd(cmd) + rc = [ True , True ] + if systemconfig["LCDtype"]: + setup_lcd(systemconfig["LCDtype"], + systemconfig["TEMPLATES"], + systemconfig["Remotetype"]) + else: + logging.debug(" LCD not defined") + logging.info("__End IR\n") + return rc
\ No newline at end of file diff --git a/abs/mv-core/MythVantage-config/mv_misc.py b/abs/mv-core/MythVantage-config/mv_misc.py new file mode 100755 index 0000000..9ea9c95 --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_misc.py @@ -0,0 +1,180 @@ +# -*- coding: utf-8 -*- +import logging, mv_common +import os, re +from urllib2 import Request, urlopen, URLError, HTTPError + +config_file = "mv_config" +data_config = __import__(config_file, globals(), locals(), []) + +def setup_zip(MVROOT,zipcode): + logging.debug("____Setting up the zipcode____") + + if zipcode: + cmd="%s/bin/restore_default_settings.sh -c ZIP -c %s" %(MVROOT,zipcode) + mv_common.runcmd(cmd) + #Let's also speed things up for those in North America + cmd="mkdir /usr/bin/perlbin/vendor/tv_grabbers_non_na" + mv_common.runcmd(cmd) + cmd="mv /usr/bin/perlbin/vendor/tv_grab_* /usr/bin/perlbin/vendor/tv_grabbers_non_na" + mv_common.runcmd(cmd) + cmd="mv /usr/bin/perlbin/vendor/tv_grabbers_non_na/tv_grab_na* /usr/bin/perlbin/vendor/" + mv_common.runcmd(cmd) + else: + logging.debug(" Zipcode is not set") + + logging.debug("__End of zipcode\n") + +def setup_tz(timezone,TEMPLATES): + logging.info("____Setting up the timezone____") + + if not timezone: + timezone="unknown" + logging.info(" Setting timezone to %s",timezone) + mv_common.remove_file("/etc/localtime") + #try: + #logging.debug(" Removing /etc/localtime") + #os.remove("/etc/localtime") + #except: + #logging.debug(" Couldn't remove /etc/localtime") + #pass + + srclink="/usr/share/zoneinfo/%s" %timezone + logging.debug(" symlinking %s to /etc/localtime",srclink) + try: + os.symlink(srclink,"/etc/localtime") + except: + logging.critical(" Couldn't make symlink for /etc/localtime") + cmd = '''sed -e "s/^TIMEZONE=.*$/TIMEZONE=\\"%s\\" /" /etc/rc.conf > $TEMPLATES/rc.conf''' %re.escape(timezone) + mv_common.runcmd(cmd) + + if os.path.exists("/etc/php/php.ini"): + logging.info(" Changing timezone for php") + cmd = '''sed -i "s/^.*date.timezone.*$/date.timezone=%s/" ${BASE}/etc/php/php.ini''' %re.escape(timezone) + mv_common.runcmd(cmd) + + mv_common.cp_and_log(TEMPLATES+"/rc.conf","/etc/rc.conf") + logging.info("__End of timezone\n") + +def setup_nfs(systemconfig): + nfslist=[] + logging.info("____Start of setup_nfs____") + scrubnfs(systemconfig["TEMPLATES"]) + + if systemconfig["HaveCentralNFS"] == "yes": + logging.debug(" Using a Central NFS server") + if systemconfig["NFSserver"] == "file:nfsmap": + #if it's a file check for it, failure results in downloading attempt from MBE + nfsmap_file=data_config.MYTHHOME+"/templates/nfsmap" + if not os.path.exists(nfsmap_file): + logging.debug(" Couldn't find local %s",nfsmap_file) + logging.info(" Trying to download nfsmap from MBE") + nfsmap_file = download_nfsmap(systemconfig["dbhost"]) + nfslist = process_nfsmap_file(nfsmap_file) + # if it's an ip parse ip and download file + elif re.search(systemconfig["NFSserver"],":nfsmap"): + ip=systemconfig["NFSserver"].split(":")[0] + nfsmap_file = download_nfsmap(ip) + nfslist = process_nfsmap_file(nfsmap_file) + #else treat it as a single mount point + else: + item = (systemconfig["NFSserver"] , systemconfig["NFSmount"]) + nfslist.append(item) + else: + #if standalone or slave try to use MBE + if systemconfig["SystemType"] == "Frontend_only" or systemconfig["SystemType"] == "Slave_Backend": + item = (systemconfig["dbhost"] , data_config.DATAMOUNT) + nfslist.append(item) + setup_nfs_fstab(nfslist) + logging.info("__End of nfs\n") + +def setup_sleep(systemconfig): + logging.debug("____Setting up sleep____") + autoshutdown = systemconfig["AutoShutdown"] + stime1 = systemconfig["Shutdowntime"] + stime2 = systemconfig["Shutdowntime2"] + cstime1='' + + if autoshutdown == "1" : + if not stime1 == "-1" : + cstime1 = stime1 + cshutdown = cstime1 + if not stime2 == "-1" : + if cstime1 : + cshutdown = "%s,%s" %(cstime1,stime2) + else: + cshutdown = stime2 + logging.debug(" Shutdown time at %s",cshutdown) + cmd='''sed -e "s/HOUR/%s/g" %s/cron.template | crontab - -u mythtv''' %(cshutdown,systemconfig["TEMPLATES"]) + mv_common.runcmd(cmd) + else: + logging.info(" Shutdown not enabled") + cmd='''sed -e "/00 HOUR.*/d" %s/cron.template | crontab - -u mythtv''' %systemconfig["TEMPLATES"] + mv_common.runcmd(cmd) + + logging.debug("__End of sleep\n") + + +def process_nfsmap_file(mapfile): + logging.debug(" processing nfsmap file %s",mapfile) + nfslist = [] + try: + f = open(mapfile,"r") + for line in f.readlines(): + if line.startswith("#"): + continue + item = line.split() + if len(item) <= 1 : + continue + logging.debug(" %s",item) + nfslist.append(item) + except : + logging.critical("Couldn't read file %s, or some other error",mapfile) + return nfslist + +def scrubnfs(templates): + logging.info(" Scrubbing nfs") + mv_common.cp_and_log("/etc/fstab",templates+"/fstab.conf.template") + #used this sed cmd because it's clean and took me forever to figure out =) + cmd='''sed '/^#STARTSCRUB.*$/,/^#ENDSCRUB.*$/d' %s/fstab.conf.template > /etc/fstab''' %templates + mv_common.runcmd(cmd) + +def download_nfsmap(ip): + nfsmap_file="/tmp/nfsmap" + myurl="http://%s:1337/templates/nfsmap" %ip + req = Request(myurl) + try: + f = urlopen(req) + logging.info(" downloading %s", myurl) + local_file = open(nfsmap_file, "w") + #Write to our local file + local_file.write(f.read()) + local_file.close() + #handle errors + except HTTPError, e: + logging.info(" File download failed") + logging.debug(" %s", myurl) + logging.debug(" HTTP Error: %s", e.code) + except URLError, e: + logging.info(" File download failed") + logging.debug(" %s",myurl) + logging.debug(" URL Error: %s ", e.reason) + + return nfsmap_file + +def setup_nfs_fstab(nfslist): + logging.info(" Adding nfs paths to fstab") + try: + f = open('/etc/fstab', 'a') + line = "#STARTSCRUB --------------anything in this block will be scrubbed\n" + f.write(line) + for s, m in nfslist: + line = "%s %s nfs \n" %(s,m) + logging.debug(" %s",line) + f.write(line) + line = "#ENDSCRUB\n" + f.write(line) + f.close() + except: + logging.critical(" *Couldn't open /etc/fstab for writing") + logging.debug(" Done adding nfs paths to fstab") + diff --git a/abs/mv-core/MythVantage-config/mv_network.py b/abs/mv-core/MythVantage-config/mv_network.py new file mode 100755 index 0000000..3f8de3b --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_network.py @@ -0,0 +1,504 @@ +# -*- coding: utf-8 -*- +import sys , os, commands , glob, time, re +import logging +import mv_common +import socket, fcntl, struct, array +import netifaces, iplib +global etcnetdir +etcnetdir = "/etc/net/ifaces" + +def setup_MYTH_DHCP(systemconfig): + default_interface = systemconfig["default_interface"] + try: + defaultdhcp = systemconfig["HostUSEDHCP"+default_interface] + except: + logging.critical(" *Error occured finding default dhcp") + defaultdhcp = "0" + logging.debug(" Using %s as dhcp value for %s", defaultdhcp, default_interface) + return defaultdhcp + +def all_interfaces(): + max_possible = 128 # arbitrary. raise if needed. + bytes = max_possible * 32 + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + names = array.array('B', '\0' * bytes) + outbytes = struct.unpack('iL', fcntl.ioctl( + s.fileno(), + 0x8912, # SIOCGIFCONF + struct.pack('iL', bytes, names.buffer_info()[0]) + ))[0] + namestr = names.tostring() + return [namestr[i:i+32].split('\0', 1)[0] for i in range(0, outbytes, 32)] + +def get_ip(ifname): + logging.debug(" Finding ip address for %s", ifname) + all_if = all_interfaces() + logging.debug(" found interfaces:%s", all_if) + if ifname in all_if : + logging.debug(" Found %s in all_interfaces", ifname) + else: + logging.critical("* Couldn't find %s in list", ifname) + ifname = all_if[0] + logging.critical("* Using %s for interface name", ifname) + + + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + return socket.inet_ntoa(fcntl.ioctl( + s.fileno(), + 0x8915, # SIOCGIFADDR + struct.pack('256s', ifname[:15]) + )[20:24]) + +def get_default_route(iface): + rcroute = "127.0.0.1" + f = open ('/proc/net/route', 'r') + for line in f: + words = string.split (line) + netiface = words[0] + route = words[2] + flags = words[3] + try: + if ( netiface == iface ) and ( flags == "0003") : + route = iplib.IPv4Address(route, notation="hex") + t = str(route.get_dot()) + s = t.split(".") + rcroute = s[3] + "." + s[2] + "." + s[1] + "." + s[0] + break + except ValueError: + pass + return rcroute + +def setup_MYTH_IP(systemconfig): + default_interface = systemconfig["default_interface"] + #check for dhcp in use + if setup_MYTH_DHCP(systemconfig) == "0": + logging.debug(" dhcp is in use, finding dhcp ip") + defaultip = get_ip(default_interface) + else: + try: + defaultip = systemconfig["Hostip"+default_interface] + except: + logging.debug(" Error occured finding the defaultip") + defaultip = "127.0.0.1" + logging.debug(" Using %s as default ip", defaultip) + return defaultip + + +def setup_MYTH_GW(systemconfig): + default_interface = systemconfig["default_interface"] + #check for dhcp in use + if setup_MYTH_DHCP(systemconfig) == "0": + logging.debug(" dhcp is in use, finding dhcp ip") + defaultgw = get_default_route(default_interface) + else: + try: + defaultgw = systemconfig["Hostgw"+default_interface] + except: + logging.debug(" Error occured finding the defaultgw") + defaultgw = "127.0.0.1" + logging.debug(" Using %s as default gw", defaultgw) + return defaultgw + + +def setup_MTYH_DNS(): + returndns = "127.0.0.1" + try: + f = open ('/etc/resolv.conf', 'r') + for line in f: + if line.startswith("nameserver"): + print line + returndns = line.split()[1] + break + except: + logging.debug(" Couldn't open /etc/resolv.conf for myth_dns") + logging.debug(" using %s for myth_dns", returndns) + return returndns + + + + + +def flush(netdev): + logging.debug(" Flushing %s",netdev) + cmd = '''ip address flush dev %s''' %netdev + mv_common.runcmd(cmd) + +def kill_dhcp(basedir): + logging.debug(" _Start of kill_dhcp") + logging.debug(" Killing off dhcpd") + stddir = os.getcwd() + piddir = ("%s/var/run/") %basedir + try: + os.chdir(piddir) + for FILE in glob.glob("dhcpcd-*.pid"): + f = open(FILE,'r') + pid = f.readline() + f.close + cmd = "kill -9 %s" %pid + mv_common.runcmd(cmd) + mv_common.remove_file(FILE) + os.chdir(stddir) + except: + pass + +def setup_nameserver(dns): + logging.info(" Adding %s for DNS", dns) + cmd = '''grep -q %s /etc/resolv.conf''' %dns + status = mv_common.runcmd(cmd) + if not status == 0 : + cmd = ''' echo "nameserver %s" >> /etc/resolv.conf ''' %dns + mv_common.runcmd(cmd) + + + +def setup_hostname(systemconfig): + logging.debug(" _Start of setup_hostname") + try: + hostname = systemconfig["hostname"] + except: + logging.critical(" *Hostname could not be set") + logging.info(" Using default value of me") + hostname = "me" + logging.info(" Setting the hostname to %s", hostname) + cmd = ''' echo %s > /etc/hostname ''' %hostname + mv_common.runcmd(cmd) + cmd = "cat /etc/hosts | grep -v 127.0.0.1 | grep -v %s > /tmp/hosts" %hostname + mv_common.runcmd(cmd) + if systemconfig["mythdhcp"] == "1" : + logging.debug(" not using dhcp") + cmd = ''' echo 127.0.0.1 localhost > /etc/hosts ''' + mv_common.runcmd(cmd) + cmd = ''' echo %s %s > /etc/hosts ''' %(systemconfig["mythip"], systemconfig["hostname"]) + mv_common.runcmd(cmd) + else: + cmd = ''' echo 127.0.0.1 %s localhost > /etc/hosts ''' %systemconfig["hostname"] + mv_common.runcmd(cmd) + cmd = '''cat /tmp/hosts >> /etc/hosts ''' + mv_common.runcmd(cmd) + + +def write_wpafile(line,netdev): + logging.debug(" writing out wpa_supplicant.conf file") + logging.debug(line) + wpafile = etcnetdir+"/"+netdev+"/wpa_supplicant.conf" + try: + f = open(wpafile,'w') + f.write(line) + f.close() + except: + logging.debug(" Couldn't write to %s",wpafile) + +def setup_wpa(netinfo,netdev): + logging.info(" %s will use wpa for encryption",netdev) + line = ''' +#This file was automaticly generated, any changes may be lost +ctrl_interface=/var/run/wpa_supplicant +network={ + ssid="%s" + # Preshared key as an ASCII passphrase + psk="%s" + scan_ssid=1 + key_mgmt=WPA-EAP WPA-PSK NONE + pairwise=CCMP TKIP + proto=WPA RSN +}''' %(netinfo["ESSID"],netinfo["KEY"]) + write_wpafile(line,netdev) + +def setup_wep(netinfo,netdev): + logging.info(" %s will use wep for encryption",netdev) + logging.debug(" When a packet comes along, you must wep it") + line=''' +#This file was automaticly generated, any changes may be lost +ctrl_interface=/var/run/wpa_supplicant +network={ + ssid="%s" + key_mgmt=NONE + wep_key0=%s + wep_tx_keyidx=0 + scan_ssid=1 + auth_alg=SHARED +} +''' %(netinfo["ESSID"],netinfo["KEY"]) + write_wpafile(line,netdev) + + +def setup_none(netinfo,netdev): + logging.info(" %s will not use encryption",netdev) + line = ''' +#This file was automaticly generated, any changes may be lost +ctrl_interface=/var/run/wpa_supplicant +network={ + ssid="%s" + key_mgmt=NONE +} +''' %netinfo["ESSID"] + write_wpafile(line,netdev) + +def setup_interface(netdev,systemconfig): + logging.debug(" _Start of setup_interface for %s",netdev) + nettrans = {'Hostip':'ip', + 'Hostnetmask':'netmask', + 'HostActive':'isactive', + 'HostDNS':'dns', + 'HostUSEDHCP':'UseDHCP', + 'HostGW':'GW', + 'HostMTU':'mtu', + 'HOST_iswireless':"wireless", + 'HostESSID':'ESSID', + 'HostKey':'KEY', + 'HostUseEncryption':'ENCRYPT'} + netinfo = {} + #populate the netinfo dict + for netitem in nettrans: + if systemconfig[netitem+netdev]: + netinfo[nettrans[netitem]] = systemconfig[netitem+netdev] + else: + netinfo[nettrans[netitem]] = False + logging.debug(" %s:%s",netitem,netinfo[nettrans[netitem]]) + logging.info(" %s wireless: %s", netdev,netinfo["wireless"]) + try: + os.makedirs(etcnetdir) + except: + logging.debug(" Could not create %s",etcnetdir) + + optionfile=etcnetdir+"/"+netdev+"/options" + if not os.path.exists(optionfile): + os.makedirs(etcnetdir+"/"+netdev) + mv_common.cp_and_log(systemconfig["TEMPLATES"]+"/etcnet/eth/options", optionfile) + + if netinfo["isactive"] == "1" : + change_iface_state(netdev,"enabled") + else: + change_iface_state(netdev,"disabled") + + if netinfo["wireless"] == "1" : + + logging.info(" Enabling wireless extensions") + cmd = ''' sed -i -e 's/^CONFIG_WIRELESS=.*$/CONFIG_WIRLESS=yes/g' %s/%s/options''' %(etcnetdir,netdev) + mv_common.runcmd(cmd) + if netinfo["ENCRYPT"] == "WEP": + setup_wep(netinfo,netdev) + elif netinfo["ENCRYPT"] == "WPA": + setup_wpa(netinfo,netdev) + elif netinfo["ENCRYPT"] == "none": + setup_none(netinfo,netdev) + + else: + logging.info(" Disabling wireless extensions") + cmd = '''sed -i -e 's/^CONFIG_WIRLESS=.*$/CONFIG_WIRLESS=no/g' %s/%s/options''' %(etcnetdir, netdev) + mv_common.runcmd(cmd) + #try: + wpafile=etcnetdir+"/"+netdev+"/wpa_supplicant.conf" + #os.remove(wpafile) + mv_common.remove_file(wpafile) + #except: + #logging.debug(" Couldn't remove %s",wpafile) + + if netinfo["UseDHCP"] == "0" : + logging.info(" Enabling DHCP support") + cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=dhcp/g' %s/%s/options''' %(etcnetdir, netdev) + mv_common.runcmd(cmd) + else: + logging.info(" Using static ip address of %s",netinfo["ip"]) + cmd = ''' sed -i -e 's/^BOOTPROTO=.*$/BOOTPROTO=static/g' %s/%s/options''' %(etcnetdir, netdev) + mv_common.runcmd(cmd) + cmd = '''echo "default via %s" > %s/%s/ipv4route''' %(netinfo["GW"], etcnetdir, netdev) + mv_common.runcmd(cmd) + cmd = '''echo "%s%s" > %s/%s/ipv4address ''' %(netinfo["ip"], netinfo["netmask"].split()[0], etcnetdir, netdev) + mv_common.runcmd(cmd) + setup_nameserver(netinfo["dns"]) + + if netinfo["mtu"] : + logging.info(" Setting mtu to %s", netinfo["mtu"]) + cmd = '''sed -i '/^mtu.*$/d' %s/%s/iplink''' %(etcnetdir,netdev) + mv_common.runcmd(cmd) + cmd = ''' echo "mtu %s" >> %s/%s/iplink''' %(netinfo["mtu"], etcnetdir,netdev) + mv_common.runcmd(cmd) + else: + logging.info(" Using default mtu value") + cmd = '''sed -i '/^mtu.*$/d' %s/%s/iplink''' %(etcnetdir,netdev) + mv_common.runcmd(cmd) + + +def change_iface_state(netdev, state): + if state == "enabled": + logging.info(" Activating %s", netdev) + cmd = '''sed -i -e 's/^ONBOOT=.*$/ONBOOT=yes/g' %s/%s/options''' %(etcnetdir,netdev) + mv_common.runcmd(cmd) + cmd = '''sed -i -e 's/^DISABLED=.*$/DISABLED=no/g' %s/%s/options ''' %(etcnetdir,netdev) + mv_common.runcmd(cmd) + else: + logging.info(" Disabling %s", netdev) + cmd = '''sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' %s/%s/options''' %(etcnetdir,netdev) + mv_common.runcmd(cmd) + cmd = '''sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' %s/%s/options ''' %(etcnetdir,netdev) + mv_common.runcmd(cmd) + cmd = "/sbin/ifconfig %s down" %netdev + mv_common.runcmd(cmd) + cmd = "ip address flush %s" %netdev + mv_common.runcmd(cmd) + +def devcheck(netdev): + cmd = ''' /sbin/ifconfig %s''' %netdev + rc = mv_common.runcmd(cmd) + if rc == 0 : + return True + else: + return False + +def udev_rules(netdev): + filename = "/etc/udev/rules.d/net.rules" + if devcheck(netdev): + logging.info(" Finding macaddress for %s",netdev) + try: + macaddress = netifaces.ifaddresses(netdev)[netifaces.AF_LINK][0]['addr'] + logging.debug(" Macaddress: %s",macaddress) + except: + logging.debug(" Couldn't find mac address for %s",netdev) + return + try: + f = open(filename,'a') + except: + logging.debug(" Couldn't open %s for writing", filename) + return + if netdev.startswith('eth'): + line = '''KERNEL=="eth*", SYSFS{address}=="%s", NAME="%s"''' % ( macaddress , netdev) + elif netdev.startswith('wlan'): + line = '''KERNEL=="wlan*", SYSFS{address}=="%s", NAME="%s"'''% ( macaddress , netdev) + elif netdev.startswith('ath'): + line = '''KERNEL=="ath*", SYSFS{address}=="%s", NAME="%s"''' % ( macaddress , netdev) + logging.debug(" adding to net.rules ") + logging.debug(" %s",line) + f.write(line) + f.write("\n") + f.close() + +def find_active(systemconfig,this_is_install): + interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1', 'ath0') + logging.debug(" _Start of find_active") + + if systemconfig["mythdhcp"] == "1": + mv_common.remove_file("/etc/resolv.conf") + cmd = ''' echo search lan > /etc/resolv.conf ''' + mv_common.runcmd(cmd) + cmd = ''' echo nameserver 127.0.0.1 >> /etc/resolv.conf ''' + mv_common.runcmd(cmd) + + for netdev in interfacelist: + if this_is_install: + udev_rules(netdev) + currentnet = "HostActive" + netdev + try: + systemconfig[currentnet] + except: + logging.debug(" %s is not defined",currentnet) + change_iface_state(netdev, "disabled") + continue + if systemconfig[currentnet] == "1" : + #check if device is present + if devcheck(netdev) : + setup_interface(netdev,systemconfig) + else: + logging.debug(" Interface %s not found in config", netdev) + #change_iface_state(netdev, "disabled") + else: + change_iface_state(netdev, "disabled") + +def vnc_netboot_check(): + logging.debug(" Start of VNC/NETBOOT check") + vnc = False + netboot = False + try: + f = open('/proc/cmdline', 'r') + bootoptions = f.readlines() + f.close() + except: + logging.critical(" *Couldn't open /proc/cmdline") + logging.debug(" Assuming it's ok to fiddle with the network") + return True + bootoptions = bootoptions[0] + if re.match("vnc",bootoptions) != None : + logging.debug(" Found VNC option") + vnc = True + if re.match("nfsroot",bootoptions) != None : + logging.debug(" Found netboot option") + netboot = True + + return (vnc or netboot) + +def start_network(): + if not vnc_netboot_check(): + logging.info(" Restarting network") + cmd ="/etc/net/scripts/network.init reload" + mv_common.runcmd(cmd) + cmd ="/etc/net/scripts/network.init restart" + mv_common.runcmd(cmd) + else: + logging.info(" Will not restart network due to netboot/vnc") + + +def stop_network(): + if not vnc_netboot_check(): + logging.info(" Stopping network") + cmd ="/etc/net/scripts/network.init stop" + mv_common.runcmd(cmd) + kill_dhcp("") + interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1', 'ath0') + for i in interfacelist: + flush(i) + else: + logging.info(" Will not stop network due to netboot/vnc") + pass + +def hostname_change_check(systemconfig): + restartfe = False + logging.debug(" _Start of hostname_change_check") + oldhostname = socket.gethostname() + #oldhostname = "crap" + newhostname = systemconfig["hostname"] + mv_root = systemconfig["MVROOT"] + logging.debug(" Old hostname: %s", oldhostname) + logging.debug(" New hostname: %s", newhostname) + if oldhostname != newhostname : + logging.info(" Changing hostname in database to match new hostname") + cmd ="%s/bin/restore_default_settings.sh -cuhostname -o -h%s" %(mv_root, oldhostname) + mv_common.runcmd(cmd) + logging.info(" Changing hostname to %s", newhostname) + cmd = "hostname %s" %newhostname + mv_common.runcmd(cmd) + if systemconfig["SystemType"] != "Frontend_only" : + logging.info(" Restarting backend") + mv_common.stop_service("mythbackend") + mv_common.start_service("mythbackend") + restartfe = True + else: + logging.debug(" old and new hostnames matched, leaving things along") + logging.debug(" __End of hostname_change_check") + return restartfe + + + +def setup_network (systemconfig,this_is_install): + logging.info("____Start of network____") + logging.info(" Setting up the network") + restartfe = hostname_change_check(systemconfig) + setup_hostname(systemconfig) + find_active(systemconfig,this_is_install) + start_network() + logging.info("__End of network\n") + return restartfe + + + +##this is used by the install process to start the network +def install_network_setup(systemconfig): + logging.info("____Start of network_install____") + logging.info(" Setting up the network") + #setup_MYTH_vars + setup_hostname(systemconfig) + stop_network() + find_active(systemconfig) + start_network() + logging.info("__End of network install \n") + + diff --git a/abs/mv-core/MythVantage-config/mv_screensaver.py b/abs/mv-core/MythVantage-config/mv_screensaver.py new file mode 100755 index 0000000..2da970c --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_screensaver.py @@ -0,0 +1,199 @@ +# -*- coding: utf-8 -*- +import logging, mv_common +import re +import os + + +def mplayer_saver_check (cmd,templatefile): + logging.debug(" Checking for heartbeat command in mplayer.conf") + mplayerconf = "/etc/mplayer/mplayer.conf" + if not os.path.exists(mplayerconf): + logging.debug(" copying in mplayer template file") + mv_common.cp_and_log(templatefile, mplayerconf) + + try: + f = open(mplayerconf, 'r') + mplayerconf_contents = f.readlines() + f.close() + except: + logging.debug(" Couldn't open %s for reading",mplayerconf) + mplayerconf_contents = "#\n" + + try: + f = open(mplayerconf, 'w') + except: + logging.debug(" Couldn't open %s for writing",mplayerconf) + return + + for line in mplayerconf_contents: + if re.match("^.*stop-xscreensaver",line): + continue + elif re.match("^.*heartbeat-cmd",line): + continue + else: + f.write(line) + + f.write("stop-xscreensaver = 0\n") + line='''heartbeat-cmd="%s"\n''' %cmd + f.write(line) + f.close() + + +def killxscreensaver(): + logging.info(" Stopping xscreensaver") + cmd="xscreensaver-command --exit " + mv_common.runcmd(cmd) + cmd="killall xscreensaver " + mv_common.runcmd(cmd) + +def killgscreensaver(): + logging.info(" Stopping gnome-screensaver") + cmd="gnome-screensaver-command --exit " + mv_common.runcmd(cmd) + cmd="killall gnome-screensaver " + mv_common.runcmd(cmd) + + +def setup_x_screensaver(idle,theme,screenconfigfile,templatefile): + logging.info(" Configuring X screensaver") + killgscreensaver() + logging.debug(" Why can't xscreensaver have a nice configuration !") + + if not os.path.exists(screenconfigfile): + logging.debug(" copying in new template file") + mv_common.cp_and_log(templatefile,screenconfigfile) + + try: + f = open(screenconfigfile, 'r') + screenconfigcontents=f.readlines() + f.close() + except: + logging.info("Couldn't open %s for reading",screenconfigfile) + return + try: + f = open(screenconfigfile, 'w') + except: + logging.info("Couldn't open %s for writing",screenconfigfile) + return + + startline=0 + foundline=0 + + for k, line in enumerate(screenconfigcontents): + if re.match("programs:",line): + startline = k + if re.search(theme,line): + foundline = k + themenumber=foundline-startline-2 + + for line in screenconfigcontents: + if re.match("selected.*$",line): + continue + + if re.match("timeout",line): + logging.info(" Setting idletime to %s",idle) + outline = "timeout: 0:%s:00 \n" %idle + f.write(outline) + elif re.match("mode",line): + if theme == "Random": + logging.info(" Setting theme to %s", "Random") + outline = "mode: random \n" + f.write(outline) + outline = "selected: -1 \n" + f.write(outline) + continue + + elif theme == "Blank": + logging.info(" Setting theme to %s", "blank") + outline = "mode: blank \n" + f.write(outline) + outline = "selected: -1 \n" + f.write(outline) + continue + + else: + logging.info(" Setting theme to %s", theme) + outline = "mode: one\n" + f.write(outline) + logging.debug(" Theme number is %s",themenumber) + outline = "selected: %s\n" %themenumber + f.write(outline) + continue + + else: + outline = line + f.write(outline) + f.close() + logging.debug("__End of xscreensaver") + +def setup_gnome_screensaver(theme,idletime): + logging.info(" Configuring gnome screensaver") + + logging.info(" Disabling lock screen") + cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type bool --set /apps/gnome-screensaver/lock_enabled false''' + mv_common.runcmd(cmd) + + logging.info(" Setting idletime to %s",idletime) + cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type int -s "/apps/gnome-screensaver/idle_delay" %s''' %idletime + mv_common.runcmd(cmd) + + logging.info(" Setting mode to single") + cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string -s "/apps/gnome-screensaver/mode" single''' + mv_common.runcmd(cmd) + + if theme == "Random": + logging.info(" setting theme to random") + cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string -s "/apps/gnome-screensaver/mode" random''' + mv_common.runcmd(cmd) + + elif theme == "Blank": + logging.info(" setting theme to blank") + cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --type string -s "/apps/gnome-screensaver/themes" blank''' + mv_common.runcmd(cmd) + + else: + logging.info(" setting theme to %s",theme) + cmd='''gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory --set --type list --list-type=string /apps/gnome-screensaver/themes [screensavers-%s]''' %theme + mv_common.runcmd(cmd) + + killxscreensaver() + logging.info("__End gnome screensaver") + + + + +def setup_screensaver (systemconfig,data_config): + logging.info("____Start of screensaver configuration____") + screensavertype = systemconfig["Screensavertype"] + theme = systemconfig["Screensavertheme"] + idletime = systemconfig["Screensaveridle"] + configfile = data_config.MYTHHOME+"/.xscreensaver" + templatefile = systemconfig["TEMPLATES"]+"/xscreensaver.template" + mtemplate = systemconfig["TEMPLATES"]+"/mplayer.conf.template" + + if screensavertype == "xscreensaver": + mv_common.pacinstall("xscreensaver") + mv_common.pacremove("gnome-screensaver") + setup_x_screensaver(idletime, theme, configfile, templatefile) + mplayer_saver_check("/usr/bin/xscreensaver-command -deactivate &",mtemplate) + + elif screensavertype == "gscreensaver": + mv_common.pacinstall("xscreensaver") + mv_common.pacinstall("gnome-screensaver") + setup_gnome_screensaver(theme,idletime) + mplayer_saver_check("/usr/bin/gnome-screensaver-command -p &",mtemplate) + + elif screensavertype == "none": + mv_common.pacremove("xscreensaver") + mv_common.pacremove("gnome-screensaver") + killgscreensaver() + killxscreensaver() + + elif screensavertype == "tinker" : + logging.debug(" screensaver tinker mode detected") + else: + logging.debug(" Unknown screensaver") + logging.info("__End of screensaver\n") + + + diff --git a/abs/mv-core/MythVantage-config/mv_smolt.py b/abs/mv-core/MythVantage-config/mv_smolt.py new file mode 100755 index 0000000..5fd3722 --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_smolt.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +import logging +import mv_common + +def read_release(stype): + if stype == "LinHES": + rfile = "/etc/LinHES-release" + else: + rfile = "/etc/MythVantage-release" + + try: + f= open(rfile,'r') + releasename = f.readlines()[0] + f.close() + except: + logging.debug(" Couldn't open %s",rfile) + releasename = "unknown" + + return releasename + + +def setup_smolt_type(SystemType,Remotetype,RunFrontend,mythhome,stype): + logging.debug("____Start of setup_smolt_type____") + releasename = read_release(stype) + + if SystemType == "Standalone": + smoltsystem = 6 + MVRELEASE="%s (Standalone)" %releasename + elif SystemType == "Master_backend": + if RunFrontend == "1": + smoltsystem = 2 + MVRELEASE="%s (MBE with Frontend)" %releasename + else: + smoltsystem=1 + MVRELEASE="%s (MBE)" %releasename + elif SystemType == "Slave_backend": + if RunFrontend == "1" : + smoltsystem = 4 + MVRELEASE="%s (SLAVE with Frontend)" %releasename + else: + smoltsystem = 5 + MVRELEASE="%s (SLAVE)" %releasename + elif SystemType == "Frontend_only": + smoltsystem = 3 + MVRELEASE="%s ( Frontend only)" %releasename + + logging.debug(" smolt type is %s : %s", MVRELEASE,smoltsystem) + smoltfile = mythhome+"/.mythtv/smolt.info" + cmd = ''' echo "%s" > /etc/os_myth_release ''' %MVRELEASE + mv_common.runcmd(cmd) + + cmd = '''echo "systemtype=%s" > %s''' %(smoltsystem,smoltfile) + mv_common.runcmd(cmd) + + cmd = '''echo "remote=%s" >> %s ''' %(Remotetype,smoltfile) + mv_common.runcmd(cmd) + + logging.debug("__End of setup_smolt_type") + diff --git a/abs/mv-core/MythVantage-config/mv_software.py b/abs/mv-core/MythVantage-config/mv_software.py new file mode 100755 index 0000000..e5b96b2 --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_software.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +import logging, mv_common +import os, re + +def setup_software(systemconfig, data_config): + logging.info("____Start of Software install____") + default_disabled = ("mythphone", "mytharchive", "mythbrowser", "mythnews", + "mythgame", "mythflix", "mythweather", + "mythappletrailers", "mythstream", "mythvodka") + + default_installed=("mythcontrols", "mythgallery", "mythmovies", + "mythmusic", "mythsmolt", "mythvideo") + other_pkg=("miro", "xe", "romdb", "xine", "dvdcss", "webmin" , "fuppes") + + for pkg in default_disabled: + try: + if systemconfig[pkg] == "1": + mv_common.pacinstall(pkg) + else: + mv_common.pacremove(pkg) + except: + logging.debug(" ERROR-- %s is not defined", pkg) + + for pkg in default_installed: + try: + if systemconfig[pkg] == "0": + mv_common.pacremove(pkg) + else: + mv_common.pacinstall(pkg) + except: + logging.debug(" ERROR-- %s is not defined", pkg) + + for pkg in other_pkg: + try: + if systemconfig[pkg] == "1": + mv_common.pacinstall(pkg) + elif systemconfig[pkg] == "0": + mv_common.pacremove(pkg) + except: + logging.debug(" ERROR-- %s is not defined", pkg) + logging.info("__End Software\n ")
\ No newline at end of file diff --git a/abs/mv-core/MythVantage-config/mv_webuser.py b/abs/mv-core/MythVantage-config/mv_webuser.py new file mode 100755 index 0000000..a8517a8 --- /dev/null +++ b/abs/mv-core/MythVantage-config/mv_webuser.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +import logging, mv_common +#import os + +def setup_web_auth(UseMythWEB_auth): + logging.info("____Start of setup_web_auth____") + if UseMythWEB_auth == str(1): + #enable auth + logging.info(" Enabling authorization for mythweb") + cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf''' + mv_common.runcmd(cmd) + else: + #disable auth + logging.info(" Disabling authorization for mythweb") + cmd='''sed -i "s/^.*include.*auth-inc.conf.*$/#include \\"\/etc\/lighttpd\/auth-inc.conf\\"/g" /etc/lighttpd/lighttpd.conf''' + mv_common.runcmd(cmd) + logging.debug("Restarting lighttpd") + cmd="sudo sv restart lighttpd" + mv_common.runcmd(cmd) + logging.info("__End of webauth\n") + diff --git a/abs/mv-core/MythVantage-config/myth_user_call.py b/abs/mv-core/MythVantage-config/myth_user_call.py new file mode 100755 index 0000000..63915a4 --- /dev/null +++ b/abs/mv-core/MythVantage-config/myth_user_call.py @@ -0,0 +1,159 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +#Wrapper script to manage USERNAME accounts + web security +# myth_USERNAME_all -c add -u USERNAME +# myth_USERNAME_all -c delete -u USERNAME +# myth_USERNAME_all -c pass -u USERNAME -p pass +# myth_USERNAME_all -c web -u USERNAME -p pass + +import pexpect, sys, time +import os, re, getopt +import mv_common + + + + +def chroot_check(): + if not INIT_CHECK : + return False + cmd = '''ps -p 1 -o comm=''' + init = mv_common.runcmd_output(cmd).strip() + if init == "runit": + return False + else: + return True + + +def store_commands(full_call): + file_name = "/root/myth_user_call.out" + try: + f = open(file_name,'a') + except: + print "%s could not be opened" % file_name + sys.exit(1) + f.write(full_call) + f.write("\n") + f.close() + try: + os.chmod(600,file_name) + except: + pass + + +def add_user(username,full_call): + if chroot_check() : + print "calling myth_call_user in chroot to add user" + store_commands(full_call) + else: + print "Adding user %s" %username + cmd = '''useradd -m -s /bin/bash %s -G audio,video,optical,storage,users''' %username + mv_common.runcmd(cmd) + cmd = ''' usermod -a -G mythtv %s ''' %username + + +def del_user(username,full_call): + if chroot_check() : + print "calling myth_call_user in chroot to del user" + store_commands(full_call) + else: + print "Removing user %s" %username + cmd = '''userdel %s ''' %username + mv_common.runcmd(cmd) + + +def pass_change(username,password,full_call) : + if chroot_check() : + print "calling myth_call_user in chroot to change password" + store_commands(full_call) + else: + print "changing password for %s" %username + passwd = pexpect.spawn("/usr/bin/passwd %s" % username) + + for repeat in (1, 2): + passwd.expect("password: ") + passwd.sendline(password) + time.sleep(0.1) + +def web_security(username,password) : + file_name = "/etc/lighttpd/lighttpd.user" + file_contents = '' + if os.path.exists(file_name): + try: + f = open(file_name,'r') + file_contents = f.readlines() + except: + print " couldn't read %s" % file_name + try: + f = open(file_name,'w') + except: + print "%s could not be opened for writing" % file_name + return + + for line in file_contents: + if not re.search(username, line): + f.write(line) + line = "%s:%s" %(username, password) + f.write(line) + f.write("\n") + f.close() + + +def usage (): + print "Valid options are:" + print " -c (add|delete|pass|web)" + print " -u USERNAME" + print " -p password" + sys.exit(0) + +def main(argv): + global INIT_CHECK + full_call = "" + INIT_CHECK = True + try: + opts, args = getopt.getopt(argv, 'c:u:p:ih' ) + except getopt.GetoptError, why: + print why + usage() + print "exception happened" + sys.exit(2) + + for opt, arg in opts: + if opt in ("-h", "--help"): + usage() + sys.exit(0) + elif opt in ("-c") : + module = arg + full_call += ''' -c %s ''' %re.escape(arg) + elif opt in ("-u") : + username = arg + full_call += ''' -u %s ''' %re.escape(arg) + elif opt in ("-p") : + password = arg + full_call += ''' -p %s ''' %re.escape(arg) + elif opt in ("-i") : + INIT_CHECK = False + full_call += ''' -i ''' + try: + username + except: + usage() + + if module == "add": + add_user(username,full_call) + elif module == "delete": + del_user(username,full_call) + elif module == "pass": + try: + password + except: + print "needs a password" + usage() + pass_change(username,password,full_call) + elif module == "web": + web_security(username,password) + else: + usage() + +if __name__ == "__main__": + main(sys.argv[1:]) + diff --git a/abs/mv-core/MythVantage-config/systemconfig.py b/abs/mv-core/MythVantage-config/systemconfig.py new file mode 100755 index 0000000..c559e09 --- /dev/null +++ b/abs/mv-core/MythVantage-config/systemconfig.py @@ -0,0 +1,243 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import sys, os, commands, glob, time +import getopt, re, MySQLdb +import logging +import mv_common , mv_network +import inspect +#____________________________________________setup the logging______________________________________________________ +LOG_FILENAME = '/tmp/systemconfig.log' +DEBUGLOG = '/tmp/systemconfig_debug.log' +logging.basicConfig(level=logging.DEBUG, + format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', + datefmt='%m-%d %H:%M', + filename=DEBUGLOG, + filemode='w') +# define a Handler which writes INFO messages or higher to the sys.stderr +console = logging.StreamHandler() +console.setLevel(logging.INFO) +# set a format which is simpler for console use +#formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s') +formatter = logging.Formatter("%(message)s") +# tell the handler to use this format +console.setFormatter(formatter) +# add the handler to the root logger +logging.getLogger('').addHandler(console) + +#infoformatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") +infoformatter = logging.Formatter("%(message)s") +infofile = logging.FileHandler(LOG_FILENAME, 'w') +infofile.setFormatter(infoformatter) +infofile.setLevel(logging.INFO) +logging.getLogger('').addHandler(infofile) + + +def usage(): + logging.info("tell people how to use this") + +def setup_x(systemconfig): + cmd = "%s/bin/xconfig.sh" %systemconfig["MVROOT"] + mv_common.runcmd(cmd) + +def main(argv): + try: + MVROOT = os.environ["MV_ROOT"] + except: + logging.debug("MVROOT was not defined, using the default value") + MVROOT = "/usr/MythVantage" + + global cmdmodule + global systemconfig + systemconfig["MVROOT"]=MVROOT + restartlcd = False + cmdmodule={"misc":False , "sleep":False , "hostype":False , "hostypec":False , "advanced":False , "audio":False , "network":False , "advancedX":False , "webuser":False , "restartfe":False , "reloadfe":False , "ddns":False , "screensaver":False , "ir":False , "this_is_install":False , "user":False, "software":False, "plugins":False, "smolt":False, "all":False, "dhcp_request":False } + try: + opts, args = getopt.getopt(argv, 'c:hm:d:', ["help","modules" ] ) + except getopt.GetoptError, why: + print why + usage() + print "exception happened" + sys.exit(2) + for opt, arg in opts: + if opt in ("-h", "--help"): + usage() + sys.exit(0) + elif opt in ("-m"): + for i in arg.split(","): + cmdmodule[i]=True + elif opt in ("-d"): + dhcp_dev = arg + + + if cmdmodule["this_is_install"] or cmdmodule["hostypec"]: + systemconfig["hostypec"] = True + cmdmodule["smolt"] = True + + systemconfig["mythip"] = mv_network.setup_MYTH_IP(systemconfig) + systemconfig["mythdhcp"] = mv_network.setup_MYTH_DHCP(systemconfig) + systemconfig["mythgw"] = mv_network.setup_MYTH_DHCP(systemconfig) + systemconfig["mythdns"] = mv_network.setup_MYTH_DHCP(systemconfig) + + if cmdmodule["all"]: + logging.info("*** WILL RUN ALL MODULES ***") + cmdmodule["hostype"] = True + cmdmodule["ir"]= True + cmdmodule["network"] = True + cmdmodule["audio"] = True + cmdmodule["misc"] = True + cmdmodule["sleep"] = True + cmdmodule["webuser"] = True + cmdmodule["ddns"] = True + cmdmodule["screensaver"] = True + cmdmodule["advanced"] = True + cmdmodule["software"] = True + cmdmodule["advancedX"] = True + cmdmodule["smolt"] = True + cmdmodule["user"] = True + + + if cmdmodule["hostype"]: + import mv_hostype + cmdmodule["advancedX"] = True + setup_x(systemconfig) + cmdmodule["ir"] = True + mv_hostype.hostypeprint(systemconfig) + cmdmodule["smolt"] = True + + if cmdmodule["network"]: + restartfe = mv_network.setup_network(systemconfig, cmdmodule["this_is_install"]) + if restartfe == True : + logging.debug(" Setting the frontend to restart due to network change") + cmdmodule["restartfe"] = True + + + + if cmdmodule["ir"] == True: + import mv_ir + restart = mv_ir.setup_ir(systemconfig,data_config) + restartfe = restart[0] + restartlcd = restart[1] + if restartfe == True : + logging.debug(" Setting the frontend to restart due to lirc change") + cmdmodule["restartfe"] = True + cmdmodule["smolt"] = True + + + if cmdmodule["audio"] == True: + logging.debug("______Start of Audio Configuration______") + if not systemconfig["Audiotype"] == "tinker": + cmd="%s/bin/soundconfig.sh -t real -i %s -d %s" %(MVROOT,systemconfig["Audiotype"],systemconfig["SoundDevice"]) + mv_common.runcmd(cmd) + else: + logging.debug(" Tinker mode(audio), not changing configuration") + logging.debug("__End of audio") + + if cmdmodule["misc"]: + import mv_misc + mv_misc.setup_zip(MVROOT,systemconfig["zipcode"]) + mv_misc.setup_tz(systemconfig["timezone"],systemconfig["TEMPLATES"]) + mv_misc.setup_nfs(systemconfig) + + if cmdmodule["sleep"]: + import mv_misc + mv_misc.setup_sleep(systemconfig) + + if cmdmodule["webuser"]: + import mv_webuser + mv_webuser.setup_web_auth(systemconfig["UseMythWEB_auth"]) + + if cmdmodule["ddns"]: + print " LOOK FOR DDNS" + + if cmdmodule["screensaver"]: + import mv_screensaver + mv_screensaver.setup_screensaver(systemconfig, data_config) + + if cmdmodule["advanced"]: + import mv_advanced + mv_advanced.setup_advanced(systemconfig, data_config) + + if cmdmodule["software"] or cmdmodule["plugins"]: + import mv_software + mv_software.setup_software(systemconfig, data_config) + + if cmdmodule["advancedX"]: + setup_x(systemconfig) + + if cmdmodule["restartfe"]: + mv_common.restartfe(restartlcd) + + if cmdmodule["reloadfe"]: + mv_common.reloadfe(systemconfig["dbhost"],restartlcd) + + if cmdmodule["smolt"]: + import mv_smolt + mv_smolt.setup_smolt_type(systemconfig["SystemType"], + systemconfig["Remotetype"], + systemconfig["RunFrontend"], + data_config.MYTHHOME, + data_config.SYSTEMTYPE) + + if cmdmodule["user"]: + logging.info("____Start of ssh user____") + if systemconfig["rootSSH"] == "1" : + logging.info(" Allowing ssh access for root") + cmd = '''sed -i "s/^.*PermitRootLogin.*$/PermitRootLogin yes/" /etc/ssh/sshd_config''' + mv_common.runcmd(cmd) + else: + logging.info(" Removing ssh access for root") + cmd = '''sed -i "s/^.*PermitRootLogin.*$/PermitRootLogin no/" /etc/ssh/sshd_config''' + mv_common.runcmd(cmd) + logging.info("__End of ssh user\n") + + if cmdmodule["dhcp_request"]: + cmd = '''dhcpcd -t4 -h' ' -Td %s > /tmp/mvnetwork.dhcpinfo ''' %dhcp_dev + mv_common.runcmd(cmd) + + +if __name__ == "__main__": + + config_file = "mv_config" + data_config = __import__(config_file, globals(), locals(), []) + #Read in systemconfig + global systemconfig + systemconfig = {"hostypec":False} + file_name = "/etc/systemconfig" + try: + config_file = open(file_name) + except: + logging.critical("%s could not be opened", file_name) + sys.exit(1) + + for line in config_file: + line = line.strip() + if line and line[0] is not "#" and line[-1] is not "=": + var, val = line.rsplit("=", 1) + val = val.strip('"') + systemconfig[var.strip()] = val.strip() + try: + systemconfig["TEMPLATES"] = os.environ["TEMPLATES"] + except: + logging.critical(" *TEMPLATES is not defined") + logging.critical(" *using default value") + systemconfig["TEMPLATES"] = "/usr/MythVantage/templates" + + logging.debug("______START OF DEBUG______") + main(sys.argv[1:]) + logging.debug("______cmd line options______") + for i in cmdmodule.items(): + logging.debug (i) + logging.debug("______systemconfig______") + for i in systemconfig.items(): + logging.debug(i) + #pass + + + + + + + + + + diff --git a/abs/mv-core/MythVantage-config/systemconfig.sh b/abs/mv-core/MythVantage-config/systemconfig.sh index a85d88e..218f705 100755 --- a/abs/mv-core/MythVantage-config/systemconfig.sh +++ b/abs/mv-core/MythVantage-config/systemconfig.sh @@ -4,1275 +4,16 @@ #Any changes made to config files will be removed when systemconfig.sh is run # #JM -################################################################### -#set -x -. /etc/profile -MVRELEASE=`cat /etc/mythvantage-release |cut -d" " -f -2` - echo $@ >/tmp/systemconfig.call echo "----------------------start of systemconfig $@ ----------------------" -BASE="" - -#TEMPLATES="/usr/share/templates" . /etc/profile . $MV_ROOT/bin/networkconfig.sh -PACMAN="pacman --noconfirm" -postfix=`cat ${BASE}/usr/share/mythtv/.releasetype` -PKGBLACKLIST=$BASE/etc/blacklist.package - -if [ x$1 = x"Mysql_only" ] -then - rm -f /tmp/mysql.txt - sed -e "s/^DBHostName=.*$/DBHostName=$2/" $TEMPLATES/mysql.txt > /tmp/mysql.txt - exit 0 -fi - - -if [ -f /etc/systemconfig ] -then - . /etc/systemconfig - setup_MYTH_vars - TEMPNET="Hostip"$default_interface - echo $TEMPNET - eval MYTHIP=\$${TEMPNET} -else - echo "could not find /etc/systemconfig" - exit 1 -fi - - - -#----------------------------------------------------- - - -function setupmysql { -#setup mysql.txt to find the database servers -if [ $SystemType = "Master_backend" ] -then - if [ $MYTHDHCP = 0 ] - then - #this grabs eth0, as that is all thats supported. - # dbhost=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n1` - dbhost=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'` - sed -e "s/^dbhost=.*$/dbhost=\"$dbhost\"/" /etc/systemconfig >/tmp/systemconfig.old - cp /tmp/systemconfig.old ${BASE}/etc/systemconfig - ##logic to change master_serverip and backend_serverip in db - ${BASE}${MV_ROOT}/bin/restore_default_settings.sh -c BECONFIG -s master -a $dbhost - else - - dbhost=$MYTHIP - sed -e "s/^dbhost=.*$/dbhost=\"$dbhost\"/" /etc/systemconfig >/tmp/systemconfig.old - cp /tmp/systemconfig.old ${BASE}/etc/systemconfig - #logic to change dbhost in db - ${BASE}${MV_ROOT}/bin/restore_default_settings.sh -c BECONFIG -s master -a $dbhost - fi -fi - -if [ $SystemType = "Slave_backend" ] -then - if [ $MYTHDHCP = 0 ] - then - #this grabs eth0, as that is all thats supported. - #slavehost=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n1` - slavehost=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'` - ##logic to change backend_serverip in db - ${BASE}${MV_ROOT}/bin/restore_default_settings.sh -c BECONFIG -s slave -a $slavehost - else - slavehost=$MYTHIP - - #logic to change backend_serverif in db - ${BASE}${MV_ROOT}/bin/restore_default_settings.sh -c BECONFIG -s slave -a $slavehost - fi -fi - -MYSQLTXT=${BASE}/usr/share/mythtv/mysql.txt -if [ $SystemType = "Standalone" ] -then - sed -e "s/^DBHostName=.*$/DBHostName="localhost"/" $TEMPLATES/mysql.txt > $MYSQLTXT -else - sed -e "s/^DBHostName=.*$/DBHostName=$dbhost/" $TEMPLATES/mysql.txt > $MYSQLTXT -fi -rm ${BASE}/data/home/mythtv/.mythtv/mysql.txt -rm ${BASE}${MV_ROOT}/bin/mythtv/.mythtv/mysql.txt -if [ -f ${BASE}/data/home/mythtv/templates/mysql.txt ] -then - cp ${BASE}/data/home/mythtv/templates/mysql.txt $MYSQLTXT -fi - -chmod 755 $MYSQLTXT -chown mythtv $MYSQLTXT - -} - -function setupmysqlnetwork(){ -MFILE=etc/my.cnf -grep "#skip-networking" $BASE/$MFILE -status=$? - - - -if [ $SystemType = "Standalone" ] -then - sed -ie "s/^#skip-networking/skip-networking/g" $BASE/$MFILE - if [ $status = 0 ] - then - sudo sv restart mysql - echo "restarting mysql with no network" - fi - -fi - -if [ $SystemType = "Master_backend" ] -then - sed -ie "s/^skip-networking/#skip-networking/g" $BASE/$MFILE - if [ $status = 1 ] - then - sudo sv restart mysql - echo "restarting mysql with network" - fi - -fi - - -} - - -function settimezone { -#set the timezone -if [ x"$timezone" = x ] -then - timezone="unknown" -fi -rm ${BASE}/etc/localtime -echo $timezone -ln -s "/usr/share/zoneinfo/$timezone" ${BASE}/etc/localtime -sed -e "s~^TIMEZONE=.*$~TIMEZONE=\"${timezone}\"~" ${BASE}/etc/rc.conf > $TEMPLATES/rc.conf - -# echo CLOCK="UTC" > ${BASE}/etc/conf.dclock -# echo CLOCK_SYSTOCH="yes" >> ${BASE}/etc/conf.d/clock -# echo TIMEZONE="$timezone" >> ${BASE}/etc/conf.d/clock -cp $TEMPLATES/rc.conf /etc/rc.conf - -} - - -function setupreceiver { -case $ReceiverType in - tinker) echo "do nothing" - ;; - Serial) echo "setup serial lirc" - sed -i -e '/.*#lirc/d' ${BASE}/etc/modules.mythvantage - echo "lirc_serial #lirc" >> ${BASE}/etc/modules.mythvantage - /usr/bin/load-modules-mythvantage.sh - ;; - Usb-imon) echo "setup receiver-usb-imon" - sed -i -e '/.*#lirc/d' ${BASE}/etc/modules.mythvantage - echo "lirc_imon #lirc" >> ${BASE}/etc/modules.mythvantage - /usr/bin/load-modules-mythvantage.sh - ;; - Hauppauge) echo "setup hauppauge reciever (lirc_i2c)" - sed -i -e '/.*#lirc/d' ${BASE}/etc/modules.mythvantage - echo "lirc_i2c #lirc" >> ${BASE}/etc/modules.mythvantage - cp $TEMPLATES/modules/lirc_i2c.conf ${BASE}/etc/modprobe.d/lirc_i2c.conf - rmmod lirc_i2c 2>/dev/null - load-modules-mythvantage.sh - ;; - - *) sed -i -e '/.*#lirc/d' ${BASE}/etc/modules.mythvantage - ;; -esac - - -} - -function setupremote { -case $Remotetype in - no_remote) echo "No remote selected" - daemon_remove="lircd $daemon_remove" - ;; - tinker) echo "Remote in tinker mode" - ;; - *) echo "Setup remote" - mv ${BASE}/etc/lircd.conf ${BASE}/etc/lircd.conf.`date +%Y-%m-%d-%H-%M` - cd $TEMPLATES/remotes/$Remotetype - for i in lircd* - do - cat $i >> ${BASE}/etc/lircd.conf - done - cp lircrc ${BASE}/etc/lircrc - if [ -f $TEMPLATES/LCD/$LCDtype/lircrc ] - then - cat $TEMPLATES/LCD/$LCDtype/lircrc >> /etc/lircrc - cat $TEMPLATES/LCD/$LCDtype/lircd.conf >> /etc/lircd.conf - fi - if [ -f $TEMPLATES/transmit/$Blastertype/lircd.conf ] - then - cat $TEMPLATES/transmit/$Blastertype/lircd.conf >> ${BASE}/etc/lircd.conf - fi - chmod 755 /etc/lircrc - daemon_add="lircd $daemon_add" - sv hup lircd - ;; -esac - -} - -function setupblaster { -#cd $TEMPLATES/transmit/$Blastertype -#for i in lircd* -#do -# cat lircd.conf >> ${BASE}/etc/lircd.conf -#done -# REMOTE_NAME${BASE}/usr/bin/change_chan.sh=`grep name lircd.conf* |awk -F" " ' { print $2 } '` -sed -e "s/^REMOTE_NAME=.*$/REMOTE_NAME=${Blastertype} /" $TEMPLATES/change_chan.sh > ${BASE}/usr/bin/change_chan.sh -chmod 755 ${BASE}/usr/bin/change_chan.sh -#channel change script change -setupremote - -} - -function setupevrouter { -if [ x$UseEvrouter = x1 ] -then - case x$EvrouterConfig in - xtinker ) - echo "do nothing for evrouter" - ;; - x ) echo "empty evrouter" - ;; - * ) echo "setup evrouter for $EvrouterConfig " - cp $TEMPLATES/evrouter/$EvrouterConfig /etc/evrouter.cfg - daemon_add="evrouter Xvfb $daemon_remove" - - ;; - esac -else - # disable evrouter - daemon_remove="evrouter Xvfb $daemon_remove" -fi - - - - -} - -function setupLCD { -case x$LCDtype in - xtinker) echo "do nothing" - ;; - xno_lcd) echo "disabling lcd" - sv down lcdd - /usr/bin/load-modules-mythvantage.sh UNLOAD LCD - sed -i -e '/.*#LCD/d' ${BASE}/etc/modules.mythvantage - daemon_remove="lcdd $daemon_remove" - ;; - x) echo "empty lcd" ;; - - *) echo "setup lcd" - if [ -f $TEMPLATES/LCD/$LCDtype/modules ] - then - sed -i -e '/.*#LCD/d' ${BASE}/etc/modules.mythvantage - cat $TEMPLATES/LCD/$LCDtype/modules >> ${BASE}/etc/modules.mythvantage - #should also modprobe - fi - - - if [ -f $TEMPLATES/LCD/$LCDtype/LCDd.conf ] - then - cp -f $TEMPLATES/LCD/$LCDtype/LCDd.conf /etc - # install="lcdproc $install" - daemon_add="lcdd $daemon_add" - /usr/bin/load-modules-mythvantage.sh - RESTART_FE="true" - RESTART_LCD="true" - fi - #check if lirc capable,if so then call setupremote - if [ -f $TEMPLATES/LCD/$LCDtype/lircrc ] - then - setupremote - fi - ;; -esac - -} - - - -function scrubnfs { -cp /etc/fstab $TEMPLATES/fstab.conf.template -grep -v nfs $TEMPLATES/fstab.conf.template > ${BASE}/etc/fstab - } - - function setupfstab () { - # setupfstab $NFSserver $NFSshare $NFSmount - echo "$1 $2 nfs" >> ${BASE}/etc/fstab - if [ ! -e "$2" ] - then - mkdir -p "$2" - chown mythtv:mythtv "$2" - fi - if [ x$DCONFIG = x ] - then - mount $2 & - fi - -} - -function setupncidclient -{ - sed -e "s/^set Host.*$/set Host $dbhost /" $TEMPLATES/ncid.conf.template >${BASE}/etc/ncid/ncid.conf -} - -function setupnciddaemon { -cp -f /etc/ncid/ncidd.conf $TEMPLATES/ncidd.conf.template -sed -e "s/.*set ttyport.*$/set ttyport = \/dev\/$nciddSerialPort /" $TEMPLATES/ncidd.conf.template >${BASE}/etc/ncid/ncidd.conf - -} - -function setupntp () { -cat > ${BASE}/etc/ntp.conf << EOF -# default restrictions -restrict default noquery notrust nomodify -# NTP drift file - used to keep track of your system clocks -# time deviation -driftfile /etc/ntp.drift - -# NTP log file -logfile /var/log/ntp.log -# override the default restrictions here, servers that can query -restrict 192.168.0.0 mask 255.255.0.0 nomodify -restrict 10.0.0.0 mask 255.0.00 nomodify - -#servers to sync with -EOF -#this is used for backend or standlone types -if [ $1 = "1" ] -then - echo "server ntp1.cs.wisc.edu" >> ${BASE}/etc/ntp.conf - echo "server ntp3.sf-bay.org" >> ${BASE}/etc/ntp.conf - echo "restrict ntp1.cs.wisc.edu noquery nomodify" >> ${BASE}/etc/ntp.conf - echo "restrict ntp3.sf-bay.org noquery nomodify" >> ${BASE}/etc/ntp.conf - -else - echo "server $dbhost" >> ${BASE}/etc/ntp.conf - echo "restrict $dbhost noquery nomodify" >> ${BASE}/etc/ntp.conf -fi - - -} - -function setupplugins (){ - -pkglistinstall="" -pkglistremove="" -#default enabled -for i in mythcontrols mythgallery mythmovietime mythmusic mythsmolt mythvideo -do - eval pkgvalue=\$${i} - - if [ x$pkgvalue = x ] - then - pkglistinstall="$pkglistinstall $i$postfix" - else - if [ x$pkgvalue = x1 ] - then - pkglistinstall="$pkglistinstall $i$postfix" - else - pkglistremove="$pkglistremove $i$postfix" - fi - fi - - - -done - - - -#default disabled -for i in mythphone mytharchive mythbrowser mythnews mythgame mythflix mythweather -do - eval pkgvalue=\$${i} - - if [ x$pkgvalue = x ] - then - pkglistremove="$pkglistremove $i$postfix" - else - if [ x$pkgvalue = x1 ] - then - pkglistinstall="$pkglistinstall $i$postfix" - else - pkglistremove="$pkglistremove $i$postfix" - fi - fi -done -install="$pkglistinstall $install" -remove="$pkglistremove $remove" - -} -function LCDcheck () { -case x$LCDtype in - xtinker) echo "do nothing lcd " - ;; - xno_lcd) echo "no lcd " - ;; - xxosd) install="xosd lcdproc $install" - ;; - x) echo "lcd empty " - ;; - *) - install="lcdproc $install" - ;; -esac -} - - -function packages () { -#see which plugins need to be installed -echo " Starting to install Packages" -setupplugins -LCDcheck -if [ ! -f $PKGBLACKLIST ] -then - touch $PKGBLACKLIST -fi -for i in $remove -do - echo "-----------$i --------------" - grep -q $i $PKGBLACKLIST - if [ $? = 1 ] - then - pacman -Q $i 2>/dev/null - #VAR=`pacman -Q $i 2>&1 ` - if [ $? = 0 ] - then - if [ $i = "mythweb$postfix" ] - then - pacman --noconfirm -R mythweb$postfix - echo removed $i - else - pacman --noconfirm -Rs $i - echo removed $i - fi - fi - else - echo "$i is black listed" - fi -done -# fi - -for i in $install -do - echo "-----------$i --------------" - grep -q $i $PKGBLACKLIST - if [ $? = 1 ] - then - pacman -Q $i 2>/dev/null - #VAR=`pacman -Q $i 2>&1 ` - # echo $VAR |grep -vq error: - - if [ ! $? = 0 ] - then - pacman --noconfirm -Sf $i - echo installed $i - else - echo "$i already installed" - fi - else - echo "$i is black listed" - fi -done -} - -function daemons { -echo "Daemons on boot" - -for i in $daemon_remove -do - sv check $i 1>/dev/null - status=$? - if [ $status -eq 0 ] - then - sv down $i - fi - remove_service.sh $i -done - - -for i in $daemon_add -do - sv check $i 1>/dev/null - status=$? - add_service.sh $i - - if [ $status -eq 0 ] - then - case $i in - mysql*) sv hup $i - ;; - mythback*) sv hup $i - ;; - lirc* ) sv hup $i - ;; - frontend) sv check frontend 1>/dev/null - ;; - - smbd ) sv hup $i - ;; - nmbd ) sv hup $i - ;; - evrouter) sv restart $i - ;; - *) sv down $i - sleep 1 - sv up $i - ;; - esac - fi - -done - -} - - -function services -{ - ser_install="" - ser_daemon_add="" - ser_remove="" - ser_daemon_remove="" - if [ x$UseEvrouter = x1 ] - then - ser_daemon_add="evrouter Xvfb $ser_daemon_add" - else - ser_daemon_remove="evrouter Xvfb $ser_remove" - fi - - if [ x$RunDHCP = x1 ] - then - ser_daemon_add="dnsmasq $ser_daemon_add" - ser_install="dnsmasq mvpmc $ser_install" - - else - ser_daemon_remove="dnsmasq $ser_daemon_remove" - ser_remove="dnsmasq mvpmc $ser_remove" - fi - - if [ x$RunFrontend = x1 ] - then - ser_daemon_add="frontend hal ghosd $ser_daemon_add" - ser_install="ghosd $ser_install" - showX=true - else - ser_daemon_remove="frontend hal $ser_daemon_remove" - ser_remove="$ser_remove" - fi - - if [ x$UseMythWEB = x1 ] - then - ser_install="lighttpd mythweb$postfix $ser_install" - ser_daemon_add="lighttpd $ser_daemon_add" - else - ser_remove="mythweb$postfix $ser_remove" - ser_daemon_remove="$ser_daemon_remove" - fi - - #samba - if [ x$UseSamba = x1 ] - then - ser_install="samba $ser_install" - ser_daemon_add="nmbd smbd $ser_daemon_add " - if [ x$Samba_mediareadonly = x1 ] - then - smreadonly="no" - else - smreadonly="yes" - fi - - if [ x$Samba_homereadonly = x1 ] - then - shreadonly="no" - else - shreadonly="yes" - fi - - if [ ! -d ${BASE}/etc/samba ] - then - mkdir ${BASE}/etc/samba - fi - - if [ -f ${BASE}/data/home/mythtv/templates/smb.conf ] - then - install -D -m755 ${BASE}/data/home/mythtv/templates/smb.conf ${BASE}/etc/samba/smb.conf - else - sed -e "s/^.*workgroup =.*$/ workgroup = $Samba_domain/g " \ - -e "s/^.*server string = .*$/ server string = $hostname/g" $TEMPLATES/samba/smb.conf.template > ${BASE}/etc/samba/smb.conf - - if [ x$Samba_media = "x1" ] - then - echo "include = /etc/samba/smb.conf.media" >> ${BASE}/etc/samba/smb.conf - sed -e "s/^.*writeable.*$/writeable = $smreadonly/g" $TEMPLATES/samba/smb.conf.media > ${BASE}/etc/samba/smb.conf.media - fi - - if [ x$Samba_home = "x1" ] - then - echo "include = /etc/samba/smb.conf.home" >> ${BASE}/etc/samba/smb.conf - sed -e "s/^.*writeable.*$/writeable = $shreadonly/g" $TEMPLATES/samba/smb.conf.home > ${BASE}/etc/samba/smb.conf.home - - fi - - fi - else - ser_remove="samba $ser_remove" - ser_install="smbclient $ser_install" - ser_daemon_remove="smbd nmbd $ser_daemon_remove" - fi - - - if [ x$UseNFS = x1 ] - then - ser_install="nfs-utils portmap $ser_install" - ser_daemon_add="nfsd nfslock portmap $ser_daemon_add" - sed -e "s/REPLACEME/*/g" $TEMPLATES/exports.template > ${BASE}/etc/exports - - else - ser_remove="$ser_remove" - ser_daemon_remove="nfsd nfslock $ser_daemon_remove" - fi - - if [ x$Runncidd = x1 ] - then - ser_daemon_add="ncidd ncid $ser_daemon_add" - ser_install="ncid $ser_install" - else - ser_daemon_remove="ncidd ncid $ser_daemon_remove" - ser_remove="ncid $ser_remove" - fi - if [ x$UseEvrouter = x1 ] - then - ser_install="evrouter Xvfb $ser_install" - else - ser_remove="evrouter $ser_remove" - fi - #Setting the default, just to avoid the or statement.. - if [ x$UseHobbit = x ] - then - UseHobbit=1 - fi - - if [ x$UseHobbit = x1 ] - then - case $SystemType in - Standalone|Master_backend ) - ser_daemon_add="hobbit $ser_daemon_add" - ser_install="hobbitserver $ser_install" - ;; - - *) ser_daemon_add="hobbit-client $ser_daemon_add" - ser_install="hobbit-client $ser_install" - ;; - esac - else - ser_daemon_remove="hobbit hobbit-client $ser_daemon_remove" - ser_remove="hobbit-client hobbitserver $ser_remove" - rm -f /data/srv/httpd/htdocs/hobbit/index.html - - fi - - - -} - - - -function setupsleep { -if [ x$AutoShutdown = x1 ] -then - cronshutdowntime="" - if [ x$Shutdowntime != x-1 ] - then - cronshutdowntime=$Shutdowntime - fi - if [ x$Shutdowntime2 != x-1 ] - then - if [ x$cronshutdowntime = x ] - then - cronshutdowntime=$Shutdowntime2 - else - cronshutdowntime="${cronshutdowntime},${Shutdowntime2}" - fi - fi - - sed -e "s/HOUR/$cronshutdowntime/g" $TEMPLATES/cron.template | crontab - -u mythtv -else - sed -e "/00 HOUR.*/d" $TEMPLATES/cron.template | crontab - -u mythtv -fi - -} - - -function setuppacman () { -#setup link to httpd dir -echo "Configuring pacman" -if [ ! x$1 = x ] -then - ln -s ${BASE}/data/var ${BASE}/data/srv/httpd/htdocs/repo - echo "creating the link for the pacman repo mirror" -fi - -for i in mv-core mv-core-testing mv-extra mv-extra-testing -do - echo "[$i]" > ${BASE}/etc/pacman.d/$i - #add mirror if needed - if [ x$PKG_MIRROR = x1 ] - then - echo " Server = http://$dbhost/repo/$i " >> ${BASE}/etc/pacman.d/$i - fi - #add user templates - USERTEMPLATES="/data/home/mythtv/templates" - if [ -f $USERTEMPLATES/sources/$i ] - then - echo "Adding user $i" - cat $USERTEMPLATES/sources/$i >> ${BASE}/etc/pacman.d/$i - fi - cat $TEMPLATES/sources/$i >> ${BASE}/etc/pacman.d/$i - echo "setting local mirror to $dbhost for $i " -done - -#sed -e "s/REPLACEME/$dbhost/g" $TEMPLATES/sources/svc_pkg > /etc/pacman.d/svc_pkg - - -} - - -function setupzipcode () { -if [ ! x$zipcode = x ] -then - ${MV_ROOT}/bin/restore_default_settings.sh -c ZIP -z $zipcode -fi -} - -function process_nfsmap () { -#first look for a local copy of nfsmap -if [ $1 = noip ] -then - if [ -f /data/home/mythtv/templates/nfsmap ] - then - NFSMAP="/data/home/mythtv/templates/nfsmap" - else - mv -f /tmp/nfsmap /tmp/nfsmap.old - wget -O /tmp/nfsmap http://$dbhost:1337/templates/nfsmap - if [ $? = 0 ] - then - NFSMAP="/tmp/nfsmap" - fi - fi -else - mv -f /tmp/nfsmap /tmp/nfsmap.old - wget -O /tmp/nfsmap http://$1:1337/templates/nfsmap - if [ $? = 0 ] - then - NFSMAP="/tmp/nfsmap" - fi -fi - -if [ -f $NFSMAP ] -then - #read in file - while read line - do - NFSserver=`echo "$line"|cut -d" " -f1` - NFSmount=`echo "$line"|cut -d" " -f2` - setupfstab $NFSserver $NFSmount - done <$NFSMAP -else - echo "couldn't find nfsmap" - -fi -} - -function setupcnfs () { -scrubnfs -if [ $HaveCentralNFS = "yes" ] -then - case x$NFSserver in - xfile:nfsmap ) - process_nfsmap noip - ;; - *:nfsmap ) - nfsmapip=`echo "$NFSserver" | cut -d: -f1 ` - process_nfsmap $nfsmapip - ;; - *) setupfstab $NFSserver $NFSmount - esac - - #if [ ! x"$NFSserver" = "xfile:nfsmap" ] - #then - # setupfstab $NFSserver $NFSmount - #else - # process_nfsmap - #fi -else - echo "fe_nfs" - #if no central nfs found, then use the mbe. - if [ $SystemType = "Frontend_only" ] - then - setupfstab ${dbhost}:/data/media /data/media - fi -fi - -} - -function setupbootsplash () { - -if [ x$Usebootsplash = x1 ] -then - COMMAND="%s/^default.*0/default 1/g" -else - COMMAND="%s/^default.*1/default 0/g" -fi - -ex ${BASE}/boot/grub/menu.lst <<EOF -:$COMMAND -:wq -EOF - -} - -function setuphobbitclient () { -COMMAND="%s/^BBDISP=.*$/BBDISP=$dbhost/g" - - -ex ${BASE}/data/srv/hobbit/client/etc/hobbitclient.cfg <<EOF -:$COMMAND -:wq -EOF - -} - -function setupSyslog () { -COMMAND="%s/^destination d_remote.*$/destination d_remote \{tcp\(\"${dbhost}\" port\(514\)\) \;\} \;/" -ex ${BASE}/etc/syslog-ng.conf <<EOF -:$COMMAND -:wq -EOF - - - - -} - -function setupfuncminion () { -COMMAND="%s/^certmaster.*$/certmaster = ${dbhost}/" -ex ${BASE}/etc/certmaster/minion.conf <<EOF -:$COMMAND -:wq -EOF -} - -function setupDNSMASQ(){ -if [ x$RunDHCP = x1 ] -then - echo "DNSMASQ setup" - - #set default route to my GW - COMMAND="%s/^dhcp-option=3.*$/dhcp-option=3,${route}/" - ex ${BASE}/etc/dnsmasq.conf <<EOF - :$COMMAND - :wq -EOF - - #setup dns to my ip - COMMAND="%s/^dhcp-option=6.*$/dhcp-option=6,${MYTHIP}/" - ex ${BASE}/etc/dnsmasq.conf <<EOF - :$COMMAND - :wq -EOF - - - #change nfsroot to my ip - COMMAND="%s/nfsroot=.*:/nfsroot=${MYTHIP}:/" - ex ${BASE}/data/srv/tftp/pxelinux.cfg/default <<EOF - :$COMMAND - :wq -EOF - - #add 127.0.0.1 to /etc/resolv.conf - echo "search lan" > ${BASE}/etc/resolv.conf - echo "nameserver 127.0.0.1" >> ${BASE}/etc/resolv.conf - echo "nameserver $nameserver" >> ${BASE}/etc/resolv.conf -fi - -#setup dongle.config -COMMAND="%s/mvpmc -f .*/mvpmc -f \/etc\/helvR10.fon -s ${MYTHIP} \& /" -ex ${BASE}/data/srv/tftp/dongle.bin.config <<EOF -:$COMMAND -:wq -EOF -} - -function reloadfe(){ -PID=`ps -ef |grep mythfrontend|grep -v grep |awk '{print $2 }'` -/usr/bin/backend_control.sh clearcache behost $dbhost -if [ x$RESTART_LCD = xtrue ] -then - killall -9 mythlcdserver -fi -kill -s USR1 $PID - -} - - -function setup_db (){ - -install="mysql avahli" -daemon_add="mysql" -packages -daemons -status=1 -mysqlstatus=1 -while [ ! $status = 0 ] -do - sv stop mysql - sleep 1 - sv start mysql - mysqlstatus=$? - if [ $mysqlstatus = 0 ] - then - mysql -e "show databases;" - showstatus=$? - if [ $showstatus = 0 ] - then - pacman --noconfirm -R mythdb-initial - pacman --noconfirm -S mythdb-initial - $MV_ROOT/bin/restore_default_settings.sh -c load - if [ $SystemType = "Master_backend" ] - then - $MV_ROOT/bin/restore_default_settings.sh -c BECONFIG -s master -a $dbhost - fi - #update database to allow user jobs on this host. - $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW - $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL - if [ -d /data/srv/mysql/mythconverg ] - then - pacman --noconfirm -R webcalendar - pacman --noconfirm --nodeps -S webcalendar - status=0 - fi - fi - fi -done -} - -function setup_web_auth { - if [ x$UseMythWEB_auth = x1 ] - then - #enable auth - sed -ie "s/^.*include.*auth-inc.conf.*$/include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf - else - #disable auth - sed -ie "s/^.*include.*auth-inc.conf.*$/#include \"\/etc\/lighttpd\/auth-inc.conf\"/g" /etc/lighttpd/lighttpd.conf - fi - sudo sv restart lighttpd - -} - -#----------------------------------------------------MAIN PROGRAM------------------------------------------- -#misc,sleep,hostype,advanced,audio -eval LAST=\$$# -LIST=`echo $LAST | tr , " " ` - -hosttypechange="false" - - -for i in $LIST -do - echo $i - case $i in - misc) showmisc="true" - ;; - sleep) showsleep="true" - ;; - hostype) showhost="true" - showX="true" - ;; - hostypec) hosttypechange="true" - ;; - advanced) showadvanced="true" - #showhost="true" - ;; - audio) showaudio="true" - ;; - network) shownetwork="true" - ;; - advancedX) showX="true" - ;; - webuser) setup_web_auth - ;; - restartfe) killall -9 mythfrontend - killall -9 mythwelcome - exit 0 - ;; - reloadfe) reloadfe - ;; - - this_is_install) MV_NEW_INSTALL="true" - ;; - NETINSTALL) RESTART_NETWORK="false" - NET_INSTALL="true" - - esac -done - -if [ x$MV_NEW_INSTALL = xtrue ] -then - hosttypechange="false" -fi - - - -# exit 1 - -#network -if [ x"$shownetwork" = xtrue ] -then - OLDHOSTNAME=`hostname` - NEWHOSTNAME=$hostname - if [ ! $OLDHOSTNAME = $NEWHOSTNAME ] - then - if [ ! x$NET_INSTALL = xtrue ] - then - ${MV_ROOT}/bin/restore_default_settings.sh -cuhostname -o -h$OLDHOSTNAME - RESTART_FE="true" - hostname $NEWHOSTNAME - if [ $SystemType != "Frontend_only" ] - then - sv restart mythbackend - fi - fi - fi - - setup_network - vnc_check - if [ x$USEVNC = x1 ] - then - echo "reloading network" - ${BASE}/etc/net/scripts/network.init reload - ${BASE}/etc/net/scripts/network.init restart - else - echo "netboot/vnc, will not restart network" - fi -fi - - -if [ x$showhost = "xtrue" ] -then - case $SystemType in - Standalone) - setupntp 1 - services - if [ x$hosttypechange = "xtrue" ] - then - setup_db - fi - if [ -f ${BASE}/etc/avahi/services/mysql.service ] - then - rm -f ${BASE}/etc/avahi/services/mysql.service - sudo sv restart avahi - fi - - install="lighttpd mysql mythdb-initial avahli myth2ipod mythtv-status portmap local-website webcalendar php $ser_install" - remove="none $ser_remove" - - daemon_add="lighttpd mysql mythbackend avahi portmap $ser_daemon_add" - daemon_remove="none $ser_daemon_remove" - - ;; - Master_backend) - setupntp 1 - services - - if [ ! -f ${BASE}/etc/avahi/services/mysql.service ] - then - mkdir ${BASE}/etc/avahi/services - cp $TEMPLATES/mysql.service ${BASE}/etc/avahi/services/mysql.service - sudo sv restart avahi - fi - - install="lighttpd local-website mysql mythdb-initial webcalendar php avahi portmap myth2ipod mythtv-status func $ser_install " - remove="$ser_remove" - - daemon_add="lighttpd mysql mythbackend avahi portmap certmaster $ser_daemon_add" - daemon_remove="$ser_daemon_remove" - ;; - Slave_backend) - setupntp 0 - services - if [ x$hosttypechange = "xtrue" ] - then - setup_db - fi - if [ -f ${BASE}/etc/avahi/services/mysql.service ] - then - rm -f ${BASE}/etc/avahi/services/mysql.service - sudo sv restart avahi - fi - - #cp $TEMPLATES/mysql.service ${BASE}/etc/avahi/services/mysql.service - install="mysql avahi func $ser_install " - remove=" $ser_remove" - - daemon_add="mythbackend avahi portmap mythtv-status funcd $ser_daemon_add" - daemon_remove="$ser_daemon_remove" - ;; - Frontend_only) - #Add values for services - setupntp 0 - services - if [ -f ${BASE}/etc/avahi/services/mysql.service ] - then - rm -f ${BASE}/etc/avahi/services/mysql.service - sudo sv restart avahi - fi - - install="libmysqlclient mysql-clients portmap avahi func $ser_install" - remove="mysql local-website lighttpd php mythweb$postfix $ser_remove" - - daemon_add="avahi portmap funcd $ser_daemon_add " - daemon_remove="mysql lighttpd mythbackend $ser_daemon_remove" - ;; - - - esac - setupSyslog - setupfuncminion -fi - -#apply these to ALL types - - - - -#systemtype - -if [ x$showhost = "xtrue" ] -then - setupmysqlnetwork - setupmysql - setupremote - #grab the new dbhost key - /usr/bin/grabkey.py -fi - -#audio - -if [ x$showaudio = "xtrue" ] -then - #setupsoundtype - if [ ! x$Audiotype = xtinker ] - then - ${MV_ROOT}/bin/soundconfig.sh -t real -i $Audiotype -d $SoundDevice - fi -fi - -#should always run -packages - -#misc - -if [ x$showmisc = "xtrue" ] -then - setupzipcode - settimezone - setupcnfs -fi - -#sleep -if [ x$showsleep = "xtrue" ] -then - setupsleep -fi - -if [ x$showX = "xtrue" ] -then - ${MV_ROOT}/bin/xconfig.sh -fi - -#advanced -if [ x$showadvanced = "xtrue" ] -then - if [ ! x$showhost = "xtrue" ] - then - services - install="none $ser_install" - remove="none $ser_remove" - daemon_add=" none $ser_daemon_add" - daemon_remove="none $ser_daemon_remove" - packages - - - if [ x$SystemType = xMaster_backend ] - then - setuppacman link - else - setuppacman - fi - fi - setupncidclient - setupnciddaemon - setupbootsplash - setuphobbitclient - setupreceiver - setupevrouter - setupblaster - setupLCD - setupDNSMASQ - -fi - - - -daemons -#add check for lcd, and restart if needed. - -if [ x$RESTART_FE = xtrue ] -then - reloadfe -fi - - +postfix=`cat ${BASE}/usr/local/share/mythtv/.releasetype` +systemconfig.py -m $@ +rc=$? +echo "systemconfig.py exit code $rc" +exit $rc -case $SystemType in - Standalone) smoltsystem=6 - MVRELEASE="$MVRELEASE (Standalone)" - ;; - Master_backend) - if [ x$RunFrontend = x1 ] - then - smoltsystem=2 - MVRELEASE="$MVRELEASE (MBE with Frontend)" - else - smoltsystem=1 - MVRELEASE="$MVRELEASE (MBE)" - fi - ;; - Slave_backend) - if [ x$RunFrontend = x1 ] - then - smoltsystem=5 - MVRELEASE="$MVRELEASE (SLAVE with Frontend)" - else - smoltsystem=5 - MVRELEASE="$MVRELEASE (SLAVE)" - fi - ;; - Frontend_only) - smoltsystem=3 - MVRELEASE="$MVRELEASE ( Frontend only)" - ;; -esac -echo $MVRELEASE > /etc/os_myth_release -echo "systemtype=$smoltsystem" > /data/home/mythtv/.mythtv/smolt.info 2>/dev/null -echo "remote=$Remotetype" >> /data/home/mythtv/.mythtv/smolt.info 2>/dev/null diff --git a/abs/mv-core/MythVantage-config/timezip.py b/abs/mv-core/MythVantage-config/timezip.py index 18f338f..bf6b389 100755 --- a/abs/mv-core/MythVantage-config/timezip.py +++ b/abs/mv-core/MythVantage-config/timezip.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # import MySQL module #used to import the zipcode/timezone/nfs info fromMBE import MySQLdb @@ -45,7 +46,10 @@ def selectvars(): # execute SQL statement cursor.execute("select hostname from settings where value='BackendServerIP' and data=(%s)",(masterdb)) result = cursor.fetchone() - BEhostname=result[0] + try: + BEhostname=result[0] + except TypeError: + BEhostname="" cursor.execute("select data from settings where value='HostZipcode' and hostname=(%s)",(BEhostname)) result = cursor.fetchone() @@ -87,7 +91,7 @@ def selectvars(): try: tz_region=result[0] except TypeError: - tz="" + tz_region="" tempsubregion="HostTimeZoneRegion_" + tz_region cursor.execute("select data from settings where value=%s and hostname=(%s)",(tempsubregion,BEhostname)) diff --git a/abs/mv-core/MythVantage-config/xconfig.sh b/abs/mv-core/MythVantage-config/xconfig.sh index eaa84b6..2fad821 100755 --- a/abs/mv-core/MythVantage-config/xconfig.sh +++ b/abs/mv-core/MythVantage-config/xconfig.sh @@ -1,51 +1,64 @@ #!/bin/bash +#SET DISPLAYCARD to force a cardtype +#SET DISPLAYRES to force Xres, ENV takes precendent over cmdline +#displayres=cmdline #NVPKGS="ati-dri xf86-video-ati xf86-video-radeonhd intel-dri xf86-video-intel unichrome-dri xf86-video-unichrome xf86-video-mga xf86-video-savage xf86-video-trident" -NVPKGS="ati-dri xf86-video-ati xf86-video-radeonhd intel-dri xf86-video-intel xf86-video-mga xf86-video-savage xf86-video-trident" +NVPKGS="ati-dri xf86-video-ati xf86-video-radeonhd intel-dri xf86-video-intel xf86-video-mga xf86-video-savage xf86-video-trident unichrome-dri xf86-video-openchrome" BASE="" . /etc/profile NVIDIA_96XX="$TEMPLATES/xorg/96xx_supported.txt" #TEMPLATES="/usr/share/templates" +MYTHHOME=$BASE/home/mythtv function Xvalues { CMDLINE=$(cat /proc/cmdline) echo "$CMDLINE" | grep -q forceXvesa - if [ $? = 0 ] + if [ $? = 0 ] then VGACARDTYPE=vesa + Xcardtype=$VGACARDTYPE else VGACARDTYPE=`lspci | grep -i vga | sort -r | head -n 1 | cut -d: -f3 | cut -d" " -f2` VGAPCIID=`lspci | grep -i vga | sort -r | head -n 1 | cut -d" " -f1` CARDID=`lspci -n | grep "$VGAPCIID" | grep 10de | cut -d" " -f3 | cut -d: -f2` VENDORID=`lspci -n | grep "$VGAPCIID" | grep 10de | cut -d" " -f3 | cut -d: -f1` fi - echo "$VGACARDTYPE" + #force VGACARDTYPE + if [ ! x$DISPLAYCARD = x ] + then + VGACARDTYPE=$DISPLAYCARD + Xcardtype=$VGACARDTYPE + fi + echo "Will use $VGACARDTYPE" currentmode=`cat "$BASE/etc/X11/xorg.conf" | grep Modes | awk -Fs '{ print $2 }'` } function presetupX { - if [ "$XUseAdvanced" = 1 ] + if [ -f /etc/sysconfig/IGNORE_X ] then + echo "Will not run xconfig.sh due to presence of /etc/sysconfig/IGNORE_X" + return 1 + else if [ "$XIgnoreConfig" = 1 ] then echo "Using User supplied X" - if [ -f "$BASE/data/home/mythtv/templates/xorg.user" ] + if [ -f "$MYTHHOME/templates/xorg.user" ] then - cp -f "$BASE/data/home/mythtv/templates/xorg.user" "$XORG_CONF" + cp -f "$MYTHHOME/templates/xorg.user" "$XORG_CONF" else echo "Didn't find the file" - echo "Copy your config file to $BASE/data/home/mythtv/templates/xorg.use" >> "$XORG_CONF" + echo "Copy your config file to $MYTHHOME/templates/xorg.user" > "$XORG_CONF" fi else - setupAdvancedX - fi - else - if [ -f /etc/sysconfig/IGNORE_X ] - then - echo "Will not run xconfig.sh due to presence of /etc/sysconfig/IGNORE_X" - else - setupX + if [ "$XUseAdvanced" = 1 ] + then + setupAdvancedX + else + setupX + fi fi fi + } function setupAdvancedX { @@ -53,7 +66,7 @@ function setupAdvancedX { Xcategory=`echo "$Xresadvanced" | cut -d_ -f1` Xres=`echo "$Xresadvanced" | cut -d_ -f2` echo "$Xcategory" - if [ "$Xcategory" = "Nvidia" ] + if [ "$Xcategory" = "nVidia Modeline" ] then Xres="" if [ "$XnVidia1080p" = "1" ] @@ -79,7 +92,7 @@ function setupAdvancedX { fi # echo $ML case $Xcardtype in - NVIDIA|nVidia) + NVIDIA|nVidia|nvidia) case $Xconnection in DVI) ConnectedMonitor=DFP ;; vga) ConnectedMonitor=CRT;; @@ -175,7 +188,12 @@ function setupX { then case $VGACARDTYPE in nVidia) - sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.nvidia" > "$XORG_CONF" + if [ ${Xres} = Auto ] + then + sed -e "/^.*Modes.*$/d" "$TEMPLATES/xorg/xorg.conf.nvidia" > "$XORG_CONF" + else + sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.nvidia" > "$XORG_CONF" + fi if [ "$TESTMODE" != "test" ] then #nvidia check right here @@ -184,11 +202,13 @@ function setupX { then #install 96xx drivers echo "installing nvidia 96xx drivers" + pacman --noconfirm -Rd libgl > /dev/null 2>&1 pacman --noconfirm -R $NVPKGS > /dev/null 2>&1 pacman --noconfirm -S nvidia-96xx nvidia-96xx-utils > /dev/null 2>&1 else #install latest drivers echo "installing current nvidia drivers" + pacman --noconfirm -Rd libgl > /dev/null 2>&1 pacman --noconfirm -R $NVPKGS > /dev/null 2>&1 pacman --noconfirm -S nvidia nvidia-utils > /dev/null 2>&1 fi @@ -205,7 +225,12 @@ function setupX { # xf86-video-openchrome # xf86-video-unichrome # There is also a seperate driver for the Unichrome Pro - sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.via" > "$XORG_CONF" + if [ ${Xres} = Auto ] + then + sed -e "/^.*Modes.*$/d" "$TEMPLATES/xorg/xorg.conf.via" > "$XORG_CONF" + else + sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.via" > "$XORG_CONF" + fi if [ "$TESTMODE" != "test" ] then if [ "$OPENCHROME" = "1" ] @@ -236,8 +261,13 @@ function setupX { fi ;; - Intel) - sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.intel" > "$XORG_CONF" + Intel|intel) + if [ ${Xres} = Auto ] + then + sed -e "/^.*Modes.*$/d" "$TEMPLATES/xorg/xorg.conf.intel" > "$XORG_CONF" + else + sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.intel" > "$XORG_CONF" + fi if [ "$TESTMODE" != "test" ] then pacman --noconfirm -R nvidia-utils > /dev/null 2>&1 @@ -247,7 +277,12 @@ function setupX { ;; vesa|InnoTek) - sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF" + if [ ${Xres} = Auto ] + then + sed -e "/^.*Modes.*$/d" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF" + else + sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vesa" > "$XORG_CONF" + fi ;; *) @@ -257,11 +292,21 @@ function setupX { if [ -f "$XCONF" ] then echo "Using $XCONF" - grep -v Modes "$XCONF" | sed -e "/Depth.*16/a Modes \"${Xres}\" " -e "/Depth.*24/a Modes \"${Xres}\"" -e 's/dev\/mouse/dev\/psaux/g'> "$XORG_CONF" + if [ ${Xres} = Auto ] + then + grep -v Modes "$XCONF" | sed -e 's/dev\/mouse/dev\/psaux/g'> "$XORG_CONF" + else + grep -v Modes "$XCONF" | sed -e "/Depth.*16/a Modes \"${Xres}\" " -e "/Depth.*24/a Modes \"${Xres}\"" -e 's/dev\/mouse/dev\/psaux/g'> "$XORG_CONF" + fi elif [ -f "$XCONFB" ] then echo "Using $XCONFB" - sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$XCONFB" > "$XORG_CONF" + if [ ${Xres} = Auto ] + then + sed -e "/^.*Modes.*$/d" "$XCONFB" > "$XORG_CONF" + else + sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$XCONFB" > "$XORG_CONF" + fi else echo "Xorg configuration failed" fi @@ -296,6 +341,22 @@ else else Xres="800x600" fi + CMDLINE=$(cat /proc/cmdline) + echo $CMDLINE | grep -q displayres + if [ $? = 0 ] + then + TEMPVAR=${CMDLINE#*displayres=} + DSR=${TEMPVAR%% *} + fi + if [ ! x$DSR = x ] + then + Xres=$DSR + fi + if [ ! x$DISPLAYRES = x ] + then + Xres=$DISPLAYRES + fi + XORG_CONF="/etc/X11/xorg.conf" XVMC_CONFIG="/etc/X11/XvMCConfig" fi diff --git a/abs/mv-core/hobbit-client/client/bin/bb b/abs/mv-core/hobbit-client/client/bin/bb Binary files differindex 1202ab4..0fa4434 100755 --- a/abs/mv-core/hobbit-client/client/bin/bb +++ b/abs/mv-core/hobbit-client/client/bin/bb diff --git a/abs/mv-core/hobbit-client/client/bin/bbcmd b/abs/mv-core/hobbit-client/client/bin/bbcmd Binary files differindex 3dd325b..a18e54c 100755 --- a/abs/mv-core/hobbit-client/client/bin/bbcmd +++ b/abs/mv-core/hobbit-client/client/bin/bbcmd diff --git a/abs/mv-core/hobbit-client/client/bin/bbdigest b/abs/mv-core/hobbit-client/client/bin/bbdigest Binary files differindex 9f607e9..c073c01 100755 --- a/abs/mv-core/hobbit-client/client/bin/bbdigest +++ b/abs/mv-core/hobbit-client/client/bin/bbdigest diff --git a/abs/mv-core/hobbit-client/client/bin/bbhostgrep b/abs/mv-core/hobbit-client/client/bin/bbhostgrep Binary files differindex e981aee..d46fd7b 100755 --- a/abs/mv-core/hobbit-client/client/bin/bbhostgrep +++ b/abs/mv-core/hobbit-client/client/bin/bbhostgrep diff --git a/abs/mv-core/hobbit-client/client/bin/bbhostshow b/abs/mv-core/hobbit-client/client/bin/bbhostshow Binary files differindex 2157ccb..ea5633a 100755 --- a/abs/mv-core/hobbit-client/client/bin/bbhostshow +++ b/abs/mv-core/hobbit-client/client/bin/bbhostshow diff --git a/abs/mv-core/hobbit-client/client/bin/clientupdate b/abs/mv-core/hobbit-client/client/bin/clientupdate Binary files differindex 9db22bd..761feae 100755 --- a/abs/mv-core/hobbit-client/client/bin/clientupdate +++ b/abs/mv-core/hobbit-client/client/bin/clientupdate diff --git a/abs/mv-core/hobbit-client/client/bin/hobbitlaunch b/abs/mv-core/hobbit-client/client/bin/hobbitlaunch Binary files differindex 9104dda..ab2185c 100755 --- a/abs/mv-core/hobbit-client/client/bin/hobbitlaunch +++ b/abs/mv-core/hobbit-client/client/bin/hobbitlaunch diff --git a/abs/mv-core/hobbit-client/client/bin/logfetch b/abs/mv-core/hobbit-client/client/bin/logfetch Binary files differindex 0b71938..40e36a0 100755 --- a/abs/mv-core/hobbit-client/client/bin/logfetch +++ b/abs/mv-core/hobbit-client/client/bin/logfetch diff --git a/abs/mv-core/hobbit-client/client/bin/msgcache b/abs/mv-core/hobbit-client/client/bin/msgcache Binary files differindex 33daa51..3f8c57d 100755 --- a/abs/mv-core/hobbit-client/client/bin/msgcache +++ b/abs/mv-core/hobbit-client/client/bin/msgcache diff --git a/abs/mv-core/hobbit-client/client/bin/orcahobbit b/abs/mv-core/hobbit-client/client/bin/orcahobbit Binary files differindex 9fcb227..05a359e 100755 --- a/abs/mv-core/hobbit-client/client/bin/orcahobbit +++ b/abs/mv-core/hobbit-client/client/bin/orcahobbit diff --git a/abs/mv-core/mp_all.sh b/abs/mv-core/mp_all.sh new file mode 100644 index 0000000..dd310fc --- /dev/null +++ b/abs/mv-core/mp_all.sh @@ -0,0 +1,31 @@ +#!/bin/sh +pkgver=21228 +pkgrel=1 + +# NOTE: Make sure to build and install mythtv first BEFORE building anything else +buildlist=('mythtv' 'mytharchive' 'mythbrowser' 'mythflix' 'mythgallery' 'mythgame' 'mythmovies' 'mythmusic' 'mythnews' 'mythvideo' 'mythweather' 'mythzoneminder' 'mythweb' 'myththemes' 'morethemes') +#buildlist=(mythtv-release-fixes Midnight-blue Midnight-wide MythVanage-mythmenu basic-amber basic-blue basic-green basic-purple basic-red mytharchive mythbrowser mythcontrols mythflix mythgallery mythgame mythmovietime mythmusic mythnews mythphone mythsmolt mythtv-themes mythvideo mythweather mythweb syth-lacquer-clean syth-lacquer-wide) +buildlist=(Midnight-blue Midnight-wide MythVanage-mythmenu basic-amber basic-blue basic-green basic-purple basic-red mytharchive mythbrowser mythcontrols mythflix mythgallery mythgame mythmovietime mythmusic mythnews mythphone mythsmolt mythtv-themes mythvideo mythweather mythweb syth-lacquer-wide) +buildlist=(MythVantage-config MythVantage-system certmaster confuse dnsmasq e16-myth-settings enlightenment evrouter func ghosd graphviz hobbit-client hobbitmon keylaunch lcdproc lighttpd local-website mediadirs mythdb-initial mythtv-status mythvantage-live ncid openssh runit-scripts-mv syslog-ng tilda webcal) +# build and install +for i in `echo ${buildlist[@]:0}` +do + echo "---------- building $i ----------" + cd ./$i + + # set svn version in the PKGBUILD +# sed -i s/^pkgver=.*/pkgver=$pkgver/ PKGBUILD +# sed -i s/^pkgrel=.*/pkgrel=$pkgrel/ PKGBUILD + + # make the package + mp -sr --noconfirm -f --holdver || exit 1 + pacman -Sy + # clean up afterwards + rm -rf pkg + rm -f *~ + + cd .. +done + +echo "" +echo "DONE!" diff --git a/abs/mv-core/myth/release-fixes/compile-plugins.sh b/abs/mv-core/myth/release-fixes/compile-plugins.sh deleted file mode 100755 index 22d03d9..0000000 --- a/abs/mv-core/myth/release-fixes/compile-plugins.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -logdir=`pwd` -rm fail.log -for i in plugins/* -do - if [ -d $i ] - then - mydir=`pwd` - - cd $i -# versionpkg -mf||exit 1 - echo "starting $i" - mp -fsr || echo "$i failed" >> $logdir/fail.log - cd $mydir - fi -done - diff --git a/abs/mv-core/myth/release-fixes/Midnight-blue/PKGBUILD b/abs/mv-core/myth/stable/Midnight-blue/PKGBUILD index 7c09fcf..d5fe664 100755 --- a/abs/mv-core/myth/release-fixes/Midnight-blue/PKGBUILD +++ b/abs/mv-core/myth/stable/Midnight-blue/PKGBUILD @@ -1,6 +1,6 @@ pkgname=Midnight-blue -pkgver=1 -pkgrel=23 +pkgver=21228 +pkgrel=1 pkgdesc="" url="" license="" diff --git a/abs/mv-core/myth/release-fixes/Midnight-wide/PKGBUILD b/abs/mv-core/myth/stable/Midnight-wide/PKGBUILD index 73fb965..13b0e6e 100755 --- a/abs/mv-core/myth/release-fixes/Midnight-wide/PKGBUILD +++ b/abs/mv-core/myth/stable/Midnight-wide/PKGBUILD @@ -1,6 +1,6 @@ pkgname=Midnight-wide -pkgver=1 -pkgrel=23 +pkgver=21228 +pkgrel=1 pkgdesc="" url="" license="" diff --git a/abs/mv-core/myth/release-fixes/MythVanage-mythmenu/MythVantage-menu/HOST_SETTINGS.xml b/abs/mv-core/myth/stable/MythVanage-mythmenu/MythVantage-menu/HOST_SETTINGS.xml index c9b7e20..c9b7e20 100755 --- a/abs/mv-core/myth/release-fixes/MythVanage-mythmenu/MythVantage-menu/HOST_SETTINGS.xml +++ b/abs/mv-core/myth/stable/MythVanage-mythmenu/MythVantage-menu/HOST_SETTINGS.xml diff --git a/abs/mv-core/myth/release-fixes/MythVanage-mythmenu/MythVantage-menu/util_menu.xml b/abs/mv-core/myth/stable/MythVanage-mythmenu/MythVantage-menu/util_menu.xml index aeecbbb..aeecbbb 100644 --- a/abs/mv-core/myth/release-fixes/MythVanage-mythmenu/MythVantage-menu/util_menu.xml +++ b/abs/mv-core/myth/stable/MythVanage-mythmenu/MythVantage-menu/util_menu.xml diff --git a/abs/mv-core/myth/release-fixes/MythVanage-mythmenu/MythVantage-menu/util_menu.xml.mv b/abs/mv-core/myth/stable/MythVanage-mythmenu/MythVantage-menu/util_menu.xml.mv index 4a94303..4a94303 100755 --- a/abs/mv-core/myth/release-fixes/MythVanage-mythmenu/MythVantage-menu/util_menu.xml.mv +++ b/abs/mv-core/myth/stable/MythVanage-mythmenu/MythVantage-menu/util_menu.xml.mv diff --git a/abs/mv-core/myth/release-fixes/MythVanage-mythmenu/PKGBUILD b/abs/mv-core/myth/stable/MythVanage-mythmenu/PKGBUILD index ed3a517..e03f7a6 100755 --- a/abs/mv-core/myth/release-fixes/MythVanage-mythmenu/PKGBUILD +++ b/abs/mv-core/myth/stable/MythVanage-mythmenu/PKGBUILD @@ -1,6 +1,6 @@ pkgname=MythVantage-mythmenu -pkgver=1.0 -pkgrel=7 +pkgver=21228 +pkgrel=1 pkgdesc="Myth menu with MythVantage settings" #depends=( mythtv-svn ) source=() diff --git a/abs/mv-core/myth/release-fixes/basic-amber/PKGBUILD b/abs/mv-core/myth/stable/basic-amber/PKGBUILD index 739486f..7568b16 100755 --- a/abs/mv-core/myth/release-fixes/basic-amber/PKGBUILD +++ b/abs/mv-core/myth/stable/basic-amber/PKGBUILD @@ -1,6 +1,6 @@ pkgname=basic-amber -pkgver=1 -pkgrel=8 +pkgver=21228 +pkgrel=1 pkgdesc="" url="" license="" diff --git a/abs/mv-core/myth/release-fixes/basic-blue/PKGBUILD b/abs/mv-core/myth/stable/basic-blue/PKGBUILD index 6e6d7d8..0e1df75 100755 --- a/abs/mv-core/myth/release-fixes/basic-blue/PKGBUILD +++ b/abs/mv-core/myth/stable/basic-blue/PKGBUILD @@ -1,6 +1,6 @@ pkgname=basic-blue -pkgver=1 -pkgrel=8 +pkgver=21228 +pkgrel=1 pkgdesc="" url="" license="" diff --git a/abs/mv-core/myth/release-fixes/basic-green/PKGBUILD b/abs/mv-core/myth/stable/basic-green/PKGBUILD index 6cca366..e0867f5 100755 --- a/abs/mv-core/myth/release-fixes/basic-green/PKGBUILD +++ b/abs/mv-core/myth/stable/basic-green/PKGBUILD @@ -1,6 +1,6 @@ pkgname=basic-green -pkgver=1 -pkgrel=7 +pkgver=21228 +pkgrel=1 pkgdesc="" url="" license="" diff --git a/abs/mv-core/myth/release-fixes/basic-purple/PKGBUILD b/abs/mv-core/myth/stable/basic-purple/PKGBUILD index cc5baeb..8c470d0 100755 --- a/abs/mv-core/myth/release-fixes/basic-purple/PKGBUILD +++ b/abs/mv-core/myth/stable/basic-purple/PKGBUILD @@ -1,6 +1,6 @@ pkgname=basic-purple -pkgver=1 -pkgrel=7 +pkgver=21228 +pkgrel=1 pkgdesc="" url="" license="" diff --git a/abs/mv-core/myth/release-fixes/basic-red/PKGBUILD b/abs/mv-core/myth/stable/basic-red/PKGBUILD index 1ff6569..2815672 100755 --- a/abs/mv-core/myth/release-fixes/basic-red/PKGBUILD +++ b/abs/mv-core/myth/stable/basic-red/PKGBUILD @@ -1,6 +1,6 @@ pkgname=basic-red -pkgver=1 -pkgrel=9 +pkgver=21228 +pkgrel=1 pkgdesc="" url="" license="" diff --git a/abs/mv-core/myth/stable/mp_all.sh b/abs/mv-core/myth/stable/mp_all.sh new file mode 100644 index 0000000..ef6aea8 --- /dev/null +++ b/abs/mv-core/myth/stable/mp_all.sh @@ -0,0 +1,30 @@ +#!/bin/sh +pkgver=21228 +pkgrel=1 + +# NOTE: Make sure to build and install mythtv first BEFORE building anything else +buildlist=('mythtv' 'mytharchive' 'mythbrowser' 'mythflix' 'mythgallery' 'mythgame' 'mythmovies' 'mythmusic' 'mythnews' 'mythvideo' 'mythweather' 'mythzoneminder' 'mythweb' 'myththemes' 'morethemes') +#buildlist=(mythtv-release-fixes Midnight-blue Midnight-wide MythVanage-mythmenu basic-amber basic-blue basic-green basic-purple basic-red mytharchive mythbrowser mythcontrols mythflix mythgallery mythgame mythmovietime mythmusic mythnews mythphone mythsmolt mythtv-themes mythvideo mythweather mythweb syth-lacquer-clean syth-lacquer-wide) +buildlist=(Midnight-blue Midnight-wide MythVanage-mythmenu basic-amber basic-blue basic-green basic-purple basic-red mytharchive mythbrowser mythcontrols mythflix mythgallery mythgame mythmovietime mythmusic mythnews mythphone mythsmolt mythtv-themes mythvideo mythweather mythweb syth-lacquer-wide) +# build and install +for i in `echo ${buildlist[@]:0}` +do + echo "---------- building $i ----------" + cd ./$i + + # set svn version in the PKGBUILD + sed -i s/^pkgver=.*/pkgver=$pkgver/ PKGBUILD + sed -i s/^pkgrel=.*/pkgrel=$pkgrel/ PKGBUILD + + # make the package + mp -sr --noconfirm -f -i --holdver || exit 1 + + # clean up afterwards + rm -rf pkg + rm -f *~ + + cd .. +done + +echo "" +echo "DONE!" diff --git a/abs/mv-core/myth/release-fixes/plugins/mytharchive/PKGBUILD b/abs/mv-core/myth/stable/mytharchive/PKGBUILD index ad6b8fb..16e4ce9 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mytharchive/PKGBUILD +++ b/abs/mv-core/myth/stable/mytharchive/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mytharchive-release-fixes -pkgver=17719 -pkgrel=6 +pkgver=21228 +pkgrel=1 pkgdesc="MythTV plugin that lets you create DVDs from or archive your recorded shows." arch=('i686') url="http://www.mythtv.org" diff --git a/abs/mv-core/myth/release-fixes/plugins/mythbrowser/PKGBUILD b/abs/mv-core/myth/stable/mythbrowser/PKGBUILD index adfe87a..674536e 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythbrowser/PKGBUILD +++ b/abs/mv-core/myth/stable/mythbrowser/PKGBUILD @@ -1,7 +1,7 @@ pkgname=mythbrowser-release-fixes -pkgver=17284 -pkgrel=2 +pkgver=21228 +pkgrel=1 pkgdesc="Mini web browser for MythTV" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythcontrols/PKGBUILD b/abs/mv-core/myth/stable/mythcontrols/PKGBUILD index ea1109f..5fe329b 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythcontrols/PKGBUILD +++ b/abs/mv-core/myth/stable/mythcontrols/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythcontrols-release-fixes -pkgver=17719 -pkgrel=5 +pkgver=21228 +pkgrel=1 pkgdesc="Experimental controls for MythTV" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythflix/PKGBUILD b/abs/mv-core/myth/stable/mythflix/PKGBUILD index a3a48fe..a417a28 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythflix/PKGBUILD +++ b/abs/mv-core/myth/stable/mythflix/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythflix-release-fixes -pkgver=17719 -pkgrel=2 +pkgver=21228 +pkgrel=1 pkgdesc="Netflix access plugin for MythTV" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythgallery/PKGBUILD b/abs/mv-core/myth/stable/mythgallery/PKGBUILD index a12e22c..9ca81ff 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythgallery/PKGBUILD +++ b/abs/mv-core/myth/stable/mythgallery/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythgallery-release-fixes -pkgver=17719 -pkgrel=3 +pkgver=21228 +pkgrel=1 pkgdesc="Image gallery plugin for MythTV" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythgame/PKGBUILD b/abs/mv-core/myth/stable/mythgame/PKGBUILD index 8cf2f65..2dc412a 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythgame/PKGBUILD +++ b/abs/mv-core/myth/stable/mythgame/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythgame-release-fixes -pkgver=17719 -pkgrel=4 +pkgver=21228 +pkgrel=1 pkgdesc="Emulation plugin for MythTV" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythmovietime/PKGBUILD b/abs/mv-core/myth/stable/mythmovietime/PKGBUILD index 5560410..6a5ae8f 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythmovietime/PKGBUILD +++ b/abs/mv-core/myth/stable/mythmovietime/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythmovietime-release-fixes -pkgver=17284 -pkgrel=6 +pkgver=21228 +pkgrel=1 pkgdesc="Emulation plugin for MythTV" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythmusic/PKGBUILD b/abs/mv-core/myth/stable/mythmusic/PKGBUILD index bfb1de5..0617b0b 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythmusic/PKGBUILD +++ b/abs/mv-core/myth/stable/mythmusic/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythmusic-release-fixes -pkgver=17719 -pkgrel=9 +pkgver=21228 +pkgrel=1 pkgdesc="Music playing plugin for MythTV" url="http://www.mythtv.org" arch=('i686' 'x86_64') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythmusic/music_flac.patch b/abs/mv-core/myth/stable/mythmusic/music_flac.patch index b152249..b152249 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythmusic/music_flac.patch +++ b/abs/mv-core/myth/stable/mythmusic/music_flac.patch diff --git a/abs/mv-core/myth/release-fixes/plugins/mythnews/PKGBUILD b/abs/mv-core/myth/stable/mythnews/PKGBUILD index 90ae093..a5fa26e 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythnews/PKGBUILD +++ b/abs/mv-core/myth/stable/mythnews/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythnews-release-fixes -pkgver=17719 -pkgrel=4 +pkgver=21228 +pkgrel=1 pkgdesc="News checking plugin for MythTV" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythphone/PKGBUILD b/abs/mv-core/myth/stable/mythphone/PKGBUILD index 7227958..7fd3b46 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythphone/PKGBUILD +++ b/abs/mv-core/myth/stable/mythphone/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythphone-release-fixes -pkgver=17719 -pkgrel=3 +pkgver=21228 +pkgrel=1 pkgdesc="Plugin that allows phone calls to be made to MythTv" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythsmolt/PKGBUILD b/abs/mv-core/myth/stable/mythsmolt/PKGBUILD index b8e421a..db1b977 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythsmolt/PKGBUILD +++ b/abs/mv-core/myth/stable/mythsmolt/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythsmolt-release-fixes -pkgver=0.21 -pkgrel=4 +pkgver=21228 +pkgrel=1 pkgdesc="mythsmolt, a hardware profileing tool" arch=('i686' 'x86_64') url="http://www.mythvantage.com" diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/3466-v1.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/3466-v1.patch index 912ce27..912ce27 100755 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/3466-v1.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/3466-v1.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/PKGBUILD b/abs/mv-core/myth/stable/mythtv-release-fixes/PKGBUILD index 6c57b51..a22451d 100755 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/PKGBUILD +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/PKGBUILD @@ -1,5 +1,5 @@ pkgname=mythtv-release-fixes -pkgver=20034 +pkgver=21228 pkgrel=1 pkgdesc=".21 A personal video recorder for Linux" url="http://www.mythtv.org" diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/dbconfig.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/dbconfig.patch index 1d181ac..1d181ac 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/dbconfig.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/dbconfig.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/debug_uitypes.cpp.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/debug_uitypes.cpp.patch index b87b89f..b87b89f 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/debug_uitypes.cpp.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/debug_uitypes.cpp.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/debug_xmlparse.cpp.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/debug_xmlparse.cpp.patch index f479bbe..f479bbe 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/debug_xmlparse.cpp.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/debug_xmlparse.cpp.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/jump_snapshot.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/jump_snapshot.patch index 2d2c68b..2d2c68b 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/jump_snapshot.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/jump_snapshot.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/myth.find_orphans.pl b/abs/mv-core/myth/stable/mythtv-release-fixes/myth.find_orphans.pl index c258e1d..c258e1d 100755 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/myth.find_orphans.pl +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/myth.find_orphans.pl diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/myth.sh b/abs/mv-core/myth/stable/mythtv-release-fixes/myth.sh index fb7122c..fb7122c 100755 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/myth.sh +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/myth.sh diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/mythbackend b/abs/mv-core/myth/stable/mythtv-release-fixes/mythbackend index f96c6b7..f96c6b7 100755 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/mythbackend +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/mythbackend diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/mythbackend.sh b/abs/mv-core/myth/stable/mythtv-release-fixes/mythbackend.sh index e7a7b70..e7a7b70 100755 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/mythbackend.sh +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/mythbackend.sh diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/myththemedmenu.cpp.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/myththemedmenu.cpp.patch index f5baccd..f5baccd 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/myththemedmenu.cpp.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/myththemedmenu.cpp.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/myththemedmenu.h.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/myththemedmenu.h.patch index 9744b11..9744b11 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/myththemedmenu.h.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/myththemedmenu.h.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/mythtv.install b/abs/mv-core/myth/stable/mythtv-release-fixes/mythtv.install index 2c87aee..2c87aee 100755 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/mythtv.install +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/mythtv.install diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/pop_be_restart.cpp.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/pop_be_restart.cpp.patch index a7a5326..a7a5326 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/pop_be_restart.cpp.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/pop_be_restart.cpp.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/pop_be_restart.h.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/pop_be_restart.h.patch index 1fba435..1fba435 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/pop_be_restart.h.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/pop_be_restart.h.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/reload.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/reload.patch index 9cc2044..9cc2044 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/reload.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/reload.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/screenshot_jump.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/screenshot_jump.patch index 8a5dee4..8a5dee4 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/screenshot_jump.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/screenshot_jump.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/screenshots.diff b/abs/mv-core/myth/stable/mythtv-release-fixes/screenshots.diff index 2b5dabe..2b5dabe 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/screenshots.diff +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/screenshots.diff diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/screenshots2.diff b/abs/mv-core/myth/stable/mythtv-release-fixes/screenshots2.diff index 64ce08c..64ce08c 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/screenshots2.diff +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/screenshots2.diff diff --git a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/smolt_jump.patch b/abs/mv-core/myth/stable/mythtv-release-fixes/smolt_jump.patch index ca9bd08..ca9bd08 100644 --- a/abs/mv-core/myth/release-fixes/mythtv-release-fixes/smolt_jump.patch +++ b/abs/mv-core/myth/stable/mythtv-release-fixes/smolt_jump.patch diff --git a/abs/mv-core/myth/release-fixes/mythtv-themes/PKGBUILD b/abs/mv-core/myth/stable/mythtv-themes/PKGBUILD index 877b790..379f2d9 100755 --- a/abs/mv-core/myth/release-fixes/mythtv-themes/PKGBUILD +++ b/abs/mv-core/myth/stable/mythtv-themes/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythtv-themes-release-fixes -pkgver=15931 -pkgrel=7 +pkgver=21228 +pkgrel=1 pkgdesc="themes for mythtv" url="http://www.mythtv.org" license="GPL" diff --git a/abs/mv-core/myth/release-fixes/plugins/mythvideo/PKGBUILD b/abs/mv-core/myth/stable/mythvideo/PKGBUILD index 2be63e3..5afee6a 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythvideo/PKGBUILD +++ b/abs/mv-core/myth/stable/mythvideo/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythvideo-release-fixes -pkgver=17719 -pkgrel=2 +pkgver=21228 +pkgrel=1 pkgdesc="Video playback and browsing plugin for MythTV" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythweather/PKGBUILD b/abs/mv-core/myth/stable/mythweather/PKGBUILD index 2870928..dae89df 100644 --- a/abs/mv-core/myth/release-fixes/plugins/mythweather/PKGBUILD +++ b/abs/mv-core/myth/stable/mythweather/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythweather-release-fixes -pkgver=17719 -pkgrel=6 +pkgver=21228 +pkgrel=1 pkgdesc="Weather checking plugin for MythTV" url="http://www.mythtv.org" arch=('i686') diff --git a/abs/mv-core/myth/release-fixes/plugins/mythweb/PKGBUILD b/abs/mv-core/myth/stable/mythweb/PKGBUILD index 9bddf1c..52341a4 100755 --- a/abs/mv-core/myth/release-fixes/plugins/mythweb/PKGBUILD +++ b/abs/mv-core/myth/stable/mythweb/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythweb-release-fixes -pkgver=17724 -pkgrel=21 +pkgver=21228 +pkgrel=1 pkgdesc="mythweb" url="http://www.mythtv.org" license="GPL" diff --git a/abs/mv-core/myth/release-fixes/plugins/mythweb/dblogininit.inc b/abs/mv-core/myth/stable/mythweb/dblogininit.inc index c5395c5..c5395c5 100755 --- a/abs/mv-core/myth/release-fixes/plugins/mythweb/dblogininit.inc +++ b/abs/mv-core/myth/stable/mythweb/dblogininit.inc diff --git a/abs/mv-core/myth/release-fixes/plugins/mythweb/mythweb.install b/abs/mv-core/myth/stable/mythweb/mythweb.install index e135b6c..e135b6c 100755 --- a/abs/mv-core/myth/release-fixes/plugins/mythweb/mythweb.install +++ b/abs/mv-core/myth/stable/mythweb/mythweb.install diff --git a/abs/mv-core/myth/release-fixes/plugins/mythweb/mythweblighttpd.patch b/abs/mv-core/myth/stable/mythweb/mythweblighttpd.patch index 6403a88..6403a88 100755 --- a/abs/mv-core/myth/release-fixes/plugins/mythweb/mythweblighttpd.patch +++ b/abs/mv-core/myth/stable/mythweb/mythweblighttpd.patch diff --git a/abs/mv-core/myth/release-fixes/syth-lacquer-clean/PKGBUILD b/abs/mv-core/myth/stable/syth-lacquer-clean/PKGBUILD index a40d639..92e37d6 100755 --- a/abs/mv-core/myth/release-fixes/syth-lacquer-clean/PKGBUILD +++ b/abs/mv-core/myth/stable/syth-lacquer-clean/PKGBUILD @@ -1,6 +1,6 @@ pkgname=syth-lacquer-clean-wide -pkgver=1 -pkgrel=10 +pkgver=21228 +pkgrel=1 pkgdesc="" url="" license="" diff --git a/abs/mv-core/myth/release-fixes/syth-lacquer-wide/PKGBUILD b/abs/mv-core/myth/stable/syth-lacquer-wide/PKGBUILD index 1aa8c77..edf4357 100755 --- a/abs/mv-core/myth/release-fixes/syth-lacquer-wide/PKGBUILD +++ b/abs/mv-core/myth/stable/syth-lacquer-wide/PKGBUILD @@ -1,6 +1,6 @@ pkgname=syth-lacquer-wide -pkgver=4 -pkgrel=2 +pkgver=21228 +pkgrel=1 pkgdesc="Syth for mythtv .21" url="" license="" diff --git a/abs/mv-core/mythvantage-live/PKGBUILD b/abs/mv-core/mythvantage-live/PKGBUILD index 6f3a02d..d23d8e7 100644 --- a/abs/mv-core/mythvantage-live/PKGBUILD +++ b/abs/mv-core/mythvantage-live/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythvantage-live pkgver=5.3.3 -pkgrel=7 +pkgrel=8 provides="linhes-live" pkgdesc="components for the Live System." diff --git a/abs/mv-core/openssh/PKGBUILD b/abs/mv-core/openssh/PKGBUILD deleted file mode 100644 index 0c3c4a2..0000000 --- a/abs/mv-core/openssh/PKGBUILD +++ /dev/null @@ -1,63 +0,0 @@ -# $Id: PKGBUILD 23216 2009-01-06 05:04:12Z eric $ -# Maintainer: Aaron Griffin <aaron@archlinux.org> -# Contributor: judd <jvinet@zeroflux.org> - -pkgname=openssh -pkgver=5.1p1 -pkgrel=2 -#_gsskexver=20080404 -pkgdesc='A Secure SHell server/client' -arch=(i686 x86_64) -license=('custom') -url="http://www.openssh.org/portable.html" -backup=('etc/ssh/ssh_config' 'etc/ssh/sshd_config' 'etc/pam.d/sshd') -depends=('openssl>=0.9.8g' 'zlib' 'pam' 'tcp_wrappers' 'heimdal>=1.2-1') -source=(ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$pkgname-$pkgver.tar.gz - sshd sshd.confd sshd.pam) - #http://www.sxw.org.uk/computing/patches/$pkgname-$pkgver-gsskex-$_gsskexver.patch -md5sums=('03f2d0c1b5ec60d4ac9997a146d2faec' 'd9ee5e0a0d143689b3d6f11454a2a892' - 'e2cea70ac13af7e63d40eb04415eacd5' '1c7c2ea8734ec7e3ca58d820634dc73a') - -build() { - cd $startdir/src/$pkgname-$pkgver - #patch -up0 < $startdir/src/$pkgname-$pkgver-gsskex-$_gsskexver.patch - - #NOTE we disable-strip so that makepkg can decide whether to strip or not - ./configure --prefix=/usr --libexecdir=/usr/lib/ssh \ - --sysconfdir=/etc/ssh --with-tcp-wrappers --with-privsep-user=nobody \ - --with-md5-passwords --with-pam --with-mantype=man --mandir=/usr/man \ - --with-xauth=/usr/bin/xauth --with-kerberos5=/usr --disable-strip - make || return 1 - make DESTDIR=$startdir/pkg install - - #What is this for? Is it needed? - mkdir -p $startdir/pkg/var/empty - - install -D -m755 $startdir/src/sshd $startdir/pkg/etc/rc.d/sshd - - install -D -m644 LICENCE $startdir/pkg/usr/share/licenses/$pkgname/LICENCE - install -D -m644 $startdir/src/sshd.pam $startdir/pkg/etc/pam.d/sshd - install -D -m644 $startdir/src/sshd.confd $startdir/pkg/etc/conf.d/sshd - - rm $startdir/pkg/usr/man/man1/slogin.1 - ln -sf ssh.1.gz $startdir/pkg/usr/man/man1/slogin.1.gz - - #additional contrib scripts that we like - install -D -m755 contrib/findssl.sh $startdir/pkg/usr/bin/findssl.sh - install -D -m755 contrib/ssh-copy-id $startdir/pkg/usr/bin/ssh-copy-id - install -D -m644 contrib/ssh-copy-id.1 $startdir/pkg/usr/man/man1/ssh-copy-id.1 - - # sshd_config - sed -i \ - -e 's|^#ListenAddress 0.0.0.0|ListenAddress 0.0.0.0|g' \ - -e 's|^#UsePAM no|UsePAM yes|g' \ - -e 's|^#ChallengeResponseAuthentication yes|ChallengeResponseAuthentication no|g' \ - $startdir/pkg/etc/ssh/sshd_config - echo "HashKnownHosts yes" >> $startdir/pkg/etc/ssh/ssh_config - echo "StrictHostKeyChecking ask" >> $startdir/pkg/etc/ssh/ssh_config - - #ssh_config - sed -i \ - -e 's|^# Host \*|Host *|g' \ - $startdir/pkg/etc/ssh/ssh_config -} diff --git a/abs/mv-core/openssh/sshd b/abs/mv-core/openssh/sshd deleted file mode 100755 index 875028a..0000000 --- a/abs/mv-core/openssh/sshd +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions -. /etc/conf.d/sshd - -PID=`cat /var/run/sshd.pid 2>/dev/null` -case "$1" in - start) - stat_busy "Starting Secure Shell Daemon" - [ -f /etc/ssh/ssh_host_key ] || { /usr/bin/ssh-keygen -t rsa1 -N "" -f /etc/ssh/ssh_host_key >/dev/null; } - [ -f /etc/ssh/ssh_host_rsa_key ] || { /usr/bin/ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key >/dev/null; } - [ -f /etc/ssh/ssh_host_dsa_key ] || { /usr/bin/ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key >/dev/null; } - [ -z "$PID" ] && /usr/sbin/sshd $SSHD_ARGS - if [ $? -gt 0 ]; then - stat_fail - else - add_daemon sshd - stat_done - fi - ;; - stop) - stat_busy "Stopping Secure Shell Daemon" - [ ! -z "$PID" ] && kill $PID &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - else - rm_daemon sshd - stat_done - fi - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart}" -esac -exit 0 diff --git a/abs/mv-core/openssh/sshd.confd b/abs/mv-core/openssh/sshd.confd deleted file mode 100644 index 5ce7c00..0000000 --- a/abs/mv-core/openssh/sshd.confd +++ /dev/null @@ -1,4 +0,0 @@ -# -# Parameters to be passed to sshd -# -SSHD_ARGS="" diff --git a/abs/mv-core/openssh/sshd.pam b/abs/mv-core/openssh/sshd.pam deleted file mode 100644 index dc70815..0000000 --- a/abs/mv-core/openssh/sshd.pam +++ /dev/null @@ -1,10 +0,0 @@ -#%PAM-1.0 -#auth required pam_securetty.so #Disable remote root -auth required pam_unix.so -auth required pam_nologin.so -auth required pam_env.so -account required pam_unix.so -account required pam_time.so -password required pam_unix.so -session required pam_unix_session.so -session required pam_limits.so diff --git a/abs/mv-core/syslog-ng/PKGBUILD b/abs/mv-core/syslog-ng/PKGBUILD index a9efeee..9a30df6 100644 --- a/abs/mv-core/syslog-ng/PKGBUILD +++ b/abs/mv-core/syslog-ng/PKGBUILD @@ -1,6 +1,6 @@ pkgname=syslog-ng -pkgver=2.0.9 -pkgrel=4 +pkgver=2.0.10 +pkgrel=1 pkgdesc="A portable syslogd replacement with enhanced, flexible configuration scheme." arch=(i686 x86_64) license=('GPL') @@ -10,7 +10,7 @@ depends=('tcp_wrappers' 'logrotate') install=('syslog.install') provides=('logger') backup=('etc/syslog-ng.conf') -source=(http://www.balabit.com/downloads/files/syslog-ng/sources/stable/src/$pkgname-$pkgver.tar.gz \ +source=(http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/$pkgver/source/${pkgname}_$pkgver.tar.gz \ syslog-ng.conf syslog-ng.logrotate syslog-ng log_care.sh) build() { |