summaryrefslogtreecommitdiffstats
path: root/abs
diff options
context:
space:
mode:
Diffstat (limited to 'abs')
-rwxr-xr-xabs/core-testing/LinHES-config/PKGBUILD2
-rwxr-xr-xabs/core-testing/LinHES-config/install_proxy.sh112
-rw-r--r--abs/core-testing/LinHES-config/networkconfig.sh7
-rw-r--r--abs/core-testing/LinHES-config/restore_km_db_chroot.sh9
-rw-r--r--abs/mv-core/MythVantage-config/networkconfig.sh8
5 files changed, 83 insertions, 55 deletions
diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD
index 543d182..68f88c9 100755
--- a/abs/core-testing/LinHES-config/PKGBUILD
+++ b/abs/core-testing/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-config
pkgver=1.0
-pkgrel=103
+pkgrel=115
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 )
diff --git a/abs/core-testing/LinHES-config/install_proxy.sh b/abs/core-testing/LinHES-config/install_proxy.sh
index e6b0976..f251c70 100755
--- a/abs/core-testing/LinHES-config/install_proxy.sh
+++ b/abs/core-testing/LinHES-config/install_proxy.sh
@@ -14,6 +14,7 @@ run=$MV_ROOT/bin/install_functions.sh
. /etc/systemconfig 2>/dev/null
. $MV_ROOT/bin/networkconfig.sh
CMDLINE=$(cat /proc/cmdline)
+BACKUPFILE="/myth/backup/mythconverg.sql.gz"
#TEMPNET="Hostip"$default_interface
#eval MYTHIP=\$${TEMPNET}
@@ -53,11 +54,13 @@ function apply_new_auth () {
function backup_sql_check {
-
- if [ -f $mountpoint/myth/backup/mythconverg.sql.gz ]
+ if [ -f ${mountpoint}${BACKUPFILE} ]
then
+
+ echo "found ${mountpoint}${BACKUPFILE} "
return 0
else
+ echo "did not find ${mountpoint}${BACKUPFILE} "
return 1
fi
}
@@ -66,8 +69,15 @@ function upgrade_mount_search {
MYTH_P=`cat /tmp/etc/fstab |grep /myth| awk ' {print $1 '} `
umount $mountpoint/myth
mount $MYTH_P $mountpoint/myth
+ backup_sql_check
+ if [ $? = 1 ]
+ then
+ mkdir -p /new_boot/root/backup
+ cp -f /tmp/mythconverg.sql.gz /new_boot/root/backup/mythconverg.sql.gz
+ BACKUPFILE="/root/backup/mythconverg.sql.gz"
+ echo "setting BACKUPFILE to $BACKUPFILE"
+ fi
return 0
-
}
@@ -195,7 +205,7 @@ function upgrade () {
$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
+ echo "Upgrading $hostname" > /tmp/.install_state
sleep 1
cp -rf /tmp/etc /new_boot/etc.old
cp -rf /tmp/oss /new_boot/var/lib/oss.old
@@ -210,7 +220,7 @@ function upgrade () {
cp -fp /new_boot/etc.old/ssh/*.pub /new_boot/etc/ssh/
cp -fp /new_boot/etc.old/ssh/*.key /new_boot/etc/ssh/
cp -fp /new_boot/etc.old/ssh/*key /new_boot/etc/ssh/
-
+ cp -fp /new_boot/etc.old/mdadm.conf /new_boot/etc/
if [ ! -f /tmp/etc/KnoppMyth-version ]
then
#passwd/shadow/group
@@ -225,27 +235,27 @@ function upgrade () {
fi
$run fstab_fix_it $disk UPGRADE
- #this is here to copy in the systemconfig file as soon as possible.
+ #this is here to copy in the systemconfig file as soon as possible.
cp -f /etc/systemconfig "$mountpoint"/etc
echo "Writing boot sector" > /tmp/.install_state
progress 99
sleep 1
$run grub_it $disk
-
-
- echo "Configuring system" > /tmp/.install_state
+ echo "Configuring system" > /tmp/.install_state
progress
sleep 1
cp /etc/mtab "$mountpoint"/etc/mtab
cp -f /etc/systemconfig "$mountpoint"/etc
#make sure mythconverg.sql.gz is present
- if [ ! backup_sql_check ]
+ backup_sql_check
+ if [ $? = 1 ]
then
upgrade_mount_search
fi
-
- if [ -f /tmp/etc/KnoppMyth-version ]
+ 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
@@ -255,9 +265,14 @@ function upgrade () {
chown root:mythtv "$mountpoint"/etc/systemconfig
chown -R mythtv:mythtv ${mountpoint}$SE
chmod -R 775 ${mountpoint}$SE
- touch $mountpoint/home/mythtv/.kmupgrade && chmod 777 $mountpoint/home/mythtv/.kmupgrade
+ if [ ! $status = 0 ]
+ then
+ touch $mountpoint/home/mythtv/.kmupgrade && chmod 777 $mountpoint/home/mythtv/.kmupgrade
+ fi
fi
+
+
cp -f $MV_ROOT/bin/*.sh "$mountpoint"$MV_ROOT/bin/
chmod -R 755 ${mountpoint}/root
chown root:mythtv "$mountpoint"/etc/systemconfig
@@ -270,29 +285,41 @@ function upgrade () {
#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 [ -f /new_boot/myth/backup/mythconverg.sql.gz ]
+ echo $CMDLINE | grep -q clean_upgrade
+ status=$?
+ if [ $status = 0 ]
then
+ #new db as part of clean upgrade
echo "--------------------------------"
- echo "Restoring database"
+ echo "clean upgrade installing new database"
echo "--------------------------------"
- chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" > /tmp/chrootdb_km.out
- 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" > /tmp/chrootdb.out
+ else
+ #proceed as normal
+ if [ -f "$mountpoint"/$BACKUPFILE ]
+ then
+ echo "--------------------------------"
+ echo "Restoring database"
+ echo "--------------------------------"
+ chroot "$mountpoint" "$MV_ROOT/bin/restore_km_db_chroot.sh" "$BACKUPFILE" > /tmp/chrootdb_km.out
+ 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" > /tmp/chrootdb.out
+ fi
fi
if [ -f /tmp/etc/KnoppMyth-version ]
then
- chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t hostsettings
+ 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
+ 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
+ chroot "$mountpoint" $MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings
fi
#
#Run second time
@@ -300,8 +327,6 @@ function upgrade () {
chroot "$mountpoint" $MV_ROOT/bin/systemconfig.sh advanced,this_is_install
apply_new_auth
-
-
umount "$mountpoint/dev"
umount "$mountpoint/proc"
@@ -364,10 +389,15 @@ echo "-----------------------------------------------------------------------3--
netboot-full_install ;;
find_update)
+
#TRY TO mount first partition of drive
#copy /etc/systemconfig to live, import settings into db
#umount drive
- $run mount_it $disk
+ 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
@@ -378,10 +408,11 @@ echo "-----------------------------------------------------------------------3--
cp /new_boot/etc/systemconfig /etc/systemconfig
cp -rf /new_boot/etc /tmp/etc
cp -rf /new_boot/var/lib/oss /tmp/oss
-
+ [ -e /tmp/etc/mdadm.conf ] && cp -rf /tmp/etc/mdadm.conf /etc/
$MV_ROOT/bin/restore_default_settings.sh -c restore -t syssettings -h $MVHOSTNAME -d 127.0.0.1
else
cp -rf /new_boot/etc /tmp/etc
+ [ -e /tmp/etc/mdadm.conf ] && cp -rf /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 -`
@@ -394,20 +425,13 @@ echo "-----------------------------------------------------------------------3--
$run update_db_it HostTimeZoneRegion "$TZREGION"
$run update_db_it HostTimeZoneRegion_$TZREGION "$TZSUB"
fi
-
-
-
fi
-
-
-
$run umount_it $disk
+ fi
;;
upgrade_it)
- #"$MV_ROOT/bin/install_proxy.sh upgrade_it " + install_drive + " " + rootfs + "&"
upgrade
-
;;
disk_model_it)
model="unknown"
@@ -420,11 +444,8 @@ echo "-----------------------------------------------------------------------3--
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
-
+ size=`parted /dev/$2 print |grep Disk|awk ' { print $3 } ' `
+ echo ""$model" $size " >/tmp/model
;;
network_check_it)
#Should never return from check_network
@@ -437,7 +458,7 @@ echo "-----------------------------------------------------------------------3--
check_self)
myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'`
echo "network check myself"
- ifconfig
+ ifconfig
ping -c 1 $myipdefault
if [ ! $? = 0 ]
then
@@ -448,12 +469,13 @@ echo "-----------------------------------------------------------------------3--
check_gw)
#check gateway
echo "network check gateway"
- /sbin/route -n
+ /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
- ping -c 1 $mygwdefault
+ sleep 2
+ ping -c 5 $mygwdefault
if [ ! $? = 0 ]
then
exit 4
diff --git a/abs/core-testing/LinHES-config/networkconfig.sh b/abs/core-testing/LinHES-config/networkconfig.sh
index 23e3774..5611265 100644
--- a/abs/core-testing/LinHES-config/networkconfig.sh
+++ b/abs/core-testing/LinHES-config/networkconfig.sh
@@ -51,8 +51,11 @@ function change_iface_state () {
sed -i -e 's/^DISABLED=.*$/DISABLED=no/g' $ETCNETDIR/$1/options
else
echo "setting $1 to inactive"
- sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options
- sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' $ETCNETDIR/$1/options
+ if [ -e $ETCNETDIR/$1/options ]
+ then
+ sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options
+ sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' $ETCNETDIR/$1/options
+ fi
/sbin/ifconfig $1 down
ip address flush $1
fi
diff --git a/abs/core-testing/LinHES-config/restore_km_db_chroot.sh b/abs/core-testing/LinHES-config/restore_km_db_chroot.sh
index 17ad113..7ff6faf 100644
--- a/abs/core-testing/LinHES-config/restore_km_db_chroot.sh
+++ b/abs/core-testing/LinHES-config/restore_km_db_chroot.sh
@@ -30,12 +30,11 @@ if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ]
pacman --noconfirm -R mythdb-initial
pacman --noconfirm -S mythdb-initial
- if [ -f /myth/backup/mythconverg.sql.gz ]
+ if [ -f $DBFILE ]
then
echo "restoring old database"
- gunzip -c /myth/backup/mythconverg.sql.gz > /myth/backup/mythconverg.sql
- mysql mythconverg < /myth/backup/mythconverg.sql
-
+ gunzip -c $DBFILE > /tmp/mythconverg.sql
+ mysql mythconverg < /tmp/mythconverg.sql
else
echo "Could not restore old database, mythconverg.sql is missing."
touch /tmp/.upgrade_db_failed
@@ -48,7 +47,7 @@ if [ $SystemType = "Master_backend" -o $SystemType = "Standalone" ]
fi
fi
done
- rm -f /myth/backup/mythconverg.sql
+ rm -f /tmp/mythconverg.sql
else
exit 0
fi
diff --git a/abs/mv-core/MythVantage-config/networkconfig.sh b/abs/mv-core/MythVantage-config/networkconfig.sh
index b4ffd5c..5611265 100644
--- a/abs/mv-core/MythVantage-config/networkconfig.sh
+++ b/abs/mv-core/MythVantage-config/networkconfig.sh
@@ -51,8 +51,11 @@ function change_iface_state () {
sed -i -e 's/^DISABLED=.*$/DISABLED=no/g' $ETCNETDIR/$1/options
else
echo "setting $1 to inactive"
- sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options
- sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' $ETCNETDIR/$1/options
+ if [ -e $ETCNETDIR/$1/options ]
+ then
+ sed -i -e 's/^ONBOOT=.*$/ONBOOT=no/g' $ETCNETDIR/$1/options
+ sed -i -e 's/^DISABLED=.*$/DISABLED=yes/g' $ETCNETDIR/$1/options
+ fi
/sbin/ifconfig $1 down
ip address flush $1
fi
@@ -262,6 +265,7 @@ function start_network {
if [ ! $USEVNC = 0 ]
then
/etc/net/scripts/network.init reload
+ /etc/net/scripts/network.init restart
else
echo "VNC/NETBOOT in use, will NOT restart network"
fi