summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-config')
-rw-r--r--abs/core/LinHES-config/09_mythvantge_runit_grub46
-rw-r--r--abs/core/LinHES-config/LinHES-release2
-rwxr-xr-xabs/core/LinHES-config/MythVantage.sh2
-rwxr-xr-x[-rw-r--r--]abs/core/LinHES-config/PKGBUILD100
-rwxr-xr-xabs/core/LinHES-config/backend_control.sh66
-rw-r--r--abs/core/LinHES-config/blacklist_nouveau.conf2
-rw-r--r--abs/core/LinHES-config/blacklist_pcspkr.conf1
-rw-r--r--abs/core/LinHES-config/config-sudo.rules3
-rw-r--r--abs/core/LinHES-config/config.install (renamed from abs/core/LinHES-config/LinHES.install)22
-rw-r--r--abs/core/LinHES-config/hdhr.conf2
-rwxr-xr-xabs/core/LinHES-config/install_functions.sh43
-rwxr-xr-xabs/core/LinHES-config/install_proxy.sh13
-rw-r--r--abs/core/LinHES-config/issue1
-rwxr-xr-xabs/core/LinHES-config/mv_advanced.py179
-rwxr-xr-xabs/core/LinHES-config/mv_common.py30
-rwxr-xr-xabs/core/LinHES-config/mv_config.py22
-rwxr-xr-xabs/core/LinHES-config/mv_fileshare.py418
-rwxr-xr-xabs/core/LinHES-config/mv_hostype.py139
-rwxr-xr-xabs/core/LinHES-config/mv_install.py1111
-rwxr-xr-xabs/core/LinHES-config/mv_ir.py95
-rwxr-xr-xabs/core/LinHES-config/mv_misc.py103
-rwxr-xr-xabs/core/LinHES-config/mv_network.py43
-rwxr-xr-xabs/core/LinHES-config/mv_screensaver.py22
-rwxr-xr-x[-rw-r--r--]abs/core/LinHES-config/mv_supplemental.py9
-rwxr-xr-xabs/core/LinHES-config/mv_vnc.py88
-rw-r--r--abs/core/LinHES-config/myth_settings_wrapper.sh30
-rw-r--r--abs/core/LinHES-config/myth_user_call319
-rw-r--r--abs/core/LinHES-config/mythvantage.cfg2
-rw-r--r--abs/core/LinHES-config/networkconfig.sh6
-rwxr-xr-xabs/core/LinHES-config/print_xorg_res.py128
-rwxr-xr-xabs/core/LinHES-config/restore_default_settings.sh14
-rwxr-xr-xabs/core/LinHES-config/soundconfig.sh17
-rwxr-xr-xabs/core/LinHES-config/systemconfig.py72
-rwxr-xr-xabs/core/LinHES-config/systemconfig.sh20
-rwxr-xr-xabs/core/LinHES-config/xconfig.sh512
35 files changed, 2431 insertions, 1251 deletions
diff --git a/abs/core/LinHES-config/09_mythvantge_runit_grub b/abs/core/LinHES-config/09_mythvantge_runit_grub
new file mode 100644
index 0000000..1d7774e
--- /dev/null
+++ b/abs/core/LinHES-config/09_mythvantge_runit_grub
@@ -0,0 +1,46 @@
+#!/bin/sh
+prefix="/usr"
+exec_prefix="${prefix}"
+datarootdir="/usr/share"
+. "${datarootdir}/grub/grub-mkconfig_lib"
+if [ -z "$boot_device_id" ]; then
+boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+fi
+
+gettext_printf "Found LinHES runit: \n" >&2
+echo "
+menuentry 'LinHES' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-true-$boot_device_id' {
+ load_video
+ set gfxpayload=keep
+ insmod gzio
+ insmod part_msdos
+ insmod ext2
+ set root='hd0,msdos1'
+ if [ x$feature_platform_search_hint = xy ]; then
+ search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 $boot_device_id
+ else
+ search --no-floppy --fs-uuid --set=root $boot_device_id
+ fi
+ echo 'Loading Linux core repo kernel ...'
+ linux /boot/vmlinuz-linux root=UUID=$boot_device_id ro quiet splash=silent init=/sbin/runit
+ echo 'Loading initial ramdisk ...'
+ initrd /boot/initramfs-linux.img
+ }
+menuentry 'LinHES --no-splash' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-true-$boot_device_id' {
+ #load_video
+ #set gfxpayload=keep
+ insmod gzio
+ insmod part_msdos
+ insmod ext2
+ set root='hd0,msdos1'
+ if [ x$feature_platform_search_hint = xy ]; then
+ search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 $boot_device_id
+ else
+ search --no-floppy --fs-uuid --set=root $boot_device_id
+ fi
+ echo 'Loading Linux core repo kernel ...'
+ linux /boot/vmlinuz-linux root=UUID=$boot_device_id ro init=/sbin/runit
+ echo 'Loading initial ramdisk ...'
+ initrd /boot/initramfs-linux.img
+}
+"
diff --git a/abs/core/LinHES-config/LinHES-release b/abs/core/LinHES-config/LinHES-release
index 869ae81..747db47 100644
--- a/abs/core/LinHES-config/LinHES-release
+++ b/abs/core/LinHES-config/LinHES-release
@@ -1 +1 @@
-LinHES R7.4 (rdt)
+LinHES 8.0 (Trip the bits)
diff --git a/abs/core/LinHES-config/MythVantage.sh b/abs/core/LinHES-config/MythVantage.sh
index 286c908..ffa8d34 100755
--- a/abs/core/LinHES-config/MythVantage.sh
+++ b/abs/core/LinHES-config/MythVantage.sh
@@ -1,3 +1,5 @@
export MV_ROOT=/usr/MythVantage
export PATH=$PATH:$MV_ROOT/bin
export TEMPLATES=$MV_ROOT/templates
+results=`grep MYTHHOME $MV_ROOT/bin/mv_config.py`
+eval export $results
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index 7cebf11..32b397c 100644..100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,15 +1,16 @@
pkgname=LinHES-config
pkgver=2.3
-pkgrel=80
+pkgrel=152
conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
pkgdesc="Install and configure your system"
depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
'sg3_utils' 'nmbscan' 'system-templates' 'rsync' 'python-parted'
- 'ddcxinfo' 'python-pexpect' 'python-netifaces' 'LinHES-timezone'
- 'python-iplib' 'mythinstall>=2-10')
-arch=('i686')
+ 'python-pexpect' 'python-netifaces'
+ 'python-iplib' 'mythinstall>=2-10' 'sudo' 'setserial')
+#LinHES-timezone
+arch=('i686' 'x86_64')
-source=(mv_install.py
+source=(mv_install.py 09_mythvantge_runit_grub
mv_config.py
myth_user_call
file_time_offset.py
@@ -23,7 +24,6 @@ source=(mv_install.py
timezip.py
soundconfig.sh
LinHES-release
- issue
MythVantage.sh
create_master.sh
build_diskless.sh
@@ -43,16 +43,23 @@ source=(mv_install.py
mv_webuser.py
mv_hostype.py
mv_supplemental.py
+ mv_vnc.py
+ mv_fileshare.py
systemconfig.py
myth_user_call.py
- mythvantage.cfg)
+ mythvantage.cfg
+ config-sudo.rules
+ hdhr.conf blacklist_nouveau.conf blacklist_pcspkr.conf
+ print_xorg_res.py backend_control.sh )
backup=(etc/mythvantage.cfg)
-install=LinHES.install
+install=config.install
build() {
mkdir -p $startdir/pkg/etc
mkdir -p $startdir/pkg/usr/share/mythtv/themes/default
+ install -D -m0755 09_mythvantge_runit_grub $startdir/pkg/etc/grub.d/09_mythvantge_runit_grub
+
MVDIR=$startdir/pkg/usr/MythVantage
mkdir $startdir/pkg/etc/profile.d
@@ -61,8 +68,7 @@ build() {
mkdir -p $MVDIR/etc
#copy in all the installer specific stuff
-# install -m0700 myth_user_call $MVDIR/bin/myth_user_call
- install -m0700 myth_user_call.py $MVDIR/bin/myth_user_call
+ install -m 0700 myth_user_call.py $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
@@ -91,7 +97,11 @@ build() {
install -m 0755 mv_webuser.py $MVDIR/bin/
install -m 0755 mv_hostype.py $MVDIR/bin/
install -m 0755 mv_supplemental.py $MVDIR/bin/
+ install -m 0755 mv_vnc.py $MVDIR/bin/
+ install -m 0755 mv_fileshare.py $MVDIR/bin/
install -m 0755 systemconfig.py $MVDIR/bin/
+ install -m 0755 print_xorg_res.py $MVDIR/bin/
+ install -m 0755 backend_control.sh $MVDIR/bin/
install -m 0755 mythvantage.cfg $startdir/pkg/etc/
#README file displayed on install
@@ -99,46 +109,64 @@ build() {
mkdir -p $startdir/pkg/usr/bin
install -m 0755 file_time_offset.py $startdir/pkg/usr/bin/file_time_offset.py
-
#Copy in the branding stuff
install -m 0755 LinHES-release $startdir/pkg/etc/LinHES-release
- install -m 0755 issue $startdir/pkg/etc/issue
+ #sudo rules
+ mkdir -p $startdir/pkg/etc/sudoers.d/
+ chmod 750 $startdir/pkg/etc/sudoers.d/
+ chown -R root:root $startdir/pkg/etc/sudoers.d
+ install -o root -g root -m 0750 config-sudo.rules $startdir/pkg/etc/sudoers.d/config_sudo
+
+ #sysctrl conf
+ install -o root -g root -D -m 0755 hdhr.conf $startdir/pkg/etc/sysctl.d/hdhr.conf
+
+ #modules blacklist files
+ install -o root -g root -D -m 0755 blacklist_pcspkr.conf $startdir/pkg/etc/modprobe.d/blacklist_pcspkr.conf
+ install -o root -g root -D -m 0755 blacklist_nouveau.conf $startdir/pkg/etc/modprobe.d/blacklist_nouveau.conf
}
-md5sums=('18af4fe481e1fc2ae02050026eb5cd27'
- '16b98fcb3753ef6cfc35075c326d30e4'
- 'e36da536dd651ef182e7642337889e77'
+md5sums=('70ea19d41cf33ec8ae26c4e8cb5cd240'
+ 'f33e1a6f7985091b8d47cbaf7433f90f'
+ '1afacd0337d95f140b2a1777c27f041a'
+ '2596460462cf6c889cf8f95485537b20'
'985891a43f7c4c983eb2a362162f1a0f'
- '13172731c8b08d669336da31cece5775'
- '5a31addfbdc1154b05997f972a32fa33'
- 'c20f73d4da5d7e15e1f3eb85c7dcb49a'
+ 'fda01259a4bc74d83c9092d338bd247a'
+ '768504ef10ecd11a22875ccea9fcf62b'
+ 'f73d6d6f98839e900cb6685bf5dc4eae'
'68199e861c2933ccbb84735b9b440157'
- '9ae8d79f620c6d19973c55c32a921874'
- '79579277e0545aeeb50fba403434194c'
- '960017a34d9cc78af6298f45aad6eb8e'
+ '2a7f3b34e522acfd08283b86c8926aba'
+ '4a538bdfbb2833c48bcffb4f82729de6'
+ '689b01f7636e09b2f9657c6ce6006ee7'
'ecf9e5df20683a769c4a8a8f2d65de85'
- '6d32a88e76b0a97b0ce67d37ef6394aa'
- 'eaafce1499980eded37b9ad4e8dce28b'
- '6aff504ed5e860adc1b7317cd0780900'
- '55fccb1da0417a896b724f7cfc32dd5a'
+ 'a6faa20d905e2fd92ce79acab044b759'
+ '8ba06c2ce6129371548cc360ccca27f8'
+ '5f890ea9bda6aef652d2560ca19dac07'
'ab2aa42c2947148c2b1cac0ade6d1d55'
'd429b59d3cfb37b0624c6a4a71a7c2c0'
- 'a225143e3df6f56d451c2875e54ddbae'
+ 'f6a935c35123fdc7c259c01cbc794a64'
'9151c74fcaf18ec4cf5e757cfdbc7017'
'3d1e4a119f38cff0498bf8a67e94e4b3'
'71fd2d0d448fc2fcd15415a1beed7109'
- '61ccbf573ee196e3edf53a512820b431'
- 'e1715bbbabd42e7419755b09f60734aa'
+ 'af6b3c5ec0d974b3e19ff1ed50662ee5'
+ 'eff2543a8dd0fa13f10360d1594d823d'
'b845de3e05c1734cce4b9ac5e8f1baaf'
- '6801f87992b44118a12b6dfe6ea68127'
- '5e69839659d65ddda35b8a9982dc29e9'
- '3afd18517bb765d1680f4fcc8d08c9cc'
- 'ec6a9961e4d1b53ec1240c5979efff11'
+ 'e869e2c72212881db1e4fa40b116efe5'
+ '8b7dce4a3a0a281fa6656aa8781a648e'
+ '2934fd80277e4598856f3171ccef9bfd'
+ '824e49d9b01fed295c704ab68908b464'
'fe5e31b833cc6707209e9d656b6eb53c'
'ecb52b9b7a9ac0c8988093c1dfdda635'
'23d0e12b7ca1cc6ea6b993c1d7ff20b9'
- '0b5b9e5385c7ae77e561812e96ce8161'
- '755c05b833aca6c5be130972af052e8b'
- 'd8f80e5686d02555f044363f1ac17d97'
+ '8f442cfe2574af3e4520a124e28fcd7c'
+ 'b4900090d841d3e390cb840cf16afd85'
+ '85101b79d1ee30bff8244c810828033f'
+ '923197a517cb83d77263e8cea8b8c16a'
+ '6aef6f4484c45c5135b77199f63ab317'
'2596460462cf6c889cf8f95485537b20'
- 'a63ff9ef5250965aeabc74bfa8e43981')
+ '4cba2bb55c6b8e27c57a6171f42d0455'
+ '4804aa93aaad3dfcfff08cd9ffd68836'
+ '0fa6fffd87f350380d45f1f8a5b7babe'
+ '6ec39b010c0ed8901ea896c7e153d330'
+ '3866086e6af5e3528a66eff492f2f4dd'
+ 'c9279fa095af624ee3d9bc75d3328360'
+ 'a0df3d90e4a0da6781e45414a5f1b754')
diff --git a/abs/core/LinHES-config/backend_control.sh b/abs/core/LinHES-config/backend_control.sh
new file mode 100755
index 0000000..07ff162
--- /dev/null
+++ b/abs/core/LinHES-config/backend_control.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+#. /etc/systemconfig
+#echo $@ > /tmp/parms
+#start Slavebackend: fusion 192.168.1.120
+COMMAND=$1
+BETYPE=$2
+eval LAST=\$$#
+dbhost=`echo $LAST`
+hostname=`hostname`
+MESSAGE=""
+
+case $COMMAND in
+ stop) MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestop.cgi 2>/dev/null`
+ rc=$?
+
+ if [ $rc != 0 ]
+ then
+ lh_message.sh "Could not stop the backend."
+ else
+ echo "$MESSAGE" | grep -q "'$hostname': 'Message delivered'"
+ rc=$?
+ if [ $rc != 0 ]
+ then
+ msg_client.py "* Backend Stopped" > /dev/null
+ fi
+ fi
+ ;;
+
+ start )
+ MESSAGE=`/usr/bin/curl http://$dbhost:1337/bestart.cgi 2>/dev/null`
+ rc=$?
+ if [ $rc != 0 ]
+ then
+ lh_message.sh "Could not start the backend"
+ else
+ echo "$MESSAGE" | grep -q "'$hostname': 'Message delivered'"
+ rc=$?
+ if [ $rc != 0 ]
+ then
+ msg_client.py "* Backend Started" > /dev/null
+ fi
+ fi
+ ;;
+
+ restart)
+ /usr/MythVantage/bin/backend_control.sh stop $dbhost
+ sleep 2
+ /usr/MythVantage/bin/backend_control.sh start $dbhost
+ ;;
+
+ clearcache)
+ MESSAGE2=`/usr/bin/curl http://$dbhost:1337/beclear.cgi 2>/dev/null`
+ rc=$?
+ if [ $rc != 0 ]
+ then
+ lh_message.sh "Could not clear the cache"
+ else
+ echo "$MESSAGE" | grep -q "'$hostname': 'Message delivered'"
+ rc=$?
+ if [ $rc != 0 ]
+ then
+ msg_client.py "* cache cleared" > /dev/null
+ fi
+ fi
+esac
+
diff --git a/abs/core/LinHES-config/blacklist_nouveau.conf b/abs/core/LinHES-config/blacklist_nouveau.conf
new file mode 100644
index 0000000..e09e227
--- /dev/null
+++ b/abs/core/LinHES-config/blacklist_nouveau.conf
@@ -0,0 +1,2 @@
+blacklist nouveau
+install nouveau /bin/false
diff --git a/abs/core/LinHES-config/blacklist_pcspkr.conf b/abs/core/LinHES-config/blacklist_pcspkr.conf
new file mode 100644
index 0000000..b46792e
--- /dev/null
+++ b/abs/core/LinHES-config/blacklist_pcspkr.conf
@@ -0,0 +1 @@
+blacklist pcspkr
diff --git a/abs/core/LinHES-config/config-sudo.rules b/abs/core/LinHES-config/config-sudo.rules
new file mode 100644
index 0000000..67d5aba
--- /dev/null
+++ b/abs/core/LinHES-config/config-sudo.rules
@@ -0,0 +1,3 @@
+mythtv ALL = NOPASSWD:/usr/MythVantage/bin/mythvantage
+mythtv ALL = NOPASSWD:/usr/MythVantage/bin/MythVantage
+
diff --git a/abs/core/LinHES-config/LinHES.install b/abs/core/LinHES-config/config.install
index fb967aa..fb905fb 100644
--- a/abs/core/LinHES-config/LinHES.install
+++ b/abs/core/LinHES-config/config.install
@@ -15,28 +15,6 @@ post_install() {
echo "List of packages to ignore" > /etc/blacklist.package
echo "one package per line" >> /etc/blacklist.package
fi
-
-LINE="mythtv ALL = NOPASSWD:/usr/MythVantage/bin/mythvantage"
-LINE1="mythtv ALL = NOPASSWD:/usr/MythVantage/bin/MythVantage"
- for i in "$LINE" "$LINE1"
- do
- cp /etc/sudoers /etc/sudoers.bak
- grep -q "$i" /etc/sudoers
- if [ $? != 0 ]
- then
- echo "$i" >> /etc/sudoers
- visudo -cf /etc/sudoers
- if [ ! $? = 0 ]
- then
- cp /etc/sudoers.bak /etc/sudoers
- echo $i
- echo "Error adding files"
- exit 1
- fi
- fi
- done
-
-
}
# arg 1: the new package version
diff --git a/abs/core/LinHES-config/hdhr.conf b/abs/core/LinHES-config/hdhr.conf
new file mode 100644
index 0000000..51a3407
--- /dev/null
+++ b/abs/core/LinHES-config/hdhr.conf
@@ -0,0 +1,2 @@
+#icrease read buffers for the hdhr
+net.core.rmem_max=1048576
diff --git a/abs/core/LinHES-config/install_functions.sh b/abs/core/LinHES-config/install_functions.sh
index 08206fc..fd33e00 100755
--- a/abs/core/LinHES-config/install_functions.sh
+++ b/abs/core/LinHES-config/install_functions.sh
@@ -61,9 +61,10 @@ function bootsplash_setup (){
function setupremote {
[ -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 ]
+ remotepath="$TEMPLATES/remotes/$remotebucket/$Remotetype"
+ if [ -d ${remotepath} ]
then
- cd $TEMPLATES/remotes/$Remotetype
+ cd ${remotepath}
for i in lircd*
do
cat $i >> $BASE/etc/lircd.conf
@@ -71,6 +72,8 @@ function setupremote {
cp -f lircrc* $BASE/etc/lircrc 2> /dev/null
[ -e /etc/lircrc ] && chmod 755 /etc/lircrc
update_db_settings HostRemoteType "$Remotetype"
+ update_db_settings HostRemotebucket "$remotebucket"
+ update_db_settings HostRemoteType_${remotebucket} "$Remotetype"
#special case for special remote
printhl "Starting with support for $Remotetype"
if [ "$Remotetype" == "dvico" ]
@@ -85,7 +88,7 @@ function setupremote {
[ -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"
+ echo "Couldn't open directory ${remotepath}"
fi
}
@@ -100,6 +103,8 @@ do
FoundReceiverType=`echo "$line"|cut -d"|" -f2`
Remotetype=`echo "$line"|cut -d"|" -f4`
statusline=`echo "$line"|cut -d"|" -f2,4`
+ remotebucket=`echo "$line"|cut -d"|" -f5`
+ #echo $remotebucket
#echo "Found $statusline , $Remotetype"
echo "Found Hauppauge"
echo "-------------------"
@@ -139,6 +144,7 @@ do
if [ $? -eq 0 ]
then
Remotetype=`echo "$line"|cut -d"|" -f2`
+ remotebucket=`echo "$line"|cut -d"|" -f4`
printhl "Found $Remotetype"
setupremote
found_remote=0
@@ -159,6 +165,8 @@ if [ $found_remote -eq 1 ]
then
#No remote found_remote
update_db_settings HostRemoteType "no_remote"
+ update_db_settings HostRemotebucket "favorites"
+ update_db_settings HostRemoteType_favorites "no_remote"
fi
}
@@ -348,6 +356,8 @@ function init_remote {
then
TEMPVAR=${CMDLINE#*remoteport=}
REMOTEPORT=${TEMPVAR%% *}
+ #port was given assume we are using a serial receiver
+ ReceiverType="Serial"
if [ x"$ReceiverType" = "xSerial" ]
then
if [ -e /dev/$REMOTEPORT ]
@@ -362,17 +372,44 @@ function init_remote {
fi
in_kernel_support "disable"
+ echo $CMDLINE | grep -q remotebucket
+ if [ $? -eq 0 ]
+ then
+ TEMPVAR=${CMDLINE#*remotebucket=}
+ remotebucket=${TEMPVAR%% *}
+ else
+ remotebucket="favorites"
+ fi
+
+
+
echo $CMDLINE | grep -q remote
if [ $? -eq 0 ]
then
TEMPVAR=${CMDLINE#*remote=}
Remotetype=${TEMPVAR%% *}
+
setupremote
else
scan_for_usb_remote
fi
}
+function home_check(){
+ #This bit of code is used to determine where mythhome is located
+ if [ x$MYTHHOME = x ]
+ then
+ . /etc/profile.d/MythVantage.sh
+ fi
+
+ if [ x$MYTHHOME = x ]
+ then
+ echo "MYTHHOME not defined!"
+ exit 1
+ fi
+
+ }
+
#-----------------------
diff --git a/abs/core/LinHES-config/install_proxy.sh b/abs/core/LinHES-config/install_proxy.sh
index c2a450d..99609cc 100755
--- a/abs/core/LinHES-config/install_proxy.sh
+++ b/abs/core/LinHES-config/install_proxy.sh
@@ -1,6 +1,6 @@
#!/bin/bash
export TERM=vt100
-MVHOSTNAME=larch5
+MVHOSTNAME=apheleia
. /etc/profile
TEMP_TEMPLATES=/tmp/templates
disk=$2
@@ -30,7 +30,8 @@ progress () {
case $1 in
full_install_it )
- mv_install.py --rootdisk=$disk --rootfs=$rootfs --rootsize=$rootsize --datafs=$datafs --datasize=$datasize --datadisk=$disk --swapsize=$swapsize -c full_install
+ #mv_install.py --rootdisk=$disk --rootfs=$rootfs --rootsize=$rootsize --datafs=$datafs --datasize=$datasize --datadisk=$disk --swapsize=$swapsize -c full_install
+ mv_install.py -c full_install
rc=$?
echo "mv_install.py exit code $rc"
if [ $rc != 0 ]
@@ -47,10 +48,13 @@ case $1 in
find_update)
mv_install.py --rootdisk=$disk -c find_upgrade
+ #mv_install.py -c find_upgrade
;;
upgrade_it)
- mv_install.py --rootdisk=$disk --rootfs=$rootfs -c upgrade
+ install_proxy.sh network_check_it setup_network
+ #mv_install.py --rootdisk=$disk --rootfs=$rootfs -c upgrade
+ mv_install.py -c upgrade
;;
disk_model_it)
@@ -76,7 +80,8 @@ case $1 in
;;
check_self)
- myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'`
+ #myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'`
+ myipdefault=`ip addr show $default_interface| grep inet |grep -v inet6 | cut -d/ -f1 | awk '{ print $2}'`
echo "network check myself"
ifconfig
ping -c 1 $myipdefault
diff --git a/abs/core/LinHES-config/issue b/abs/core/LinHES-config/issue
index 00d4abd..8b13789 100644
--- a/abs/core/LinHES-config/issue
+++ b/abs/core/LinHES-config/issue
@@ -1,2 +1 @@
-LinHes
diff --git a/abs/core/LinHES-config/mv_advanced.py b/abs/core/LinHES-config/mv_advanced.py
index fdcd1e2..8ed216e 100755
--- a/abs/core/LinHES-config/mv_advanced.py
+++ b/abs/core/LinHES-config/mv_advanced.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import logging, os, re
import mv_common
+import glob
def setup_pacman(create_link):
if create_link:
@@ -84,20 +85,27 @@ def setup_ncid_daemon(Runncidd):
def setup_splash(Usebootsplash):
if Usebootsplash == "1":
logging.info(" Enabling splash")
- cmd = ''' sed -i "s/^default.*0/default 1/g" /boot/grub/menu.lst'''
+ cmd = ''' sed -i "s/^set default.*$/set default="0"/g" /boot/grub/grub.cfg'''
+ mv_common.runcmd(cmd)
+ #this is needed in case grub-mkconfig is run
+ cmd = ''' sed -i "s/^GRUB_DEFAULT.*$/GRUB_DEFAULT="0"/g" /etc/default/grub'''
mv_common.runcmd(cmd)
else:
logging.info(" Disabling splash")
- cmd = ''' sed -i "s/^default.*1/default 0/g" /boot/grub/menu.lst'''
+ cmd = ''' sed -i "s/^set default.*$/set default="1"/g" /boot/grub/grub.cfg'''
+ mv_common.runcmd(cmd)
+ #this is needed in case grub-mkconfig is run
+ cmd = ''' sed -i "s/^GRUB_DEFAULT.*$/GRUB_DEFAULT="1"/g" /etc/default/grub'''
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_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):
@@ -227,141 +235,7 @@ def setup_mythweb(UseMythWEB):
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.get("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.get("Samba_media")
- Samba_home = systemconfig.get("Samba_home")
- if systemconfig.get("Samba_mediareadonly") == "0":
- smreadonly = "yes"
- else:
- smreadonly = "no"
-
- if systemconfig.get("Samba_homereadonly") == "0":
- shreadonly = "yes"
- else:
- shreadonly = "no"
- domain = systemconfig.get("Samba_domain")
- servername = systemconfig.get("hostname")
-
- try:
- f = open(systemconfig.get("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")
- mv_common.restart_service("nmbd")
- mv_common.restart_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("rpcbind")
- cmd = '''sed -e "s/REPLACEME/*/g" %s >/etc/exports''' %templatefile
- mv_common.runcmd(cmd)
- mv_common.add_service("nfsd")
- mv_common.add_service("nfs-common")
- mv_common.add_service("rpcbind")
- else:
- logging.info(" Removing NFS server")
- mv_common.remove_service("nfsd")
+# mv_common.remove_service("lighttpd")
return
def setup_dyndns(DDnsEnable):
@@ -398,22 +272,19 @@ def setup_advanced(systemconfig,data_config):
setup_hobbit(systemconfig.get("UseHobbit"),
systemconfig.get("SystemType"),
systemconfig.get("dbhost"))
- if data_config.SYSTEMTYPE == "LinHES":
- setup_rrd(systemconfig.get("UseRRD"))
+ #if data_config.SYSTEMTYPE == "LinHES":
+ #setup_rrd(systemconfig.get("UseRRD"))
setup_evrouter(systemconfig.get("UseEvrouter"),
- systemconfig.get("EvrouterConfig"),
- systemconfig.get("TEMPLATES"))
+ systemconfig.get("EvrouterConfig"),
+ systemconfig.get("TEMPLATES"))
setup_DNSmasq(systemconfig.get("RunDHCP"),
- systemconfig.get("mythip"),
- systemconfig.get("mythgw"),
- systemconfig.get("mythdns"))
+ systemconfig.get("mythip"),
+ systemconfig.get("mythgw"),
+ systemconfig.get("mythdns"))
setup_mythweb(systemconfig.get("UseMythWEB"))
- setup_samba(systemconfig,data_config)
- setup_NFSshares(systemconfig.get("UseNFS"),
- systemconfig.get("TEMPLATES")+"/exports.template")
setup_dyndns(systemconfig.get("DDnsEnable"))
logging.info("__End of advanced configuration\n")
diff --git a/abs/core/LinHES-config/mv_common.py b/abs/core/LinHES-config/mv_common.py
index e4bef48..1cb761e 100755
--- a/abs/core/LinHES-config/mv_common.py
+++ b/abs/core/LinHES-config/mv_common.py
@@ -108,22 +108,24 @@ def link_file(srcfile,link_name):
return
-def mkdir_mythhome(mythhome):
+def mkdir_mythhome(mythhome,user,grp=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
+ #os.chown(mythhome+"/.mythtv", int(user), int(grp))
+ #logging.debug("* Couldn't chown of %s", mythhome)
+
+ cmd = ''' chown -R %s %s/.mythtv''' %(user,mythhome)
runcmd(cmd)
- cmd = ''' chgrp -R mythtv %s/.mythtv''' %mythhome
+ cmd = ''' chgrp -R %s %s/.mythtv''' %(grp,mythhome)
runcmd(cmd)
+ except:
+ logging.debug("* Couldn't chown of %s", mythhome)
pass
@@ -162,6 +164,16 @@ def restart_service(daemon):
cmd = "sv restart %s" %daemon
runcmd(cmd)
+def check_service(daemon):
+ logging.info(" Checking status of service %s",daemon)
+ cmd = "sv status %s" %daemon
+ results = runcmd_output(cmd)
+ status = results.split()[0]
+ if status == "run:":
+ return True
+ else:
+ return False
+
def hup_service(daemon):
logging.info(" hup service %s",daemon)
cmd = "sv hup %s" %daemon
@@ -204,6 +216,10 @@ def pacinstall(pkg):
pacinstall("dolphin-emu")
elif pkg == "webonlinhes":
pacinstall("web-on-linhes")
+ elif pkg == "xymonclient":
+ if os.path.exists('/home/xymon/client'):
+ cmd='''pacman --noconfirm --dbonly -Sddf xymonclient'''
+ mv_common.runcmd(cmd)
if not pkg_blacklist_check(pkg):
if pkg_installed_check(pkg):
diff --git a/abs/core/LinHES-config/mv_config.py b/abs/core/LinHES-config/mv_config.py
index 2904366..381f424 100755
--- a/abs/core/LinHES-config/mv_config.py
+++ b/abs/core/LinHES-config/mv_config.py
@@ -1,9 +1,26 @@
# -*- coding: utf-8 -*-
SYSTEMTYPE="LinHES"
-MVHOSTNAME="larch5"
+MVHOSTNAME="apheleia"
MOUNTPOINT="/new_boot"
-DATAMOUNT="/myth"
+DATAMOUNT="/data/storage/disk0"
+
+HOMEMOUNT="/home"
+SQLMOUNT="/data/srv/mysql"
+
MYTHHOME="/home/mythtv"
+VNCHOME="/home/vncsvc"
+NOOPDEBUG="FALSE"
+TEMP_TEMPLATES="/tmp/templates"
+share_exclude_dir=['mysql','srv']
+
+SG_MAP_AUTONFS_SKIP=['media/tv','media/video','media/video_stuff']
+
+MAP_AUTONFS_SKIP=['lost+found','media','backup']
+
+
+
+
+
SQUASHFILE="/tmp/.squashlist"
SQUASHLIST=("bin","boot","etc","home","lib","opt","root","sbin","usr","var","data","service")
NOOPDEBUG="FALSE"
@@ -15,3 +32,4 @@ SMEDIA="myth"
+
diff --git a/abs/core/LinHES-config/mv_fileshare.py b/abs/core/LinHES-config/mv_fileshare.py
new file mode 100755
index 0000000..ebb53c7
--- /dev/null
+++ b/abs/core/LinHES-config/mv_fileshare.py
@@ -0,0 +1,418 @@
+# -*- coding: utf-8 -*-
+import logging, os, re
+import mv_common
+import glob
+from urllib2 import Request, urlopen, URLError, HTTPError
+#client side
+
+def setup_nfs_client(systemconfig,data_config):
+ nfslist=[]
+ nfsmap_serverfile ="nfsmap"
+ logging.info("____Start of setup_nfs__client____")
+ scrubnfs(systemconfig.get("TEMPLATES"))
+
+ if systemconfig.get("HaveCentralNFS") == "yes":
+ logging.debug(" Using a Central NFS server")
+ if systemconfig.get("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.get("dbhost"),nfsmap_serverfile)
+ nfslist = process_nfsmap_file(nfsmap_file)
+
+ # if it's an ip parse ip and download file
+ elif re.search(systemconfig.get("NFSserver"),":nfsmap"):
+ ip=systemconfig.get("NFSserver").split(":")[0]
+ nfsmap_file = download_nfsmap(ip,nfsmap_serverfile)
+ nfslist = process_nfsmap_file(nfsmap_file)
+ #else treat it as a single mount point
+ else:
+ item = (systemconfig.get("NFSserver") , systemconfig["NFSmount"])
+ nfslist.append(item)
+ else:
+ #if frontend_only or slave try to use MBE nfs_map_auto
+ if systemconfig.get("SystemType") == "Frontend_only" or systemconfig["SystemType"] == "Slave_Backend":
+ logging.info(" Central NFS not found, trying to use MBE as nfs server")
+ nfsmap_serverfile = "nfsmap_auto"
+ ip=systemconfig.get("dbhost")
+ nfsmap_file = download_nfsmap(ip,nfsmap_serverfile)
+ nfslist = process_nfsmap_file(nfsmap_file)
+
+
+ setup_nfs_fstab(nfslist)
+ logging.info("__End of nfs\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_serverfile):
+ nfsmap_file="/tmp/nfsmap"
+ myurl="http://%s:1337/templates/%s" %(ip,nfsmap_serverfile)
+ 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_mkdir(nfs_dirname):
+ logging.info(" Creating NFS mount point %s" , nfs_dirname)
+ try:
+ os.makedirs(nfs_dirname)
+ except:
+ logging.debug(" Failed creating nfs mount point")
+
+
+
+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)
+ setup_nfs_mkdir(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")
+
+
+
+
+
+#server side
+def setup_samba(systemconfig,data_config):
+ mythhome = data_config.MYTHHOME
+ excludes = data_config.share_exclude_dir
+ if systemconfig.get("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.get("Samba_media")
+ Samba_home = systemconfig.get("Samba_home")
+ if systemconfig.get("Samba_mediareadonly") == "0":
+ smreadonly = "yes"
+ else:
+ smreadonly = "no"
+
+ if systemconfig.get("Samba_homereadonly") == "0":
+ shreadonly = "yes"
+ else:
+ shreadonly = "no"
+ domain = systemconfig.get("Samba_domain")
+ servername = systemconfig.get("hostname")
+
+ try:
+ f = open(systemconfig.get("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
+
+ shares = scan_for_shares()
+ medialines='''
+[%s]
+ path = %s
+ public = yes
+ only guest = yes
+ writeable = %s
+ printable = no
+ force user = mythtv
+ force group = mythtv
+ create mask = 0755\n'''
+ new_share=[]
+ excludes
+ for share in shares:
+ share_name = share.split("/")[-1]
+ share_path = share
+ #new_share.append(medialines %(share_name,share_patch,smreadonly)
+ f.write(medialines %(share_name,share_path,smreadonly) )
+ logging.debug(" %s",medialines %(share_name,share_path,smreadonly) )
+ excludeline = ' veto files = '
+ for exclude in excludes:
+ excludeline+= ''' "/%s/" ''' %exclude
+
+ if excludes != []:
+ f.write( excludeline)
+ logging.debug(excludeline)
+ f.write("\n")
+
+ f.close()
+ 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")
+ mv_common.restart_service("nmbd")
+ mv_common.restart_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 scan_for_shares():
+ import ConfigParser
+ config = ConfigParser.RawConfigParser()
+ file_list=glob.glob("/etc/storage.d/*.conf")
+ share_list = []
+ for conf_file in file_list:
+ try:
+ logging.debug(" mv_fileshare: reading in %s" %conf_file)
+ config.read(conf_file)
+ shareable = config.get('storage','shareable')
+ if shareable == "True" :
+ mp = config.get('storage','mountpoint')
+ share_list.append(mp)
+ if config.get('storage','mmount') == "True" :
+ share_list.append("/myth")
+ except:
+ logging.debug(" mv_fileshare: Couldn't open %s for reading" %conf_file)
+
+ return share_list
+
+def setup_etc_exports(shares,data_config,servername):
+ #read in /etc/ exports
+ conf_file="/etc/exports"
+ excludes = data_config.share_exclude_dir
+ nfsmap_sg_auto_skip = data_config.SG_MAP_AUTONFS_SKIP
+ nfsmap_auto_skip = data_config.MAP_AUTONFS_SKIP
+
+ #print nfsmap_auto_skip
+ nfs_auto_line ="%s:%s %s"
+
+
+ nfs_map_auto = []
+
+ share_list = []
+
+
+ #create the lists for both /etc/exports and nfs_map_auto
+ for share in shares:
+ if share == "/myth":
+ continue
+ os.chdir(share)
+ file_list=glob.glob("*")
+ for dirname in file_list:
+ if os.path.isdir(dirname):
+ tempname = "%s/%s" %(share,dirname)
+ if dirname not in nfsmap_auto_skip:
+ share_list.append(tempname)
+ if dirname not in nfsmap_sg_auto_skip:
+ templine = nfs_auto_line %(servername,tempname,tempname)
+ nfs_map_auto.append(templine)
+
+
+ file_list=glob.glob("media/*")
+ for dirname in file_list:
+ if os.path.isdir(dirname):
+ tempname = "%s/%s" %(share,dirname)
+ if dirname not in nfsmap_auto_skip:
+ share_list.append(tempname)
+ if dirname not in nfsmap_sg_auto_skip:
+ templine = nfs_auto_line %(servername,tempname,tempname)
+ nfs_map_auto.append(templine)
+
+
+
+
+ new_exports=[]
+ new_exports.append("#This file was generated by systemconfig.py -m fileshare")
+ new_exports.append("#Use exportfs -arv to reread. \n\n")
+ #for exclude in excludes:
+ # share_line='''/%s *(noaccess)''' %exclude
+ # new_exports.append(share_line)
+
+ for share in share_list:
+ share_line='''%s *(rw,all_squash,anonuid=1000,anongid=1000,no_subtree_check)''' %share
+ new_exports.append(share_line)
+ #for exclude in excludes:
+ #share_line='''/%s *(noaccess)''' %exclude
+ #new_exports.append(share_line)
+
+ #write out nfs_map_auto
+ try:
+
+ logging.info(" writing nfsmap_auto")
+ try:
+ os.makedirs("%s/templates/" %data_config.MYTHHOME)
+ except:
+ pass
+ conf_file_nfs = "%s/templates/nfsmap_auto" %(data_config.MYTHHOME)
+ f=open(conf_file_nfs,'w')
+ for line in nfs_map_auto:
+ f.write(line)
+ f.write("\n")
+ logging.debug("%s" %line)
+ f.close()
+ except:
+ logging.info("* error writing /data/srv/htdocs/nfsmap_auto")
+
+ try:
+ logging.info(" writing /etc/exports")
+ f=open(conf_file,'w')
+ for line in new_exports:
+ f.write(line)
+ f.write("\n")
+ logging.debug("%s" %line)
+ f.close()
+ except:
+ logging.info("* error writing /etc/exports")
+
+
+
+def setup_NFSshares(UseNFS,templatefile,data_config,servername):
+ if UseNFS == "1":
+ logging.info(" Activating NFS server")
+ mv_common.pacinstall("nfs-utils")
+ mv_common.pacinstall("rpcbind")
+ shares = scan_for_shares()
+ setup_etc_exports(shares,data_config,servername)
+
+ mv_common.add_service("nfsd")
+ mv_common.add_service("nfs-common")
+ mv_common.add_service("rpcbind")
+ cmd="exportfs -arv"
+ mv_common.runcmd(cmd)
+ 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_fileshare(systemconfig,data_config):
+ if mv_common.read_config(mv_common.module_config,"fileshare") == False :
+ logging.info("____Skipping of fileshare, config disabled____")
+ return
+ logging.info("____Start of fileshare configuration____")
+ #client
+ setup_nfs_client(systemconfig,data_config)
+ #server
+ setup_NFSshares(systemconfig.get("UseNFS"),
+ systemconfig.get("TEMPLATES")+"/exports.template",data_config,systemconfig.get("hostname"))
+ setup_samba(systemconfig,data_config)
+
+ logging.info("__End of fileshare configuration\n")
diff --git a/abs/core/LinHES-config/mv_hostype.py b/abs/core/LinHES-config/mv_hostype.py
index 59b05b6..5655986 100755
--- a/abs/core/LinHES-config/mv_hostype.py
+++ b/abs/core/LinHES-config/mv_hostype.py
@@ -38,7 +38,7 @@ def setup_db():
def setup_mysqlnetwork(EnableNetwork):
logging.debug(" Setting up mysql network")
- mysqlconf = "/etc/my.cnf"
+ mysqlconf = "/etc/mysql/my.cnf"
cmd = '''grep "#skip-networking" %s ''' %mysqlconf
status = mv_common.runcmd(cmd)
@@ -49,7 +49,7 @@ def setup_mysqlnetwork(EnableNetwork):
else:
cmd = '''sed -ie "s/^skip-networking/#skip-networking/g" %s ''' %mysqlconf
mv_common.runcmd(cmd)
- mv_common.restart_service("mysqld")
+ mv_common.restart_service("mysql")
else:
logging.debug(" Disabling mysql networking")
if status == 1 :
@@ -57,7 +57,7 @@ def setup_mysqlnetwork(EnableNetwork):
else:
cmd = '''sed -ie "s/#skip-networking/skip-networking/g" %s ''' %mysqlconf
mv_common.runcmd(cmd)
- mv_common.restart_service("mysqld")
+ mv_common.restart_service("mysql")
def generate_config_xml(uuid,dbhost):
@@ -101,32 +101,9 @@ def setup_mysql_connection(systemconfig):
dbhost = systemconfig.get("dbhost")
uuid = gen_uuid()
config_xml=generate_config_xml(uuid,dbhost)
- mv_common.mkdir_mythhome(data_config.MYTHHOME)
+ mv_common.mkdir_mythhome(data_config.MYTHHOME,"mythtv","mythtv")
- 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)
@@ -148,6 +125,77 @@ def setup_mysql_connection(systemconfig):
home_xml_file=data_config.MYTHHOME + "/.mythtv/config.xml"
mv_common.link_file(configxml_file,home_xml_file)
+ #setup link for root user
+ mv_common.mkdir_mythhome("/root","root","root")
+ home_xml_file="/root/.mythtv/config.xml"
+ mv_common.link_file(configxml_file,home_xml_file)
+
+
+
+ if systemtype == "Master_backend":
+ logging.debug(" Setting dbhost to %s in systemconfig", mythip)
+ dbhost = mythip
+ cmd = '''sed -i "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)
+ cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s master -a %s ''' %(mv_root, dbhost)
+ b=mv_common.runcmd_output(cmd)
+ logging.debug(b)
+ #mv_common.reloadfe(systemconfig.get("dbhost"),True)
+
+ if systemtype == "Slave_backend":
+ slavehost = mythip
+ logging.debug(" Changing slave in settings: %s", slavehost)
+ cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s slave -a %s ''' %(mv_root, slavehost)
+ #cmd = '''%s/bin/restore_default_settings.sh -c BECONFIG -s slave -a %s ''' %(mv_root, slavehost)
+ b=mv_common.runcmd_output(cmd)
+ logging.debug(b)
+
+
+ if systemtype == "Standalone":
+ logging.debug(" changing mysql.txt file to use localhost")
+ cmd = '''sed -e "s/^DBHostName=.*$/DBHostName="localhost"/" %s > %s ''' %(mysqltemplate, mysqltxt)
+ mv_common.runcmd(cmd)
+
+ #mv_common.reloadfe(systemconfig.get("dbhost"),True)
+
+ cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s standalone ''' %(mv_root)
+ b=mv_common.runcmd_output(cmd)
+ logging.debug(b)
+
+ #mv_common.reloadfe(systemconfig.get("dbhost"),True)
+
+ logging.debug(" Running beconfig a 2nd time")
+ cmd = '''%s/bin/myth_settings_wrapper.sh -c BECONFIG -s standalone ''' %(mv_root)
+ #mv_common.runcmd(cmd)
+ b=mv_common.runcmd_output(cmd)
+ logging.debug(b)
+ #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)
+ #try:
+ #f = open(configxml_file, 'w')
+
+ #for outline in config_xml:
+ #f.write(outline)
+ #f.close()
+ #except:
+ #logging.debug(" Couldn't write config.xml")
+
+ #home_xml_file=data_config.MYTHHOME + "/.mythtv/config.xml"
+ #mv_common.link_file(configxml_file,home_xml_file)
+
@@ -260,7 +308,7 @@ def hostypeprint(systemconfig):
daemon_list=''
daemon_remove_list=''
run_mysqlnetwork = False
-
+ restart_mbe = False
profile_status="/etc/profile.d/z_myth_status.sh"
myth_status="/usr/LH/bin/myth_status.sh"
@@ -271,9 +319,12 @@ def hostypeprint(systemconfig):
EnableNetwork = False
run_mysqlnetwork = True
if systemconfig.get("hostypec"):
- setup_db()
+ logging.info(" Host type change detected, queuing restart of backend")
+ restart_mbe = True
+
+
install_list=["nss-mdns", "mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
- daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"]
+ daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd" ,"msg_daemon"]
mv_common.link_file(myth_status,profile_status)
@@ -290,7 +341,7 @@ def hostypeprint(systemconfig):
setup_ntp(False,"null")
setup_avahi(systemconfig.get("TEMPLATES"))
install_list=["nss-mdns", "mysql", "mythdb-initial", "avahi", "rpcbind", "nfs-utils", "local-website", "myth2ipod", "mythtv-status"]
- daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd"]
+ daemon_list=["mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs", "lighttpd" ,"msg_daemon"]
EnableNetwork = True
run_mysqlnetwork = True
mv_common.link_file(myth_status,profile_status)
@@ -303,6 +354,9 @@ def hostypeprint(systemconfig):
install_list.append('certmaster')
daemon_list.append('certmaster')
+ if systemconfig.get("hostypec"):
+ logging.info(" Host type change detected, queuing restart of backend")
+ restart_mbe = True
elif systemconfig.get("SystemType") == "Slave_backend":
logging.info("Slave backend system being configured")
@@ -310,10 +364,8 @@ def hostypeprint(systemconfig):
remove_avahi_service()
mv_common.link_file(myth_status,profile_status)
- if systemconfig.get("hostypec"):
- setup_db()
install_list = [ "nss-mdns", "rpcbind", "nfs-utils", "avahi", "libmysqlclient" ]
- daemon_list = ["mythbackend", "rpcbind", "nfs-common", "netfs", "avahi" ]
+ daemon_list = ["mythbackend", "rpcbind", "nfs-common", "netfs", "avahi" ,"msg_daemon" ]
daemon_remove_list=["mysql", "lighttpd", "certmaster"]
@@ -326,6 +378,9 @@ def hostypeprint(systemconfig):
daemon_list.append('xymon-client')
setup_rsyslog_client(systemconfig.get("dbhost"))
+ if systemconfig.get("hostypec"):
+ logging.info(" Host type change detected, queuing restart of backend")
+ restart_mbe = True
elif systemconfig.get("SystemType") == "Frontend_only":
@@ -335,7 +390,7 @@ def hostypeprint(systemconfig):
install_list=["mysql-clients", "libmysqlclient", "avahi", "rpcbind", "nfs-utils"]
remove_list=["mysql","lighttpd"]
- daemon_list=["nss-mdns", "mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs" ]
+ daemon_list=["nss-mdns", "mysql", "mythbackend", "avahi", "rpcbind", "nfs-common", "netfs" ,"msg_daemon"]
daemon_remove_list=["mysql", "mythbackend","lighttpd"]
if xymon_supported:
install_list.append('xymonclient')
@@ -361,23 +416,33 @@ def hostypeprint(systemconfig):
if systemconfig.get("RunFrontend") == "1":
logging.debug(" Will run the frontend")
mv_common.add_service("frontend")
- mv_common.add_service("hal")
+ #mv_common.add_service("hal")
if data_config.SYSTEMTYPE == "MythVantage":
mv_common.add_service("ghosd")
else:
logging.debug(" Will NOT run the frontend")
mv_common.remove_service("frontend")
- mv_common.add_service("hal")
+ #mv_common.add_service("hal")
if data_config.SYSTEMTYPE == "MythVantage":
mv_common.remove_service("ghosd")
+ if restart_mbe == True :
+ setup_mysql_connection(systemconfig)
+ mv_common.stop_service("mythbackend")
+
+
if run_mysqlnetwork:
setup_mysqlnetwork(EnableNetwork)
else:
logging.debug(" Not running setup_mysql_connection")
setup_mysql_connection(systemconfig)
+
+ if restart_mbe == True :
+ mv_common.start_service("mythbackend")
+
+
if func_supported:
setup_func_minion(systemconfig.get("dbhost"),systemconfig.get("hostname"))
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index 2e60ab7..aa895da 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -12,6 +12,20 @@ except:
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"
+ print ""
+ print "Alt usage involves reading config from a file"
+ print "The conf file is read when no command line options are given"
+ print " /etc/systemconfig must also be present "
+
+ print "Create /tmp/install_conf, with contents similiar to this. Sizes are in MB"
+ print " rootdisk=sda"
+ print " rootfs=ext4"
+ print " rootsize=5000"
+ print " datafs=reiserfs"
+ print " datasize=all"
+ print " datadisk=sda"
+ print " swapsize=200"
+ print " op=full_install"
def clean_upgrade():
return False
@@ -66,6 +80,14 @@ def kill_dhcp_chroot():
os.chdir(stddir)
except:
pass
+ #force kill
+ try:
+ cmd = "lsof -t /new_boot|xargs kill -9"
+ runcmd(cmd)
+ except:
+ print " !!!Problem killing all /new_boot pids"
+
+
def statgrab(disk):
cmd = "statgrab -M disk. |grep %s.write_bytes" % hostoptions["rootdisk"]
@@ -129,7 +151,7 @@ def mdadm_assemble_all():
def copy_updates():
try:
- MVROOT = os.environ["MV_ROOT"]
+ MVROOT = os.environ["MV_ROOT"].strip()
except:
logging.debug("MVROOT was not defined, using the default value")
MVROOT = "/usr/MythVantage"
@@ -197,7 +219,7 @@ def mysqldb(cmd, inchroot):
elif cmd == "stop":
mycmd = " /etc/rc.d/mysqld stop"
if inchroot == "chroot":
- mycmd = " chroot /newboot %s" %mycmd
+ mycmd = " chroot /new_boot %s" %mycmd
runcmd(mycmd)
@@ -239,7 +261,7 @@ def blank_table(diskdevice):
runcmd(cmd)
def partitions_removeall(diskdevice, label):
- logging.info("Removing all partitions for %s %s", label, diskdevice)
+ logging.info(" Removing all partitions for %s %s", label, diskdevice)
try:
device = parted.getDevice(diskdevice)
partdisk = parted.Disk(device)
@@ -252,54 +274,76 @@ def partitions_removeall(diskdevice, label):
logging.debug(" Error reading parition table, attempting to write a blank one")
blank_table(diskdevice)
+def find_next_start_sector(partition_list):
+ newstart = 0
+ partlist = []
+ for partition in partition_list:
+ 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
+ # print slice
+ #Start the new partition one after the end of last
+ newstart = usedend + 3
+ return newstart
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
+
+ # newstart = 0
totalused = 0
device = parted.getDevice(diskdevice)
- logging.debug("Sector size is %s %s", diskdevice , device.sectorSize)
+ logging.debug(" Sector size is %s %s", diskdevice , device.sectorSize)
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
+ #first set to all paritions
+ partition_list = partdisk.partitions
+
+ if ptype == "LOGICAL":
+ #check for other logical:
+ logical_partitions=partdisk.getLogicalPartitions()
+ if logical_partitions == [] :
+ logging.info(" First Logical drive, working with extended partition")
+ newstart = partdisk.getExtendedPartition().geometry.start + 3
+ else:
+ newstart = find_next_start_sector(logical_partitions)
+ else:
+ #all partitions
+ partitionlist = partdisk.partitions
+ newstart = find_next_start_sector(partition_list)
if startsector == 0:
newstart = 2048
- if size == "ALL":
+
+ 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")
+ 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)
+ logging.debug(" Size is %s", length)
if length > device.length:
length = device.length - newstart
- logging.info("Size is larger then disk, reducing size")
- logging.debug("New Size is %s", length)
+ logging.info("* Size is larger then disk, reducing size")
+ logging.debug("* New Size is %s", length)
try:
geom = parted.Geometry(device=device, start=newstart, length=length)
except:
- logging.info("An error occured, probably invalid parition size")
+ logging.info("* An error occured, probably invalid parition size")
error_out("invalid parition size")
#collect device constraint
@@ -309,6 +353,15 @@ def create_partitions(diskdevice, size, ptype, startsector):
# new partition
if ptype == "NORMAL":
newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_NORMAL, geometry=geom)
+
+ elif ptype == "EXTENDED":
+ newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_EXTENDED, geometry=geom)
+
+
+
+ elif ptype == "LOGICAL":
+ newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_LOGICAL, geometry=geom)
+
elif ptype == "SWAP":
newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_NORMAL, geometry=geom)
@@ -316,8 +369,8 @@ def create_partitions(diskdevice, size, ptype, startsector):
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))
+ logging.info(" created %s partition %s of %dMB and added it to %s" %
+ (ptype,newpart.getDeviceNodeName(), newpart.getSize(), diskdevice))
return newpart.getDeviceNodeName()
def set_active_parition(diskdevice):
@@ -346,15 +399,34 @@ def partition_disk():
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)
+
+ #create extended partition
+ hostoptions["extended_partition"] = create_partitions("/dev/"+rootdisk, "all", "EXTENDED", 1)
+
+ #create the logical in the extended
+ hostoptions["home_partition"] = create_partitions("/dev/"+rootdisk, hostoptions["homesize"], "LOGICAL", 1)
+ hostoptions["sql_partition"] = create_partitions("/dev/"+rootdisk, hostoptions["sqlsize"], "LOGICAL", 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)
+ hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "LOGICAL", 1)
+
+ logging.debug("sleeping for 5 seconds")
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"}
+ fscmds = {"reiserfs":"mkreiserfs -q -l ROOT",
+ "xfs": "mkfs -t xfs -f",
+ "ext3": "mkfs.ext3",
+ "jfs":"mkfs.jfs -q",
+ "ext4":"mkfs.ext4",
+ "Do_not_format":"no_format",
+ "no_format":"no_format",
+ "btrfs":"mkfs.btrfs"}
try:
rc = fscmds[fstype]
except:
@@ -368,40 +440,76 @@ def format_disk(install_type):
rootfs = fscmd(hostoptions["rootfs"])
datafs = fscmd(hostoptions["datafs"])
+ sqlfs = fscmd(hostoptions["sqlfs"])
+ homefs = fscmd(hostoptions["homefs"])
+
+
rootdisk = hostoptions["rootdisk"]
datadisk = hostoptions["datadisk"]
rootpartition = hostoptions["rootpartition"]
datapartition = hostoptions["datapartition"]
- if install_type != "upgrade":
- swapsize = hostoptions["swapsize"]
+
+ homepartition = hostoptions["home_partition"]
+ sqlpartition = hostoptions["sql_partition"]
+
+
+ #if install_type != "upgrade":
+ #swapsize = hostoptions["swapsize"]
+ #swappartition = hostoptions["swappartition"]
+
+ if install_type == "install":
swappartition = hostoptions["swappartition"]
+ 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(" Format command for rootfs %s : %s ", rootfs, rootpartition)
- if ( rootfs != "noformat"):
- logging.info("Starting format of %s", rootpartition)
+ if ( rootfs != "no_format"):
+ logging.info(" Starting %s format of %s", rootfs, rootpartition)
cmd = " %s /dev/%s" %( rootfs, rootpartition)
#os.system(cmd)
runcmd(cmd)
else:
- logging.info("Will not format root partition: %s", rootpartition)
+ 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)
+ if (datafs != "no_format"):
+ logging.info(" Starting format %s of %s", datafs, datapartition)
cmd = " %s /dev/%s" %( datafs, datapartition)
#os.system(cmd)
runcmd(cmd)
else:
- logging.info("Will not format data partition: %s", datapartition)
+ 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")
+ #for upgrades format is set to no_format
+ if ( homefs != "no_format"):
+ logging.info(" Starting format %s of %s", homefs, homepartition)
+ cmd = " %s /dev/%s" %( homefs, homepartition)
+ #os.system(cmd)
+ runcmd(cmd)
+ else:
+ logging.info(" Will not format home partition: %s", homepartition)
+
+ if ( sqlfs != "no_format"):
+ logging.info(" Starting format %s of %s", sqlfs, sqlpartition)
+ cmd = " %s /dev/%s" %( sqlfs, sqlpartition)
+ #os.system(cmd)
+ runcmd(cmd)
+ else:
+ logging.info(" Will not format sql partition: %s", sqlpartition)
+
+ logging.debug(" Format command for datafs %s : %s ", datafs, datapartition)
+ if (datafs != "no_format"):
+ logging.info(" Starting format %s of %s", datafs, datapartition)
+ cmd = " %s /dev/%s" %( datafs, datapartition)
+ #os.system(cmd)
+ runcmd(cmd)
+ else:
+ logging.info(" Will not format data partition: %s", datapartition)
logging.debug("_____End of format______")
@@ -412,43 +520,89 @@ def mount_it():
try:
mountpoint = data_config.MOUNTPOINT
mp = mountpoint
- logging.info("Creating mountpoints %s", mp)
+ logging.info(" Creating mountpoints %s", mp)
os.makedirs(mp)
except OSError:
logging.debug(" Could not create %s", mp)
-# Mount root
+ # 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 /
+ # Mount data
+ #make mountpoint after mounting /
try:
mountpoint = data_config.MOUNTPOINT
datapoint = data_config.DATAMOUNT
mp = mountpoint+datapoint
- logging.info("Creating mountpoints %s", mp)
+ 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)
+
+ #mount home
+ try:
+ mountpoint = data_config.MOUNTPOINT
+ homepoint = data_config.HOMEMOUNT
+ mp = mountpoint+homepoint
+ logging.info(" Creating mountpoints %s", mp)
+ os.makedirs(mp)
+ except OSError:
+ logging.debug(" Could not create %s", mp)
+
+ cmd = "mount /dev/%s %s" %(hostoptions["home_partition"], mp)
+ runcmd(cmd)
+
+
+ #mount sql
+ try:
+ mountpoint = data_config.MOUNTPOINT
+ sqlpoint = data_config.SQLMOUNT
+ mp = mountpoint+sqlpoint
+ logging.info(" Creating mountpoints %s", mp)
+ os.makedirs(mp)
+ except OSError:
+ logging.debug(" Could not create %s", mp)
+
+ cmd = "mount /dev/%s %s" %(hostoptions["sql_partition"], mp)
+ runcmd(cmd)
+
def unmount_it():
logging.info("______Unmounting disk______")
+ cmd = "mount -v |grep new_boot"
+ mp_list=[]
+ mplist=[]
+ mountpoint = runcmd(cmd)[1]
+ mplist="".join(mountpoint).split("\n")
+ for i in mplist:
+ mp = i.split()[2]
+ mp_list.append(mp)
+ mp_list.sort(key = len, reverse=True)
+ for i in mp_list:
+ cmd = "umount %s" %(i)
+ runcmd(cmd)
+ time.sleep(1)
+
+
+
cmd = "umount %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT)
runcmd(cmd)
time.sleep(2)
+ cmd = "umount %s" %(data_config.MOUNTPOINT+data_config.HOMEMOUNT)
+ runcmd(cmd)
+ time.sleep(2)
+
+ cmd = "umount %s" %(data_config.MOUNTPOINT+data_config.SQLMOUNT)
+ runcmd(cmd)
+ time.sleep(2)
+
+
+
cmd = "swapoff /dev/%s" %(hostoptions["swappartition"])
runcmd(cmd)
@@ -475,33 +629,170 @@ def create_squashlist():
logging.debug(i)
f.close()
+def mount_for_copy_it():
+ mounts = {}
+
+ mounts['/image_mount/root'] = 'root-image'
+ mounts['/image_mount/usr/share'] = 'usr-share'
+ mounts['/image_mount/lib/modules'] = 'lib-modules'
+ mounts['/image_mount/var/lib/pacman'] = 'var-lib-pacman'
+ mounts['/image_mount/data/storage/disk0/pacman/pkg'] = 'data-storage-disk0-pacman-pkg'
+ #mounts['/image_mount/var/cache/pacman'] = 'var-cache-pacman'
+ for image_mount, fsimage in mounts.iteritems():
+ try:
+ os.makedirs(image_mount)
+ except:
+ pass
+ cmd = 'mount /run/archiso/sfs/%s/%s.fs %s' %(fsimage,fsimage,image_mount)
+ rc = runcmd(cmd)[0]
+ if rc != 0 :
+ error_out("Mount image %s" %fsimage)
+
+
+
+
+ #image_mount='/image_mount/root'
+ #try:
+ #os.makedirs(image_mount)
+ #except:
+ #pass
+
+ #image_mount='/image_mount/usr/share'
+ #try:
+ #os.makedirs(image_mount)
+ #except:
+ #pass
+
+ #image_mount='/image_mount/lib/modules'
+ #try:
+ #os.makedirs(image_mount)
+ #except:
+ #pass
+
+ #image_mount='/image_mount/var/cache/pacman'
+ #try:
+ #os.makedirs(image_mount)
+ #except:
+ #pass
+
+ #image_mount='/image_mount/var/lib/pacman'
+ #try:
+ #os.makedirs(image_mount)
+ #except:
+ #pass
+
+
+ #fsimage='root-image'
+ #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/root' %(fsimage,fsimage)
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("Mount image root")
+
+ #fsimage='lib-modules'
+ #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/lib/modules' %(fsimage,fsimage)
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("Mount image lib-modules")
+
+ #fsimage='usr-share'
+ #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/usr/share' %(fsimage,fsimage)
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("Mount image usr share")
+
+ #fsimage='var-lib-pacman'
+ #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/var/lib/pacman' %(fsimage,fsimage)
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("Mount image var-lib-pacman")
+
+ #fsimage='var-cache-pacman'
+ #cmd = 'mount /run/archiso/sfs/%s/%s.fs /image_mount/var/cache/pacman' %(fsimage,fsimage)
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("Mount image var-cahce-pacman")
+
+
+def umount_for_copy_it():
+ mounts = {}
+
+ mounts['/image_mount/root'] = 'root-image'
+ mounts['/image_mount/usr/share'] = 'usr-share'
+ mounts['/image_mount/lib/modules'] = 'lib-modules'
+ mounts['/image_mount/var/lib/pacman'] = 'var-lib-pacman'
+ mounts['/image_mount/data/storage/disk0/pacman/pkg'] = 'data-storage-disk0-pacman-pkg'
+ #mounts['/image_mount/var/cache/pacman'] = 'var-cache-pacman'
+ for image_mount, fsimage in mounts.iteritems():
+ cmd = 'mount /run/archiso/sfs/%s/%s.fs %s' %(fsimage,fsimage,image_mount)
+ cmd='umount %s' %(image_mount)
+ rc = runcmd(cmd)[0]
+ if rc != 0 :
+ error_out("unMount image %s" %image_mount)
+
+
+ #cmd='umount %s' %('/image_mount/lib/modules')
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("unMount image lib_modules")
+
+ #cmd='umount %s' %('/image_mount/usr/share')
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("unMount image usr_share")
+
+ #cmd='umount %s' %('/image_mount/root')
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("unMount image /")
+
+ #cmd='umount %s' %('/image_mount/var/cache/pacman')
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("unMount image var-cache-pacman")
+
+ #cmd='umount %s' %('/image_mount/var/lib/pacman')
+ #rc = runcmd(cmd)[0]
+ #if rc != 0 :
+ #error_out("unMount image var-lib-pacman")
+
+
def copy_it(install_type):
logging.info("______Transferring to disk______")
+ mount_for_copy_it()
logging.debug( install_type)
if ( install_type == "install"):
logging.info("Transferring system")
- cmd = " unsquashfs -f -d %s /.livesys/medium/larch/system.sqf" %(data_config.MOUNTPOINT)
- #runcmd(cmd)
- rc = runcmd(cmd)[0]
- if rc != 0 :
- error_out("Running unsquashfs")
+ cmdlist = ['rsync -arp /image_mount/root/* /new_boot',
+ 'rsync -arp /image_mount/lib/* /new_boot/lib/',
+ 'rsync -arp /image_mount/usr /new_boot',
+ 'rsync -arp /image_mount/var /new_boot',
+ 'rsync -arp /image_mount/data/storage/disk0/* /new_boot/data/storage/disk0/'
+ ]
+
+ for cmd in cmdlist:
+ rc = runcmd(cmd)[0]
+ if rc != 0 :
+ error_out("Running %s" %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/larch/system.sqf" %(data_config.SQUASHFILE, data_config.MOUNTPOINT)
- #runcmd(cmd)
- rc = runcmd(cmd)[0]
- if rc != 0 :
- error_out("Running unsquashfs")
- #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", "var/lock", "var/tmp", "usr/lib/locale")
+
+ cmdlist = ['rsync -arp --exclude /home --exclude /data/srv/mysql /image_mount/root/* /new_boot',
+ 'rsync -arp /image_mount/lib/* /new_boot/lib/',
+ 'rsync -arp /image_mount/usr /new_boot',
+ 'rsync -arp /image_mount/var /new_boot']
+
+ for cmd in cmdlist:
+ #runcmd(cmd)
+ rc = runcmd(cmd)[0]
+ if rc != 0 :
+ error_out("Running %s" %cmd)
+
+ # Create the missing dir
+ i = ("sys", "proc", "dev", "tmp", "mnt", "media", "media/cdrom", "media/dvd", "var/lock", "var/tmp", "usr/lib/locale")
mountpoint = data_config.MOUNTPOINT
for item in i:
try:
@@ -533,12 +824,11 @@ def copy_it(install_type):
runcmd(cmd)
cmd = "chmod +s %s/bin/mount" %(data_config.MOUNTPOINT)
runcmd(cmd)
- cmd = "rm %s/etc/*.larch*" %(data_config.MOUNTPOINT)
- runcmd(cmd)
- cmd = "rm %s/etc/mkinitcpio.d/larch*" %(data_config.MOUNTPOINT)
- runcmd(cmd)
- cmd = "rm %s/etc/rc.d/functions.d/*larch*" %(data_config.MOUNTPOINT)
- runcmd(cmd)
+ #sys.exit(3)
+ apply_pristine()
+ post_process()
+
+ umount_for_copy_it()
logging.debug("__End of copy_it__")
def create_fstab(extralines):
@@ -555,10 +845,19 @@ def create_fstab(extralines):
fstab_list.append(line)
line = '''/dev/sr0 /media/cdrom auto ro,user,noauto,unhide 0 0\n'''
fstab_list.append(line)
- line = '''UUID=ROOTUID / auto defaults,noatime 0 1\n'''
+ line = '''UUID=ROOTUID / %s defaults,noatime 0 1\n''' %(hostoptions["rootfs"])
fstab_list.append(line)
- line = '''UUID=DATAUID %s auto defaults,noatime 0 1\n''' %(data_config.DATAMOUNT)
+
+ line = '''UUID=DATAUID %s %s defaults,noatime 0 1\n''' %(data_config.DATAMOUNT,hostoptions["datafs"])
+ fstab_list.append(line)
+
+ line = '''UUID=HOMEUID %s %s defaults,noatime 0 1\n''' %(data_config.HOMEMOUNT,hostoptions["homefs"])
fstab_list.append(line)
+
+ line = '''UUID=SQLUID %s %s defaults,noatime 0 1\n''' %(data_config.SQLMOUNT,hostoptions["sqlfs"])
+ fstab_list.append(line)
+
+
line = '''UUID=SWAPUID swap swap defaults 0 0 \n'''
fstab_list.append(line)
for vline in extralines:
@@ -569,16 +868,16 @@ def create_fstab(extralines):
f.close()
def find_uuid(partition):
- logging.info("Finding the UUID for %s...", 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)
+ logging.info(" The uuid is %s", uuid)
return uuid.strip()
def acl_options(partition):
- logging.info("Finding mount options for %s...", partition)
+ logging.info(" Finding mount options for %s...", partition)
acl_fs_list=["ext3","ext4"]
options = "defaults,noatime"
cmd = "/sbin/fsck -N /dev/%s" %partition
@@ -601,7 +900,7 @@ def acl_options(partition):
if i[0] == "/dev/%s" %partition:
if i[1] in acl_fs_list:
rc=True
- logging.info("Will add acl to the list of options: %s ", rc )
+ logging.info(" Will add acl to the list of options: %s ", rc )
return rc
@@ -636,6 +935,7 @@ def fstab_it(install_type):
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")
@@ -653,13 +953,24 @@ def fstab_it(install_type):
rootuuid = find_uuid(hostoptions["rootpartition"])
rootacl = acl_options(hostoptions["rootpartition"])
+ logging.info("____UUID check for %s", "home")
+ homeuuid = find_uuid(hostoptions["home_partition"])
+ homeacl = acl_options(hostoptions["home_partition"])
+
+ logging.info("____UUID check for %s", "sql")
+ sqluuid = find_uuid(hostoptions["sql_partition"])
+ sqlacl = acl_options(hostoptions["sql_partition"])
+
fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
- logging.info("Correcting UUID's in %s", fstabfile)
+ logging.info(" Correcting UUID's in %s", fstabfile)
f = open(fstabfile, 'r')
oldfscontents = f.readlines()
newfstab = []
f.close()
for line in oldfscontents:
+ if line.strip("\n") == '':
+ continue
+ #FIX ALL MOUNTS THAT START WITH UUID
if line.startswith("UUID"):
templine = line.split()
if ( templine[1] == "/"):
@@ -678,7 +989,7 @@ def fstab_it(install_type):
logging.debug( newline)
newfstab.append(newline)
- if ( templine[1] == data_config.DATAMOUNT):
+ elif ( templine[1] == data_config.DATAMOUNT):
logging.debug(" Found DATA mount")
logging.debug( templine)
templine[0] = "UUID=%s" %(datauuid)
@@ -693,7 +1004,37 @@ def fstab_it(install_type):
logging.debug( newline)
newfstab.append(newline)
- if ( templine[1] == "swap"):
+ elif ( templine[1] == data_config.HOMEMOUNT):
+ logging.debug(" Found HOME mount")
+ logging.debug( templine)
+ templine[0] = "UUID=%s" %(homeuuid)
+ if homeacl:
+ templine[3] = templine[3]+",acl"
+ newline = ''
+ for i in templine:
+ newline+=i
+ newline+=" "
+ newline+="\n"
+ logging.debug(" New fstab line:")
+ logging.debug( newline)
+ newfstab.append(newline)
+
+ elif ( templine[1] == data_config.SQLMOUNT):
+ logging.debug(" Found database mount")
+ logging.debug( templine)
+ templine[0] = "UUID=%s" %(sqluuid)
+ if sqlacl:
+ templine[3] = templine[3]+",acl"
+ newline = ''
+ for i in templine:
+ newline+=i
+ newline+=" "
+ newline+="\n"
+ logging.debug(" New fstab line:")
+ logging.debug( newline)
+ newfstab.append(newline)
+
+ elif ( templine[1] == "swap"):
if len(swapuuid) <= 5:
logging.debug(" swapp uuid is to small")
else:
@@ -704,10 +1045,16 @@ def fstab_it(install_type):
for i in templine:
newline+=i
newline+=" "
- newline+="\n"
- logging.debug(" New fstab line:")
- logging.debug( newline)
- newfstab.append(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)
+
+
elif line.startswith("none"):
templine = line.split()
if ( templine[1] == "/dev/pts" ):
@@ -724,10 +1071,14 @@ def fstab_it(install_type):
logging.debug(" Line didn't match, adding to newfstab:")
logging.debug( line)
newfstab.append(line)
- logging.info("Writing out newfstab")
+
+ logging.info(" Writing out newfstab")
logging.debug("______This is the new fstab_____")
+
f = open(fstabfile, 'w')
for line in newfstab:
+ if line.strip("\n") == '':
+ continue
logging.debug(line)
f.write(line)
#f.write("\n")
@@ -735,47 +1086,107 @@ def fstab_it(install_type):
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")
+ cmd = "chroot %s grub-install --target=i386-pc --recheck --debug /dev/%s" %(data_config.MOUNTPOINT,hostoptions["rootdisk"])
+ logging.info(" Running grub-install")
runcmd(cmd)
- rootuuid = find_uuid(hostoptions["rootpartition"])
- cmd = " mkinitcpio -b %s -g %s/boot/kernel26.img" %(data_config.MOUNTPOINT, data_config.MOUNTPOINT)
+
+ cmd = " mkinitcpio -g %s/boot/initramfs-linux.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"
+ newgrub = []
+ grubfile = data_config.MOUNTPOINT+"/etc/default/grub"
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")
+ logging.debug(" Couldn't open grub file for reading")
+ pass
+
+ time_line = "GRUB_TIMEOUT="
+ hidden_time = "GRUB_HIDDEN_TIMEOUT="
+ color_line_normal = "GRUB_COLOR_NORMAL"
+ color_line_highlight = "GRUB_COLOR_HIGHLIGHT"
+
+ for line in oldgrub:
+ new_line=line
+ if line.find(time_line) != -1 :
+ new_line="GRUB_TIMEOUT=0\n"
+
+ if line.find(color_line_normal) != -1 :
+ #new_line=line.lstrip('''#''')
+ new_line='''GRUB_COLOR_NORMAL="white/blue"\n'''
+
+ if line.find(color_line_highlight) != -1 :
+ #new_line=line.lstrip('''#''')
+ new_line='''GRUB_COLOR_HIGHLIGHT="black/yellow"\n'''
+
+ if line.find(hidden_time) != -1 :
+ new_line="GRUB_HIDDEN_TIMEOUT=5\n"
+
+ newgrub.append(new_line)
+
+ if len(newgrub) > 0:
+ try:
+ f = open(grubfile, 'w')
+ for line in newgrub:
+ logging.debug(line)
+ f.write(line)
+ f.close()
+ except:
+ logging.debug(" Couldn't open grub file for writing")
+
+
+
+ cmd="chroot %s grub-mkconfig -o /boot/grub/grub.cfg" %data_config.MOUNTPOINT
+ runcmd(cmd)
+
+def double_mount(fe_only=False, upgrade=False):
+ logging.info(" double bind mount attempt")
+ cmd = "mkdir %s/run/dbus" %data_config.MOUNTPOINT
+ runcmd(cmd)
+
+ cmd = " mount --bind /run/dbus %s/run/dbus" %data_config.MOUNTPOINT
+ runcmd(cmd)
+ for i in range(0,5):
+ if upgrade == True:
+ cmd = "chroot " + data_config.MOUNTPOINT +" /usr/LH/bin/add_storage.py --reconstruct --no_mount"
+ else:
+ if fe_only == True:
+ cmd = "chroot " + data_config.MOUNTPOINT +" /usr/LH/bin/add_storage.py --double_myth --no_mount --fe_only"
+ else:
+ #cmd = "chroot " + data_config.MOUNTPOINT +" /usr/LH/bin/add_storage.py --double_myth --no_mount"
+ cmd = "chroot " + data_config.MOUNTPOINT +" /usr/LH/bin/add_storage.py --double_myth "
+
+ if runcmd(cmd)[0] == 0:
+ logging.debug(" Add storage worked, breaking out of loop")
+ break
+ cmd = " umount %s/run/dbus" %data_config.MOUNTPOINT
+ runcmd(cmd)
+
+def move_myth_home(op):
+ logging.debug(" storage op %s" %op )
+ if op == "restore":
+ destfile = "/storage/data/"
+ srcfile = "/storage/data.old/*"
+ cmd = 'chroot %s bash -c "mv %s %s"' %(data_config.MOUNTPOINT,srcfile,destfile)
+ runcmd(cmd)
+
+ rmfile = "%s/storage/data.old" %data_config.MOUNTPOINT
+ cmd = "rmdir %s" %rmfile
+ runcmd(cmd)
+
+
+ if op == "backup":
+ srcfile = "%s/storage/data" %data_config.MOUNTPOINT
+ destfile = "%s/storage/data.old" %data_config.MOUNTPOINT
+ cmd = "mv %s %s" %(srcfile,destfile)
+ runcmd(cmd)
+
+
+
+
def genlocale():
return
@@ -818,12 +1229,14 @@ def fix_permissions():
runcmd(cmd)
cmd = " chown -R mythtv:mythtv %s" %(data_config.MOUNTPOINT+"/var/log/mythtv")
runcmd(cmd)
+ cmd = " chmod +s %s" %(data_config.MOUNTPOINT+"/usr/bin/ping")
+ runcmd(cmd)
def apply_new_auth():
logging.info("_____Applying Password updates_______")
passfile = "/root/myth_user_call.out"
try:
- MVROOT = os.environ["MV_ROOT"]
+ MVROOT = os.environ["MV_ROOT"].strip()
except:
logging.debug("MVROOT was not defined, using the default value")
MVROOT = "/usr/MythVantage"
@@ -845,71 +1258,77 @@ def apply_new_auth():
logging.debug
def add_to_blacklist(module):
- rcfile = data_config.MOUNTPOINT + "/etc/rc.conf"
+ rcfile = data_config.MOUNTPOINT + "/etc/modprobe.d/install-blacklist.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, 'r')
+ #conflines = f.readlines()
+ #f.close()
+ #except:
+ #logging.critical(" *Couldn't open %s for reading",rcfile)
+ #return
try:
- f = open(rcfile, 'w')
+ f = open(rcfile, 'a')
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)
+ line = "blacklist %s \n" %module
+ f.write(line)
+ line = "install %s /bin/false \n" %module
+ f.write(line)
f.close()
+ #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"
+ rcfile = data_config.MOUNTPOINT + "/etc/modules-load.d/install-autoload.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, 'r')
+ #conflines = f.readlines()
+ #f.close()
+ #except:
+ #logging.critical(" *Couldn't open %s for reading",rcfile)
+ #return
try:
- f = open(rcfile, 'w')
+ f = open(rcfile, '1')
except:
- logging.critical(" *Couldn't open %s for reading",rcfile)
+ logging.critical(" *Couldn't open %s for writing",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)
+ line = "%s" %module
+ f.write(line)
f.close()
+ #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()
@@ -926,7 +1345,7 @@ def special_hardware_check():
logging.debug(" Boot options: %s", bootoptions)
for item in bootoptions:
logging.debug(item)
- if re.match("disablemodules",item) != None :
+ if (re.match("disablemodules",item) != None) or (re.match("modprobe.blacklist",item) != None ):
logging.debug(" Found disabledmodules")
modulelist = item.split("=")[1]
for module in modulelist.split(','):
@@ -1030,10 +1449,48 @@ def restore_default_settings():
copy_updates()
fix_permissions()
+def apply_pristine():
+ logging.info("_____Applying Pristine files_______")
+ if data_config.NOOPDEBUG == "FALSE":
+ cmd = "chroot " + data_config.MOUNTPOINT + " " + "tar -xvf /pristine.tar"
+ else:
+ cmd = "echo chroot " + data_config.MOUNTPOINT + " " + "tar -xvf /pristine.tar"
+ try:
+# Using os.system because runcmd fails
+ logging.debug(cmd)
+ os.system(cmd)
+ except:
+ logging.debug("Applying pristine files failed %s", passfile)
+ logging.debug
+
+ try:
+ removefile="%s/pristine.tar" %(data_config.MOUNTPOINT)
+ os.remove(removefile)
+ except OSError:
+ logging.debug(" Couldn't remove pristine.tar")
+ pass
+
+def post_process():
+ logging.info("_____Post processing_______")
+ if data_config.NOOPDEBUG == "FALSE":
+ cmd = "chroot " + data_config.MOUNTPOINT + " " + "/root/.post_process/go.sh"
+ else:
+ cmd = "echo chroot " + data_config.MOUNTPOINT + " " + "/root/.post_process/go.sh"
+ try:
+# Using os.system because runcmd fails
+ logging.debug(cmd)
+ os.system(cmd)
+ except:
+ logging.debug("Applying post_process_failed %s", passfile)
+ logging.debug
+
+
+
+
def full_install(hostoptions):
logging.info("______Start of full install______")
try:
- MVROOT = os.environ["MV_ROOT"]
+ MVROOT = os.environ["MV_ROOT"].strip()
except:
logging.debug(" MVROOT was not defined, using the default value")
MVROOT = "/usr/MythVantage"
@@ -1066,77 +1523,87 @@ def full_install(hostoptions):
mount_it()
swapon()
-
-# Find number of bytes written to disk before starting copy. This is used
-# to have a somewhat decent progress indication.
+ #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 system to disk
copy_it("install")
-# Remove old fstab so that a new one is created
+ #at this point /storage exisit and is populated with myth home dir
+
+
+ #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
+
+ # Configure system
msg = "Configuring system"
update_status(msg)
progress(98)
+
+ mount_bind_chroot()
grub_it()
- genlocale()
+ umount_bind_chroot()
+
+ genlocale() #currently does nothing
special_hardware_check()
-# Configuring the system
+
logging.info("______Configuring system________")
cp_and_log("/etc/systemconfig", data_config.MOUNTPOINT+"/etc/systemconfig")
+ cp_and_log("/etc/install_conf", data_config.MOUNTPOINT+"/etc/install_conf")
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/myth_settings_wrapper.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()
+
+ restore_default_settings() #also calls copy_updates, 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
+ #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)
+ 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")
+ #move_myth_home("backup")
+
+ mysqldb("start","chroot")
+ double_mount()
mysqldb("stop", "chroot")
- kill_dhcp_chroot()
+
+ #move_myth_home("restore") #restoring after the bind mound/symlink has occured
+
+ #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)
+ cmd = "chroot %s DISPLAY=127.0.0.1:0 %s/bin/MythVantage -t restore, default 1" %(data_config.MOUNTPOINT, MVROOT)
runcmd(cmd)
+ move_myth_home("backup")
+ if systemconfig["SystemType"] == "Slave_backend":
+ double_mount()
+ else:
+ double_mount(fe_only=True)
+ move_myth_home("restore")
# Need to check for to touch /tmp/.dbsysfailed
#cmd = " chroot %s %s/bin/myth_settings_wrapper.sh -c restore -t syssettings " %(data_config.MOUNTPOINT, MVROOT)
#runcmd(cmd)
@@ -1153,15 +1620,17 @@ def full_install(hostoptions):
cmd = "chroot %s %s/bin/myth_settings_wrapper.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT, MVROOT)
runcmd(cmd)
umount_bind_chroot()
- cmd = " touch %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
+
+ cmd = "chroot %s touch %s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
runcmd(cmd)
- cmd = " chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
+ cmd = "chroot %s chmod 777 %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")
+ kill_dhcp_chroot()
unmount_it()
logging.debug("_____End of full install_____")
@@ -1188,9 +1657,10 @@ def find_upgrade():
if os.path.exists(srcfile):
logging.info("Found systemconfig file %s", srcfile)
TEMPLATES = os.environ["TEMPLATES"]+"/settings/syssettings"
+ TEMPLATE_ = os.environ["TEMPLATES"]+"/settings"
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_log2(data_config.TEMP_TEMPLATES, TEMPLATE_, '*')
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")
@@ -1280,15 +1750,18 @@ def upgrade_mount_search():
def upgrade(hostoptions):
-
try:
- MVROOT = os.environ["MV_ROOT"]
+ MVROOT = os.environ["MV_ROOT"].strip()
except:
logging.debug("MVROOT was not defined, using the default value")
MVROOT = "/usr/MythVantage"
+ hostoptions["backupfile"] = data_config.BACKUPPATH+data_config.BACKUPFILE
+
logging.info("______Start of upgrade______")
cmd = "touch /tmp/.this_is_upgrade"
runcmd(cmd)
+
+ #format disk
if hostoptions["rootfs"] == "Do_not_format":
logging.info("Will not format root filesystem")
else:
@@ -1296,18 +1769,26 @@ def upgrade(hostoptions):
update_status(statusmsg)
progress(2)
format_disk("upgrade")
- #sys.exit(2)
+
+ #mount partitions
statusmsg = "Mounting %s" %( hostoptions["rootdisk"])
update_status(statusmsg)
progress(3)
mount_it()
swapon()
+
hostoptions["backupfile"] = data_config.BACKUPPATH+data_config.BACKUPFILE
+ #Find number of bytes written to disk before starting copy. This is used to
+ #give a somewhat decent progress indication
statgrab( hostoptions["rootdisk"])
msg = "Upgrading %s" %(systemconfig["hostname"])
update_status(msg)
time.sleep(3)
+
+ #copy system to disk
copy_it("upgrade")
+
+ #Restore /etc and key files. This is the copy found when running find_upgrade
cmd = "rm -rf %s/etc.old" %data_config.MOUNTPOINT
runcmd(cmd)
cmd = "rm -rf %s/alsa.old" %data_config.MOUNTPOINT
@@ -1317,12 +1798,19 @@ def upgrade(hostoptions):
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')
+ srcfile = "%s/etc.old/storage.d/" %(data_config.MOUNTPOINT)
+ destfile = "%s/etc/storage.d/" %(data_config.MOUNTPOINT)
+ cp_and_log2(srcfile, destfile, '*.conf')
+ cp_and_log2(srcfile, destfile, '*.pkl')
+
+
mdfile = mdadm_find("/tmp")
cp_and_log("/tmp"+mdfile, data_config.MOUNTPOINT+"/etc")
@@ -1348,23 +1836,34 @@ def upgrade(hostoptions):
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"
+
+ #configure system
+ 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()
+ #New partition layout, we do not need to search for backup file
+ #if not backup_sql_check():
+ #upgrade_mount_search()
+
+ #check fstab, see if it needs any updates
fstab_it("upgrade")
time.sleep(1)
+
+ mount_bind_chroot()
grub_it()
+ umount_bind_chroot()
+
genlocale()
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")
+ #this was needed to get around a pacman bug
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()
@@ -1372,53 +1871,69 @@ def upgrade(hostoptions):
file = "%s/%s/.kmupgrade" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
cmd = "touch %s && chmod 777 %s" %(file, file)
runcmd(cmd)
+
+ #these are also run by restore_default_settings in install
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", "")
+ apply_new_auth()
+ umount_bind_chroot()
+
+
+ #logging.info("Running systemconfig in chroot")
+ #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():
+ if clean_upgrade():
+ mysqldb("stop", "")
+ mount_bind_chroot()
logging.info("Installing new database")
- cmd = " chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT, MVROOT)
+ 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/myth_settings_wrapper.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/myth_settings_wrapper.sh -c restore -t syssettings " %(data_config.MOUNTPOINT, MVROOT)
- runcmd(cmd)
+ umount_bind_chroot()
+
+ #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/myth_settings_wrapper.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/myth_settings_wrapper.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)
+ #run systemconfig in chroot
+ mount_bind_chroot()
+ #make symlink only..no need to double_mount as fstab should already have that, unless it's a clean upgrade
+ double_mount(upgrade=True)
+ logging.info("Running systemconfig in chroot")
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()
+ kill_dhcp_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)
@@ -1428,14 +1943,38 @@ def upgrade(hostoptions):
def main(argv):
+ print install_conf
global hostoptions
+ hostoptions = {}
+ conflist=["op",
+ "rootdisk","rootfs","rootsize",
+ "datafs","datasize","datadisk","datapartition",
+ "swapsize",
+ "homesize","homefs",
+ "sqlsize","sqlfs",
+ "uprootfs"]
+
+ for i in conflist:
+ try:
+ hostoptions[i] = install_conf[i].lower()
+ except:
+ pass
+ try: #op is not set for find_upgrade
+ if hostoptions["op"] == "upgrade":
+ #rootfs is used by both upgrade and install
+ hostoptions["rootfs"] == hostoptions["uprootfs"]
+ except:
+ pass
+
+
+
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'}
+ #hostoptions = {"op": 'null'}
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
@@ -1465,24 +2004,51 @@ def main(argv):
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)
+
+ validop = ["full_install", "upgrade", "netboot", "find_upgrade"]
+ if hostoptions["op"] not in validop:
+ logging.critical("-c %s is not a valid option", hostoptions["op"])
+ sys.exit(2)
+
+
+
+ if ( hostoptions["op"] == "upgrade") or ( hostoptions["op"] == "find_upgrade" ):
+ hostoptions["datafs"] = "no_format"
+ hostoptions["homefs"] = "no_format"
+ hostoptions["sqlfs"] = "no_format"
+
+ #hardcoding partitions
+ hostoptions["rootpartition"] = hostoptions["rootdisk"]+str(1) ##hardcoded partition 1
+ hostoptions["swappartition"] = hostoptions["rootdisk"] + str(2)
+
+ try:
+ hostoptions["datadisk"]
+ except:
+ hostoptions["datadisk"] = hostoptions["rootdisk"]
+ #home/sql do not needed to be valid values for the upgrade, but using real values for reference
+ try:
+ hostoptions["home_partition"]
+ except:
+ hostoptions["home_partition"] = hostoptions["rootdisk"]+str(5)
+
+ try:
+ hostoptions["sql_partition"]
+ except:
+ hostoptions["sql_partition"] = hostoptions["rootdisk"]+str(6)
+
+ try:
+ hostoptions["datapartition"]
+ except:
+ hostoptions["datapartition"] = hostoptions["datadisk"]+str(7)
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
@@ -1531,6 +2097,27 @@ for line in config_file:
val = val.strip('"')
systemconfig[var.strip()] = val.strip()
+#Read in install_conf
+global install_conf
+install_conf = {}
+file_name = "/etc/install_layout"
+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('"')
+ install_conf[var.strip()] = val.strip()
+
+
+
+
+
if __name__ == "__main__":
config_file = "mv_config"
diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py
index 36f7545..b38c84e 100755
--- a/abs/core/LinHES-config/mv_ir.py
+++ b/abs/core/LinHES-config/mv_ir.py
@@ -80,12 +80,12 @@ def include_file( incfile,filename):
f.write("\n")
f.close()
-def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType):
+def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket):
logging.debug(" Setup of remote type %s",Remotetype)
if Remotetype == "no_remote" and HostBlasterType == "None" :
mv_common.remove_service("remotes")
elif Remotetype == "tinker":
- pass
+ pass #do nothing
else:
currenttime = strftime("%b-%d-%Y-%H:%M:%S", localtime())
cmd = "mv /etc/lircd.conf /etc/lircd.conf-%s" %currenttime
@@ -94,63 +94,37 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType):
mv_common.runcmd(cmd)
cmd = "mv /etc/remote.run /etc/remote.run-%s" %currenttime
mv_common.runcmd(cmd)
-
-
- if os.path.isdir(mythhome+"/remotes/"+Remotetype):
- logging.debug(" Found remote in home dir " )
- #search home dir
- files = mythhome + "/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 = mythhome + "/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)
- files = mythhome + "/remotes/" + Remotetype + "/remote.run*"
- 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
- cmd = "cp %s /etc/remote.run" %filename
- mv_common.runcmd(cmd)
+ if remotebucket == "user":
+ remote_path = "%s/remotes/%s" %(mythhome,Remotetype)
else:
- #template dir
- 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)
- files = templates + "/remotes/" + Remotetype + "/remote.run*"
- 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
- cmd = "cp %s /etc/remote.run" %filename
- mv_common.runcmd(cmd)
+ remote_path="%s/remotes/%s/%s" %(templates,remotebucket,Remotetype)
+
+ files = remote_path + "/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*"
+ files = remote_path + "/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)
+ files = remote_path + "/remote.run*"
+ 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
+ cmd = "cp %s /etc/remote.run" %filename
+ mv_common.runcmd(cmd)
cmd = "chmod 755 /etc/lircrc /etc/remote.run"
@@ -355,7 +329,10 @@ def setup_ir(systemconfig, data_config):
else:
remotetype = systemconfig.get("Remotetype")
- setup_ir_remote(remotetype,systemconfig.get("TEMPLATES"),data_config.MYTHHOME,systemconfig.get("HostBlasterType"))
+ setup_ir_remote(remotetype,systemconfig.get("TEMPLATES"),
+ data_config.MYTHHOME,
+ systemconfig.get("HostBlasterType"),
+ systemconfig.get("Remotebucket"))
setup_lirc_links(data_config.MYTHHOME)
if systemconfig.get("ReceiverType"):
diff --git a/abs/core/LinHES-config/mv_misc.py b/abs/core/LinHES-config/mv_misc.py
index 0cbf872..d03bdca 100755
--- a/abs/core/LinHES-config/mv_misc.py
+++ b/abs/core/LinHES-config/mv_misc.py
@@ -44,48 +44,19 @@ def setup_tz(timezone,TEMPLATES):
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)
+
+ #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")
+ #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.get("TEMPLATES"))
-
- if systemconfig.get("HaveCentralNFS") == "yes":
- logging.debug(" Using a Central NFS server")
- if systemconfig.get("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.get("dbhost"))
- nfslist = process_nfsmap_file(nfsmap_file)
- # if it's an ip parse ip and download file
- elif re.search(systemconfig.get("NFSserver"),":nfsmap"):
- ip=systemconfig.get("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.get("NFSserver") , systemconfig["NFSmount"])
- nfslist.append(item)
- else:
- #if standalone or slave try to use MBE
- if systemconfig.get("SystemType") == "Frontend_only" or systemconfig["SystemType"] == "Slave_Backend":
- item = (systemconfig.get("dbhost")+":"+ data_config.DATAMOUNT, 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____")
@@ -114,67 +85,3 @@ def setup_sleep(systemconfig):
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/core/LinHES-config/mv_network.py b/abs/core/LinHES-config/mv_network.py
index aab1345..d0fa16c 100755
--- a/abs/core/LinHES-config/mv_network.py
+++ b/abs/core/LinHES-config/mv_network.py
@@ -18,17 +18,32 @@ def setup_MYTH_DHCP(systemconfig):
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)]
+ # read the file /proc/net/dev
+ ifacelist=[]
+ returnlist=[]
+ try:
+ f = open('/proc/net/dev','r')
+ # put the content to list
+ ifacelist = f.read().split('\n')
+ # close the file
+ f.close()
+ # remove 2 lines header
+ ifacelist.pop(0)
+ ifacelist.pop(0)
+ except:
+ logging.critical(" *Problem reading /proc/net/dev")
+
+ # loop to check each line
+ for line in ifacelist:
+ ifacedata = line.replace(' ','').split(':')
+ # check the data have 2 elements
+ if len(ifacedata) == 2:
+ # check the interface is up (Transmit/Receive data)
+ if int(ifacedata[1]) > 0:
+ #print ifacedata[0]
+ returnlist.append(ifacedata[0])
+
+ return returnlist
def get_ip(ifname):
logging.debug(" Finding ip address for %s", ifname)
@@ -43,12 +58,16 @@ def get_ip(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- return socket.inet_ntoa(fcntl.ioctl(
+
+ ip = socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
0x8915, # SIOCGIFADDR
struct.pack('256s', ifname[:15])
)[20:24])
+ logging.debug(" get_ip ip address is %s", ip)
+ return ip
+
def get_default_route(iface):
rcroute = "127.0.0.1"
f = open ('/proc/net/route', 'r')
diff --git a/abs/core/LinHES-config/mv_screensaver.py b/abs/core/LinHES-config/mv_screensaver.py
index 6a5ce1c..a1d1530 100755
--- a/abs/core/LinHES-config/mv_screensaver.py
+++ b/abs/core/LinHES-config/mv_screensaver.py
@@ -40,7 +40,7 @@ def mplayer_saver_check (cmd,templatefile):
def killxscreensaver():
- logging.info(" Stopping xscreensaver")
+ logging.info(" Stopping xscreensaver")
cmd="xscreensaver-command --exit "
mv_common.runcmd(cmd)
cmd="killall xscreensaver "
@@ -160,6 +160,25 @@ def setup_gnome_screensaver(theme,idletime):
logging.info("__End gnome screensaver")
+def start_screensaver(screensaver):
+ logging.info(" Checking if screensaver needs to be started")
+ if mv_common.check_service("frontend"):
+ killxscreensaver()
+ logging.info(" Frontend is running, starting screensaver")
+ line='''su mythtv -c "DISPLAY=localhost:0 xscreensaver -no-splash 2>&1 > /dev/null &" \n'''
+ #line='''su mythtv -c "DISPLAY=localhost:0 xscreensaver -no-splash \&" '''
+ try:
+ fout = open("/tmp/cmd.sh", "w")
+ fout.write(line)
+ fout.close()
+ os.chmod("/tmp/cmd.sh",0755)
+ cmd="/tmp/cmd.sh"
+ os.system(cmd)
+ os.remove("/tmp/cmd.sh")
+ except:
+ logging.info(" Couldn't start screensaver")
+
+
def setup_screensaver (systemconfig,data_config):
@@ -179,6 +198,7 @@ def setup_screensaver (systemconfig,data_config):
mv_common.pacremove("gnome-screensaver")
setup_x_screensaver(idletime, theme, configfile, templatefile)
mplayer_saver_check("/usr/bin/xscreensaver-command -deactivate &",mtemplate)
+ start_screensaver("xscreensaver")
elif screensavertype == "gscreensaver":
mv_common.pacinstall("xscreensaver")
diff --git a/abs/core/LinHES-config/mv_supplemental.py b/abs/core/LinHES-config/mv_supplemental.py
index e25465e..2b8bd2f 100644..100755
--- a/abs/core/LinHES-config/mv_supplemental.py
+++ b/abs/core/LinHES-config/mv_supplemental.py
@@ -20,7 +20,7 @@ def windowmanager(systemconfig):
style = ""
if style == "1" and windowmanager != "default" :
- style = "mythvantage"
+ style = "enhanced"
else:
style = ""
@@ -31,7 +31,7 @@ def windowmanager(systemconfig):
logging.info("__End of windowmanager \n")
-def supplemental(systemconfig):
+def supplemental(systemconfig,this_is_install = False):
logging.info("____Start of supplemental config ____")
try:
supplemental=systemconfig.get("supplemental")
@@ -39,6 +39,11 @@ def supplemental(systemconfig):
supplemental = "0"
if supplemental == "1":
logging.info(" Installing supplemental system\n")
+ if this_is_install == True:
+ if os.path.exists('/home/xymon/server'):
+ cmd='''pacman --noconfirm --dbonly -Sddf xymonserver'''
+ mv_common.runcmd(cmd)
+
cmd='''/usr/LH/bin/install_supplemental_service.sh'''
mv_common.runcmd(cmd)
logging.info("__End of supplemental\n") \ No newline at end of file
diff --git a/abs/core/LinHES-config/mv_vnc.py b/abs/core/LinHES-config/mv_vnc.py
new file mode 100755
index 0000000..bc1dcf5
--- /dev/null
+++ b/abs/core/LinHES-config/mv_vnc.py
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+import logging, mv_common
+import os, re
+
+config_file = "mv_config"
+
+def setupvnc_system(systemconfig,data_config):
+ logging.info("____Start of vnc setup____")
+ mv_common.pacinstall("tigervnc")
+ vncdir=data_config.VNCHOME+"/.vnc"
+ try:
+ os.makedirs(vncdir)
+ os.chown(vncdir,78,78)
+ except:
+ logging.info(" couldn't create vnc dir:%s" %vncdir)
+
+ vncfile="%s/xstartup" %vncdir
+ file_contents='''
+#!/bin/bash
+vncconfig -iconic &
+if [ ! -e ~GNUstep ]
+then
+ wmaker.inst
+ cp -f /usr/share/wm_data/GNUstep/Defaults/WindowMaker ~/GNUstep/Defaults/
+ cp -f /usr/share/wm_data/GNUstep/Defaults/WMState.vnc ~/GNUstep/Defaults/WMState
+ cp -f /usr/share/wm_data/GNUstep/Defaults/WMWindowAttributes ~/GNUstep/Defaults/
+ cp -f /usr/share/wm_data/GNUstep/Defaults/WMRootMenu ~/GNUstep/Defaults/
+fi
+exec wmaker
+'''
+ try:
+ logging.debug(" Writing %s",vncfile)
+ f= open(vncfile,'w')
+ f.write(file_contents)
+ f.close()
+ os.chmod(vncfile,0755)
+
+ except:
+ logging.debug(" Couldn't open %s",vncfile)
+ logging.debug(" Aborting vnc...")
+
+ try:
+ vncuid = pwd.getpwnam('vncsvc')[2]
+ vncgid = pwd.getpwnam('vncsvc')[3]
+ except:
+ logging.critical("* vncsvc not found")
+ vncuid = '78'
+ vncgid = '78'
+ mv_common.mkdir_mythhome(data_config.VNCHOME,vncuid,vncgid)
+
+
+ home_xml_file=data_config.VNCHOME + "/.mythtv/config.xml"
+ configxml_file="/usr/share/mythtv/config.xml"
+ mv_common.link_file(configxml_file,home_xml_file)
+
+ logging.info(" Writing out password")
+ vncpassfile="%s/passwd" %vncdir
+ cmd="echo %s|vncpasswd -f > %s" %(systemconfig.get("vncpassword"),vncpassfile)
+ mv_common.runcmd(cmd)
+ cmd="chmod 700 %s" %vncpassfile
+ mv_common.runcmd(cmd)
+ cmd="chown vncsvc %s" %vncpassfile
+ mv_common.runcmd(cmd)
+
+
+
+ logging.info("__End of vnc \n")
+
+
+def setupvnc(systemconfig,data_config):
+ logging.info("____Start of vnc config ____")
+ if mv_common.read_config(mv_common.module_config,"vnc") == False :
+ logging.info("____Skipping of vnc, config disabled____")
+ return
+
+ try:
+ vnc=systemconfig.get("vncenable")
+ except:
+ vnc = "0"
+
+ if vnc == "1":
+ logging.info(" Installing vnc system\n")
+ setupvnc_system(systemconfig,data_config)
+ mv_common.add_service("vnc")
+ else:
+ mv_common.remove_service("vnc")
+
+ logging.info("__End of vnc\n") \ No newline at end of file
diff --git a/abs/core/LinHES-config/myth_settings_wrapper.sh b/abs/core/LinHES-config/myth_settings_wrapper.sh
index 33f401f..90d41de 100644
--- a/abs/core/LinHES-config/myth_settings_wrapper.sh
+++ b/abs/core/LinHES-config/myth_settings_wrapper.sh
@@ -1,8 +1,9 @@
#!/bin/bash
+MYTH_RUN_STATUS="1"
. /etc/profile
. /etc/systemconfig
shopt -s -o nounset
-echo $@ >> /tmp/restore.out
+echo $@ >> /tmp/wrapper.out
#TEMPLATES="/usr/share/templates/settings"
TEMPLATES="$TEMPLATES/settings"
TABLES="settings keybindings jumppoints"
@@ -103,6 +104,9 @@ do
echo "template is hostsettings"
Thistemplate=syssettings
loadhost=true
+ elif [ x$Thistemplate = x"custom" ]
+ then
+ echo "template is custom"
else
echo "invalid template name"
exit 1
@@ -171,8 +175,15 @@ case $OPERATION in
;;
load)
- #this loads the distro default file, it's not active by any hosts
- mythutil --import-settings --infile $TEMPLATES/$Thistemplate/distro_default.xml
+ if [ x$Thistemplate = "xcustom" ]
+ then
+ define_xml $5 $hostname settings $6
+ load_xml $gen_xml > /tmp/load_xml_custom.log
+
+ else
+ #this loads the distro default file, it's not active by any hosts
+ mythutil --import-settings --infile $TEMPLATES/$Thistemplate/distro_default.xml
+ fi
;;
@@ -181,7 +192,7 @@ case $OPERATION in
if [ $SYSTEMTYPE = "master" ]
then
define_xml ${IP_ADDRESS} $hostname settings BackendServerIP
- load_xml
+ load_xml $gen_xml
define_xml ${IP_ADDRESS} '' settings MasterServerIP
load_xml $gen_xml
@@ -192,7 +203,18 @@ case $OPERATION in
define_xml ${IP_ADDRESS} $hostname settings BackendServerIP
load_xml $gen_xml
fi
+
+
+ if [ $SYSTEMTYPE = "standalone" ]
+ then
+ define_xml "127.0.0.1" $hostname settings BackendServerIP
+ load_xml $gen_xml
+ define_xml "127.0.0.1" '' settings MasterServerIP
+ load_xml $gen_xml
+ fi
;;
+
+
ZIP)
define_xml $ZIPCODE $hostname settings locale
load_xml $gen_xml
diff --git a/abs/core/LinHES-config/myth_user_call b/abs/core/LinHES-config/myth_user_call
index 0914b03..1b8d315 100644
--- a/abs/core/LinHES-config/myth_user_call
+++ b/abs/core/LinHES-config/myth_user_call
@@ -1,174 +1,159 @@
-#!/bin/bash
+#!/usr/bin/python2
+# -*- 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
-INIT_CHECK=TRUE
-FULL_CALL="$@"
-function CHROOT_CHECK {
- INIT=`ps -p 1 -o comm=`
- if [ x$INIT = xrunit ]
- then
- CHROOT_NEEDED=FALSE
- else
- CHROOT_NEEDED=TRUE
- fi
-}
-
-function store_commands () {
- echo "$FULL_CALL" >> /root/myth_user_call.out
- chmod 600 /root/myth_user_call.out
-}
-
-
-function add_user() {
- if [ $CHROOT_NEEDED = TRUE ]
- then
- echo "calling myth_call_user in chroot to add user"
- store_commands
- else
- echo "adding user $USERNAME"
- useradd -m -s /bin/bash $USERNAME -G audio,video,optical,storage,users
- usermod -a -G mythtv $USERNAME
-
- fi
-
-}
-
-
-function del_user() {
- if [ $CHROOT_NEEDED = TRUE ]
- then
- echo "calling myth_call_user in chroot to delete user"
- store_commands
- else
- echo "removing user $USERNAME"
- userdel $USERNAME
- fi
-
-}
-
-
-function pass_change() {
- if [ $CHROOT_NEEDED = TRUE ]
- then
- echo "calling myth_call_user in chroot to change password"
- store_commands
- else
- echo "changing password for $USERNAME"
- echo $USERNAME:$PASSWORD | chpasswd
- fi
-
-}
-
-
-function web_security {
-
- grep -q ${USERNAME}: /etc/lighttpd/lighttpd.user
- if [ $? = 0 ]
- then
- #delete user
- sed -i "/${USERNAME}\:/d" /etc/lighttpd/lighttpd.user
- fi
- echo "${USERNAME}:${PASSWORD}" >> /etc/lighttpd/lighttpd.user
-
-}
-
-function ARG_ERR() {
- if [ x$OPTARG = "x" ]
- then
- echo "$SWITCH NEEDS AND ARG"
- exit 11
- fi
-}
-
-
-function print_help {
-
- echo "Valid options are:"
- echo " -c (add|delete|pass|web)"
- echo " -u USERNAMEname"
- echo " -p password"
- exit 1
-}
-
-if [ $# -eq 0 ]
-then
- print_help
-fi
-
-declare -r OPTSTRING="c:u:p:i"
-while getopts "$OPTSTRING" SWITCH
-do
- case $SWITCH in
-
- c) ARG_ERR
- OPERATION=$OPTARG
- ;;
- u) ARG_ERR
- USERNAME=$OPTARG
- ;;
- p) ARG_ERR
- PASSWORD=$OPTARG
- ;;
- i) INIT_CHECK=FALSE
-
- esac
-done
-
-if [ $INIT_CHECK = TRUE ]
-then
- CHROOT_CHECK
-else
- CHROOT_NEEDED=FALSE
-fi
-
-case $OPERATION in
- add)
- if [ x$USERNAME = x ]
- then
- print_help
- fi
- add_user
- ;;
- delete)
- if [ x$USERNAME = x ]
- then
- print_help
- fi
- del_user
- ;;
- pass)
- if [ x$USERNAME = x ]
- then
- print_help
- fi
-
- if [ x$PASSWORD = x ]
- then
- print_help
- fi
- pass_change
- ;;
-
- web)
- if [ x$USERNAME = x ]
- then
- print_help
- fi
-
-
- if [ x$PASSWORD = x ]
- then
- print_help
- fi
- echo "adding webUSERNAME $USERNAME with pass $PASSWORD"
- web_security
- ;;
- *) print_help
- ;;
-esac
-
+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/core/LinHES-config/mythvantage.cfg b/abs/core/LinHES-config/mythvantage.cfg
index eaa4865..8897724 100644
--- a/abs/core/LinHES-config/mythvantage.cfg
+++ b/abs/core/LinHES-config/mythvantage.cfg
@@ -18,4 +18,6 @@ ir = True
user = True
software = True
smolt = True
+vnc = True
+fileshare = True
diff --git a/abs/core/LinHES-config/networkconfig.sh b/abs/core/LinHES-config/networkconfig.sh
index 770aa98..b044f20 100644
--- a/abs/core/LinHES-config/networkconfig.sh
+++ b/abs/core/LinHES-config/networkconfig.sh
@@ -206,7 +206,11 @@ function setup_interfaces() {
function find_active () {
#HostActiveeth1="1"
-rm -f ${BASE}/etc/resolv.conf
+if [ ! x$USEVNC = x0 ]
+then
+ rm -f ${BASE}/etc/resolv.conf
+fi
+
if [ x$MYTHDHCP = x1 ]
then
#add 127.0.0.1 to /etc/resolv.conf
diff --git a/abs/core/LinHES-config/print_xorg_res.py b/abs/core/LinHES-config/print_xorg_res.py
new file mode 100755
index 0000000..3b7ce56
--- /dev/null
+++ b/abs/core/LinHES-config/print_xorg_res.py
@@ -0,0 +1,128 @@
+#!/usr/bin/python2
+# -*- coding: utf-8 -*-
+
+__author__ = "James Meyer"
+__date__ = "August 23rd 2012"
+
+
+from subprocess import Popen, PIPE
+import re
+
+class available_display_res():
+ def __init__(self):
+
+ self.mode_list=[]
+ self.videocard = self.find_video_card()
+
+ if self.videocard == "nvidia":
+ self.parse_modeline_nvidia()
+ else:
+ self.sizes_xrandr()
+ #elif self.videocard == "intel":
+ #self.sizes_xrandr()
+ #elif self.videocard == "vmware":
+ #self.sizes_xrandr()
+ #elif self.videocard == "vesa":
+ #self.sizes_parse_log()
+
+
+ def getlist(self):
+ return self.mode_list
+
+ def getvc(self):
+ return self.videocard
+
+ def find_video_card(self):
+ videocard=""
+ conf_file="/etc/X11/xorg.conf.d/20-automv.conf"
+ lines=[]
+ try:
+ f=open(conf_file,'r')
+ lines=f.readlines()
+ f.close()
+ except:
+ print " find_video_card: couldn't read in %s" %conf_file
+ videocard = "unknown"
+
+ for line in lines:
+ parsed=line.split()
+ if parsed[0].strip() == "Driver":
+ videocard = parsed[1].strip('''"''')
+ break
+
+ return videocard
+
+ def parse_modeline_nvidia(self):
+ self.mode_list=[]
+ conf_file="/var/log/Xorg.0.log"
+ lines=[]
+ try:
+ f=open(conf_file,'r')
+ lines=f.readlines()
+ f.close()
+ except:
+ print " parse_modeline_nvidia: couldn't read in %s" %conf_file
+ self.mode_list=["Auto"]
+ #now parse the list looking for modelines
+ search="Modes in ModePool"
+ searchindex=[]
+ for line in lines:
+ if line.find(search) > 4 :
+ searchindex.append(lines.index(line))
+ search="End of ModePool"
+
+ if len(searchindex) == 2:
+ break
+ #extract the modelines
+ #[ 29.858] (II) NVIDIA(GPU-0): "nvidia-auto-select" : 2560 x 1600 @ 59.9 Hz (from: EDID)
+ try:
+ modelines = lines[searchindex[0]+1:searchindex[1]-1]
+ for i in modelines:
+ self.mode_list.append(i.split('''"''')[1])
+ except:
+ self.mode_list=["nvidia-auto-select"]
+
+
+ def sizes_parse_log(self):
+ self.mode_list=["parse_log_list"]
+
+ def sizes_xrandr(self):
+ """List all sizes detected by xrandr,
+ ordered by the next resolution to cycle to"""
+ size_re = re.compile("^ ([0-9]*x[0-9]*)\W*[0-9]*\.[0-9]*(\*)?")
+ p1 = Popen(['xrandr'], stdout=PIPE)
+ sizes = []
+ current_size_index = 0
+ for line in p1.communicate()[0].split("\n"):
+ m = size_re.match(line)
+ if m:
+ sizes.append(m.group(1))
+ if m.group(2) == "*":
+ current_size_index = len(sizes) - 1
+ #return sizes[current_size_index+1:] + sizes[:current_size_index+1]
+ self.mode_list = sizes[current_size_index+1:] + sizes[:current_size_index+1]
+
+def go():
+ mode = available_display_res()
+ vc = mode.getvc()
+ modelist = mode.getlist()
+ print vc
+
+ for i in modelist:
+ print i
+ conf_file="/tmp/modelines"
+ try:
+ f=open(conf_file,'w')
+ for i in modelist:
+ f.write(i)
+ f.write("\n")
+ f.close()
+ except:
+ print " print_xorg_res: couldn't write modelines to %s" %conf_file
+
+
+
+
+if __name__ == '__main__':
+ go()
+
diff --git a/abs/core/LinHES-config/restore_default_settings.sh b/abs/core/LinHES-config/restore_default_settings.sh
index ffd4b0d..ca27578 100755
--- a/abs/core/LinHES-config/restore_default_settings.sh
+++ b/abs/core/LinHES-config/restore_default_settings.sh
@@ -3,6 +3,20 @@
. /etc/systemconfig
shopt -s -o nounset
echo $@ >> /tmp/restore.out
+echo "######################################################"
+echo "######################################################"
+echo "######################################################"
+echo "######################################################"
+cat /tmp/restore.out
+
+exit 0
+
+
+
+
+
+
+
#TEMPLATES="/usr/share/templates/settings"
TEMPLATES="$TEMPLATES/settings"
TABLES="settings keybindings jumppoints"
diff --git a/abs/core/LinHES-config/soundconfig.sh b/abs/core/LinHES-config/soundconfig.sh
index c268136..b9eb906 100755
--- a/abs/core/LinHES-config/soundconfig.sh
+++ b/abs/core/LinHES-config/soundconfig.sh
@@ -4,10 +4,14 @@
echo $@ >/tmp/audio.call
BASE=""
+MYTH_RUN_STATUS="1"
. /etc/profile
TESTFILE="/usr/share/sounds/alsa/Front_Center.wav"
OSSinstalled="false"
+
BLACKLIST=/etc/modprobe.d/soundconfig_blacklist.conf
+. /usr/MythVantage/bin/install_functions.sh
+home_check
echo "---------------------------------------"
@@ -75,7 +79,8 @@ function installOSS {
fi
soundon
add_service.sh oss
- echo "install soundcore /bin/false" >$BLACKLIST
+ echo "blacklist soundcore" > $BLACKLIST
+ echo "install soundcore /bin/false" >> $BLACKLIST
}
@@ -83,9 +88,9 @@ function installOSS {
function SYNCXINE {
echo "modify xine config file"
- if [ -f /data/home/mythtv/.xine/config ]
+ if [ -f $MYTHHOME/.xine/config ]
then
- cp -f /data/home/mythtv/.xine/config $TEMPLATES/xine.config
+ cp -f $MYTHHOME/.xine/config $TEMPLATES/xine.config
else
cp $TEMPLATES/xine.config.template $TEMPLATES/xine.config
fi
@@ -97,9 +102,9 @@ echo "modify xine config file"
-e "s/^.audio.device.oss_device_name.*$/audio.device.oss_device_name:\/dev\/dsp/" \
-e "s/^.audio.devic.oss_device_number.*$/audio.device.oss_device_number:$DEVICENUMER/" \
-e "s/^.*audio.output.speaker_arrangement:.*$/Audio.output.speaker_arrangement:PassThrough/" \
- $TEMPLATES/xine.config > /data/home/mythtv/.xine/config
+ $TEMPLATES/xine.config > $MYTHHOME/.xine/config
else
- cp $TEMPLATES/xine.config /data/home/mythtv/.xine/config
+ cp $TEMPLATES/xine.config $MYTHHOME/.xine/config
fi
}
@@ -135,7 +140,7 @@ function checkOSSinstalled () {
}
function sound_config_system {
-
+
SYNCMYTHFRONTEND
# if [ x$syncXine = x1 ]
# then
diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py
index 9a9cd11..59df527 100755
--- a/abs/core/LinHES-config/systemconfig.py
+++ b/abs/core/LinHES-config/systemconfig.py
@@ -62,7 +62,19 @@ def main(argv):
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 , "func":False, "supplemental":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 ,
+ "func":False, "supplemental":False,
+ "vnc":False, "fileshare":False }
try:
opts, args = getopt.getopt(argv, 'c:hm:d:', ["help","modules" ] )
except getopt.GetoptError, why:
@@ -105,11 +117,24 @@ def main(argv):
cmdmodule["advanced"] = True
cmdmodule["software"] = True
cmdmodule["advancedX"] = True
- cmdmodule["smolt"] = True
+ #cmdmodule["smolt"] = True
cmdmodule["user"] = True
+ cmdmodule["vnc"] = True
+ cmdmodule["fileshare"] = True
+
+ ##putting this here until I can create the seperate share module
+ #if cmdmodule["fileshare"]:
+ #cmdmodule["advanced"] = True
+ #cmdmodule["misc"] = True
if cmdmodule["network"]:
restartfe = mv_network.setup_network(systemconfig, cmdmodule["this_is_install"])
+ 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)
+ cmdmodule["hostype"] = True
+
if restartfe == True :
logging.debug(" Setting the frontend to restart due to network change")
cmdmodule["restartfe"] = True
@@ -127,13 +152,13 @@ def main(argv):
setup_x(systemconfig)
cmdmodule["ir"] = True
mv_hostype.hostypeprint(systemconfig)
- cmdmodule["smolt"] = True
+ #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["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
@@ -177,7 +202,7 @@ def main(argv):
#zipcode is no longer used
#mv_misc.setup_zip(MVROOT,systemconfig.get("zipcode"))
mv_misc.setup_tz(systemconfig.get("timezone"),systemconfig["TEMPLATES"])
- mv_misc.setup_nfs(systemconfig)
+ #mv_misc.setup_nfs(systemconfig)
if cmdmodule["sleep"]:
if mv_common.read_config(mv_common.module_config,"sleep") == False :
@@ -202,6 +227,11 @@ def main(argv):
import mv_advanced
mv_advanced.setup_advanced(systemconfig, data_config)
+ if cmdmodule["fileshare"]:
+ import mv_fileshare
+ mv_fileshare.setup_fileshare(systemconfig, data_config)
+
+
if cmdmodule["software"] or cmdmodule["plugins"]:
import mv_software
mv_software.setup_software(systemconfig, data_config)
@@ -218,13 +248,13 @@ def main(argv):
if cmdmodule["reloadfe"]:
mv_common.reloadfe(systemconfig.get("dbhost"),restartlcd)
- if cmdmodule["smolt"]:
- import mv_smolt
- mv_smolt.setup_smolt_type(systemconfig.get("SystemType"),
- systemconfig.get("Remotetype"),
- systemconfig.get("RunFrontend"),
- data_config.MYTHHOME,
- data_config.SYSTEMTYPE)
+ #if cmdmodule["smolt"]:
+ #import mv_smolt
+ #mv_smolt.setup_smolt_type(systemconfig.get("SystemType"),
+ #systemconfig.get("Remotetype"),
+ #systemconfig.get("RunFrontend"),
+ #data_config.MYTHHOME,
+ #data_config.SYSTEMTYPE)
if cmdmodule["user"]:
logging.info("____Start of ssh user____")
@@ -245,7 +275,15 @@ def main(argv):
if cmdmodule["supplemental"] or cmdmodule["this_is_install"]:
import mv_supplemental
mv_supplemental.windowmanager(systemconfig)
- mv_supplemental.supplemental(systemconfig)
+ mv_supplemental.supplemental(systemconfig,cmdmodule["this_is_install"])
+
+ if cmdmodule["vnc"]:
+ import mv_vnc
+ mv_vnc.setupvnc(systemconfig,data_config)
+
+ if cmdmodule["fileshare"]:
+ import mv_fileshare
+ mv_fileshare.setup_fileshare(systemconfig, data_config)
diff --git a/abs/core/LinHES-config/systemconfig.sh b/abs/core/LinHES-config/systemconfig.sh
index dce8c74..76194dd 100755
--- a/abs/core/LinHES-config/systemconfig.sh
+++ b/abs/core/LinHES-config/systemconfig.sh
@@ -10,16 +10,16 @@ echo "----------------------start of systemconfig $@ ----------------------"
. $MV_ROOT/bin/networkconfig.sh
postfix=`cat ${BASE}/usr/local/share/mythtv/.releasetype`
-for i in larch liblarch larch-profiles larch-live
-do
- pacman -Q $i
- if [ $? == 0 ]
- then
- pacman -R $i --noconfirm
- fi
-done
-
- sed -i '/larch/d' /etc/pacman.conf
+# for i in larch liblarch larch-profiles larch-live
+# do
+# pacman -Q $i
+# if [ $? == 0 ]
+# then
+# pacman -R $i --noconfirm
+# fi
+# done
+#
+# sed -i '/larch/d' /etc/pacman.conf
systemconfig.py -m $@
rc=$?
diff --git a/abs/core/LinHES-config/xconfig.sh b/abs/core/LinHES-config/xconfig.sh
index a601352..504da81 100755
--- a/abs/core/LinHES-config/xconfig.sh
+++ b/abs/core/LinHES-config/xconfig.sh
@@ -11,12 +11,14 @@ do
done
BASE=""
+MYTH_RUN_STATUS="1"
. /etc/profile
-NVIDIA_96XX="$TEMPLATES/xorg/96xx_supported.txt"
-NVIDIA_173="$TEMPLATES/xorg/173_supported.txt"
-NVIDIA_SUPPORTED="$TEMPLATES/xorg/nvidia_supported.txt"
-MYTHHOME=$BASE/home/mythtv
+#MYTHHOME=$BASE/home/mythtv
+
+. /usr/MythVantage/bin/install_functions.sh
+home_check
+
function Xvalues {
CMDLINE=$(cat /proc/cmdline)
@@ -32,163 +34,23 @@ function Xvalues {
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 "Detected $VGACARDTYPE as the video card type"
- #currentmode=`cat "$BASE/etc/X11/xorg.conf" | grep Modes | awk -Fs '{ print $2 }'`
}
function presetupX {
- if [ -f /etc/sysconfig/IGNORE_X ]
+ if [ "$XIgnoreConfig" = 1 ]
then
- echo "Will not run xconfig.sh due to presence of /etc/sysconfig/IGNORE_X"
- return 1
- else
- if [ "$XIgnoreConfig" = 1 ]
+ echo "Using User supplied X"
+ if [ -f "$MYTHHOME/templates/xorg.user" ]
then
- echo "Using User supplied X"
- if [ -f "$MYTHHOME/templates/xorg.user" ]
- then
- cp -f "$MYTHHOME/templates/xorg.user" "$XORG_CONF"
- else
- echo "Didn't find the file"
- echo "Copy your config file to $MYTHHOME/templates/xorg.user" > "$XORG_CONF"
- fi
+ cp -f "$MYTHHOME/templates/xorg.user" "$XORG_CONF"
else
- #if [ "$XUseAdvanced" = 1 ]
- #then
- # setupAdvancedX
- #else
- setupX
- #fi
+ echo "Didn't find the file"
+ echo "Copy your config file to $MYTHHOME/templates/xorg.user" > "$XORG_CONF"
fi
+ else
+ setupX
fi
-
-}
-
-function setupAdvancedX {
-
- echo "#Doing the advanced X setup" >> $LOGFILE
- #Xcategory=`echo "$Xresadvanced" | cut -d_ -f1`
- #Xres=`echo "$Xresadvanced" | cut -d_ -f2`
-
- Xcategory=`echo "$Xresadvanced" | cut -d_ -f1`
- Xres=${Xres}
- #echo "$Xcategory"
- #echo $Xres
- if [ "$Xcategory" = "Nvidia" ]
- then
- #Xres=""
- if [ "$XnVidia1080p" = "1" ]
- then
- Xres="${Xres} 1920x1080_60"
- fi
- if [ "$XnVidia1080i" = "1" ]
- then
- Xres="${Xres} 1920x1080_60i"
- fi
- if [ "$XnVidia720p" = "1" ]
- then
- Xres="${Xres} 1280x720_60"
- fi
- if [ "$XnVidia480p" = "1" ]
- then
- Xres="${Xres} 720x480_60"
- fi
- #ML="\t Modes ${Xres}"
-# else
-# ML="\t Modes \"${Xres}\""
- fi
-
- case $Xcardtype in
- NVIDIA|nVidia|nvidia)
- nvidia_driver_install
- case $Xconnection in
- DVI) ConnectedMonitor=DFP ;;
- vga) ConnectedMonitor=CRT;;
- Auto) ConnectedMonitor=Auto;;
- TV) ConnectedMonitor=TV
- nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --tv-standard="$XTVstandard"
- nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --tv-out-format="$XTVconnection"
- # echo "Option \"TVStandard\" \"$XTVstandard\"" >>/tmp/options
- # echo "Option \"TVOutFormat\" \"$XTVconnection\"" >> /tmp/options
- ;;
- *) ConnectedMonitor=Auto;;
- esac
- if [ "$ConnectedMonitor" = Auto ]
- then
- echo "auto connection"
- else
- nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --connected-monitor="$ConnectedMonitor"
- #echo "Option \"ConnectedMonitor\" \"$ConnectedMonitor\"" >> /tmp/options
- #echo "Option \"FlatPanelProperties\" \"Scaling = centered, Dithering = enabled\"" >> /tmp/options
- #echo "Option \"DigitalVibrance\" \"0\"" >> /tmp/options
- fi
-#
-# if [ "$XignoreEDID" = 1 ]
-# then
-# EDIDvalue=true
-# EDIDFREQ=false
-# DS=" DisplaySize $XDisplaysize"
-# HS=" HorizSync $XHsync"
-# VR=" VertRefresh $XVrefresh"
-# else
-# EDIDvalue=false
-# EDIDFREQ=true
-# DS="# Display size edid used "
-# HS="# Hsync edid used "
-# VR="# Vertrefresh edid used "
-# fi
-# echo "Option \"UseEdidFreqs\" \"$EDIDFREQ\"" >> /tmp/options
-# echo "Option \"IgnoreEDID\" \"$EDIDvalue\"" >> /tmp/options
-#
-#
-# sed -e "s/^.*Modes.*$/${ML}/" \
-# -e "/INSERT MODELINE/r $TEMPLATES/xorg/modeline.$Xcategory" \
-# -e "s/^.*DisplaySize.*$/ $DS/" \
-# -e "s/^#.*HorizSync.*$/ $HS/g" \
-# -e "s/^#.*VertRefresh.*$/ $VR/g" \
-# -e "/INSERT HERE/r /tmp/options" "$TEMPLATES/xorg/xorg.conf.nvidia" > "$XORG_CONF"
-
- #nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --mode-list=\"${Xres}\"
- eval nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --mode-list=\"${Xres}\"
- ;;
-
- ati|ATI)
- case $Xconnection in
- DVI) ConnectedMonitor="tmds1,nocrt1,notv";;
- VGA) ConnectedMonitor="crt1,notmds1,notv" ;;
- TV) ConnectedMonitor="tv,nocrt1,notmds1"
- echo "Option \"TVStandard\" \"$XTVstandard\"" >>/tmp/options
- echo "Option \"TVFormat\" \"$XTVconnection\"" >> /tmp/options
- ;;
- esac
- if [ "$XignoreEDID" = 1 ]
- then
- DS=" DisplaySize $XDisplaysize"
- HS=" HorizSync $XHsync"
- VR=" VertRefresh $XVrefresh"
- else
- DS="# Display size edid used "
- HS="# Hsync edid used "
- VR="# Vertrefresh edid used "
- fi
-
- echo "Option \"ForceMonitors\" \"$ConnectedMonitor\"" >> /tmp/options
-
- sed -e "s/^.*Modes.*$/\t $ML/" \
- -e "/INSERT MODELINE/r $TEMPLATES/xorg/modeline.$Xcategory" \
- -e "s/^.*DisplaySize.*$/ $DS/" \
- -e "s/^#.*HorizSync.*$/ $HS/g" \
- -e "s/^#.*VertRefresh.*$/ $VR/g" \
- -e "/INSERT HERE/r /tmp/options" "$TEMPLATES/xorg/xorg.conf.ati" > "$XORG_CONF"
- ;;
-
-
-
- *)
- echo "unknown card type"
- ;;
- esac
}
function nvidia_prepare {
@@ -201,198 +63,167 @@ function nvidia_prepare {
do
pacman --noconfirm -Rc $i >> $LOGFILE 2>&1
done
+}
-
+function pkg_check () {
+ echo " Checking for $1 in cache or online"
+ pacman --noconfirm -Sw $1 >> $LOGFILE 2>&1
+ rc=$?
+ if [ $rc != 0 ]
+ then
+ echo " Couldn't find $1 for install, aborting"
+ echo " Couldn't find $1 for install, aborting" >> $LOGFILE 2>&1
+ exit 1
+ fi
}
function nvidia_driver_install {
+ echo "Installing Nvidia driver"
+ cp "$TEMPLATES/xorg/xorg.nvidia" $BASE/etc/X11/xorg.conf.d/20-automv.conf
+ #install latest drivers
+ pkg_check nvidia-utils
+ echo "Installing current nvidia drivers"
+ nvidia_prepare
+ pacman --noconfirm -S nvidia nvidia-utils >> $LOGFILE 2>&1
+ installed=1
+ echo "/usr/lib/libXvMCNVIDIA_dynamic.so.1" > "$XVMC_CONFIG"
+}
+function vmware_driver_install {
+ echo "Installing VMware driver"
+ echo "Installing VMware driver" >> $LOGFILE 2>&1
+ LIST="xf86-input-vmmouse xf86-video-vmware xf86-video-vesa svga-dri"
+ for i in `echo ${LIST}`
+ do
+ pkg_check $i
+ done
+ for i in `echo ${LIST}`
+ do
+ pacman -S --noconfirm $i >> $LOGFILE 2>&1
+ done
- cp "$TEMPLATES/xorg/xorg.conf.nvidia" $BASE/etc/X11/xorg.conf.d/20-automv.conf
-
- installed=0
- if [ "$TESTMODE" != "test" ]
- then
-
-
- grep -qi "$CARDID" "$NVIDIA_SUPPORTED"
- if [ $? = 0 ]
- then
- #install latest drivers
- echo "Installing current nvidia drivers"
- nvidia_prepare
- pacman --noconfirm -S nvidia nvidia-utils >> $LOGFILE 2>&1
- installed=1
- fi
-
- if [ $installed = 0 ]
- then
- #nvidia check right here
- grep -qi "$CARDID" "$NVIDIA_96XX"
- if [ $? = 0 ]
- then
- #install 96xx drivers
- echo "Installing nvidia 96xx drivers"
- nvidia_prepare
- pacman --noconfirm -S nvidia-96xx nvidia-96xx-utils >> $LOGFILE 2>&1
- installed=1
- fi
- fi
-
- if [ $installed = 0 ]
- then
- grep -qi "$CARDID" "$NVIDIA_173"
- if [ $? = 0 ]
- then
- #install latest drivers
- echo "Installing 173 nvidia drivers"
- nvidia_prepare
- pacman --noconfirm -S nvidia-173xx nvidia-173xx-utils >> $LOGFILE 2>&1
- installed=1
- fi
- fi
-
- if [ $installed = 0 ]
- then
- #this is a failsafe, can't find the right driver, then use the latest'
- #install latest drivers
- echo "Couldn't find the card in the supported list"
- echo "Installing current nvidia drivers"
-
- nvidia_prepare
- pacman --noconfirm -S nvidia nvidia-utils >> $LOGFILE 2>&1
- installed=1
- fi
-
-
- fi
+}
+function vesa_driver_install {
+ echo "Installing Vesa driver"
+ echo "Installing Vesa driver" >> $LOGFILE 2>&1
+ pacman -S --noconfirm xf86-video-vesa >> $LOGFILE 2>&1
+}
- if [ \"$Xres\" = "Auto" ]
- then
- nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --mode-list="nvidia-auto-select"
- else
- #nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --mode-list=$Xres
- eval nvidia-xconfig -c /etc/X11/xorg.conf.d/20-automv.conf --mode-list=\"${Xres}\"
- fi
+function intel_driver_install {
+ echo "Installing Intel driver"
+ echo "Installing Intel driver" >> $LOGFILE 2>&1
+ pkg_check xf86-video-intel
+ #this is used to remove nvidia
+ nvidia_prepare
+ pacman -S --noconfirm xf86-video-intel >> $LOGFILE 2>&1
+ echo "/usr/lib/libIntelXvMC.so.1" > "$XVMC_CONFIG"
+}
- echo "/usr/lib/libXvMCNVIDIA_dynamic.so.1" > "$XVMC_CONFIG"
- #rm $BASE/etc/X11/xorg.conf.d/20-nvidia.conf
+# if [ "$Xcategory" = "Nvidia" ]
+# then
+# #Xres=""
+# if [ "$XnVidia1080p" = "1" ]
+# then
+# Xres="${Xres} 1920x1080_60"
+# fi
+# if [ "$XnVidia1080i" = "1" ]
+# then
+# Xres="${Xres} 1920x1080_60i"
+# fi
+# if [ "$XnVidia720p" = "1" ]
+# then
+# Xres="${Xres} 1280x720_60"
+# fi
+# if [ "$XnVidia480p" = "1" ]
+# then
+# Xres="${Xres} 720x480_60"
+# fi
+
+function set_res {
+ echo " Setting modeline to ${Xres}"
+ echo " Setting modeline to ${Xres}" >> $LOGFILE 2>&1
+ cat > /etc/X11/xorg.conf.d/30-screen.conf <<EOF
+ Section "Screen"
+ Identifier "Screen0" #Collapse Monitor and Device section to Screen section
+ Device "Device0"
+ Monitor "Monitor0"
+ DefaultDepth 24 #Choose the depth (16||24)
+ SubSection "Display"
+ Depth 24
+ Modes "${Xres}" #Choose the resolution
+ EndSubSection
+ EndSection
+EOF
}
function setupX {
Xvalues
- #echo "$currentmode ____ ${Xres}"
- #if [ "${currentmode}" != \"${Xres}\" ]
if [ x = x ]
then
case $VGACARDTYPE in
- nVidia)
+ NVIDIA|nVidia|nvidia)
nvidia_driver_install
- ;;
-
- # VMware)
- # sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$TEMPLATES/xorg/xorg.conf.vmware" > "$XORG_CONF"
- # ;;
-
- VIA|S3)
- # There are actually multiple options here
- # xf86-video-openchrome
- # xf86-video-unichrome
- # There is also a seperate driver for the Unichrome Pro
- 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" ]
+ if [ \"$Xres\" = "Auto" ]
then
- pacman --noconfirm -R nvidia nvidia-utils >> $LOGFILE 2>&1
- pacman --noconfirm -S libgl unichrome-dri xf86-video-openchrome >> $LOGFILE 2>&1
- else
- pacman --noconfirm -R nvidia nvidia-utils >> $LOGFILE 2>&1
- pacman --noconfirm -S libgl unichrome-dri xf86-video-unichrome >> $LOGFILE 2>&1
+ Xres="nvidia-auto-select"
fi
- fi
- # I'm making educated guesses here...
- if lspci | grep "VGA" | grep -qi "Unichrome Pro"
- then
- if [ -f "/usr/lib/libchromeXvMCPro.so.1" ]
+
+ if [ ${Xres} != "Auto" ]
then
- echo "/usr/lib/libchromeXvMCPro.so.1" > "$XVMC_CONFIG"
+ set_res
else
- echo "/usr/lib/libviaXvMCPro.so.1" > "$XVMC_CONFIG"
+ rm -f /etc/X11/xorg.conf.d/30-screen.conf
fi
- else
- if [ -f "/usr/lib/libchromeXvMC.so.1" ]
+ ;;
+
+ VMware)
+ vmware_driver_install
+ cp $TEMPLATES/xorg/xorg.vmware /etc/X11/xorg.conf.d/20-automv.conf
+ echo "copy in autostart functions" >> $LOGFILE 2>&1
+ mkdir -p /etc/X11/autostart >> $LOGFILE 2>&1
+ echo "#!/bin/bash" > /etc/X11/autostart/vmware.sh
+ echo "/usr/bin/vmware-user-suid-wrapper" >> /etc/X11/autostart/vmware.sh
+ chmod 755 /etc/X11/autostart/vmware.sh
+ if [ ${Xres} != "Auto" ]
then
- echo "/usr/lib/libchromeXvMC.so.1" > "$XVMC_CONFIG"
+ set_res
else
- echo "/usr/lib/libviaXvMC.so.1" > "$XVMC_CONFIG"
+ rm -f /etc/X11/xorg.conf.d/30-screen.conf
fi
- fi
- ;;
+ ;;
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 >> $LOGFILE 2>&1
- pacman --noconfirm -S libgl >> $LOGFILE 2>&1
- fi
- echo "/usr/lib/libIntelXvMC.so.1" > "$XVMC_CONFIG"
- ;;
-
- vesa|InnoTek)
- 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
- ;;
-
- *)
- XCONF=/root/xorg.conf.new
- XCONFB=/etc/X11/xorg.conf.install
- X -configure
- if [ -f "$XCONF" ]
- then
- echo "Using $XCONF"
- if [ ${Xres} = Auto ]
+ intel_driver_install
+ cp $TEMPLATES/xorg/xorg.intel /etc/X11/xorg.conf.d/20-automv.conf
+ if [ ${Xres} != "Auto" ]
then
- grep -v Modes "$XCONF" | sed -e 's/dev\/mouse/dev\/psaux/g'> "$XORG_CONF"
+ set_res
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"
+ rm -f /etc/X11/xorg.conf.d/30-screen.conf
fi
- elif [ -f "$XCONFB" ]
- then
- echo "Using $XCONFB"
- if [ ${Xres} = Auto ]
+ ;;
+
+ vesa|InnoTek|*) #leaving this as * and vesa for no real reason other then it's explicit to catch vesa
+ vesa_driver_install
+ cp $TEMPLATES/xorg/xorg.vesa /etc/X11/xorg.conf.d/20-automv.conf
+ if [ ${Xres} != "Auto" ]
then
- sed -e "/^.*Modes.*$/d" "$XCONFB" > "$XORG_CONF"
+ set_res
else
- sed -e "s/^.*Modes.*$/\t Modes \"${Xres}\"/" "$XCONFB" > "$XORG_CONF"
+ rm -f /etc/X11/xorg.conf.d/30-screen.conf
fi
- else
- echo "Xorg configuration failed"
- fi
- rm -f "$XCONF" >> $LOGFILE 2>&1
+
;;
+
esac
fi
}
+
+#---------------------------------------------------------------------------------
#MAIN
@@ -400,52 +231,43 @@ LINE=`grep -i xorg /etc/mythvantage.cfg|grep -q False`
rc=$?
if [ $rc = 0 ]
then
- echo "xorg configuration disabled in /etc/mythvantage.cfg"
- exit 0
+ echo "** xorg configuration disabled in /etc/mythvantage.cfg"
+ exit 1
fi
-TESTMODE="$1"
-if [ "$TESTMODE" = "test" ]
+if [ -f /etc/sysconfig/IGNORE_X ]
then
- XORG_CONF="/tmp/xorg.conf.test"
- XVMC_CONFIG="/tmp/XvMCConfig.test"
- XUseAdvanced="1"
- XIgnoreConfig="${2}"
- Xcardtype="${3}"
- XIgnoreEDID="${4}"
- Xconnection="${5}"
- XHsync="${6}"
- XVrefresh="${7}"
- Xresadvanced="${8}"
- XTVstandard="${9}"
- XTVconnection="${10}"
- XDisplaysize="${11}"
-else
- if [ -f /etc/systemconfig ]
- then
- . /etc/systemconfig
- 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
+ echo "** Will not run xconfig.sh due to presence of /etc/sysconfig/IGNORE_X"
+ exit 1
+fi
- XORG_CONF="/etc/X11/xorg.conf"
- XVMC_CONFIG="/etc/X11/XvMCConfig"
+if [ -f /etc/systemconfig ]
+then
+ . /etc/systemconfig
+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"
+
presetupX