[SCM] Debian Live application startscripts branch, master, updated. 85189905f5ca49359f1e153877dd4c636da39b55

Daniel Baumann daniel at debian.org
Fri Dec 19 18:43:06 UTC 2008


The following commit has been merged in the master branch:
commit 85189905f5ca49359f1e153877dd4c636da39b55
Author: Daniel Baumann <daniel at debian.org>
Date:   Fri Dec 19 19:38:38 2008 +0100

    Rewrapping live-vmware-player and correcting couple of style issues.

diff --git a/initscripts/live-vmware-player b/initscripts/live-vmware-player
index 3d35914..07a4c4b 100755
--- a/initscripts/live-vmware-player
+++ b/initscripts/live-vmware-player
@@ -1,181 +1,227 @@
 #!/bin/sh
+
 ### BEGIN INIT INFO
-# Provides:          live-vmware-player
+# Provides:		live-vmware-player
 # Required-Start:
 # Required-Stop:
 # Default-Start:
 # Default-Stop:
-# Short-Description: Setup miscellaneous things for VMWarePlayer.
-# Description:	The script tests for boot parameter of custom_options=ACTION:IMAGEPATH:VMXNAME
-# 		ACTION: The operation to perform on the workstation (none|scratch)
-#		IMAGEPATH: The folder path to the VMWare image you want to run.
-#		VMXNAME: The name of the VMWare image you want to run.
-# Notes:To use this file with WMWare images you will need to have a few things setup:
-#	1.) The VMWare Player needs to be installed in the image.
-#	2.) This script uses (s|h)da1 for writing image data, and is used as a scratch space.
-#	    This scratch space should be a file system with linux permissions such as ext2.
-#	3.) VMWare image(s) should be in a mounted folder and setup as follows:
-#	    - Image(s) set to snapshot mode.
-#	    - For each image, the image folder needs to have a file called image-release with a
-#	      variable CRELEASE. An example: CRELEASE="1.0.0"
-#             The image-release file is used by the image maintainer and this script to tell
-#	      workstation(s) using a given image, to erase locally stored vmware image files
-#	      and setup with the newly configure image. The operation of erasing locally stored
-#	      vmare image files, is referred to as a scratch.
+# Short-Description:	Setting up VMware Player.
+# Description:		This script setups all necessary things to do a complete
+#			deployment of VMware Player based live systems.
 ### END INIT INFO
 
+# The script tests for boot parameter of custom_options=ACTION:IMAGEPATH:VMXNAME
+#
+# ACTION: The operation to perform on the workstation (none|scratch)
+# IMAGEPATH: The folder path to the VMware image you want to run.
+# VMXNAME: The name of the VMware image you want to run.
+#
+# Notes:To use this file with WMWare images you will need to have a few things
+# setup:
+#
+# 1. The VMware Player needs to be installed in the image.
+# 2. This script uses (s|h)da1 for writing image data, and is used as a scratch
+#    space. This scratch space should be a file system with linux permissions
+#    such as ext2.
+# 3. VMware image(s) should be in a mounted folder and setup as follows:
+#    - Image(s) set to snapshot mode.
+#    - For each image, the image folder needs to have a file called
+#      image-release with a variable CRELEASE. An example: CRELEASE="1.0.0"
+#
+# The image-release file is used by the image maintainer and this script to tell
+# workstation(s) using a given image, to erase locally stored vmware image files
+# and setup with the newly configure image. The operation of erasing locally
+# stored vmare image files, is referred to as a scratch.
+
 PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
