From 71ecbe8e688b11dd3baf8dc1c41d3b355eac01c6 Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Fri, 23 Oct 2009 17:26:38 +0000 Subject: default directories introduced. please test and say what you think. examples see plugins vmware and vmchooser. can be simplyfied further (VIRTDIR, ETC...). /opt/openslx can bu user for plugins, ect as well (maybe PLUGINDIR?). git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@3177 95ad53e4-c205-0410-b2fa-d234c58c8868 --- os-plugins/plugins/vmchooser/XX_vmchooser.sh | 35 ++++++++++++++++------------ 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'os-plugins/plugins/vmchooser/XX_vmchooser.sh') diff --git a/os-plugins/plugins/vmchooser/XX_vmchooser.sh b/os-plugins/plugins/vmchooser/XX_vmchooser.sh index 65e23d4e..1cb827a3 100644 --- a/os-plugins/plugins/vmchooser/XX_vmchooser.sh +++ b/os-plugins/plugins/vmchooser/XX_vmchooser.sh @@ -12,14 +12,19 @@ # script is included from init via the "." load function - thus it has all # variables and functions available +# include default directories +. /etc/openslx.conf + CONFFILE="/initramfs/plugin-conf/vmchooser.conf" +ETCDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR} +VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR} if [ -e $CONFFILE ]; then . $CONFFILE if [ $vmchooser_active -ne 0 ] ; then - [ $DEBUGLEVEL -gt 0 ] && echo "vmchooser: copying stage3 configuration file ..." - testmkd /mnt/etc/opt/openslx - cp $CONFFILE /mnt/etc/opt/openslx/vmchooser-stage3.conf + [ $DEBUGLEVEL -gt 0 ] \ + && echo "vmchooser: copying stage3 configuration file ..." + cp $CONFFILE ${ETCDIR}/vmchooser-stage3.conf testmkd /mnt/var/X11R6/bin ln -s /opt/openslx/plugin-repo/vmchooser/run-virt.sh \ @@ -28,8 +33,8 @@ if [ -e $CONFFILE ]; then /mnt/var/X11R6/bin/vmchooser # setup all generic virtualization / starting stuff like the floppy image - testmkd /mnt/var/lib/virt/vmchooser/fd-loop 1777 - testmkd /mnt/var/lib/virt/vmchooser/loopimg + testmkd ${VIRTDIR}/vmchooser/fd-loop 1777 + testmkd ${VIRTDIR}/vmchooser/loopimg # loop file for exchanging information between linux and vm guest if modprobe ${MODPRV} loop; then @@ -39,32 +44,32 @@ if [ -e $CONFFILE ]; then fi # mount a clean tempfs (bug in UnionFS prevents loopmount to work) grep -qE "unionfs |aufs " /proc/mounts && \ - mount -n -o size=1500k -t tmpfs vm-loopimg /mnt/var/lib/virt/vmchooser/loopimg + mount -n -o size=1500k -t tmpfs vm-loopimg ${VIRTDIR}/vmchooser/loopimg # create an empty floppy image of 1.4MByte size - dd if=/dev/zero of=/mnt/var/lib/virt/vmchooser/loopimg/fd.img \ - count=2880 bs=512 2>/dev/null - chmod 0777 /mnt/var/lib/virt/vmchooser/loopimg/fd.img + dd if=/dev/zero of=${VIRTDIR}/vmchooser/loopimg/fd.img count=2880 bs=512 \ + 2>/dev/null + chmod 0777 ${VIRTDIR}/vmchooser/loopimg/fd.img # use dos formatter copied into stage3 - mkdosfs /mnt/var/lib/virt/vmchooser/loopimg/fd.img >/dev/null 2>&1 #|| error - mount -n -t msdos -o loop,umask=000 /mnt/var/lib/virt/vmchooser/loopimg/fd.img \ - /mnt/var/lib/virt/vmchooser/fd-loop + mkdosfs ${VIRTDIR}/vmchooser/loopimg/fd.img >/dev/null 2>&1 #|| error + mount -n -t msdos -o loop,umask=000 ${VIRTDIR}/vmchooser/loopimg/fd.img \ + ${VIRTDIR}/vmchooser/fd-loop # create run-virt.include header (and fill in information on removable # devices if present echo -e "# run-virt.include created by $0 during stage3 plugin setup" \ - >/mnt/etc/opt/openslx/run-virt.include + >${ETCDIR}/run-virt.include waitfor /etc/hwinfo.cdrom j=0 for i in $(cat /etc/hwinfo.cdrom); do - echo "cdrom_$j=$i" >>/mnt/etc/opt/openslx/run-virt.include + echo "cdrom_$j=$i" >>${ETCDIR}/run-virt.include j=$(expr $j + 1) done waitfor /etc/hwinfo.floppy j=0 for i in $(cat /etc/hwinfo.floppy); do - echo "floppy_$j=$i" >>/mnt/etc/opt/openslx/run-virt.include + echo "floppy_$j=$i" >>${ETCDIR}/run-virt.include j=$(expr $j + 1) done -- cgit v1.2.3-55-g7522