diff options
author | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-06-06 21:08:32 (GMT) |
---|---|---|
committer | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-06-06 21:08:32 (GMT) |
commit | 1801434dc7e6b34c1fb22a7ece0bad3538a5bb20 (patch) | |
tree | 83e3ba0c170833b3afcf5f18d4e94ef100f5afd2 /abs | |
parent | 816aa5eb71f700980ab5cb4c332c74b831d838a8 (diff) | |
parent | a8b2865581cb2db961008c79ea48f31005b20113 (diff) | |
download | linhes_pkgbuild-1801434dc7e6b34c1fb22a7ece0bad3538a5bb20.zip linhes_pkgbuild-1801434dc7e6b34c1fb22a7ece0bad3538a5bb20.tar.gz linhes_pkgbuild-1801434dc7e6b34c1fb22a7ece0bad3538a5bb20.tar.bz2 |
Merge branch 'HEAD' of ssh://cesman@knoppmyth.net/mount/repository/LinHES-PKGBUILD
Diffstat (limited to 'abs')
22 files changed, 968 insertions, 327 deletions
diff --git a/abs/core-testing/LinHES-config-svn/PKGBUILD b/abs/core-testing/LinHES-config-svn/PKGBUILD index 2927a6e..32645a2 100755 --- a/abs/core-testing/LinHES-config-svn/PKGBUILD +++ b/abs/core-testing/LinHES-config-svn/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config-svn pkgver=1.0 -pkgrel=294 +pkgrel=299 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev ) pkgdesc="Install and configure your system" depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates ) diff --git a/abs/core-testing/LinHES-config-svn/install_db_chroot.sh b/abs/core-testing/LinHES-config-svn/install_db_chroot.sh index 1a0131e..808dbb9 100755 --- a/abs/core-testing/LinHES-config-svn/install_db_chroot.sh +++ b/abs/core-testing/LinHES-config-svn/install_db_chroot.sh @@ -6,58 +6,112 @@ myhost=$hostname hostname $myhost echo $myhost > /etc/hostname -echo "install_db_chroot hostname is $hostname" +echo "$0 hostname is $hostname" . $MV_ROOT/bin/install_functions.sh #myhost=`cat /etc/hostname` -#mount -t proc none /proc -pacman --noconfirm -Sf mysql -/etc/rc.d/mysqld - -status=1 -mysqlstatus=1 -while [ ! $status = 0 ] -do - /etc/rc.d/mysqld stop - sleep 1 - /etc/rc.d/mysqld start - mysqlstatus=$? - if [ $mysqlstatus = 0 ] - then - mysql -e "show databases;" - showstatus=$? - if [ $showstatus = 0 ] - then - pacman --noconfirm -R mythdb-initial - pacman --noconfirm -S mythdb-initial - $MV_ROOT/bin/restore_default_settings.sh -c load - DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1 - $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings - $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install - - update_db_settings HostServiceMythWEB "1" - echo 'UseMythWEB="1"' >> /etc/systemconfig - - #update database to allow user jobs on this host. - $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW - $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL - if [ -d /data/srv/mysql/mythconverg ] - #if [ -d /var/lib/mysql/mythconverg ] - then +# Before this script is called, the mysqld that facilitated the installation is killed. +# We need to make sure to stop and start the mysqld that will be used post-install so +# that the database can be initialized. + +/etc/rc.d/mysqld stop +killall -9 mysqld +/etc/rc.d/mysqld start +sleep 1 + +# Put a limit on how many times we try to (re-)start MySQL +success_test() { + # parameter: number of tries to start mysqld so far + PID=`pidof -o %PPID /usr/sbin/mysqld` + if [ -z "$PID" ]; then # mysqld isn't running + if [ $1 -gt 3 ]; then + echo "ERROR: Failed to start MySQL server in $1 attempts." + sleep 5 + exit 1 + else + echo "Tried $1 time(s) to start MySQL server." + return 1 + fi + else # mysqld is running + return 0 + fi + # should never get here + return 1 +} + +mysqld_tries=0 +# See if MySQL server is running; try several ways to start it if it's not. +while true; do + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server is running" + break + else + echo "MySQL server is not running. Trying to start it." + # Maybe it just needs to be started + sleep 1 + /etc/rc.d/mysqld start + mysqld_tries=$((mysqld_tries + 1)) + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server has been started" + break + else + echo "MySQL server may not be installed. Trying to install it." + # Maybe it's not installed; try (re-)installing it and starting it + sleep 1 + pacman --noconfirm -Sf mysql + sleep 1 + /etc/rc.d/mysqld start + mysqld_tries=$((mysqld_tries + 1)) + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server has been installed and started" + break + else + echo "MySQL server would not start, even after (re-)installing it." + fi + fi + fi +done + +# At this point, MySQL server should be up and running + +while true; do + mysql -e "show databases;" + + if [ $? -eq 0 ]; then + pacman --noconfirm -R mythdb-initial + pacman --noconfirm -S mythdb-initial + $MV_ROOT/bin/restore_default_settings.sh -c load + DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1 + $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings + $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install + + update_db_settings HostServiceMythWEB "1" + echo 'UseMythWEB="1"' >> /etc/systemconfig + + #update database to allow user jobs on this host. + $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW + $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL + #if [ -d /var/lib/mysql/mythconverg ] + if [ -d /data/srv/mysql/mythconverg ]; then # pacman --noconfirm -R webcalendar # pacman --noconfirm --nodeps -S webcalendar - status=0 - fi + break + else + echo "Failed to create mythconverg database. Will re-try." + sleep 1 + fi # if [ $SystemType = "Master_backend" ] # then # $MV_ROOT/bin/restore_default_settings.sh -c BECONFIG -s master -a $dbhost # fi - fi + else + echo "Failed to look for databases. Will re-try." + sleep 1 fi done /etc/rc.d/mysqld stop #umount /proc - - - diff --git a/abs/core-testing/LinHES-config-svn/install_functions.sh b/abs/core-testing/LinHES-config-svn/install_functions.sh index ddade6d..4f6f7ed 100755 --- a/abs/core-testing/LinHES-config-svn/install_functions.sh +++ b/abs/core-testing/LinHES-config-svn/install_functions.sh @@ -38,7 +38,7 @@ update_db_settings Theme "$pick" function splash_setup (){ echo $CMDLINE | grep -q splash=silent - if [ $? = 0 ] + if [ $? -eq 0 ] then update_db_settings Hostbootsplash 1 else @@ -61,7 +61,7 @@ function setupremote { update_db_settings HostRemoteType "$Remotetype" #special case for special remote echo "Starting with support for $Remotetype" - if [ x$Remotetype = "xdvico" ] + if [ "$Remotetype" == "dvico" ] then /usr/sbin/lircd -d /dev/usb/hiddev0 else @@ -79,7 +79,7 @@ echo "Scanning for Hauppauge receiver" for hpgid in `lspci -nm -d4444: |cut -d" " -f6- |tr -d '"'|tr " " :` do line=`grep $hpgid $TEMPLATES/remotes/i2c.id` - if [ $? = 0 ] + if [ $? -eq 0 ] then modprobe lirc_i2c FoundReceiverType=`echo "$line"|cut -d"|" -f2` @@ -102,7 +102,7 @@ while read line do USBID=`echo "$line"|cut -d"|" -f1` lsusb -d "$USBID" > /dev/null 2>/dev/null - if [ $? = 0 ] + if [ $? -eq 0 ] then Remotetype=`echo "$line"|cut -d"|" -f2` echo "Found $Remotetype" @@ -111,7 +111,7 @@ do break fi done <$BASE/$TEMPLATES/remotes/receiver_usb.id -if [ $found_remote = 1 ] +if [ $found_remote -eq 1 ] then scan_for_hpg_receiver fi @@ -125,7 +125,7 @@ fi function rest_of_network () { #netmask echo $CMDLINE | grep -q netmask - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*netmask=} NETMASK=${TEMPVAR%% *} @@ -139,7 +139,7 @@ function rest_of_network () { fi #gateway echo $CMDLINE | grep -q gateway - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*gateway=} GATEWAY=${TEMPVAR%% *} @@ -152,7 +152,7 @@ function rest_of_network () { #dns echo $CMDLINE | grep -q dns - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*dns=} DNS=${TEMPVAR%% *} @@ -165,7 +165,7 @@ function rest_of_network () { function init_network { echo $CMDLINE |grep -q netdev - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*netdev=} MYTHDEFAULT=${TEMPVAR%% *} @@ -176,7 +176,7 @@ function init_network { echo $CMDLINE | grep -q ip - if [ $? = 0 ] + if [ $? -eq 0 ] then update_db_settings HostDefaulteth0 0 update_db_settings HostDefault${MYTHDEFAULT} 1 @@ -187,7 +187,7 @@ function init_network { TEMPVAR=${CMDLINE#*ip=} IP=${TEMPVAR%% *} - if [ x$IP = xdhcp ] + if [ "$IP" == "dhcp" ] then /sbin/dhcpcd $MYTHDEFAULT update_db_settings HostUseDHCP${MYTHDEFAULT} 0 @@ -202,11 +202,11 @@ function init_network { function init_remote { echo $CMDLINE | grep -q remoteport - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remoteport=} REMOTEPORT=${TEMPVAR%% *} - if [ x"$ReceiverType" = "xSerial" ] + if [ "$ReceiverType" == "Serial" ] then if [ -e /dev/$REMOTEPORT ] then @@ -220,7 +220,7 @@ function init_remote { fi echo $CMDLINE | grep -q remote - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remote=} Remotetype=${TEMPVAR%% *} @@ -239,7 +239,7 @@ ROOT=$1 DATA=$2 SWAP=$3 -if [ ! x$SWAP = xNO ] +if [ "$SWAP" != "NO" ] then SWAPLINE=",$SWAP,S" MKSWAPCMD="mkswap /dev/${disk}2" @@ -248,7 +248,7 @@ if [ ! x$SWAP = xNO ] MKSWAPCMD="" fi -if [ x$DATA = xALL ] +if [ "$DATA" == "ALL" ] then DATALINE=",,," EXTRALINE="" @@ -315,7 +315,7 @@ unmount_it () { copy_it () { - if [ x$1 = xALL ] + if [ "$1" == "ALL" ] then echo "Transferring system" unsquashfs -f -d /$mountpoint /.livesys/medium/system.sqf @@ -403,7 +403,7 @@ function find_uuid() { get_grub_map() { - rm /tmp/dev.map + [ -e /tmp/dev.map ] && rm /tmp/dev.map /sbin/grub --no-floppy --device-map /tmp/dev.map <<EOF quit EOF @@ -422,17 +422,17 @@ mapdev() { fi for dev in $devs do - if [ "(" = $(echo $dev | cut -b1) ]; then + if [ "(" == $(echo $dev | cut -b1) ]; then grubdevice="$dev" else - if [ "$dev" = "$linuxdevice" ]; then + if [ "$dev" == "$linuxdevice" ]; then device_found=1 break fi fi done - if [ "$device_found" = "1" ]; then - if [ "$partition_flag" = "0" ]; then + if [ "$device_found" == "1" ]; then + if [ "$partition_flag" == "0" ]; then echo "$grubdevice" else grubdevice_stringlen=${#grubdevice} @@ -461,7 +461,7 @@ dogrub() { #/usr/sbin/xfs_freeze -f /$mountpoint > /dev/null 2>&1 echo "freezing xfs fs" /usr/sbin/xfs_freeze -f /$mountpoint - if [ $? = 0 ] + if [ $? -eq 0 ] then sleep 40 echo "unfreezing xfs" @@ -531,7 +531,7 @@ case $1 in create_fstab fi #was 5 - if [ x$3 = xUPGRADE ] + if [ "$3" == "UPGRADE" ] then if [ ! -f /tmp/etc/KnoppMyth-version ] then @@ -558,11 +558,11 @@ case $1 in SWAPUUID=$FOUNDUUID FOUNDUUID="" - if [ x$4 = x ] + if [ "$4" == "" ] then #upgrade find_uuid ${2}3 - elif [ x$5 = xFULL_INSTALL ] + elif [ "$5" == "FULL_INSTALL" ] then #install find_uuid ${2}3 @@ -585,7 +585,7 @@ case $1 in if [ -f /tmp/etc/fstab ] then grep -q /dev/vg /tmp/etc/fstab - if [ $? = 0 ] + if [ $? -eq 0 ] then grep /dev/vg /tmp/etc/fstab >> /$mountpoint/etc/fstab grep /dev/vg /tmp/etc/fstab | awk -v mount=$mountpoint ' { print "/" mount $2 }' |xargs mkdir diff --git a/abs/core-testing/LinHES-config-svn/install_proxy.sh b/abs/core-testing/LinHES-config-svn/install_proxy.sh index 3f626a1..32d01d7 100755 --- a/abs/core-testing/LinHES-config-svn/install_proxy.sh +++ b/abs/core-testing/LinHES-config-svn/install_proxy.sh @@ -174,7 +174,7 @@ full_install () { sleep 1 $run partition_it $disk $rootsize $datasize $swapsize - echo "Formating $disk" > /tmp/.install_state + echo "Formatting $disk" > /tmp/.install_state progress 2 sleep 1 $run format_it $disk $rootfs $datafs @@ -294,7 +294,7 @@ function upgrade () { if [ ! x$rootfs = "xDo_not_format" ] then - echo "Formating $disk" > /tmp/.install_state + echo "Formatting $disk" > /tmp/.install_state progress 2 sleep 1 $run format_it $disk $rootfs NO diff --git a/abs/core-testing/LinHES-config/install_db_chroot.sh b/abs/core-testing/LinHES-config/install_db_chroot.sh index 1a0131e..808dbb9 100755 --- a/abs/core-testing/LinHES-config/install_db_chroot.sh +++ b/abs/core-testing/LinHES-config/install_db_chroot.sh @@ -6,58 +6,112 @@ myhost=$hostname hostname $myhost echo $myhost > /etc/hostname -echo "install_db_chroot hostname is $hostname" +echo "$0 hostname is $hostname" . $MV_ROOT/bin/install_functions.sh #myhost=`cat /etc/hostname` -#mount -t proc none /proc -pacman --noconfirm -Sf mysql -/etc/rc.d/mysqld - -status=1 -mysqlstatus=1 -while [ ! $status = 0 ] -do - /etc/rc.d/mysqld stop - sleep 1 - /etc/rc.d/mysqld start - mysqlstatus=$? - if [ $mysqlstatus = 0 ] - then - mysql -e "show databases;" - showstatus=$? - if [ $showstatus = 0 ] - then - pacman --noconfirm -R mythdb-initial - pacman --noconfirm -S mythdb-initial - $MV_ROOT/bin/restore_default_settings.sh -c load - DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1 - $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings - $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install - - update_db_settings HostServiceMythWEB "1" - echo 'UseMythWEB="1"' >> /etc/systemconfig - - #update database to allow user jobs on this host. - $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW - $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL - if [ -d /data/srv/mysql/mythconverg ] - #if [ -d /var/lib/mysql/mythconverg ] - then +# Before this script is called, the mysqld that facilitated the installation is killed. +# We need to make sure to stop and start the mysqld that will be used post-install so +# that the database can be initialized. + +/etc/rc.d/mysqld stop +killall -9 mysqld +/etc/rc.d/mysqld start +sleep 1 + +# Put a limit on how many times we try to (re-)start MySQL +success_test() { + # parameter: number of tries to start mysqld so far + PID=`pidof -o %PPID /usr/sbin/mysqld` + if [ -z "$PID" ]; then # mysqld isn't running + if [ $1 -gt 3 ]; then + echo "ERROR: Failed to start MySQL server in $1 attempts." + sleep 5 + exit 1 + else + echo "Tried $1 time(s) to start MySQL server." + return 1 + fi + else # mysqld is running + return 0 + fi + # should never get here + return 1 +} + +mysqld_tries=0 +# See if MySQL server is running; try several ways to start it if it's not. +while true; do + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server is running" + break + else + echo "MySQL server is not running. Trying to start it." + # Maybe it just needs to be started + sleep 1 + /etc/rc.d/mysqld start + mysqld_tries=$((mysqld_tries + 1)) + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server has been started" + break + else + echo "MySQL server may not be installed. Trying to install it." + # Maybe it's not installed; try (re-)installing it and starting it + sleep 1 + pacman --noconfirm -Sf mysql + sleep 1 + /etc/rc.d/mysqld start + mysqld_tries=$((mysqld_tries + 1)) + success_test $mysqld_tries + if [ $? -eq 0 ]; then + echo "MySQL server has been installed and started" + break + else + echo "MySQL server would not start, even after (re-)installing it." + fi + fi + fi +done + +# At this point, MySQL server should be up and running + +while true; do + mysql -e "show databases;" + + if [ $? -eq 0 ]; then + pacman --noconfirm -R mythdb-initial + pacman --noconfirm -S mythdb-initial + $MV_ROOT/bin/restore_default_settings.sh -c load + DISPLAY=127.0.0.1:0 $MV_ROOT/bin/MythVantage -t restore,default_1 + $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings + $MV_ROOT/bin/systemconfig.sh misc,hostype,this_is_install + + update_db_settings HostServiceMythWEB "1" + echo 'UseMythWEB="1"' >> /etc/systemconfig + + #update database to allow user jobs on this host. + $MV_ROOT/bin/restore_default_settings.sh -c USERJOBALLOW + $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL + #if [ -d /var/lib/mysql/mythconverg ] + if [ -d /data/srv/mysql/mythconverg ]; then # pacman --noconfirm -R webcalendar # pacman --noconfirm --nodeps -S webcalendar - status=0 - fi + break + else + echo "Failed to create mythconverg database. Will re-try." + sleep 1 + fi # if [ $SystemType = "Master_backend" ] # then # $MV_ROOT/bin/restore_default_settings.sh -c BECONFIG -s master -a $dbhost # fi - fi + else + echo "Failed to look for databases. Will re-try." + sleep 1 fi done /etc/rc.d/mysqld stop #umount /proc - - - diff --git a/abs/core-testing/LinHES-config/install_functions.sh b/abs/core-testing/LinHES-config/install_functions.sh index ce9a057..9f38384 100755 --- a/abs/core-testing/LinHES-config/install_functions.sh +++ b/abs/core-testing/LinHES-config/install_functions.sh @@ -38,7 +38,7 @@ update_db_settings Theme "$pick" function parse_cmdline_2_db(){ echo $CMDLINE | grep -q displayres - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*displayres=} update_db_settings HostXres $TEMPVAR @@ -49,7 +49,7 @@ function parse_cmdline_2_db(){ function bootsplash_setup (){ echo $CMDLINE | grep -q splash=silent - if [ $? = 0 ] + if [ $? -eq 0 ] then update_db_settings Hostbootsplash 1 else @@ -72,7 +72,7 @@ function setupremote { update_db_settings HostRemoteType "$Remotetype" #special case for special remote printhl "Starting with support for $Remotetype" - if [ x$Remotetype = "xdvico" ] + if [ "$Remotetype" == "dvico" ] then /usr/sbin/lircd -d /dev/usb/hiddev0 else @@ -90,7 +90,7 @@ printhl " Scanning for Hauppauge receiver" for hpgid in `lspci -nm -d4444: |cut -d" " -f6- |tr -d '"'|tr " " :` do line=`grep $hpgid $TEMPLATES/remotes/i2c.id` - if [ $? = 0 ] + if [ $? -eq 0 ] then modprobe lirc_i2c FoundReceiverType=`echo "$line"|cut -d"|" -f2` @@ -131,7 +131,7 @@ while read line do USBID=`echo "$line"|cut -d"|" -f1` lsusb -d "$USBID" > /dev/null 2>/dev/null - if [ $? = 0 ] + if [ $? -eq 0 ] then Remotetype=`echo "$line"|cut -d"|" -f2` printhl "Found $Remotetype" @@ -140,7 +140,7 @@ do break fi done <$BASE/$TEMPLATES/remotes/receiver_usb.id -if [ $found_remote = 1 ] +if [ $found_remote -eq 1 ] then scan_for_hpg_receiver fi @@ -154,7 +154,7 @@ fi function rest_of_network () { #netmask echo $CMDLINE | grep -q netmask - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*netmask=} NETMASK=${TEMPVAR%% *} @@ -168,7 +168,7 @@ function rest_of_network () { fi #gateway echo $CMDLINE | grep -q gateway - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*gateway=} GATEWAY=${TEMPVAR%% *} @@ -180,7 +180,7 @@ function rest_of_network () { #dns echo $CMDLINE | grep -q dns - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*dns=} DNS=${TEMPVAR%% *} @@ -193,7 +193,7 @@ function rest_of_network () { function init_network { echo $CMDLINE |grep -q netdev - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*netdev=} MYTHDEFAULT=${TEMPVAR%% *} @@ -204,7 +204,7 @@ function init_network { echo $CMDLINE | grep -q ip - if [ $? = 0 ] + if [ $? -eq 0 ] then update_db_settings HostDefaulteth0 0 update_db_settings HostDefault${MYTHDEFAULT} 1 @@ -215,7 +215,7 @@ function init_network { TEMPVAR=${CMDLINE#*ip=} IP=${TEMPVAR%% *} - if [ x$IP = xdhcp ] + if [ "$IP" == "dhcp" ] then /sbin/dhcpcd $MYTHDEFAULT update_db_settings HostUseDHCP${MYTHDEFAULT} 0 @@ -230,7 +230,7 @@ function init_network { function init_remote { echo $CMDLINE | grep -q remoteport - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remoteport=} REMOTEPORT=${TEMPVAR%% *} @@ -248,7 +248,7 @@ function init_remote { fi echo $CMDLINE | grep -q remote - if [ $? = 0 ] + if [ $? -eq 0 ] then TEMPVAR=${CMDLINE#*remote=} Remotetype=${TEMPVAR%% *} @@ -267,7 +267,7 @@ ROOT=$1 DATA=$2 SWAP=$3 -if [ ! x$SWAP = xNO ] +if [ ! "$SWAP" == "NO" ] then SWAPLINE=",$SWAP,S" MKSWAPCMD="mkswap /dev/${disk}2" @@ -276,7 +276,7 @@ if [ ! x$SWAP = xNO ] MKSWAPCMD="" fi -if [ x$DATA = xALL ] +if [ "$DATA" == "ALL" ] then DATALINE=",,," EXTRALINE="" @@ -343,7 +343,7 @@ unmount_it () { copy_it () { - if [ x$1 = xALL ] + if [ "$1" == "ALL" ] then echo "Transferring system" unsquashfs -f -d /$mountpoint /.livesys/medium/system.sqf @@ -431,7 +431,7 @@ function find_uuid() { get_grub_map() { - rm /tmp/dev.map + [ -e /tmp/dev.map ] && rm /tmp/dev.map /sbin/grub --no-floppy --device-map /tmp/dev.map <<EOF quit EOF @@ -489,7 +489,7 @@ dogrub() { #/usr/sbin/xfs_freeze -f /$mountpoint > /dev/null 2>&1 echo "freezing xfs fs" /usr/sbin/xfs_freeze -f /$mountpoint - if [ $? = 0 ] + if [ $? -eq 0 ] then sleep 40 echo "unfreezing xfs" @@ -559,7 +559,7 @@ case $1 in create_fstab fi #was 5 - if [ x$3 = xUPGRADE ] + if [ "$3" == "UPGRADE" ] then if [ ! -f /tmp/etc/KnoppMyth-version ] then @@ -586,11 +586,11 @@ case $1 in SWAPUUID=$FOUNDUUID FOUNDUUID="" - if [ x$4 = x ] + if [ "$4" == "" ] then #upgrade find_uuid ${2}3 - elif [ x$5 = xFULL_INSTALL ] + elif [ "$5" == "FULL_INSTALL" ] then #install find_uuid ${2}3 @@ -613,7 +613,7 @@ case $1 in if [ -f /tmp/etc/fstab ] then grep -q /dev/vg /tmp/etc/fstab - if [ $? = 0 ] + if [ $? -eq 0 ] then grep /dev/vg /tmp/etc/fstab >> /$mountpoint/etc/fstab grep /dev/vg /tmp/etc/fstab | awk -v mount=$mountpoint ' { print "/" mount $2 }' |xargs mkdir diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh index b9d6b67..4d158e7 100755 --- a/abs/core-testing/LinHES-config/install_proxy.sh +++ b/abs/core-testing/LinHES-config/install_proxy.sh @@ -17,155 +17,685 @@ run=$MV_ROOT/bin/install_functions.sh CMDLINE=$(cat /proc/cmdline) BACKUPFILE="/myth/backup/mythconverg.sql.gz" +#TEMPNET="Hostip"$default_interface +#eval MYTHIP=\$${TEMPNET} +function create_chroot_mnt_points() { + + echo "Creating directory for media in chroot" + mkdir -p $mountpoint/media/cdrom + mkdir -p $mountpoint/media/dvd + mkdir -p $mountpoint/mnt + +} +function cp_and_log () { + ls $1 >/dev/null 2>&1 + status=$? + if [ $status = 0 ] + then + echo "copying $1 to $2" + cp -rfp $1 $2 + else + echo "$1 is not present, skipping..." + fi + +} + +function mdadm_find () { + + PREFIX=$1 + if [ -e $PREFIX/etc/KnoppMyth-version ] + then + MDADM_CONF="/etc/mdadm/mdadm.conf" + else + MDADM_CONF="/etc/mdadm.conf" + fi + echo "Using $MDADM_CONF" +} progress () { - mypercent=`echo "$1" | cut -d. -f1` - if [ x$mypercent = x ] +mypercent=`echo "$1" | cut -d. -f1` +if [ x$mypercent = x ] +then +echo "" > /tmp/.install_percent +else +echo "${mypercent}% complete" > /tmp/.install_percent +fi + + +} + +function apply_new_auth () { +#check if file is present + if [ -f /root/myth_user_call.out ] + then + #read in file, running each command in chroot + exec 4</root/myth_user_call.out + while read LINE <&4 + do + if [ ! x"$LINE" = x ] + then + #run commands in chroot + chroot "$mountpoint" $MV_ROOT/bin/myth_user_call -i $LINE > /tmp/user_auth.update + fi + done + rm -f /root/myth_user_call.out + else + echo "No new password changes to apply" + fi +} + + +function backup_sql_check { + if [ -f ${mountpoint}${BACKUPFILE} ] + then + echo "found ${mountpoint}${BACKUPFILE} " + rc=0 + else + echo "did not find ${mountpoint}${BACKUPFILE} " + rc=1 + fi + return $rc +} + +function mdadm_assemble_all { + + mdadm_find /tmp + mdadm --assemble --scan -c /tmp${MDADM_CONF} + MDLIST=`grep ARRAY /tmp${MDADM_CONF}|tr -s [:space:]|cut -d" " -f2` + for array in $MDLIST + do + echo "assembling array $array" + mdadm --assemble -c /tmp${MDADM_CONF} $array + sleep 2 + fsck -p $array + done + +} + +function upgrade_mount_search { + + MYTH_P=`cat /tmp/etc/fstab |grep -E /myth[[:space:]] | awk ' {print $1 '} ` + umount $mountpoint/myth + + #should probably just mdadm all the time + echo $MYTH_P |grep -q \/md. + if [ $? = 0 ] then - echo "" > /tmp/.install_percent + mdadm_assemble_all + fi + + echo $MYTH_P |grep -q UUID + if [ $? = 0 ] + then + MUUID=`echo $MYTH_P|cut -d= -f2|tr -d \"` + echo blkid $MUUID + blkid -t UUID=$MUUID + if [ ! $? = 0 ] + then + echo "couldn't find $MUUID, starting md support" + mdadm_assemble_all + fi + mount -U $MUUID $mountpoint/myth + echo mount -U $MUUID $mountpoint/myth + MYTHMOUNT=`blkid -t UUID=$MUUID|cut -d: -f1` + MYTHMOUNT=`basename $MYTHMOUNT` + echo "MYTHMOUNT is $MYTHMOUNT" else - echo "${mypercent}% complete" > /tmp/.install_percent + mount $MYTH_P $mountpoint/myth + echo mount $MYTH_P $mountpoint/myth + MYTHMOUNT=`basename $MYTH_P` + echo "MYTHMOUNT is $MYTHMOUNT" + fi + sleep 2 + backup_sql_check + if [ $? = 1 ] + then + mkdir -p /new_boot/root/backup + if [ ! -e /tmp/mythconverg.sql.gz ] + then + echo "Couldn't find ANY database to restore, upgrade will continue but a new database will be installed." + else + cp_and_log /tmp/mythconverg.sql.gz /new_boot/root/backup/mythconverg.sql.gz + BACKUPFILE="/root/backup/mythconverg.sql.gz" + echo "setting BACKUPFILE to $BACKUPFILE" + fi fi + return 0 } +full_install () { + if [ -f /tmp/.this_is_upgrade ] + then + rm /tmp/.this_is_upgrade + fi + echo "Partitioning $disk" > /tmp/.install_state + progress 1 + sleep 1 + $run partition_it $disk $rootsize $datasize $swapsize + + echo "Formatting $disk" > /tmp/.install_state + progress 2 + sleep 1 + $run format_it $disk $rootfs $datafs + + echo "Preparing $disk" > /tmp/.install_state + progress 3 + sleep 1 + $run mount_it $disk + + startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "` + + echo "STARTSIZE=$startsize">/tmp/.startsize.io + echo "Creating $hostname" > /tmp/.install_state + + sleep 1 + $run copy_it $disk ALL + rm $mountpoint/etc/fstab + $run fstab_fix_it $disk $rootfs $datafs FULL_INSTALL + echo "Configuring system" > /tmp/.install_state + progress 100 + #progress 99 + sleep 1 + $run grub_it $disk + + + #echo "Configuring system" > /tmp/.install_state + #progress 100 + sleep 1 + cp_and_log /etc/systemconfig "$mountpoint"/etc + cp_and_log /root/xorg.conf.install "$mountpoint"/etc/X11/xorg.conf.install + #run save syssettings to save settings, then copy to new mountpoint + $MV_ROOT/bin/restore_default_settings.sh -c save -t syssettings -h $MVHOSTNAME -d localhost + SE=$TEMPLATES/settings/syssettings + mkdir -p ${mountpoint}$SE + #cp -rp $SE/* ${mountpoint}$SE/ + cp_and_log "$SE/*" "${mountpoint}$SE/" + chown root:mythtv "$mountpoint"/etc/systemconfig + chown -R mythtv:mythtv ${mountpoint}$SE + + chmod -R 775 ${mountpoint}$SE + chmod 775 "$mountpoint"/etc/systemconfig + mkdir -p "$mountpoint"/var/log/mythtv + chown mythtv "$mountpoint"/var/log/mythtv + #copy over any updates that might have occured + #cp -rp $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/ + cp_and_log "$MV_ROOT/bin/*.sh" "$mountpoint"$MV_ROOT/bin/ + chmod -R 755 ${mountpoint}/root + create_chroot_mnt_points + cp_and_log /etc/mtab "$mountpoint"/etc/mtab + # cp_and_log /etc/hostname "$mountpoint"/etc/hostname + apply_new_auth + + + if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] + then + #installing DB to local machine + #turn off old live database, so the chroot one can start + echo "---------------------CHROOT INSTALLDB-------------------------" + /etc/rc.d/mysqld stop + mount --bind /dev "$mountpoint/dev" + mount --bind /proc "$mountpoint/proc" + mount -t sysfs none $mountpoint/sys + chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" 2>&1 |tee /tmp/chrootdb.out + #chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install + echo "stopping mysql in chroot" + chroot "$mountpoint" /etc/rc.d/mysqld stop + kill_dhcp_chroot + sleep 2 + lsof |grep new_boot + umount -l "$mountpoint/dev" + umount -l "$mountpoint/proc" + umount -l "$mountpoint/sys" + + echo "---------------------END CHROOT INSTALLDB-------------------------" + /etc/rc.d/mysqld start + else + #update remotedb with this host settings + mount --bind /dev "$mountpoint/dev" + mount --bind /proc "$mountpoint/proc" + mount -t sysfs none $mountpoint/sys + chroot "$mountpoint" DISPLAY=127.0.0.1:0 /usr/local/bin/MythVantage -t restore,default_1 + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings + if [ ! $? = 0 ] + then + touch $mountpoint/tmp/.dbsysfailed + chmod 777 $mountpoint/tmp/.dbsysfailed + else + #Run second time + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c ACCESSCONTROL + umount -l "$mountpoint/dev" + umount -l "$mountpoint/proc" + umount -l "$mountpoint/sys" + fi + fi + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,user + touch $mountpoint/home/mythtv/.configure && chmod 777 $mountpoint/home/mythtv/.configure + + echo "Done" > /tmp/.install_state + cp_and_log /tmp/mythvantage_install.log $mountpoint/var/log/ + $run umount_it $disk + +} + +function createsquashlist(){ +if [ -f $1 ] +then + rm -f +$1 +fi +for i in bin boot etc home lib opt root sbin usr var data +do +echo $i >> $1 +done + + +} + + + + +function upgrade () { + touch /tmp/.this_is_upgrade + + if [ ! x$rootfs = "xDo_not_format" ] + then + echo "Formatting + $disk" > /tmp/.install_state + progress 2 + sleep 1 + $run format_it $disk $rootfs NO + fi + echo "Preparing $disk" > /tmp/.install_state + progress 3 + sleep 1 + $run mount_it $disk + startsize=`statgrab -M disk.|grep $disk.write_bytes|cut -d= -f 2|tr -d " "` + echo "STARTSIZE=$startsize">/tmp/.startsize.io + echo "Upgrading $hostname" > /tmp/.install_state + sleep 1 + cp_and_log /tmp/etc /new_boot/etc.old + cp_and_log /tmp/oss /new_boot/var/lib/oss.old + + + SQUASHLIST="/tmp/.squashlist" + createsquashlist $SQUASHLIST + $run copy_it $disk $SQUASHLIST + #copy back ssh keys + +# cp_and_log -rp /data/var/cache/pacman/pkg/* /new_boot/data/var/cache/pacman/pkg/ + cp_and_log "/new_boot/etc.old/ssh/*.pub" /new_boot/etc/ssh/ + cp_and_log "/new_boot/etc.old/ssh/*.key" /new_boot/etc/ssh/ + cp_and_log "/new_boot/etc.old/ssh/*key" /new_boot/etc/ssh/ + mdadm_find /tmp + cp_and_log /tmp${MDADM_CONF} /new_boot/etc + #cp_and_log /new_boot/etc.old/mdadm/mdadm.conf /new_boot/etc/ + cp_and_log /new_boot/etc.old/asound.state /new_boot/etc/ + if [ ! -f /tmp/etc/KnoppMyth-version ] + then + #passwd/shadow/group + cp_and_log /new_boot/etc.old/passwd /new_boot/etc/ + cp_and_log /new_boot/etc.old/shadow /new_boot/etc/ + cp_and_log /new_boot/etc.old/group /new_boot/etc/ + fi + mkdir -p "$mountpoint"/var/log/mythtv + chown mythtv "$mountpoint"/var/log/mythtv + if [ x$rootfs = "xDo_not_format" ] + then + rootfs=`grep \/\ /tmp/etc/fstab |awk ' { print $3 } '` + fi + #this is here to copy in the systemconfig file as soon as possible. + cp_and_log /etc/systemconfig "$mountpoint"/etc/systemconfig + echo "Configuring system" > /tmp/.install_state + progress 100 + backup_sql_check + if [ $? = 1 ] + then + upgrade_mount_search + fi + echo $run fstab_fix_it $disk UPGRADE $MYTHMOUNT + $run fstab_fix_it $disk UPGRADE $MYTHMOUNT + create_chroot_mnt_points + + #echo "Writing boot sector" > /tmp/.install_state + #progress 99 + sleep 1 + $run grub_it $disk + #echo "Configuring system" > /tmp/.install_state + #progress 100 + sleep 1 + cp_and_log /etc/mtab "$mountpoint"/etc/mtab + cp_and_log /etc/systemconfig "$mountpoint"/etc + cp_and_log /root/xorg.conf.install "$mountpoint"/etc/X11/xorg.conf.install +#make sure mythconverg.sql.gz is present + #backup_sql_check + #if [ $? = 1 ] + #then + # upgrade_mount_search + #fi + echo $CMDLINE | grep -q clean_upgrade + status=$? + if [ -f /tmp/etc/KnoppMyth-version -o $status = 0 ] + then + #run save syssettings to save settings, then copy to new mountpoint + $MV_ROOT/bin/restore_default_settings.sh -c save -t syssettings -h $MVHOSTNAME -d localhost + SE=$TEMPLATES/settings/syssettings + mkdir -p ${mountpoint}$SE + #cp -rfp $SE/* ${mountpoint}$SE/ + cp_and_log "$SE/*" "${mountpoint}$SE/" + chown root:mythtv "$mountpoint"/etc/systemconfig + chown -R mythtv:mythtv ${mountpoint}$SE + chmod -R 775 ${mountpoint}$SE + if [ ! $status = 0 ] + then + touch $mountpoint/home/mythtv/.kmupgrade && chmod 777 $mountpoint/home/mythtv/.kmupgrade + fi + fi + + + + cp_and_log "$MV_ROOT/bin/*.sh" "$mountpoint"$MV_ROOT/bin/ + chmod -R 755 ${mountpoint}/root + chown root:mythtv "$mountpoint"/etc/systemconfig + chmod 775 "$mountpoint"/etc/systemconfig + #mount /proc and /dev + mount --bind /dev "$mountpoint/dev" + mount --bind /proc "$mountpoint/proc" + + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install + #wrap this in a network check_network, no need to update the db if the import worked. + ##### do I need to start mysql? + /etc/rc.d/mysqld stop + if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ] + then + echo $CMDLINE | grep -q clean_upgrade + status=$? + if [ $status = 0 ] + then + #new db as part of clean upgrade + echo "--------------------------------" + echo "clean upgrade installing new database" + echo "--------------------------------" + chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" |tee /tmp/chrootdb.out + echo "############################################" + echo "End Installing new database/clean" + echo "############################################" + else + #proceed as normal + if [ -f "$mountpoint"/$BACKUPFILE ] + then + echo "--------------------------------" + echo "Restoring database with $BACKUPFILE" + echo "--------------------------------" + chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" "$BACKUPFILE" |tee /tmp/chrootdb_km.out + echo "############################################" + echo "End Restoring database" + echo "############################################" + else + echo "--------------------------------" + echo "Couldn't find backup file, installing new database" + echo "--------------------------------" + touch /tmp/.upgrade_db_failed + chroot "$mountpoint" "$MV_ROOT/bin/install_db_chroot.sh" |tee /tmp/chrootdb.out + echo "############################################" + echo "End Installing new database" + echo "############################################" + fi + fi + fi + + if [ -f /tmp/etc/KnoppMyth-version ] + then + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t hostsettings + #change permissions of /myth (only needed on km->linhes) + chown -R mythtv:mythtv $mountpoint/myth + chown -R root:root $mountpoint/myth/backup + else + chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings + fi + # + #Run second time + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh misc,hostype,network,advanced,user,this_is_install + chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,this_is_install + echo "stopping mysql in chroot" + chroot "$mountpoint" /etc/rc.d/mysqld stop + apply_new_auth + kill_dhcp_chroot + umount -l "$mountpoint/dev" + umount -l "$mountpoint/proc" + + echo "Done" > /tmp/.install_state + cp_and_log /tmp/mythvantage_install.log $mountpoint/var/log/ + + $run umount_it $disk + /etc/rc.d/mysqld start +} + +function netboot-full_install () { + TEMPVAR=${CMDLINE#*nfsroot=} + NFSROOT=${TEMPVAR%% *} + NFSROOT=`echo $NFSROOT|cut -d: -f1` + MAC=`/sbin/ifconfig eth0|grep HWaddr| cut -d: -f2-|awk '{ print $3}'|tr : -` + URL="http://$NFSROOT:1337/diskless.py?HOSTNAME=$hostname&MAC=$MAC" + echo "calling $URL" + echo "Starting" > /tmp/.install_state + curl $URL + ${MV_ROOT}/bin/xconfig.sh +} + +# function killdhcp () { +# if [ -f /etc/dhcpc/dhcpcd-eth0.pid ] +# then +# pid=`cat /etc/dhcpc/dhcpcd-eth0.pid` +# kill -9 $pid +# rm -f /etc/dhcpc/dhcpcd-eth0.pid +# rm -f /var/run/dhcpcd* +# fi +# if [ -f /var/run/dhcpcd-eth0.pid ] +# then +# pid=`cat /var/run/dhcpcd-eth0.pid` +# kill -9 $pid +# rm -f /var/run/dhcpcd-eth0.pid* +# fi +# ip address flush dev eth0 +# } + + + +function SANE_SYSETTINGS () { +sed -e '/HOSTrootfstype/d' \ + -e '/HOSTrootfstype/d' \ + -e '/HOSTdatafstype/d' \ + -e '/HOSTOSsize/d' \ + -e '/HostUseALLdata/d' \ + -e '/HOSTDATAsize/d' \ + -e '/HOSTuprootfstype/d' \ + -e '/HostUseSWAP/d' \ + -e '/HOSTSWAPsize/d ' /tmp/templates/settings/syssettings/settings.txt > /tmp/settings.new + mv /tmp/settings.new /tmp/templates/settings/syssettings/settings.txt +} + case $1 in - full_install_it ) - mv_install.py --rootdisk=$disk --rootfs=$rootfs --rootsize=$rootsize --datafs=$datafs --datasize=$datasize --datadisk=$disk --swapsize=$swapsize -c full_install - ;; + full_install_it ) full_install ;; - NETBOOT) - echo "-----------------------------------------------------------------------3-----" - netboot-full_install - ;; + NETBOOT) +echo "-----------------------------------------------------------------------3-----" + netboot-full_install ;; + + find_update) + + #TRY TO mount first partition of drive + #copy /etc/systemconfig to live, import settings into db + #umount drive + echo $CMDLINE | grep -q clean_upgrade + if [ $? = 1 ] + then + $run mount_it $disk + [ -e "/new_boot/root/backup/mythconverg.sql.gz" ] && cp /new_boot/root/backup/mythconverg.sql.gz /tmp + + + if [ -f /new_boot/etc/systemconfig ] + then + ###########ADD templates + mkdir -p $TEMP_TEMPLATES + cp_and_log /new_boot/$TEMPLATES $TEMP_TEMPLATES + SANE_SYSETTINGS + cp_and_log $TEMP_TEMPLATES/settings $TEMPLATES/ + cp_and_log /new_boot/etc/systemconfig /etc/systemconfig + cp_and_log /new_boot/etc /tmp/etc + cp_and_log /new_boot/var/lib/oss /tmp/oss + [ -e /tmp/etc/mdadm.conf ] && cp_and_log /tmp/etc/mdadm.conf /etc/ - find_update) - mv_install.py --rootdisk=$disk -c find_upgrade + $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings -h $MVHOSTNAME -d 127.0.0.1 + else + cp_and_log /new_boot/etc /tmp/etc + [ -e /tmp/etc/mdadm.conf ] && cp_and_log /tmp/etc/mdadm.conf /etc/ + #now we search for the timezone and try to update + TZREGION=`cat /tmp/etc/timezone | cut -d"/" -f1` + TZSUB=`cat /tmp/etc/timezone | cut -d"/" -f2 -` + + + if [ $TZREGION = $TZSUB ] + then + $run update_db_it HostTimeZoneRegion "$TZREGION" + else + $run update_db_it HostTimeZoneRegion "$TZREGION" + $run update_db_it HostTimeZoneRegion_$TZREGION "$TZSUB" + fi + fi + backup_sql_check + echo $? + upgrade_mount_search + echo $? + $run umount_it $disk + fi ;; - upgrade_it) - mv_install.py --rootdisk=$disk --rootfs=$rootfs -c upgrade + upgrade_it) + upgrade ;; + disk_model_it) + model="unknown" + size="xxx" + case $2 in - disk_model_it) - model="unknown" - size="xxx" - case $2 in - h* ) - model=`cat /proc/ide/$2/model` - ;; - s*) model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '` - ;; - esac - size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' ` - echo ""$model" $size " >/tmp/model + h* ) + model=`cat /proc/ide/$2/model` + ;; + s*) model=`sginfo /dev/$2|grep Product|awk ' { print $2 } '` + ;; + esac + size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' ` + echo ""$model" $size " >/tmp/model ;; + network_check_it) + #Should never return from check_network + case $2 in + setup_network) + vnc_check + install_network_setup + ;; - network_check_it) - #Should never return from check_network - case $2 in - setup_network) - vnc_check - install_network_setup - ;; - - check_self) - myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'` - echo "network check myself" - ifconfig - ping -c 1 $myipdefault - if [ ! $? = 0 ] - then - exit 3 - #can't ping yourself - fi - ;; - check_gw) - #check gateway - echo "network check gateway" - /sbin/route -n - mygwdefault=`/sbin/route -n |grep $default_interface|grep UG|awk '{ print $2}'` - echo "Default gateway seems to be $mygwdefault" - if [ ! x$mygwdefault = x ] - then - sleep 2 - ping -c 5 $mygwdefault - if [ ! $? = 0 ] - then - exit 4 - fi - fi - ;; - check_ns) - #check nameserver - echo " network check nameserver" - mydns=`cat /etc/resolv.conf|grep nameserver|head -1|awk '{ print $2}'` - ping -c 1 $mydns - if [ ! $? = 0 ] - then - exit 5 - fi - ;; - check_names) - echo "network check resolve names" - host google.com - if [ ! $? = 0 ] - then - exit 6 - fi - ;; - host_names) - #if host is found, then check to see if it's online - #if hoip matchs my ip assume it's ok - echo "network check my hostname $hostname" - hout=`host $hostname|head -n1` - status=$? - hoip=`echo $hout|awk '{print $4}'` - if [ $hoip = found: ] - then - status=1 - fi - - unkownhost=`host unkown.linhes.org |head -n1 ` - unkownhostip=`echo $unkownhost |awk '{print $4}'` - - #found host, now grab the ip - if [ $status = 0 ] - then - hoip=`echo $hout|awk '{print $4}'` - /sbin/ifconfig -a |grep -q $hoip - if [ $? = 0 ] - then - echo "DNS ip matches on of my ips $hoip" - status=0 - else - if [ $unkownhostip = $hoip ] - then - echo "Bad DNS returning false hits" - echo "Assuming hostname is OK" - echo "DNS unknown: $unkownhostip" - echo " HOSTDNS: $hoip " - /sbin/ifconfig -a |grep "inet addr" - else - echo "IP in DNS but doesn't match mine, hostname is not safe to use" - echo "DNS:$hoip" - echo "HOST: " - /sbin/ifconfig -a |grep "inet addr" - status=7 + check_self) + myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'` + echo "network check myself" + ifconfig + ping -c 1 $myipdefault + if [ ! $? = 0 ] + then + exit 3 + #can't ping yourself + fi + ;; + check_gw) + #check gateway + echo "network check gateway" + /sbin/route -n + mygwdefault=`/sbin/route -n |grep $default_interface|grep UG|awk '{ print $2}'` + echo "Default gateway seems to be $mygwdefault" + if [ ! x$mygwdefault = x ] + then + sleep 2 + ping -c 5 $mygwdefault + if [ ! $? = 0 ] + then + exit 4 + fi + fi + ;; + check_ns) + #check nameserver + echo " network check nameserver" + mydns=`cat /etc/resolv.conf|grep nameserver|head -1|awk '{ print $2}'` + ping -c 1 $mydns + if [ ! $? = 0 ] + then + exit 5 + fi + ;; + check_names) + echo "network check resolve names" + host google.com + if [ ! $? = 0 ] + then + exit 6 + fi + ;; + host_names) + #if host is found, then check to see if it's online + #if hoip matchs my ip assume it's ok + echo "network check my hostname $hostname" + hout=`host $hostname|head -n1` + status=$? + hoip=`echo $hout|awk '{print $4}'` + if [ $hoip = found: ] + then + status=1 fi - fi - else - echo "Couldn't find hostname in DNS, must be safe to use" - status=0 - fi - exit $status - ;; - - esac - exit 0 - ;; - * ) + unkownhost=`host unkown.linhes.org |head -n1 ` + unkownhostip=`echo $unkownhost |awk '{print $4}'` + + #found host, now grab the ip + if [ $status = 0 ] + then + hoip=`echo $hout|awk '{print $4}'` + /sbin/ifconfig -a |grep -q $hoip + if [ $? = 0 ] + then + echo "DNS ip matches on of my ips $hoip" + status=0 + else + if [ $unkownhostip = $hoip ] + then + echo "Bad DNS returning false hits" + echo "Assuming hostname is OK" + echo "DNS unknown: $unkownhostip" + echo " HOSTDNS: $hoip " + /sbin/ifconfig -a |grep "inet addr" + else + echo "IP in DNS but doesn't match mine, hostname is not safe to use" + echo "DNS:$hoip" + echo "HOST: " + /sbin/ifconfig -a |grep "inet addr" + status=7 + fi + fi + else + echo "Couldn't find hostname in DNS, must be safe to use" + status=0 + fi + exit $status + ;; + + esac + exit 0 + ;; + + + * ) if [ -f /tmp/.install_state ] then state=`cat /tmp/.install_state` @@ -179,7 +709,7 @@ case $1 in if [ -f /tmp/.startsize.io ] then - . /tmp/.startsize.io + . /tmp/.startsize.io #finding the drive ddrive=`df | grep $mountpoint | head -n1 | awk -F/ ' { print $3 } ' | cut -d" " -f 1|cut -b1,2,3 ` used=`statgrab -M disk.|grep ${ddrive}.write_bytes|cut -d= -f 2|tr -d " "` @@ -201,11 +731,7 @@ case $1 in cond2=$(echo "$percent > 98" |bc ) if [ $cond2 -eq 1 ] then - percent=98 - fi - if [ x"${state}" = "xDone" ] - then - percent=100 + percent=98 fi cond3=$(echo "$percent < 3" |bc ) if [ $cond3 -eq 0 ] @@ -214,7 +740,7 @@ case $1 in fi fi fi - ;; + ;; esac diff --git a/abs/core-testing/LinHES-config/ir_config.sh b/abs/core-testing/LinHES-config/ir_config.sh index 69d8406..28134e2 100644 --- a/abs/core-testing/LinHES-config/ir_config.sh +++ b/abs/core-testing/LinHES-config/ir_config.sh @@ -2,8 +2,7 @@ function include_lirc () { config_file=$1 include_file=$2 grep -q ${include_file} ${config_file} - if [ $? = 0 ] - then + if [ "$?" == "0" ]; then echo ${include_file} already present else echo "include \"${include_file}\"" >> $config_file @@ -39,8 +38,7 @@ function setup_ir_remote { #make backup copy mv ${BASE}/etc/lircd.conf ${BASE}/etc/lircd.conf.`date +%Y-%m-%d-%H-%M` mv ${BASE}/etc/lircrc ${BASE}/etc/lircrc.`date +%Y-%m-%d-%H-%M` - if [ $HostBlasterType = pvr150 ] - then + if [ "$HostBlasterType" == "pvr150" ]; then Remotetype=hauppauge-blaster fi @@ -58,18 +56,15 @@ function setup_ir_remote { chmod 755 /etc/lircrc daemon_add="lircd $daemon_add" #standard location for mythtv lircrc - if [ ! -e /home/mythtv/.mythtv/lircrc ] - then - if [ ! -d /home/mythtv/.mythtv ] - then + if [ ! -e /home/mythtv/.mythtv/lircrc ]; then + if [ ! -d /home/mythtv/.mythtv ]; then mkdir /home/mythtv/.mythtv chown mythtv:mythtv /home/mythtv/.mythtv fi ln -s /etc/lircrc /home/mythtv/.mythtv/lircrc 2> /dev/null fi #standard location for lircrc - if [ ! -e /home/mythtv/.lircrc ] - then + if [ ! -e /home/mythtv/.lircrc ]; then ln -s /etc/lircrc /home/mythtv/.lircrc 2> /dev/null fi # echo "Sending hup to lircd" @@ -141,16 +136,14 @@ function setup_lcd () { x) echo "empty lcd" ;; *) echo "setup lcd" - if [ -f $TEMPLATES/LCD/$LCDtype/modules ] - then + if [ -f $TEMPLATES/LCD/$LCDtype/modules ]; then sed -i -e '/.*#LCD/d' ${BASE}/etc/modules.mythvantage cat $TEMPLATES/LCD/$LCDtype/modules >> ${BASE}/etc/modules.mythvantage #should also modprobe fi - if [ -f $TEMPLATES/LCD/$LCDtype/LCDd.conf ] - then + if [ -f $TEMPLATES/LCD/$LCDtype/LCDd.conf ]; then cp_and_log $TEMPLATES/LCD/$LCDtype/LCDd.conf /etc # install="lcdproc $install" daemon_add="lcdd $daemon_add" @@ -160,10 +153,8 @@ function setup_lcd () { fi #check if lirc capable,if so then call setupremote #if not in tinker mode check for remote - if [ ! x$Remotetype = xtinker ] - then - if [ -f $TEMPLATES/LCD/$LCDtype/lircrc ] - then + if [ "$Remotetype" != "tinker" ]; then + if [ -f $TEMPLATES/LCD/$LCDtype/lircrc ]; then cd $TEMPLATES/LCD/$LCDtype for i in lircd* do @@ -182,18 +173,15 @@ function setup_lcd () { } function setup_blaster_proto () { - if [ x$HostBlasterType = x ] - then + if [ "$HostBlasterType" == "" ]; then HostBlasterType = "crap" fi - if [ ! $HostBlasterType = pvr150 -a ! $HostBlasterType = None ] - then + if [[ ("$HostBlasterType" != "pvr150") && ("$HostBlasterType" != "None") ]]; then for i in `seq $Hostnumblaster` do TEMP=HostTransmitproto_$i eval proto=\$${TEMP} - if [ -f $TEMPLATES/transmit/${proto}/lircd.conf ] - then + if [ -f $TEMPLATES/transmit/${proto}/lircd.conf ]; then include_lirc ${BASE}/etc/lircd.conf $TEMPLATES/transmit/${proto}/lircd.conf fi done @@ -207,8 +195,7 @@ function setup_blaster_proto () { function setup_blaster_transmiter () { echo "setup_blaster_transmiter" #if it's Reciever type, then these modules have already been loaded. - if [ ! x$HostBlasterType = xReceiver ] - then + if [ "$HostBlasterType" != "Receiver" ]; then case $HostBlasterType in None) echo "no blaster" sed -i -e '/.*#blaster/d' ${BASE}/etc/modules.mythvantage @@ -235,8 +222,7 @@ function setup_blaster_transmiter () { } function setupir () { - if [ ! x$Remotetype = xtinker ] - then + if [ "$Remotetype" != "tinker" ]; then setup_ir_remote setup_ir_receiver unload_all_lirc diff --git a/abs/core-testing/aumix/PKGBUILD b/abs/core-testing/aumix/PKGBUILD index 560427f..09b525a 100644 --- a/abs/core-testing/aumix/PKGBUILD +++ b/abs/core-testing/aumix/PKGBUILD @@ -2,7 +2,7 @@ pkgname=aumix pkgver=2.8 -pkgrel=3 +pkgrel=4 pkgdesc="A color text mode sound mixer with GPM support" arch=('i686' 'x86_64') license=('GPL') diff --git a/abs/core-testing/fbsplash/PKGBUILD b/abs/core-testing/fbsplash/PKGBUILD index 92a59ea..5d42484 100644 --- a/abs/core-testing/fbsplash/PKGBUILD +++ b/abs/core-testing/fbsplash/PKGBUILD @@ -2,7 +2,7 @@ pkgname=fbsplash pkgver=1.5.4.3 -pkgrel=13 +pkgrel=14 pkgdesc="A userspace implementation of a splash screen for Linux (formerly known as gensplash)" arch=('i686' 'x86_64') url="http://fbsplash.berlios.de" diff --git a/abs/core-testing/fbsplash/darch.tar.bz2 b/abs/core-testing/fbsplash/darch.tar.bz2 Binary files differnew file mode 100644 index 0000000..0faab98 --- /dev/null +++ b/abs/core-testing/fbsplash/darch.tar.bz2 diff --git a/abs/core-testing/fbsplash/fbsplash.inithooks b/abs/core-testing/fbsplash/fbsplash.inithooks index 0e8c60c..c396b92 100644 --- a/abs/core-testing/fbsplash/fbsplash.inithooks +++ b/abs/core-testing/fbsplash/fbsplash.inithooks @@ -28,14 +28,14 @@ stat_busy() { # Load variables # var_load STEP_NR MAX_STEPS RC_MULTI RC_SYSINIT RC_SHUTDOWN # Only update the splash progress if we're in sysinit, multi, or shutdown. # - if [[ ${SPLASH_RC_MULTI} == 1 || ${SPLASH_RC_SYSINIT} == 1 || ${SPLASH_RC_SHUTDOWN} == 1 ]]; then + if [[ "${SPLASH_RC_MULTI}" == "1" || "${SPLASH_RC_SYSINIT}" == "1" || "${SPLASH_RC_SHUTDOWN}" == "1" ]]; then ((SPLASH_STEP_NR++)) SPLASH_PROGRESS=$((100*${SPLASH_STEP_NR}/${SPLASH_MAX_STEPS})) SPLASH_CURRENT_PROGRESS=${SPLASH_PROGRESS} splash_update_progress ${SPLASH_PROGRESS} var_save STEP_NR CURRENT_PROGRESS fi - if [ ${SPLASH_RC_SHUTDOWN} == 1 ]; then + if [ "${SPLASH_RC_SHUTDOWN}" == "1" ]; then save_shutdown_steps fi @@ -57,7 +57,7 @@ start_daemon() { } # rc.sysinit # -if [ $CALLER == '/etc/rc.sysinit' ]; then +if [ "$CALLER" == '/etc/rc.sysinit' ]; then # echo "fbsplash: Setting up splash..." splash_cache_prep SPLASH_MAX_STEPS=$(load_boot_steps) @@ -69,14 +69,14 @@ if [ $CALLER == '/etc/rc.sysinit' ]; then fi # rc.multi # -if [ $CALLER == '/etc/rc.multi' ]; then +if [ "$CALLER" == '/etc/rc.multi' ]; then SPLASH_RC_MULTI=1 SPLASH_RC_SYSINIT=0 var_save RC_MULTI RC_SYSINIT fi # rc.shutdown # -if [ $CALLER == '/etc/rc.shutdown' ]; then +if [ "$CALLER" == '/etc/rc.shutdown' ]; then # echo "fbsplash: Setting up splash..." splash_cache_prep SPLASH_MAX_STEPS=$(load_shutdown_steps) diff --git a/abs/core-testing/mythtv/stable/mythweb/PKGBUILD b/abs/core-testing/mythtv/stable/mythweb/PKGBUILD index 768eba0..e601ae9 100644 --- a/abs/core-testing/mythtv/stable/mythweb/PKGBUILD +++ b/abs/core-testing/mythtv/stable/mythweb/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythweb pkgver=0.21 -pkgrel=13 +pkgrel=15 pkgdesc="Web interface for MythTV's backend" arch=('i686' 'x86_64') url="http://www.mythtv.org" @@ -23,14 +23,15 @@ build() { # tar -zxvf $startdir/patch/icons.tar.gz ### + # Workaround for LIGHTTPD bug in mythweb.pl (affects DB queries) + cd $startdir/src/mythplugins/$pkgname/ + patch -p0 < $startdir/patch/mythweb.pl.diff + cp -r $startdir/src/mythplugins/$pkgname/* $startdir/pkg/$DOCROOT # cp $startdir/src/mythplugins-$pkgver/$pkgname/data/.htaccess $startdir/pkg/$DOCROOT rm $startdir/pkg/srv/$DOCROOT/README chown -R http:users $startdir/pkg/$DOCROOT chmod g+rw $startdir/pkg/$DOCROOT/{image_cache,php_sessions,data} - - - } diff --git a/abs/core-testing/mythtv/stable/mythweb/patch/mythweb.pl.diff b/abs/core-testing/mythtv/stable/mythweb/patch/mythweb.pl.diff new file mode 100644 index 0000000..6dcbf99 --- /dev/null +++ b/abs/core-testing/mythtv/stable/mythweb/patch/mythweb.pl.diff @@ -0,0 +1,23 @@ +*** mythweb-unpatched.pl 2009-06-02 14:55:24.011861459 -0400 +--- mythweb.pl 2009-06-02 14:56:24.386441304 -0400 +*************** +*** 49,57 **** + + # Connect to the database + END { $dbh->disconnect() if ($dbh); } +! our $dbh = DBI->connect("dbi:mysql:database=$ENV{'db_name'}:host=$ENV{'db_server'}", +! $ENV{'db_login'}, +! $ENV{'db_password'}); + unless ($dbh) { + print header(), + "Cannot connect to database: $!\n\n"; +--- 49,57 ---- + + # Connect to the database + END { $dbh->disconnect() if ($dbh); } +! our $dbh = DBI->connect("dbi:mysql:database=$ENV{'DB_NAME'}:host=$ENV{'DB_SERVER'}", +! $ENV{'DB_LOGIN'}, +! $ENV{'DB_PASSWORD'}); + unless ($dbh) { + print header(), + "Cannot connect to database: $!\n\n"; diff --git a/abs/core-testing/tweaker/PKGBUILD b/abs/core-testing/tweaker/PKGBUILD index f546293..9617e49 100644 --- a/abs/core-testing/tweaker/PKGBUILD +++ b/abs/core-testing/tweaker/PKGBUILD @@ -1,6 +1,6 @@ pkgname=tweaker pkgver=1 -pkgrel=29 +pkgrel=31 pkgdesc="" arch=('i686' 'x86_64') diff --git a/abs/core-testing/tweaker/bin/twk_cpu.pl b/abs/core-testing/tweaker/bin/twk_cpu.pl index fb256cb..118bac1 100755 --- a/abs/core-testing/tweaker/bin/twk_cpu.pl +++ b/abs/core-testing/tweaker/bin/twk_cpu.pl @@ -84,7 +84,7 @@ sub implement_option { # } } case "medium" { - change_or_make_setting('AutoCommflagWhileRecording', '0') || exit -1; + change_or_make_setting('AutoCommflagWhileRecording', '1') || exit -1; change_or_make_setting('Theme', 'LinHES') || exit -1; # Moderate eye candy, moderate performance #change_or_make_setting('PreferredMPEG2Decoder', 'libmpeg2') || exit -1; # Least CPU usage, lowest quality #change_or_make_entry("displayprofiles", [["pref_decoder", "libmpeg2"]], [["profilegroupid", "1"], ["profileid", "1"]]) || exit -1; # Least CPU usage, lowest quality @@ -94,7 +94,7 @@ sub implement_option { case "high" { change_or_make_setting('AutoCommflagWhileRecording', '1') || exit -1; # ??? Interacts with screen aspect ratio - change_or_make_setting('Theme', 'LinHES') || exit -1; # High eye candy, potentially low performance + change_or_make_setting('Theme', 'LinHES') || exit -1; # Moderate eye candy, moderate performance #change_or_make_entry("displayprofiles", [["pref_decoder", "ffmpeg"]], [["profilegroupid", "1"], ["profileid", "1"]]) || exit -1; # Most CPU usage, best quality #change_or_make_setting('PreferredMPEG2Decoder', 'ffmpeg') || exit -1; # Most CPU usage, best quality change_or_make_setting('DefaultVideoPlaybackProfile', 'CPU++') || exit -1; # best playback defaults for powerful hardware diff --git a/abs/core-testing/tweaker/bin/twk_general.pl b/abs/core-testing/tweaker/bin/twk_general.pl index 5b48bda..387920c 100755 --- a/abs/core-testing/tweaker/bin/twk_general.pl +++ b/abs/core-testing/tweaker/bin/twk_general.pl @@ -407,12 +407,11 @@ sub implement_option { change_or_make_setting('StartupSecsBeforeRecording', '120'); change_or_make_setting('TruncateDeletesSlowly', '1'); change_or_make_setting('UseOutputPictureControls', '1'); - change_or_make_setting('UserJob1', 'myth2ipod -cut \"%DIR%\" \"%FILE%\"'); - change_or_make_setting('UserJob2', 'myt2xvid3 -cut \"%DIR%\" \"%FILE%\"'); - change_or_make_setting('UserJobDesc1', 'Encode for iPod'); - change_or_make_setting('UserJobDesc2', 'Transcode to XviD'); + change_or_make_setting('UserJob4', 'myth2mp3 -cut \"%DIR%\" \"%FILE%\"'); + change_or_make_setting('UserJobDesc1', 'User Job #1'); + change_or_make_setting('UserJobDesc2', 'User Job #2'); change_or_make_setting('UserJobDesc3', 'User Job #3'); - change_or_make_setting('UserJobDesc4', 'User Job #4'); + change_or_make_setting('UserJobDesc4', 'Extract audio'); change_or_make_setting('VCDPlayerCommand', 'mplayer vcd:\/\/ -cdrom-device %d -fs -zoom -vo xv -vf pp=lb'); change_or_make_setting('VideoArtworkDir', "$SQL_DirVideo/.covers"); change_or_make_setting('VideoBrowserNoDB', '1'); diff --git a/abs/core-testing/tweaker/bin/twk_keymap.sh b/abs/core-testing/tweaker/bin/twk_keymap.sh index 7e4ef8b..2aa38ee 100755 --- a/abs/core-testing/tweaker/bin/twk_keymap.sh +++ b/abs/core-testing/tweaker/bin/twk_keymap.sh @@ -69,5 +69,3 @@ else echo "ERROR: /etc/mplayer/input.conf is missing, which is unexpected." exit -1 fi - -echo "Tweaked keymap"
\ No newline at end of file diff --git a/abs/core/live-installer/PKGBUILD b/abs/core/live-installer/PKGBUILD index 5b41dcd..e93031d 100755 --- a/abs/core/live-installer/PKGBUILD +++ b/abs/core/live-installer/PKGBUILD @@ -1,6 +1,6 @@ pkgname=live-installer pkgver=1.0 -pkgrel=26 +pkgrel=27 pkgdesc="Install and configure your system" #depends=(bc mysql-python expect curl dnsutils) depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils) diff --git a/abs/core/live-installer/install_proxy.sh b/abs/core/live-installer/install_proxy.sh index 756c46d..ec7f29c 100755 --- a/abs/core/live-installer/install_proxy.sh +++ b/abs/core/live-installer/install_proxy.sh @@ -44,7 +44,7 @@ full_install () { sleep 1 $run partition_it $disk $rootsize $datasize $swapsize - echo "Formating $disk" > /tmp/.install_state + echo "Formatting $disk" > /tmp/.install_state progress 2 sleep 1 $run format_it $disk $rootfs $datafs @@ -144,7 +144,7 @@ function upgrade () { if [ ! x$rootfs = "xDo_not_format" ] then - echo "Formating $disk" > /tmp/.install_state + echo "Formatting $disk" > /tmp/.install_state progress 2 sleep 1 $run format_it $disk $rootfs NO diff --git a/abs/mv-core/MythVantage-config/PKGBUILD b/abs/mv-core/MythVantage-config/PKGBUILD index d59299e..70c3029 100755 --- a/abs/mv-core/MythVantage-config/PKGBUILD +++ b/abs/mv-core/MythVantage-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=MythVantage-config pkgver=3.2 -pkgrel=152 +pkgrel=153 pkgdesc="The Gui-installer" depends=(bc mysql-python expect curl dnsutils sg3_utils parted) arch=('i686') diff --git a/abs/mv-core/MythVantage-config/install_proxy.sh b/abs/mv-core/MythVantage-config/install_proxy.sh index 84b397e..9019349 100755 --- a/abs/mv-core/MythVantage-config/install_proxy.sh +++ b/abs/mv-core/MythVantage-config/install_proxy.sh @@ -63,7 +63,7 @@ full_install () { sleep 1 $run partition_it $disk $rootsize $datasize $swapsize - echo "Formating $disk" > /tmp/.install_state + echo "Formatting $disk" > /tmp/.install_state progress 2 sleep 1 $run format_it $disk $rootfs $datafs @@ -165,7 +165,7 @@ function upgrade () { if [ ! x$rootfs = "xDo_not_format" ] then - echo "Formating $disk" > /tmp/.install_state + echo "Formatting $disk" > /tmp/.install_state progress 2 sleep 1 $run format_it $disk $rootfs NO |