User Tools

Site Tools


linuxmce_macmini_2010_4_1:linuxmce_1204_upgrade_script

LinuxMCE Upgrade script

ToDo

  • possy:
    • take care of permission for kernel vmliunz and initrd.img

Settings permissions for kernel thingies ...

test.sh
#!/bin/sh
find /usr/pluto/diskless -maxdepth 1 -iname [0-9]* | cut -d'/' -f5 | while read each;
do
  chmod +r /usr/pluto/diskless/${each}/boot/vmlinu*;
  chmod +r /usr/pluto/diskless/${each}/boot/initrd*;
  chmod +r /usr/pluto/diskless/${each}/vmlinu*;
  chmod +r /usr/pluto/diskless/${each}/initrd*;
  echo "This md is located at $each"
done

The Script

lmceUpgrade1204.sh
#!/bin/sh
 
if (( EUID != 0 )); then
   echo "### You must run this stcript with sudo, e.g. 'sudo ./lmceUpgrade.sh'." 1>&2
   exit 100
fi
 
. /usr/pluto/bin/Config_Ops.sh; ConfEval
 
if [[ "$PK_Device" -eq "1" ]]; then
	 isCore='Core'
	 isHeadless=$AutostartMedia
else 
	isCore='Media Director'
	isHeadless=$AutostartMedia
fi
 
# LET USER CONFIRM UPDATE TO PREVENT ACCIDENTAL UPGRADES ;-)
echo '### WE ARE ABOUT TO UPGRADE LINUXMCE ---> treating device as '$isCore'! <---'
read -p "Continue (y/n)?" CONT
if [ "$CONT" == "y" ]; then
 
	# SET VARIABLES
	backSuffix=.1004
 
	sourceBackup=/etc/apt/sources.list${backSuffix}
	releaseFrom=lucid
	releaseName=precise
 
	mysqlUtf8=default-character-set=utf8
	mysqlUtf8Comment='#default-character-set=utf8'
	mySqlConf=/etc/mysql/my.cnf${backSuffix}
 
	# MODIFY FILES BECAUSE OF CHANGES IN NEW VERSIONS	 
	## MYSQL
	mysqlUtf8='default-'
	mysqlUtf8Comment='#default-'
	mySqlConf=/etc/mysql/my.cnf${backSuffix}
 
	## MYSQL
	echo 'save backup "my.cnf" to ' $mySqlConf '...'
	cp /etc/mysql/my.cnf ${mySqlConf}
	echo 'Set value in my.cnf from' $mysqlUtf8 'to' $mysqlUtf8Comment
	sed -i "s/$mysqlUtf8/$mysqlUtf8Comment/g" /etc/mysql/my.cnf
	sed -i "s/$mysqlUtf8/$mysqlUtf8Comment/g" /etc/mysql/conf.d/lmce-my.cnf  
 
	### REMOVE Packages/.gz FROM deb-cache
	echo 'remove and recreate Packages & Packages.gz in deb-cache'
	rm -f /usr/pluto/deb-cache/Package*
	touch /usr/pluto/deb-cache/Packages.gz
	touch /usr/pluto/deb-cache/Packages
 
	echo '### do-release-upgrade'		
	do-release-upgrade -f DistUpgradeViewNonInteractive
 
	echo 'Set PK_Distro = 20'
	ConfSet PK_Distro 20
 
	## SOURCES.LIST
	echo 'save backup "sources.list" to' $sourceBackup '...'
	cp /etc/apt/sources.list $sourceBackup
	echo 'Set package entries from beta2 to unstable' 
	sed -i "s/beta2/unstable/g" /etc/apt/sources.list
 
	echo '### RE-ENABLE THIRD PARTY SOURCES'
	sed -i "s/# deb/deb/g" /etc/apt/sources.list
 
 
	## DIFFERENCES BETWEEN CORE AND MD
	if [[ "$PK_Device" -eq "1" ]]; then
		echo '### '$isCore': FORCE UPDATE & FORCE INSTALL OF pluto-dcerouter'
		apt-get update
		apt-get -y --force-yes install pluto-dcerouter
 
                find /usr/pluto/diskless -maxdepth 1 -iname [0-9]* | cut -d'/' -f5 | while read each;
                do
                  chmod +r /usr/pluto/diskless/${each}/boot/vmlinu*;
                  chmod +r /usr/pluto/diskless/${each}/boot/initrd*;
                  chmod +r /usr/pluto/diskless/${each}/vmlinu*;
                  chmod +r /usr/pluto/diskless/${each}/initrd*;
                  echo "This md is located at $each"
                done
 
	else
		echo '### '$isCore': FORCE INSTALL OF pluto-confirm-dependencies' 
		apt-get -y --force-yes install pluto-confirm-dependencies
 
                chmod +r /boot/vmlinu*;
                chmod +r /boot/initrd*;
	fi
 
	echo 'Set AutostartMedia = '$isHeadless
	ConfSet AutostartMedia $isHeadless
 
	if [ "$isHeadless" == "0" ]; then
		echo 'Disable "kdm" for Headless Core'
		update-rc.d -f kdm remove
	fi
 
	echo '### CHECKING INSTALLATION ... isCore=' $PK_Device
	/usr/pluto/bin/ConfirmDependencies -h localhost -u root -o 20 -f -d $PK_Device install > /usr/pluto/bin/verifyinstallation.sh && chmod +x /usr/pluto/bin/verifyinstallation.sh && /usr/pluto/bin/verifyinstallation.sh
	apt-get -y dist-upgrade
 
	echo '### 12.04 INSTALLED? ... reboot and run through AVWizard and say "Hello" to Sarah'
 
else
  echo "### LinuxMCE upgrade canceled!";
fi
linuxmce_macmini_2010_4_1/linuxmce_1204_upgrade_script.txt · Last modified: 2013/04/16 17:29 by 127.0.0.1