-do_start () {
-        for x in $(cat /proc/cmdline); do
-		case $x in
-                	custom_options=*)
-				echo "Starting custom options of ${x#custom_options=} for VMPlayer setup." >>/var/log/live-vmware-player.log
-				# Source in some variables.
-				if [ -f /etc/live.conf ]; then
-					echo "Found /etc/live.conf!" >>/var/log/live-vmware-player.log
-					. /etc/live.conf
-				else
-					echo "No /etc/live.conf found!" >>/var/log/live-vmware-player.log
-					break
-				fi
-				# Ok here is where we need to determine info passed to do the magic.
-				ACTION=`echo ${x#custom_options=} | awk -F: '{print $1}'`
-				echo "ACTION of $ACTION " >>/var/log/live-vmware-player.log
-				IMAGEPATH=`echo ${x#custom_options=} | awk -F: '{print $2}'`
-				echo "IMAGEPATH of $IMAGEPATH " >>/var/log/live-vmware-player.log
-				VMXNAME=`echo ${x#custom_options=} | awk -F: '{print $3}'`
-				echo "VMXNAME of $VMXNAME " >>/var/log/live-vmware-player.log
-				echo "Setting up a symlink to the image we are going to use from the image pool." >>/var/log/live-vmware-player.log
-				ln -s $IMAGEPATH $IMAGEPATH/$VMXNAME
-				echo "Setting the session type with .dmrc for gdm." >>/var/log/live-vmware-player.log
-				cat > /home/$USERNAME/.dmrc <<EOF
+do_start ()
+{
+	if ! grep -qs "custom_options=" /proc/cmdline
+	then
+		exit 0
+	fi
+
+	echo "Starting custom options of ${x#custom_options=} for VMPlayer setup." >> /var/log/live-vmware-player.log
+
+	# Source in some variables.
+	if [ -f /etc/live.conf ]
+	then
+		echo "Found /etc/live.conf!" >> /var/log/live-vmware-player.log
+		. /etc/live.conf
+	else
+		echo "No /etc/live.conf found!" >> /var/log/live-vmware-player.log
+		break
+	fi
+
+	# Ok here is where we need to determine info passed to do the magic.
+	ACTION="$(echo ${x#custom_options=} | awk -F: '{print $1}')"
+	echo "ACTION of ${ACTION} " >> /var/log/live-vmware-player.log
+
+	IMAGEPATH="$(echo ${x#custom_options=} | awk -F: '{print $2}')"
+	echo "IMAGEPATH of ${IMAGEPATH} " >> /var/log/live-vmware-player.log
+
+	VMXNAME="$(echo ${x#custom_options=} | awk -F: '{print $3}')"
+	echo "VMXNAME of ${VMXNAME} " >> /var/log/live-vmware-player.log
+
+	echo "Setting up a symlink to the image we are going to use from the image pool." >> //var/log/live-vmware-player.log
+
+	ln -s ${IMAGEPATH} ${IMAGEPATH}/${VMXNAME}
+
+	echo "Setting the session type with .dmrc for gdm." >> /var/log/live-vmware-player.log
+
+cat > /home/${USERNAME}/.dmrc << EOF
 [Desktop]
 Session=vmware
 EOF
-				echo "Setting permissions on session type." >>/var/log/live-vmware-player.log
-				chown -R $USERNAME:$USERNAME /home/$USERNAME/.dmrc
 
-				echo "Setting the PostSession Default for the gdm to shutdown when we end the VMPlayer stops." >>/var/log/live-vmware-player.log
-				cat > /etc/gdm/PostSession/Default <<EOF
+	echo "Setting permissions on session type." >> /var/log/live-vmware-player.log
+	chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.dmrc
+
+	echo "Setting the PostSession Default for the gdm to shutdown when we end the VMPlayer stops." >> /var/log/live-vmware-player.log
+
+cat > /etc/gdm/PostSession/Default << EOF
 #!/bin/sh
+
 /sbin/halt
 EOF
-				echo "Setting up the vmware.desktop option." >>/var/log/live-vmware-player.log
-				cat > /usr/share/xsessions/vmware.desktop <<EOF
 
+	echo "Setting up the vmware.desktop option." >> /var/log/live-vmware-player.log
+
+cat > /usr/share/xsessions/vmware.desktop << EOF
 [Desktop Entry]
 Encoding=UTF-8
-Name=VMWare Player
-Comment=This session logs you into a VMWare session.
+Name=VMware Player
+Comment=This session logs you into a VMware session.
 Exec=/usr/bin/vmwrapper
 # no icon yet, only the top three are currently used
 Icon=
 Type=Application
 EOF
-				echo "Setup the vmwrapper which starts the vmplayer with a window manager." >>/var/log/live-vmware-player.log
-				cat > /usr/bin/vmwrapper <<EOF
+
+	echo "Setup the vmwrapper which starts the vmplayer with a window manager." >> /var/log/live-vmware-player.log
+
+cat > /usr/bin/vmwrapper << EOF
 #!/bin/sh
+
 /usr/bin/metacity &
-/usr/bin/vmplayer -X "/vmware/$VMXNAME.vmx"
+/usr/bin/vmplayer -X "/vmware/${VMXNAME}.vmx"
 EOF
-				echo "Setting chmod on the vmwrapper." >>/var/log/live-vmware-player.log
-				chmod 755 /usr/bin/vmwrapper
-
-				# Here is where once the player prompts are agreed it is injected.
-				echo "Copying over vmware settings for the user account $USERNAME." >>/var/log/live-vmware-player.log
-				cp -R /etc/vmware/.vmware /home/$USERNAME/
-
-				echo "Setting permissions on the users .vmware folder." >>/var/log/live-vmware-player.log
-				chown -R $USERNAME:$USERNAME /home/$USERNAME/.vmware
-
-				echo "Making the /vmware directory where we will compose the operations for the image." >>/var/log/live-vmware-player.log
-				mkdir /vmware
-
-				echo "Checking for a local scratch device." >>/var/log/live-vmware-player.log
-				MOUNTDEV=`fdisk -l | grep a1 | awk '{print $1}'`
-				echo "Potential scratch devices of: $MOUNTDEV" >>/var/log/live-vmware-player.log
-
-				####################################################################################################
-				# Below is where I use a variable named CRELEASE which is sourced in from the image directory.
-				# This file is created by the person managing the images so he can modify an image and all
-				# workstations using the image will know to auto scratch (erase local snapshot info) on next boot
-				# when the difference is detected between the image mainter variable in image-relase and the
-				# file local-release (with variable RELEASE).
-				####################################################################################################
-				# This is the test for when we want to upgrade an image and deploy to all workstations. Workstations
-				# will scratch upon CRELEASE != RELEASE.
-				if [ -f $IMAGEPATH/image-release ]; then
-					. $IMAGEPATH/image-release
-					echo "Found image-release: $CRELEASE " >>/var/log/live-vmware-player.log
-				else
-					echo "******* No image-release found to set the CRELEASE variable! *******" >>/var/log/live-vmware-player.log
-					CRELEASE="NONE"
-				fi
-
-				echo "Preparing VMWare image version $CRELEASE" >>/var/log/live-vmware-player.log
-				echo "Checking for clean scratch file system on $MOUNTDEV!" >>/var/log/live-vmware-player.log
-				fsck -C -a $MOUNTDEV
-
-				echo "Attempting to mount local scratch device." >>/var/log/live-vmware-player.log
-				mount -v $MOUNTDEV /vmware
-
-				echo "Checking to see if scratch was requested at boot." >>/var/log/live-vmware-player.log
-				if [ "$ACTION" = "scratch" ]; then
-					echo "Scratching everything in scratch dir on the fly!" >>/var/log/live-vmware-player.log
-					rm -rf /vmware/*
-					echo "Scratching completed!" >>/var/log/live-vmware-player.log
-				fi
-
-
-				if [ -f /vmware/local-release ]; then
-					. /vmware/local-release
-					echo "Found local-release: $RELEASE " >>/var/log/live-vmware-player.log
-					if [ "$RELEASE" != "$CRELEASE" ]; then
-						echo "Upgrading release from version $RELEASE to $CRELEASE ." >>/var/log/live-vmware-player.log
-						echo "We will take scratch actions." >>/var/log/live-vmware-player.log
-						rm -rf /vmware/*
-						echo RELEASE=\"$CRELEASE\">/vmware/local-release
-						echo "Rsyncing in some stuff to /vmware." >>/var/log/live-vmware-player.log
-						rsync --exclude=$VMXNAME-f*.vmdk -r $IMAGEPATH/ /vmware/
-						# Link in the big chunks.
-						ln -s $IMAGEPATH/$VMXNAME-f*.vmdk /vmware
-					else
-						echo "Version match no scratch action taken!" >>/var/log/live-vmware-player.log
-						echo "Removing any temp old lock files!" >>/var/log/live-vmware-player.log
-						rm -f /vmware/*LOCK
-					fi
-				else
-					echo "Looks like an initial release setup for version $CRELEASE ." >>/var/log/live-vmware-player.log
-					echo RELEASE=\"$CRELEASE\">/vmware/local-release
-					echo "Rsyncing in some stuff to /vmware." >>/var/log/live-vmware-player.log
-					rsync --exclude=$VMXNAME-f*.vmdk -r $IMAGEPATH/ /vmware/
-					# Link in the big chunks.
-					ln -s $IMAGEPATH/$VMXNAME-f*.vmdk /vmware
-				fi
-
-				echo "Setting the permissions on the /vmware folder." >>/var/log/live-vmware-player.log
-				chown -R $USERNAME:$USERNAME /vmware
-
-				echo "Completed custom options for username = $USERNAME !" >>/var/log/live-vmware-player.log
-				;;
-                esac
-	done
+
+	echo "Setting chmod on the vmwrapper." >> /var/log/live-vmware-player.log
+	chmod 0755 /usr/bin/vmwrapper
+
+	# Here is where once the player prompts are agreed it is injected.
+	echo "Copying over vmware settings for the user account ${USERNAME}." >> /var/log/live-vmware-player.log
+	cp -R /etc/vmware/.vmware /home/${USERNAME}
+
+	echo "Setting permissions on the users .vmware folder." >> /var/log/live-vmware-player.log
+	chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.vmware
+
+	echo "Making the /vmware directory where we will compose the operations for the image." >> /var/log/live-vmware-player.log
+	mkdir -p /vmware
+
+	echo "Checking for a local scratch device." >> /var/log/live-vmware-player.log
+	MOUNTDEV="$(fdisk -l | grep a1 | awk '{print $1}')"
+	echo "Potential scratch devices of: ${MOUNTDEV}" >> /var/log/live-vmware-player.log
+
+	########################################################################
+	# Below is where I use a variable named CRELEASE which is sourced in
+	# from the image directory.
+	# This file is created by the person managing the images so he can
+	# modify an image and all workstations using the image will know to auto
+	# scratch (erase local snapshot info) on next boot when the difference
+	# is detected between the image mainter variable in image-relase and the
+	# file local-release (with variable RELEASE).
+	########################################################################
+
+	# This is the test for when we want to upgrade an image and deploy to
+	# all workstations. Workstations will scratch upon CRELEASE != RELEASE.
+
+	if [ -f "${IMAGEPATH}/image-release" ]
+	then
+		. "${IMAGEPATH}/image-release"
+
+		echo "Found image-release: ${CRELEASE} " >> /var/log/live-vmware-player.log
+	else
+		echo "******* No image-release found to set the CRELEASE variable! *******" >> /var/log/live-vmware-player.log
+
+		CRELEASE="NONE"
+	fi
+
+	echo "Preparing VMware image version ${CRELEASE}" >> /var/log/live-vmware-player.log
+
+	echo "Checking for clean scratch file system on ${MOUNTDEV}!" >> /var/log/live-vmware-player.log
+	fsck -C -a ${MOUNTDEV}
+
+	echo "Attempting to mount local scratch device." >> /var/log/live-vmware-player.log
+	mount -v ${MOUNTDEV} /vmware
+
+	echo "Checking to see if scratch was requested at boot." >> /var/log/live-vmware-player.log
+	if [ "${ACTION}" = "scratch" ]
+	then
+		echo "Scratching everything in scratch dir on the fly!" >> /var/log/live-vmware-player.log
+		rm -rf /vmware/*
+
+		echo "Scratching completed!" >> /var/log/live-vmware-player.log
+	fi
+
+	if [ -f /vmware/local-release ]
+	then
+		. /vmware/local-release
+
+		echo "Found local-release: ${RELEASE} " >> /var/log/live-vmware-player.log
+
+		if [ "${RELEASE}" != "${CRELEASE}" ]
+		then
+			echo "Upgrading release from version ${RELEASE} to ${CRELEASE}." >> /var/log/live-vmware-player.log
+			echo "We will take scratch actions." >> /var/log/live-vmware-player.log
+			rm -rf /vmware/*
+
+			echo RELEASE=\"${CRELEASE}\" > /vmware/local-release
+			echo "Rsyncing in some stuff to /vmware." >> /var/log/live-vmware-player.log
+			rsync --exclude=${VMXNAME}-f*.vmdk -r ${IMAGEPATH}/ /vmware/
+
+			# Link in the big chunks.
+			ln -s ${IMAGEPATH}/${VMXNAME}-f*.vmdk /vmware
+		else
+			echo "Version match no scratch action taken!" >> /var/log/live-vmware-player.log
+			echo "Removing any temp old lock files!" >> /var/log/live-vmware-player.log
+			rm -f /vmware/*LOCK
+		fi
+	else
+		echo "Looks like an initial release setup for version ${CRELEASE}." >> /var/log/live-vmware-player.log
+		echo RELEASE=\"${CRELEASE}\" > /vmware/local-release
+		echo "Rsyncing in some stuff to /vmware." >> /var/log/live-vmware-player.log
+		rsync --exclude=${VMXNAME}-f*.vmdk -r ${IMAGEPATH}/ /vmware/
+
+		# Link in the big chunks.
+		ln -s ${IMAGEPATH}/${VMXNAME}-f*.vmdk /vmware
+	fi
+
+	echo "Setting the permissions on the /vmware folder." >> /var/log/live-vmware-player.log
+	chown -R ${USERNAME}:${USERNAME} /vmware
+
+	echo "Completed custom options for username = ${USERNAME} !" >> /var/log/live-vmware-player.log
 }
 
-case "$1" in
-  start|"")
-	do_start
-	;;
-  restart|reload|force-reload)
-	echo "Error: argument '$1' not supported" >&2
-	exit 3
-	;;
-  stop)
-	# No-op
-	;;
-  *)
-	echo "Usage: live-vmware-player [start|stop]" >&2
-	exit 3
+case "${1}" in
+	start|"")
+		do_start
+		;;
+
+	restart|reload|force-reload)
+		echo "Error: argument '${1}' not supported" >&2
+		exit 3
 	;;
+
+	stop)
+		# No-op
+		;;
+
+	*)
+		echo "Usage: live-vmware-player [start|stop]" >&2
+		exit 3
+		;;
 esac

-- 
Debian Live application startscripts



More information about the debian-live-changes mailing list