summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/os-plugins/plugins')
-rw-r--r--src/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm253
-rw-r--r--src/os-plugins/plugins/bootsplash/XX_bootsplash.sh56
-rw-r--r--src/os-plugins/plugins/bootsplash/files/lib/libglib-2.0.so.0bin0 -> 822344 bytes
-rw-r--r--src/os-plugins/plugins/bootsplash/files/lib/libsplashy.so.1bin0 -> 18948 bytes
-rw-r--r--src/os-plugins/plugins/bootsplash/files/lib/libsplashycnf.so.1bin0 -> 7804 bytes
-rwxr-xr-xsrc/os-plugins/plugins/bootsplash/files/sbin/splashybin0 -> 54215 bytes
-rwxr-xr-xsrc/os-plugins/plugins/bootsplash/files/sbin/splashy_configbin0 -> 66416 bytes
-rwxr-xr-xsrc/os-plugins/plugins/bootsplash/files/sbin/splashy_updatebin0 -> 9611 bytes
-rw-r--r--src/os-plugins/plugins/bootsplash/files/themes/openslx/blank.ttf0
-rw-r--r--src/os-plugins/plugins/bootsplash/files/themes/openslx/openslx.pngbin0 -> 89872 bytes
-rw-r--r--src/os-plugins/plugins/bootsplash/files/themes/openslx/theme.xml138
-rw-r--r--src/os-plugins/plugins/bootsplash/files/usr/lib/libdirect-1.2.so.9bin0 -> 80552 bytes
-rw-r--r--src/os-plugins/plugins/bootsplash/files/usr/lib/libdirectfb-1.2.so.9bin0 -> 474652 bytes
-rw-r--r--src/os-plugins/plugins/bootsplash/files/usr/lib/libmagic.so.1bin0 -> 105596 bytes
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/05-have-kernelvars/bootsplash.sh18
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/10-nw-if-config/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/20-nw-bridge-config/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/25-have-ip-config/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/35-have-network-root/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/40-started-hw-config/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/50-have-layered-fs/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/60-have-servconfig/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/70-before-plugins/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/80-after-plugins/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/85-have-initial-boot/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/90-postinit-done/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/95-cleanup/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/bootsplash/init-hooks/99-handing-over/bootsplash.sh1
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm432
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm63
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm30
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm30
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm132
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm162
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm54
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm169
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm161
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm161
-rw-r--r--src/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm712
-rw-r--r--src/os-plugins/plugins/desktop/XX_desktop.sh33
l---------src/os-plugins/plugins/desktop/themes/gdm/openslx-legacy1
-rwxr-xr-xsrc/os-plugins/plugins/desktop/themes/gdm/openslx/GdmGreeterTheme.desktop8
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/color.pngbin0 -> 177 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/environment.pngbin0 -> 4296 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/language-selector.pngbin0 -> 2253 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/language-selector_inactive.pngbin0 -> 2198 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/main-runner.pngbin0 -> 153 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/openslx-logo-main.pngbin0 -> 82050 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/openslx-logo.pngbin0 -> 9113 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/sessions.pngbin0 -> 4245 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/sessions_inactive.pngbin0 -> 4066 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/system.pngbin0 -> 4257 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/system_inactive.pngbin0 -> 4091 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/theme.xml224
-rw-r--r--src/os-plugins/plugins/desktop/themes/gdm/openslx/welcome-time-shadowed.pngbin0 -> 1580 bytes
-rwxr-xr-xsrc/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/GdmGreeterTheme.desktop8
-rwxr-xr-xsrc/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/KdmGreeterTheme.desktop8
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/color.pngbin0 -> 177 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/enter.pngbin0 -> 4260 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/enter_inactive.pngbin0 -> 4072 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/environment.pngbin0 -> 5076 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/main-runner.pngbin0 -> 143 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/openslx-logo-main.pngbin0 -> 82050 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/openslx-logo.pngbin0 -> 9113 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/sessions.pngbin0 -> 4245 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/sessions_inactive.pngbin0 -> 4066 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/system.pngbin0 -> 4257 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/system_inactive.pngbin0 -> 4091 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/theme.xml204
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/welcome-time-shadowed.pngbin0 -> 1580 bytes
-rwxr-xr-xsrc/os-plugins/plugins/desktop/themes/kdm/openslx/KdmGreeterTheme.desktop8
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/color.pngbin0 -> 177 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/enter.pngbin0 -> 4260 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/enter_inactive.pngbin0 -> 4072 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/environment.pngbin0 -> 5076 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/main-runner.pngbin0 -> 153 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/openslx-logo-main.pngbin0 -> 82050 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/openslx-logo.pngbin0 -> 9113 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/sessions.pngbin0 -> 4245 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/sessions_inactive.pngbin0 -> 4066 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/system.pngbin0 -> 4257 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/system_inactive.pngbin0 -> 4091 bytes
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/theme.xml232
-rw-r--r--src/os-plugins/plugins/desktop/themes/kdm/openslx/welcome-time-shadowed.pngbin0 -> 1580 bytes
-rw-r--r--src/os-plugins/plugins/dropbear/OpenSLX/OSPlugin/dropbear.pm104
-rw-r--r--src/os-plugins/plugins/dropbear/XX_dropbear.sh58
-rwxr-xr-xsrc/os-plugins/plugins/dropbear/files/dropbearmultibin0 -> 160408 bytes
-rwxr-xr-xsrc/os-plugins/plugins/dropbear/init-hooks/95-cleanup/dropbear.sh1
-rw-r--r--src/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm154
-rw-r--r--src/os-plugins/plugins/example/XX_example.sh47
-rw-r--r--src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Base.pm60
-rw-r--r--src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Debian.pm32
-rw-r--r--src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Fedora.pm32
-rw-r--r--src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Gentoo.pm32
-rw-r--r--src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Scilin.pm32
-rw-r--r--src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Suse.pm32
-rw-r--r--src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Ubuntu.pm44
-rw-r--r--src/os-plugins/plugins/infoscreen/OpenSLX/OSPlugin/infoscreen.pm112
-rw-r--r--src/os-plugins/plugins/infoscreen/XX_infoscreen.sh58
-rw-r--r--src/os-plugins/plugins/infoscreen/files/empty.xbm6
-rw-r--r--src/os-plugins/plugins/infoscreen/files/infoscreenClient.tgzbin0 -> 267172 bytes
-rwxr-xr-xsrc/os-plugins/plugins/infoscreen/files/kiosk.dpms27
-rw-r--r--src/os-plugins/plugins/kiosk/OpenSLX/Distro/Base.pm65
-rw-r--r--src/os-plugins/plugins/kiosk/OpenSLX/Distro/Debian.pm32
-rw-r--r--src/os-plugins/plugins/kiosk/OpenSLX/Distro/Fedora.pm32
-rw-r--r--src/os-plugins/plugins/kiosk/OpenSLX/Distro/Gentoo.pm32
-rw-r--r--src/os-plugins/plugins/kiosk/OpenSLX/Distro/Scilin.pm32
-rw-r--r--src/os-plugins/plugins/kiosk/OpenSLX/Distro/Suse.pm32
-rw-r--r--src/os-plugins/plugins/kiosk/OpenSLX/Distro/Ubuntu.pm47
-rw-r--r--src/os-plugins/plugins/kiosk/OpenSLX/OSPlugin/kiosk.pm123
-rw-r--r--src/os-plugins/plugins/kiosk/XX_kiosk.sh60
-rwxr-xr-xsrc/os-plugins/plugins/kiosk/files/kgettybin0 -> 14524 bytes
l---------src/os-plugins/plugins/kiosk/files/profiles/plain/.bashrc1
-rw-r--r--src/os-plugins/plugins/kiosk/files/profiles/plain/bashrc4
-rw-r--r--src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.bash_profile2
l---------src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.bashrc1
l---------src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.xinitrc1
-rw-r--r--src/os-plugins/plugins/kiosk/files/profiles/vmchooser/bashrc4
-rw-r--r--src/os-plugins/plugins/kiosk/files/profiles/vmchooser/xinitrc7
-rw-r--r--src/os-plugins/plugins/openvz/OpenSLX/OSPlugin/openvz.pm110
-rw-r--r--src/os-plugins/plugins/openvz/XX_openvz.sh66
-rw-r--r--src/os-plugins/plugins/openvz/files/machine.include0
-rw-r--r--src/os-plugins/plugins/openvz/files/run-virt.include37
-rwxr-xr-xsrc/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh30
-rw-r--r--src/os-plugins/plugins/profile/OpenSLX/Distro/Base.pm84
-rw-r--r--src/os-plugins/plugins/profile/OpenSLX/Distro/Debian.pm32
-rw-r--r--src/os-plugins/plugins/profile/OpenSLX/Distro/Fedora.pm32
-rw-r--r--src/os-plugins/plugins/profile/OpenSLX/Distro/Gentoo.pm32
-rw-r--r--src/os-plugins/plugins/profile/OpenSLX/Distro/Scilin.pm32
-rw-r--r--src/os-plugins/plugins/profile/OpenSLX/Distro/Suse.pm68
-rw-r--r--src/os-plugins/plugins/profile/OpenSLX/Distro/Ubuntu.pm66
-rw-r--r--src/os-plugins/plugins/profile/OpenSLX/Distro/Ubuntu_10.pm66
-rw-r--r--src/os-plugins/plugins/profile/OpenSLX/OSPlugin/profile.pm174
-rw-r--r--src/os-plugins/plugins/profile/XX_profile.sh31
-rw-r--r--src/os-plugins/plugins/pvs/OpenSLX/Distro/Base.pm46
-rw-r--r--src/os-plugins/plugins/pvs/OpenSLX/Distro/Debian.pm29
-rw-r--r--src/os-plugins/plugins/pvs/OpenSLX/Distro/Fedora.pm28
-rw-r--r--src/os-plugins/plugins/pvs/OpenSLX/Distro/Gentoo.pm28
-rw-r--r--src/os-plugins/plugins/pvs/OpenSLX/Distro/Suse.pm28
-rw-r--r--src/os-plugins/plugins/pvs/OpenSLX/Distro/Ubuntu.pm23
-rw-r--r--src/os-plugins/plugins/pvs/OpenSLX/OSPlugin/pvs.pm127
-rw-r--r--src/os-plugins/plugins/pvs/XX_pvs.sh46
-rwxr-xr-xsrc/os-plugins/plugins/pvs/files/pvs-vncsrv105
-rw-r--r--src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Base.pm63
-rw-r--r--src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Debian.pm43
-rw-r--r--src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Suse.pm42
-rw-r--r--src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Ubuntu.pm24
-rw-r--r--src/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm256
-rw-r--r--src/os-plugins/plugins/qemukvm/XX_qemukvm.sh112
-rw-r--r--src/os-plugins/plugins/qemukvm/files/ifdown34
-rw-r--r--src/os-plugins/plugins/qemukvm/files/ifup75
-rw-r--r--src/os-plugins/plugins/qemukvm/files/run-virt.include306
-rw-r--r--src/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh30
-rwxr-xr-xsrc/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh60
-rw-r--r--src/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm93
-rw-r--r--src/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm41
-rw-r--r--src/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm322
-rw-r--r--src/os-plugins/plugins/syslog/XX_syslog.sh31
-rw-r--r--src/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh18
-rw-r--r--src/os-plugins/plugins/syslog/init-hooks/95-cleanup/syslog.sh12
-rw-r--r--src/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm101
-rw-r--r--src/os-plugins/plugins/sysrqshutdown/XX_sysrqshutdown.sh38
-rw-r--r--src/os-plugins/plugins/sysrqshutdown/files/shutdown54
-rw-r--r--src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm59
-rw-r--r--src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm52
-rw-r--r--src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm48
-rw-r--r--src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm54
-rw-r--r--src/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm284
-rw-r--r--src/os-plugins/plugins/virtualbox/XX_virtualbox.sh98
-rw-r--r--src/os-plugins/plugins/virtualbox/files/empty-diff.vdi.gzbin0 -> 282 bytes
-rw-r--r--src/os-plugins/plugins/virtualbox/files/machine.include132
-rw-r--r--src/os-plugins/plugins/virtualbox/files/run-virt.include372
-rw-r--r--src/os-plugins/plugins/virtualbox/files/rwimg.vdi.gzbin0 -> 268 bytes
-rw-r--r--src/os-plugins/plugins/virtualbox/files/virtualbox.include47
-rw-r--r--src/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh30
-rw-r--r--src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Base.pm64
-rw-r--r--src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Debian.pm49
-rw-r--r--src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Suse.pm47
-rw-r--r--src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Ubuntu.pm50
-rw-r--r--src/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm143
-rw-r--r--src/os-plugins/plugins/vmchooser/README21
-rw-r--r--src/os-plugins/plugins/vmchooser/XX_vmchooser.sh57
-rw-r--r--src/os-plugins/plugins/vmchooser/files/default.desktop10
-rwxr-xr-xsrc/os-plugins/plugins/vmchooser/files/mesgdispbin0 -> 222820 bytes
l---------src/os-plugins/plugins/vmchooser/files/mkdosfs1
-rwxr-xr-xsrc/os-plugins/plugins/vmchooser/files/printer.sh10
-rw-r--r--src/os-plugins/plugins/vmchooser/files/run-virt.sh402
-rwxr-xr-xsrc/os-plugins/plugins/vmchooser/files/scanner.sh4
-rwxr-xr-xsrc/os-plugins/plugins/vmchooser/files/vm-template.xml60
-rw-r--r--src/os-plugins/plugins/vmchooser/files/vmchooserbin0 -> 1364048 bytes
-rwxr-xr-xsrc/os-plugins/plugins/vmchooser/files/xmlfilter.sh50
-rw-r--r--src/os-plugins/plugins/vmchooser/init-hooks/40-started-hw-config/run-virt.sh21
-rw-r--r--src/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh144
-rw-r--r--src/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm319
-rw-r--r--src/os-plugins/plugins/vmgrid/XX_vmgrid.sh104
-rw-r--r--src/os-plugins/plugins/vmgrid/files/run-vmgrid.sh430
-rw-r--r--src/os-plugins/plugins/vmgrid/files/vmgrid154
-rw-r--r--src/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh144
-rw-r--r--src/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm47
-rw-r--r--src/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm227
-rw-r--r--src/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm29
-rw-r--r--src/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm28
-rw-r--r--src/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm28
-rw-r--r--src/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm23
-rw-r--r--src/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm836
-rw-r--r--src/os-plugins/plugins/vmware/XX_vmware.sh201
-rw-r--r--src/os-plugins/plugins/vmware/files/README12
-rw-r--r--src/os-plugins/plugins/vmware/files/install-vmpl.sh284
-rw-r--r--src/os-plugins/plugins/vmware/files/nvrambin0 -> 8664 bytes
-rw-r--r--src/os-plugins/plugins/vmware/files/run-virt.include448
-rwxr-xr-xsrc/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh30
-rwxr-xr-xsrc/os-plugins/plugins/vmware/init-hooks/60-have-servconfig/vm-dhcpd.sh60
-rw-r--r--src/os-plugins/plugins/vmware/init-hooks/80-after-plugins/adapt-tmpfs.sh24
-rw-r--r--src/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm154
-rw-r--r--src/os-plugins/plugins/wlanboot/XX_wlanboot.sh27
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwconfigbin0 -> 17596 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iweventbin0 -> 13496 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwgetidbin0 -> 9300 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwlistbin0 -> 25840 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwprivbin0 -> 9340 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/bin/iwspybin0 -> 9328 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/bin/iwtest1
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/README8
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-1.ucodebin0 -> 149652 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-2.ucodebin0 -> 149816 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-1.ucodebin0 -> 187608 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-2.ucodebin0 -> 187764 bytes
-rw-r--r--src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-5000-1.ucodebin0 -> 345008 bytes
l---------src/os-plugins/plugins/wlanboot/files/lib/libiw.so1
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/files/lib/libiw.so.29bin0 -> 25892 bytes
-rwxr-xr-xsrc/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh75
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm94
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm88
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm30
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm30
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm91
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm23
-rw-r--r--src/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm221
-rw-r--r--src/os-plugins/plugins/x11vnc/XX_x11vnc.sh135
-rwxr-xr-xsrc/os-plugins/plugins/x11vnc/files/x11vnc-init83
-rw-r--r--src/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm185
-rw-r--r--src/os-plugins/plugins/xen/XX_xen.sh73
-rw-r--r--src/os-plugins/plugins/xen/files/hvm.include209
-rw-r--r--src/os-plugins/plugins/xen/files/machine.include167
-rw-r--r--src/os-plugins/plugins/xen/files/run-virt.include157
-rw-r--r--src/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh4
-rwxr-xr-xsrc/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh30
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm212
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Debian.pm50
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm89
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10.pm63
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm360
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm361
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm53
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm96
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm73
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm30
-rw-r--r--src/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm396
-rw-r--r--src/os-plugins/plugins/xserver/XX_xserver.sh351
-rw-r--r--src/os-plugins/plugins/xserver/files/README77
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/ati-install.sh24
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/nvidia-install.sh138
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/suse-gfx-install.sh330
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh124
-rwxr-xr-xsrc/os-plugins/plugins/xserver/files/ubuntu-ng-gfx-install.sh236
-rw-r--r--src/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh53
266 files changed, 18430 insertions, 0 deletions
diff --git a/src/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm b/src/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm
new file mode 100644
index 00000000..ef1db778
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/OpenSLX/OSPlugin/bootsplash.pm
@@ -0,0 +1,253 @@
+# Copyright (c) 2007..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# bootsplash.pm
+# - implementation of the 'bootsplash' plugin, which installs splashy
+# into the ramfs, including changeing theme
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::bootsplash;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'bootsplash',
+ };
+
+ mkpath("$openslxConfig{'config-path'}/plugins/bootsplash/themes");
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Installs Splashy as bootsplash into ramfs and sets a Theme.
+ End-of-Here
+ precedence => 30,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'bootsplash::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'bootsplash'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+
+ 'bootsplash::theme' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ name of the theme to apply to bootsplash (unset for no theme)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'openslx',
+ },
+ };
+}
+
+sub suggestAdditionalKernelParams
+{
+ my $self = shift;
+ my $makeInitRamFSEngine = shift;
+
+ my @suggestedParams;
+
+ # add vga=0x317 unless explicit vga-mode is already set
+ if (!$makeInitRamFSEngine->haveKernelParam(qr{\bvga=})) {
+ push @suggestedParams, 'vga=0x317';
+ }
+
+ # add quiet, if not already set
+ if (!$makeInitRamFSEngine->haveKernelParam('quiet')) {
+ push @suggestedParams, 'quiet';
+ }
+
+ return @suggestedParams;
+}
+
+sub suggestAdditionalKernelModules
+{
+ my $self = shift;
+ my $makeInitRamFSEngine = shift;
+
+ my @suggestedModules;
+
+ # Ubuntu needs vesafb and fbcon (which drags along some others)
+ #if ($makeInitRamFSEngine->{'distro-name'} =~ m{^ubuntu}i) {
+ push @suggestedModules, qw( i810 i830 i915 mga nouveau r128 radeon savage sis tdfx ttm via drm fbcon vesafb );
+ #}
+
+ return @suggestedModules;
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+
+ my $splashyPath =
+ "$self->{openslxBasePath}/lib/plugins/bootsplash/files";
+ my $pluginRepoPath = "$self->{pluginRepositoryPath}";
+
+ my $initFile = newInitFile();
+ my $do_stop = unshiftHereDoc(<<' End-of-Here');
+ /opt/openslx/plugin-repo/bootsplash/bin/splashy shutdown
+ sleep 1
+ /opt/openslx/plugin-repo/bootsplash/bin/splashy_update \
+ "progress 100" 2>/dev/null
+ End-of-Here
+
+ # add helper functions to initfile
+ # first parameter name of the function
+ # second parameter content of the function
+ $initFile->addFunction('do_start', " : # do nothing here");
+ $initFile->addFunction('do_stop', $do_stop);
+ $initFile->addFunction('do_restart', " : # do nothing here");
+
+ # place a call of the helper function in the stop block
+ # of the init file
+ # first parameter name of the function
+ # second parameter name of the block
+ $initFile->addFunctionCall('do_start', 'start');
+ $initFile->addFunctionCall('do_stop', 'stop');
+ $initFile->addFunctionCall('do_restart', 'restart');
+
+ my $distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0];
+
+ # write initfile to filesystem
+ spitFile(
+ "$pluginRepoPath/bootsplash.halt",
+ getInitFileForDistro($initFile, ucfirst($distro))
+ );
+
+ # copy splashy(_update) into plugin-repo folder
+ mkpath("$pluginRepoPath/sbin");
+ mkpath("$pluginRepoPath/lib");
+ mkpath("$pluginRepoPath/usr/lib");
+ slxsystem("cp -a $splashyPath/sbin/* $pluginRepoPath/sbin/;
+ cp -p $splashyPath/lib/* $pluginRepoPath/lib/;
+ cp -p $splashyPath/usr/lib/* $pluginRepoPath/usr/lib/") == 0
+ or die _tr(
+ "unable to copy splashy to $pluginRepoPath"
+ );
+ # create a proper (distro specific) runlevel script for halt
+ #my $initfile = newInitFile();
+ #$initfile->addDaemon("");
+ #
+ #my $runlevelscript = getInitFileForDistro($initfile, "ubuntu");
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+
+sub copyRequiredFilesIntoInitramfs
+{
+ my $self = shift;
+ my $targetPath = shift;
+ my $attrs = shift;
+ my $makeInitRamFSEngine = shift;
+
+ my $bootsplashDir = "$openslxConfig{'base-path'}/lib/plugins/bootsplash";
+ my $bootsplashConfigDir
+ = "$openslxConfig{'config-path'}/plugins/bootsplash";
+ my $bootsplashTheme = $attrs->{'bootsplash::theme'} || '';
+ my $splashyThemeDir = '';
+
+ if ($bootsplashTheme) {
+ my $bootsplashThemeDir = "$bootsplashDir/files/themes/$bootsplashTheme";
+ my $altThemeDir = "$bootsplashConfigDir/themes/$bootsplashTheme";
+ if (-d $bootsplashThemeDir) {
+ $splashyThemeDir = "$bootsplashThemeDir";
+ }
+ elsif (-d $altThemeDir) {
+ $splashyThemeDir = "$altThemeDir";
+ }
+ if (-d $splashyThemeDir) {
+ my $splashyPath = "$bootsplashDir/files";
+ $makeInitRamFSEngine->addCMD(
+ "cp -p $splashyPath/sbin/splashy* $targetPath/sbin/;
+ cp -p $splashyPath/lib/lib* $targetPath/lib/;
+ cp -p $splashyPath/usr/lib/lib* $targetPath/usr/lib/"
+ );
+ $makeInitRamFSEngine->addCMD(
+ "mkdir -p $targetPath/etc/splashy/themes"
+ );
+ $makeInitRamFSEngine->addCMD(
+ "cp -a $splashyThemeDir $targetPath/etc/splashy/themes/"
+ );
+ my $defSplashyTheme = "/etc/splashy/themes/$bootsplashTheme";
+ my $splashyConfig = unshiftHereDoc(<<" End-of-Here");
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!-- Autogenerated by OpenSLX-plugin 'bootsplash' -->
+ <splashy>
+ <!-- themes directory: -->
+ <themes>/etc/splashy/themes</themes>
+ <!-- current theme (relative path) -->
+ <current_theme>$bootsplashTheme</current_theme>
+ <!-- full path to theme, fall back in case of problems -->
+ <default_theme>$defSplashyTheme</default_theme>
+ <pid>/etc/splashy/splashy.pid</pid>
+ <fifo>/dev/.initramfs/splashy.fifo</fifo>
+ </splashy>
+ End-of-Here
+ $makeInitRamFSEngine->addCMD( {
+ file => "$targetPath/etc/splashy/config.xml",
+ content => $splashyConfig,
+ } );
+ }
+ }
+ else {
+ $bootsplashTheme = '<none>';
+ }
+
+ vlog(1, _tr("bootsplash-plugin: bootsplash=%s", $bootsplashTheme));
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/bootsplash/XX_bootsplash.sh b/src/os-plugins/plugins/bootsplash/XX_bootsplash.sh
new file mode 100644
index 00000000..372e025d
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/XX_bootsplash.sh
@@ -0,0 +1,56 @@
+# Copyright (c) 2007..2008 - RZ Uni Freiburg
+# Copyright (c) 2008 - 2009 OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'bootsplash' plugin - the runlevel script
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+if [ -e /initramfs/plugin-conf/bootsplash.conf ]; then
+ . /initramfs/plugin-conf/bootsplash.conf
+ if [ $bootsplash_active -ne 0 ]; then
+ if [ ${no_bootsplash} -eq 0 ]; then
+ # create a runlevelscript that will stop splashy before the start of KDM
+ d_mkrlscript init splashy.boot ""
+ echo -e "\tLD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib/ \
+ /opt/openslx/plugin-repo/bootsplash/sbin/splashy_update \
+ exit 2>/dev/null \
+ \n\ttype killall >/dev/null 2>&1 && killall -9 splashy" \
+ >>/mnt/etc/init.d/splashy.boot
+ d_mkrlscript close splashy.boot ""
+
+ cp /mnt/opt/openslx/plugin-repo/bootsplash/bootsplash.halt \
+ /mnt/etc/init.d/bootsplash.halt
+ chmod 744 /mnt/etc/init.d/bootsplash.halt
+ cp -a /etc/splashy /mnt/etc/
+ rllinker "bootsplash.halt" 1 1
+
+ # fix for ubuntu 1004+
+ for i in init init.inactive; do
+ for j in kdm gdm xdm lxdm; do
+ dmfile=/mnt/etc/${i}/${j}.conf
+ if [ -f $dmfile ]; then
+ sed -e "s,^script.*,script\n\t#0x42#," \
+ -e "s,#0x42#,# shutdown splashy - added by splashy plugin\n\t#0x42#," \
+ -e "s,#0x42#,if [ ! \"x$(ps aux |grep splashy |grep -v grep | wc -l)\" -eq \"x0\" ]; then\n\t#0x42#, " \
+ -e "s,#0x42#, LD_LIBRARY_PATH=/opt/openslx/uclib-rootfs/lib/ \\\\\n\t#0x42#," \
+ -e "s,#0x42#, /opt/openslx/plugin-repo/bootsplash/sbin/splashy_update exit \\\\\n\t#0x42#," \
+ -e "s,#0x42#, 2>/dev/null \n\t#0x42#," \
+ -e "s,#0x42#,fi \n\t#0x42#," \
+ -e "s,#0x42#,#splashy-stop-done#," \
+ -i $dmfile 2>/dev/null &
+ fi
+ done
+ done
+ fi
+ fi
+fi
+
diff --git a/src/os-plugins/plugins/bootsplash/files/lib/libglib-2.0.so.0 b/src/os-plugins/plugins/bootsplash/files/lib/libglib-2.0.so.0
new file mode 100644
index 00000000..e96b345b
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/lib/libglib-2.0.so.0
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/files/lib/libsplashy.so.1 b/src/os-plugins/plugins/bootsplash/files/lib/libsplashy.so.1
new file mode 100644
index 00000000..817c6d2d
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/lib/libsplashy.so.1
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/files/lib/libsplashycnf.so.1 b/src/os-plugins/plugins/bootsplash/files/lib/libsplashycnf.so.1
new file mode 100644
index 00000000..71c251d1
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/lib/libsplashycnf.so.1
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/files/sbin/splashy b/src/os-plugins/plugins/bootsplash/files/sbin/splashy
new file mode 100755
index 00000000..fee26325
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/sbin/splashy
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/files/sbin/splashy_config b/src/os-plugins/plugins/bootsplash/files/sbin/splashy_config
new file mode 100755
index 00000000..1e048366
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/sbin/splashy_config
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/files/sbin/splashy_update b/src/os-plugins/plugins/bootsplash/files/sbin/splashy_update
new file mode 100755
index 00000000..cb624fde
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/sbin/splashy_update
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/files/themes/openslx/blank.ttf b/src/os-plugins/plugins/bootsplash/files/themes/openslx/blank.ttf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/themes/openslx/blank.ttf
diff --git a/src/os-plugins/plugins/bootsplash/files/themes/openslx/openslx.png b/src/os-plugins/plugins/bootsplash/files/themes/openslx/openslx.png
new file mode 100644
index 00000000..e7f996c6
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/themes/openslx/openslx.png
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/files/themes/openslx/theme.xml b/src/os-plugins/plugins/bootsplash/files/themes/openslx/theme.xml
new file mode 100644
index 00000000..48854551
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/themes/openslx/theme.xml
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Automatically generated by splashy_config. Do not edit -->
+<splashy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://splashy.alioth.debian.org/schemas/1.1/themes.xsd">
+ <info>
+ <!-- theme name is case sensitive. use directory name -->
+ <name>openslx</name>
+ <version>0.2</version>
+ <description>OpenSLX Splashy Theme</description>
+ <urls>http://openslx.com</urls>
+ <author>mj0@uni-freiburg.de</author>
+ </info>
+ <progressbar>
+ <!-- here are tags to set the bar... x coordinate,
+ y coordinate, width and height are for the progress bar.
+ Remember that x, y, width and height are expressed in percentage -->
+ <dimension>
+ <x>0</x>
+ <y>42</y>
+ <width>100</width>
+ <height>16</height>
+ </dimension>
+ <!-- here you can set the color of the progressbar...
+ set the amount of red, green, blue and alpha channel.
+ Remember that the max value is 255 and the minumun value is 0-->
+ <color>
+ <red>128</red>
+ <green>147</green>
+ <blue>161</blue>
+ <alpha>255</alpha>
+ </color>
+ <!-- whether or not you want a border around the progressbar. default: no -->
+ <border>
+ <enable>no</enable>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>0</alpha>
+ </color>
+ </border>
+ <!-- here you can set the color of the progressbar background
+ set the amount of red, green, blue and alpha channel.
+ Remember that the max value is 255 and the minumun value is 0-->
+ <background>
+ <color>
+ <red>240</red>
+ <green>240</green>
+ <blue>240</blue>
+ <alpha>255</alpha>
+ </color>
+ </background>
+ <direction>
+ <boot>forward</boot>
+ <shutdown>backward</shutdown>
+ <resume>forward</resume>
+ <suspend>backward</suspend>
+ </direction>
+ <visibility>
+ <boot>yes</boot>
+ <shutdown>yes</shutdown>
+ <resume>yes</resume>
+ <suspend>yes</suspend>
+ </visibility>
+ </progressbar>
+ <!-- conventional path: /etc/splashy/themes + theme-name -->
+ <background>
+ <boot>openslx.png</boot>
+ <shutdown>openslx.png</shutdown>
+ <resume>openslx.png</resume>
+ <suspend>openslx.png</suspend>
+ <errorimg>openslx.png</errorimg>
+ <!-- resolution of the images. this value affects where
+ the progressbar will be drawn. If VALUE <= 0, then percentages
+ of the screen width and hight will be assumed -->
+ <dimension>
+ <!-- NOTE: x and y are not used by splashy -->
+ <x>0</x>
+ <y>0</y>
+ <width>0</width>
+ <height>0</height>
+ </dimension>
+ </background>
+ <textbox>
+ <!-- whether you want the textbox always
+ shown or no. If no, it will be shown only on error,
+ see autoverboseonerror -->
+ <enable>no</enable>
+ <!-- here are tags to set the text area... x coordinate,
+ y coordinate, width and height are for the text area.
+ Remember that x, y, width and height are expressed in percentage
+ or pixel units -->
+ <dimension>
+ <x>1</x>
+ <y>61</y>
+ <width>98</width>
+ <height>38</height>
+ </dimension>
+ <!-- here you can set the color of the text area...
+ set the amount of red, green, blue and alpha channel.
+ Remember that the max value is 255 and the minumun value is 0-->
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>0</alpha>
+ </color>
+ <!-- whether or not you want a border around the progressbar. default: no -->
+ <border>
+ <enable>no</enable>
+ <color>
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ <alpha>0</alpha>
+ </color>
+ </border>
+ <text>
+ <!-- font file to use, path relative to theme -->
+ <font>
+ <file>blank.ttf</file>
+ <height>2</height>
+ </font>
+ <!-- here you can set the color of the text/font...
+ set the amount of red, green, blue and alpha channel.
+ Remember that the max value is 255 and the minumun value is 0-->
+ <color>
+ <red>62</red>
+ <green>93</green>
+ <blue>114</blue>
+ <alpha>0</alpha>
+ </color>
+ </text>
+ </textbox>
+ <autoverboseonerror>no</autoverboseonerror>
+ <fadein>no</fadein>
+ <fadeout>no</fadeout>
+</splashy>
diff --git a/src/os-plugins/plugins/bootsplash/files/usr/lib/libdirect-1.2.so.9 b/src/os-plugins/plugins/bootsplash/files/usr/lib/libdirect-1.2.so.9
new file mode 100644
index 00000000..fbe2d611
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/usr/lib/libdirect-1.2.so.9
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/files/usr/lib/libdirectfb-1.2.so.9 b/src/os-plugins/plugins/bootsplash/files/usr/lib/libdirectfb-1.2.so.9
new file mode 100644
index 00000000..76b77716
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/usr/lib/libdirectfb-1.2.so.9
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/files/usr/lib/libmagic.so.1 b/src/os-plugins/plugins/bootsplash/files/usr/lib/libmagic.so.1
new file mode 100644
index 00000000..513b3508
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/files/usr/lib/libmagic.so.1
Binary files differ
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/05-have-kernelvars/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/05-have-kernelvars/bootsplash.sh
new file mode 100644
index 00000000..a54fde96
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/05-have-kernelvars/bootsplash.sh
@@ -0,0 +1,18 @@
+# splashy depends on /proc/fb with VESA
+# only activate with kernel option quiet and no debuglevel
+if grep -q ".*" /proc/fb > /dev/null 2>&1 \
+ && grep -qie " quiet " -qie "^quiet " -qie " quiet$" /proc/cmdline \
+ > /dev/null 2>&1 \
+ && [ $DEBUGLEVEL -eq 0 ] \
+ && [ -e /bin/splashy ] ; then
+ export no_bootsplash=0
+else
+ export no_bootsplash=1
+fi
+
+if [ ${no_bootsplash} -eq 0 ]; then
+ /bin/splashy boot 2>/dev/null
+ # add splashy.boot runlevel script
+ export D_SPLASHY=splashy.boot
+fi
+
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/10-nw-if-config/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/10-nw-if-config/bootsplash.sh
new file mode 100644
index 00000000..7f3d563e
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/10-nw-if-config/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 10" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/20-nw-bridge-config/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/20-nw-bridge-config/bootsplash.sh
new file mode 100644
index 00000000..d8155ff0
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/20-nw-bridge-config/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 20" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/25-have-ip-config/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/25-have-ip-config/bootsplash.sh
new file mode 100644
index 00000000..be6ac567
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/25-have-ip-config/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 25" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/35-have-network-root/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/35-have-network-root/bootsplash.sh
new file mode 100644
index 00000000..606eb694
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/35-have-network-root/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 35" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/40-started-hw-config/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/40-started-hw-config/bootsplash.sh
new file mode 100644
index 00000000..d5fc62ec
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/40-started-hw-config/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 40" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/50-have-layered-fs/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/50-have-layered-fs/bootsplash.sh
new file mode 100644
index 00000000..4b7e9c78
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/50-have-layered-fs/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 50" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/60-have-servconfig/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/60-have-servconfig/bootsplash.sh
new file mode 100644
index 00000000..9c3bd20f
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/60-have-servconfig/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 60" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/70-before-plugins/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/70-before-plugins/bootsplash.sh
new file mode 100644
index 00000000..fcd0c410
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/70-before-plugins/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 70" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/80-after-plugins/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/80-after-plugins/bootsplash.sh
new file mode 100644
index 00000000..0abfa5b2
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/80-after-plugins/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 80" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/85-have-initial-boot/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/85-have-initial-boot/bootsplash.sh
new file mode 100644
index 00000000..8738e454
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/85-have-initial-boot/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 85" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/90-postinit-done/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/90-postinit-done/bootsplash.sh
new file mode 100644
index 00000000..2546d298
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/90-postinit-done/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 90" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/95-cleanup/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/95-cleanup/bootsplash.sh
new file mode 100644
index 00000000..5ff86715
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/95-cleanup/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 95" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/bootsplash/init-hooks/99-handing-over/bootsplash.sh b/src/os-plugins/plugins/bootsplash/init-hooks/99-handing-over/bootsplash.sh
new file mode 100644
index 00000000..93673915
--- /dev/null
+++ b/src/os-plugins/plugins/bootsplash/init-hooks/99-handing-over/bootsplash.sh
@@ -0,0 +1 @@
+[ ${no_bootsplash} -eq 0 ] && /bin/splashy_update "progress 100" >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..316448bb
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Base.pm
@@ -0,0 +1,432 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the desktop plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use File::Basename;
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{'engine'});
+ # avoid circular reference between distro and its engine
+
+ return 1;
+}
+
+sub getDefaultDesktopManager
+{
+ my $self = shift;
+
+ # the default implementation prefers KDM over GDM over XDM
+ return $self->isKDMInstalled() ? 'kdm'
+ : $self->isGDMInstalled() ? 'gdm'
+ : $self->isXDMInstalled() ? 'xdm' : undef;
+}
+
+sub getDefaultDesktopKind
+{
+ my $self = shift;
+
+ # the default implementation prefers GNOME over KDE over XFCE
+ return $self->isGNOMEInstalled() ? 'gnome'
+ : $self->isKDEInstalled() ? 'kde'
+ : $self->isXFCEInstalled() ? 'xfce' : undef;
+}
+
+sub isGNOMEInstalled
+{
+ my $self = shift;
+
+ return isInPath('gnome-session');
+}
+
+sub installGNOME
+{
+ my $self = shift;
+
+ $self->{engine}->installPackages(
+ $self->{engine}->getInstallablePackagesForSelection('gnome')
+ );
+
+ return 1;
+}
+
+sub isGDMInstalled
+{
+ my $self = shift;
+
+ return isInPath('gdm');
+}
+
+sub installGDM
+{
+ my $self = shift;
+
+ $self->{engine}->installPackages('gdm');
+
+ return 1;
+}
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = {
+ config => '/etc/gdm/gdm.conf',
+ paths => [
+ '/var/lib/gdm',
+ '/var/log/gdm',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $pathInfo = $self->GDMPathInfo();
+ my $configFile = $pathInfo->{config};
+
+ my $paths
+ = join(
+ ' ',
+ map { '/mnt' . $_ } ( dirname($configFile), @{$pathInfo->{paths}} )
+ );
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ # written by OpenSLX-plugin 'desktop'
+
+ for i in $paths; do
+ testmkd \$i
+ done
+
+ cp /mnt$repoPath/gdm/\$desktop_mode/gdm.conf /mnt$configFile
+
+ # activate theme only if the corresponding xml file is found
+ # (otherwise fall back to default theme of vendor-OS)
+ if [ -n "\$desktop_theme" ]; then
+ thdir=/opt/openslx/plugin-repo/desktop/themes/gdm
+ theme=\$desktop_theme
+ if [ -e /mnt\$thdir/\$theme/*.xml ]; then
+ sed -i "s,\\[greeter\\],[greeter]\\nGraphicalThemedColor=," \\
+ /mnt$configFile
+ sed -i "s,\\[greeter\\],[greeter]\\nGraphicalThemeDir=\$thdir," \\
+ /mnt$configFile
+ sed -i "s,\\[greeter\\],[greeter]\\nGraphicalTheme=\$theme," \\
+ /mnt$configFile
+ fi
+ fi
+ case "\${desktop_allowshutdown}" in
+ none)
+ ;;
+ root)
+ sed "s|AllowShutdown.*|AllowShutdown=true|;\\
+ s|SecureShutdown.*|SecureShutdown=true|" \\
+ -i /mnt$configFile
+ ;;
+ users)
+ sed "s|AllowShutdown.*|AllowShutdown=true|;\\
+ s|SecureShutdown.*|SecureShutdown=false|" \\
+ -i /mnt$configFile
+ ;;
+ esac
+ [ "\${desktop_rootlogin}" -ne 0 ] && \\
+ sed "s|AllowRoot.*|AllowRoot=true|" -i /mnt$configFile
+ End-of-Here
+
+ return $script;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ return {
+ 'chooser' => {
+ },
+ 'daemon' => {
+ AutomaticLoginEnable => 'false',
+ Group => 'gdm',
+ User => 'gdm',
+ DefaultSession => 'default.desktop',
+ },
+ 'debug' => {
+ Enable => 'false',
+ },
+ 'greeter' => {
+ AllowShutdown => 'false',
+ Browser => 'false',
+ MinimalUID => '500',
+ SecureShutdown => 'false',
+ ShowDomain => 'false',
+ DefaultWelcome => 'false',
+ Welcome => 'OpenSLX Workstation (%n)',
+ },
+ 'gui' => {
+ },
+ 'security' => {
+ AllowRoot => 'false',
+ AllowRemoteRoot => 'false',
+ DisallowTCP => 'true',
+ SupportAutomount => 'true',
+ },
+ 'server' => {
+ },
+ 'xdmcp' => {
+ Enable => 'false',
+ },
+ };
+}
+
+sub GDMConfigHashForKiosk
+{
+ my $self = shift;
+
+ my $configHash = $self->GDMConfigHashForWorkstation();
+ $configHash->{daemon}->{AutomaticLoginEnable} = 'true';
+ $configHash->{daemon}->{AutomaticLogin} = 'nobody';
+
+ return $configHash;
+}
+
+sub GDMConfigHashForChooser
+{
+ my $self = shift;
+
+ my $configHash = $self->GDMConfigHashForWorkstation();
+ $configHash->{xdmcp}->{Enable} = 'true';
+
+ return $configHash;
+}
+
+sub isKDEInstalled
+{
+ my $self = shift;
+
+ return isInPath('startkde');
+}
+
+sub installKDE
+{
+ my $self = shift;
+
+ $self->{engine}->installPackages(
+ $self->{engine}->getInstallablePackagesForSelection('kde')
+ );
+
+ return 1;
+}
+
+sub isKDMInstalled
+{
+ my $self = shift;
+
+ return isInPath('kdm');
+}
+
+sub installKDM
+{
+ my $self = shift;
+
+ $self->{engine}->installPackages('kdm');
+
+ return 1;
+}
+
+sub KDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = {
+ config => '/etc/opt/kdm/kdmrc',
+ paths => [
+ '/var/lib/kdm',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+sub setupKDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $pathInfo = $self->KDMPathInfo();
+ my $configFile = $pathInfo->{config};
+
+ my $paths
+ = join(
+ ' ',
+ map { '/mnt' . $_ } ( dirname($configFile), @{$pathInfo->{paths}} )
+ );
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # written by OpenSLX-plugin 'desktop'
+
+ for i in $paths; do
+ testmkd \$i
+ done
+
+ cp /mnt$repoPath/kdm/\$desktop_mode/kdmrc /mnt$configFile
+
+ # activate theme only if the corresponding xml file is found
+ # (otherwise fall back to default theme of vendor-OS)
+ if [ -n "\$desktop_theme" ]; then
+ theme=\$desktop_theme
+ thdir=/opt/openslx/plugin-repo/desktop/themes/kdm/\$theme
+ if [ -e /mnt\$thdir/*.xml ]; then
+ sed -i "s,\\[X-\\*-Greeter\\],[X-*-Greeter]\\nUseBackground=false," \\
+ /mnt$configFile
+ sed -i "s,\\[X-\\*-Greeter\\],[X-*-Greeter]\\nTheme=\$thdir," \\
+ /mnt$configFile
+ sed -i "s,\\[X-\\*-Greeter\\],[X-*-Greeter]\\nUseTheme=true," \\
+ /mnt$configFile
+ fi
+ fi
+ case "\${desktop_allowshutdown}" in
+ none)
+ sed "s|AllowShutdown.*|AllowShutdown=None|" \\
+ -i /mnt$configFile
+ ;;
+ root)
+ sed "s|AllowShutdown.*|AllowShutdown=Root|" \\
+ -i /mnt$configFile
+ ;;
+ users)
+ sed "s|AllowShutdown.*|AllowShutdown=All|" \\
+ -i /mnt$configFile
+ ;;
+ esac
+ [ "\${desktop_rootlogin}" -ne 0 ] && \\
+ sed "s|AllowRootLogin.*|AllowRootLogin=true|" -i /mnt$configFile
+ End-of-Here
+
+ return $script;
+}
+
+sub KDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ return {
+# 'General' => {
+# StaticServers => ':0',
+# ReserveServers => ':1,:2,:3',
+# ServerVTs => '-7',
+# ConsoleTTYs => 'tty1,tty2,tty3,tty4,tty5,tty6',
+# },
+ 'X-:0-Core' => {
+ AutoLoginEnable => 'false',
+ AllowRootLogin => 'false',
+ AllowShutdown => 'All',
+ },
+ 'X-*-Greeter' => {
+ GreetString => 'OpenSLX Workstation (%h)',
+ SelectedUsers => '',
+ UserList => 'false',
+ },
+ 'X-:*-Greeter' => {
+ AllowClose => 'false',
+ UseAdminSession => 'true',
+ },
+ 'X-:0-Greeter' => {
+ LogSource => '/dev/xconsole',
+ UseAdminSession => 'false',
+ PreselectUser => 'None',
+ },
+ 'xdmcp' => {
+ Enable => 'false',
+ },
+ };
+}
+
+sub KDMConfigHashForKiosk
+{
+ my $self = shift;
+
+ my $configHash = $self->KDMConfigHashForWorkstation();
+ $configHash->{'X-:0-Core'}->{AutoLoginEnable} = 'true';
+ $configHash->{'X-:0-Core'}->{AutoLoginUser} = 'nobody';
+
+ return $configHash;
+}
+
+sub KDMConfigHashForChooser
+{
+ my $self = shift;
+
+ my $configHash = $self->KDMConfigHashForWorkstation();
+ $configHash->{xdmcp}->{Enable} = 'true';
+
+ return $configHash;
+}
+
+sub isXFCEInstalled
+{
+ my $self = shift;
+
+ return isInPath('startxfce4');
+}
+
+sub installXFCE
+{
+ my $self = shift;
+
+ $self->{engine}->installPackages(
+ $self->{engine}->getInstallablePackagesForSelection('xfce')
+ );
+
+ return 1;
+}
+
+sub isXDMInstalled
+{
+ my $self = shift;
+
+ return isInPath('xdm');
+}
+
+sub installXDM
+{
+ my $self = shift;
+
+ $self->{engine}->installPackages('xdm');
+
+ return 1;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..c212b3ef
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,63 @@
+# Copyright (c) 2006..2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Debian.pm
+# - provides Debian-specific overrides of the Distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupGDMScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ rllinker gdm 1 1
+ echo '/usr/bin/gdm' > /mnt/etc/X11/default-display-manager
+ # gdm does not like AUFS/UnionFS on its var directory
+ rm -rf /mnt/var/lib/gdm
+ mkdir -m 1770 /mnt/var/lib/gdm
+ chown root:gdm /mnt/var/lib/gdm
+ End-of-Here
+
+ return $script;
+}
+
+sub setupKDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupKDMScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ rllinker kdm 1 1
+ echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm
new file mode 100644
index 00000000..f9428aab
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Fedora.pm
@@ -0,0 +1,30 @@
+# Copyright (c) 2006, 2007 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Fedora.pm
+# - provides Fedora-specific overrides of the Distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Fedora;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+# TODO: implement!
+
+1; \ No newline at end of file
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm
new file mode 100644
index 00000000..129f4d08
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Gentoo.pm
@@ -0,0 +1,30 @@
+# Copyright (c) 2006, 2007 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Gentoo.pm
+# - provides Gentoo-specific overrides of the Distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Gentoo;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+# TODO: implement!
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm
new file mode 100644
index 00000000..1dc0482c
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Scilin.pm
@@ -0,0 +1,132 @@
+# Copyright (c) 2006..2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Scilin.pm
+# - provides Scilin-specific overrides of the Distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Scilin;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::GDMPathInfo();
+
+ # create gdm.conf-custom instead of gdm.conf
+ $pathInfo->{config} = '/etc/gdm/custom.conf';
+
+ return $pathInfo;
+}
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupGDMScript($repoPath);
+
+ my $configFile = $self->GDMPathInfo->{config};
+
+ # include common stuff (independent of display manager used)
+ $script = _setupCommonDmScript($script);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ echo "DISPLAYMANAGER=GNOME" \
+ >/mnt/etc/sysconfig/desktop
+ # gdm does not like AUFS/UnionFS on its var directory
+ mkdir -m 1770 /mnt/var/lib/gdm
+ chown root:gdm /mnt/var/lib/gdm
+ End-of-Here
+
+ return $script;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
+ $configHash->{'daemon'}->{SessionDesktopDir} =
+ '/etc/X11/session/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions';
+ $configHash->{'daemon'}->{Greeter} =
+ '/usr/libexec/gdmgreeter';
+
+ return $configHash;
+}
+
+sub setupKDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ # SUSE reads /var/adm/kdm/kdmrc.sysconfig, so we link that to
+ # our config file
+ my $pathInfo = $self->KDMPathInfo();
+ my $configFile = $pathInfo->{config};
+ mkpath("/etc/opt/kdm");
+ mkpath("/var/adm/kdm");
+ # maybe backup kdmrc.sysconfig sometimes
+ unlink("/var/adm/kdm/kdmrc.sysconfig");
+ # the config file gets overwritten if this script is present
+ unlink("/opt/kde3/share/apps/kdm/read_sysconfig.sh");
+ symlink("/etc/opt/kdm/kdmrc", "/var/adm/kdm/kdmrc.sysconfig");
+
+ my $script = $self->SUPER::setupKDMScript($repoPath);
+
+ # include common stuff (independent of display manager used)
+ $script = _setupCommonDmScript($script);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ echo "DISPLAYMANAGER=KDE" \
+ >/mnt/etc/sysconfig/desktop
+ End-of-Here
+
+ return $script;
+}
+
+sub _setupCommonDmScript
+{
+ my $script = shift;
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/X11/xdm/Xreset \
+ > /mnt/etc/X11/xdm/Xreset.system
+ echo -e '#!/bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*" - $USER
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) &
+ . /etc/X11/xdm/Xreset.system' >/mnt/etc/X11/xdm/Xreset
+ chmod a+x /mnt/etc/X11/xdm/Xreset*
+
+ # enable the inittab entry again (incomplete)
+ # sed -e "s,# line deleted.*,x:5:respawn:/etc/X11/prefdm -nodaemon," \
+ # -i /mnt/etc/inittab
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..433ed7e1
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,162 @@
+# Copyright (c) 2006..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Suse.pm
+# - provides SUSE-specific overrides of the Distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::GDMPathInfo();
+
+ # create gdm.conf-custom instead of gdm.conf
+ $pathInfo->{config} = '/etc/gdm/custom.conf';
+
+ return $pathInfo;
+}
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupGDMScript($repoPath);
+
+ my $configFile = $self->GDMPathInfo->{config};
+
+ # include common stuff (independent of display manager used)
+ $script = _setupCommonDmScript($script);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ echo -e '# changed by $0 during stage3 setup\nDISPLAYMANAGER="gdm"' \
+ >/mnt/etc/sysconfig/displaymanager
+ sed -i "s/DEFAULT_WM=.*/DEFAULT_WM=\"$desktop_kind\"/" \
+ /mnt/etc/sysconfig/windowmanager
+ #sed "s|XSESSION|/etc/xdm/Xsession|" -i /mnt$configFile
+ # gdm does not like AUFS/UnionFS on its var directory
+ rm -rf /mnt/var/lib/gdm
+ mkdir -m 1770 /mnt/var/lib/gdm
+ chown root:gdm /mnt/var/lib/gdm
+ # no use for this configuration info file
+ rm /mnt/etc/gdm/gdm_sysconfig.* 2>/dev/null
+ End-of-Here
+
+ return $script;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
+ $configHash->{'daemon'}->{SessionDesktopDir} =
+ '/etc/X11/session/:/usr/share/xsessions/';
+ $configHash->{'daemon'}->{DefaultSession} = 'default.desktop';
+ $configHash->{'daemon'}->{Greeter} =
+ '/usr/lib/gdm/gdmgreeter';
+
+ return $configHash;
+}
+
+sub setupKDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ # check for kdm version
+ my $kdmVer;
+ my $kdmPath;
+ if (-e "/usr/bin/kdm") {
+ $kdmVer = "4";
+ $kdmPath = "/usr/share/kde4";
+ }
+ else {
+ $kdmVer = "";
+ $kdmPath = "/opt/kde3/share";
+ # change default theme to openslx-legacy if kdm3
+ print " * Please change to openslx-legacy theme when using kdm3\n";
+ }
+
+ # SUSE reads /var/adm/kdm/kdmrc.sysconfig, so we link that to
+ # our config file
+ my $pathInfo = $self->KDMPathInfo();
+ my $configFile = $pathInfo->{config};
+ mkpath("/etc/opt/kdm");
+ mkpath("/var/adm/kdm");
+ # maybe backup kdmrc.sysconfig sometimes
+ unlink("/var/adm/kdm/kdmrc.sysconfig");
+ # the config file gets overwritten if this script is present
+ unlink("$kdmPath/apps/kdm/read_sysconfig.sh");
+ symlink("/etc/opt/kdm/kdmrc", "/var/adm/kdm/kdmrc.sysconfig");
+
+ my $script = $self->SUPER::setupKDMScript($repoPath);
+
+ # include common stuff (independent of display manager used)
+ $script = _setupCommonDmScript($script);
+
+ $script .= "kdmver=$kdmVer\n";
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ sed -i "s/DISPLAYMANAGER=.*/DISPLAYMANAGER=\"kdm$kdmver\"/" \
+ /mnt/etc/sysconfig/displaymanager
+ [ $(grep -q DISPLAYMANAGER /mnt/etc/sysconfig/displaymanager) ] && \
+ echo "DISPLAYMANAGER=\"kdm$kdmver\"" >>/mnt/etc/sysconfig/displaymanager
+ sed -i "s/DEFAULT_WM=.*/DEFAULT_WM=\"$desktop_kind\"/" \
+ /mnt/etc/sysconfig/windowmanager
+ # needed for compatibility X11/session(s)
+ ln -s /etc/X11/session /mnt/etc/X11/sessions
+ End-of-Here
+
+ return $script;
+}
+
+sub _setupCommonDmScript
+{
+ my $script = shift;
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ rllinker xdm 1 10
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/X11/xdm/Xreset \
+ > /mnt/etc/X11/xdm/Xreset.system
+ echo -e '#!/bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # avoid annoying messages on removed sound devices
+ ( su -c "rm ~/.kde4/share/config/phonondevicesrc" - $USER ) &
+
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*" - $USER
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null
+ chmod 0400 /tmp/files.removed ) &
+ . /etc/X11/xdm/Xreset.system' >/mnt/etc/X11/xdm/Xreset
+ chmod a+x /mnt/etc/X11/xdm/Xreset*
+
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm
new file mode 100644
index 00000000..ac14b2a5
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Suse_10_2.pm
@@ -0,0 +1,54 @@
+# Copyright (c) 2006..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Suse_10_2.pm
+# - provides SUSE-10.2-specific overrides of the Distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Suse_10_2;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Suse);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::GDMPathInfo();
+
+ # link gdm.conf-custom instead of gdm.conf
+ $pathInfo->{config} = '/etc/opt/gnome/gdm/custom.conf';
+
+ return $pathInfo;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
+ $configHash->{'daemon'}->{SessionDesktopDir} =
+ '/etc/X11/session/:/usr/share/xsessions/';
+ $configHash->{'daemon'}->{Greeter} =
+ '/opt/gnome/lib/gdm/gdmgreeter';
+
+ return $configHash;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..d222c102
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,169 @@
+# Copyright (c) 2006..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu-specific overrides of the distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::GDMPathInfo();
+
+ # link gdm.conf-custom instead of gdm.conf
+ $pathInfo->{config} = '/etc/gdm/custom.conf';
+
+ return $pathInfo;
+}
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupGDMScript($repoPath);
+
+ my $configFile = $self->GDMPathInfo->{config};
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/gdm/PostSession/Default \
+ >/mnt/etc/gdm/PostSession/Default.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*"
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) &
+ . /etc/gdm/PostSession/Default.system' >/mnt/etc/gdm/PostSession/Default
+ chmod a+x /mnt/etc/gdm/PostSession/Default*
+ # gdm should be started via upstart mechanism
+ mv /mnt/etc/init.inactive/gdm.conf /mnt/etc/init
+ echo '/usr/sbin/gdm' >/mnt/etc/X11/default-display-manager
+ # possible to do this directly?
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/metacity
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/gnome-session
+ # gdm does not like AUFS/UnionFS on its var directory
+ rm -rf /mnt/var/lib/gdm
+ mkdir -m 1770 /mnt/var/lib/gdm
+ chown root:gdm /mnt/var/lib/gdm
+ #sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \
+ # -i /mnt$configFile
+ End-of-Here
+
+ return $script;
+}
+
+sub KDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::KDMPathInfo();
+
+ $pathInfo = {
+ config => "/etc/kde4/kdm/kdmrc",
+ paths => [
+ '/var/lib/kdm',
+ '/var/run/kdm',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ return {
+ 'chooser' => {
+ Multicast => 'false',
+ },
+ 'daemon' => {
+ AutomaticLoginEnable => 'false',
+ Group => 'gdm',
+ User => 'gdm',
+ DefaultSession => 'default.desktop',
+ },
+ 'security' => {
+ DisallowTCP => 'true',
+ },
+ 'xdmcp' => {
+ Enable => 'false',
+ },
+ };
+}
+
+sub KDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $kdmVer = "4";
+ my $configHash = $self->SUPER::KDMConfigHashForWorkstation();
+ $configHash->{'General'}->{PidFile} = "/var/run/kdm.pid";
+ $configHash->{'General'}->{ServerVTs} = "-7";
+ $configHash->{'X-:0-Core'}->{Setup} = "/etc/kde$kdmVer/kdm/Xsetup";
+ $configHash->{'X-:0-Core'}->{Startup} = "/etc/kde$kdmVer/kdm/Xstartup";
+ $configHash->{'X-:0-Core'}->{Session} = "/etc/kde$kdmVer/kdm/Xsession";
+ $configHash->{'X-:0-Core'}->{Reset} = "/etc/kde$kdmVer/kdm/Xreset";
+ $configHash->{'X-:0-Core'}->{SessionsDirs} =
+ '/etc/X11/session,/usr/share/xsessions,/usr/share/apps/kdm/sessions';
+ $configHash->{'X-:0-Core'}->{ServerAttempts} = "2";
+
+ return $configHash;
+}
+
+sub setupKDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $kdmVer = "4";
+ my $script = $self->SUPER::setupKDMScript($repoPath);
+
+ $script .= "kdmver=$kdmVer\n";
+ $script .= unshiftHereDoc(<<' End-of-Here');
+
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/kde$kdmver/kdm/Xreset \
+ >/mnt/etc/kde$kdmver/kdm/Xreset.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*" - $USER
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null
+ chmod 0400 /tmp/files.removed ) &
+ . /etc/kde$kdmver/kdm/Xreset.system' >/mnt/etc/kde$kdmver/kdm/Xreset
+ chmod a+x /mnt/etc/kde$kdmver/kdm/Xreset*
+
+ mv /mnt/etc/init.inactive/kdm.conf /mnt/etc/init
+ echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/kwin
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/startkde
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm
new file mode 100644
index 00000000..6f00f181
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_8.pm
@@ -0,0 +1,161 @@
+# Copyright (c) 2006..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Ubuntu_8.pm
+# - provides Ubuntu-specific overrides of the distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Ubuntu_8;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::GDMPathInfo();
+
+ # link gdm.conf-custom instead of gdm.conf
+ $pathInfo->{config} = '/etc/gdm/gdm.conf-custom';
+
+ return $pathInfo;
+}
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupGDMScript($repoPath);
+
+ my $configFile = $self->GDMPathInfo->{config};
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/gdm/PostSession/Default \
+ >/mnt/etc/gdm/PostSession/Default.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*"
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) &
+ . /etc/gdm/PostSession/Default.system' >/mnt/etc/gdm/PostSession/Default
+ chmod a+x /mnt/etc/gdm/PostSession/Default*
+ # gdm should be started after dbus/hal
+ rllinker gdm 5 10
+ echo '/usr/sbin/gdm' >/mnt/etc/X11/default-display-manager
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/metacity
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/gnome-session
+ # gdm does not like AUFS/UnionFS on its var directory
+ rm -rf /mnt/var/lib/gdm
+ mkdir -m 1770 /mnt/var/lib/gdm
+ chown root:gdm /mnt/var/lib/gdm
+ sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \
+ -i /mnt$configFile
+ End-of-Here
+
+ return $script;
+}
+
+sub KDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::KDMPathInfo();
+ my $kdmVer = "3";
+
+ $pathInfo = {
+ config => "/etc/kde$kdmVer/kdm/kdmrc",
+ paths => [
+ '/var/lib/kdm',
+ '/var/run/kdm',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
+ $configHash->{'daemon'}->{SessionDesktopDir} =
+ '/etc/X11/session/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions/';
+
+ return $configHash;
+}
+
+sub KDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $kdmVer = "4";
+ my $configHash = $self->SUPER::KDMConfigHashForWorkstation();
+ $configHash->{'General'}->{PidFile} = "/var/run/kdm.pid";
+ $configHash->{'X-:0-Core'}->{Setup} = "/etc/kde$kdmVer/kdm/Xsetup";
+ $configHash->{'X-:0-Core'}->{Startup} = "/etc/kde$kdmVer/kdm/Xstartup";
+ $configHash->{'X-:0-Core'}->{Session} = "/etc/kde$kdmVer/kdm/Xsession";
+ $configHash->{'X-:0-Core'}->{Reset} = "/etc/kde$kdmVer/kdm/Xreset";
+ $configHash->{'X-:0-Core'}->{SessionsDirs} =
+ '/etc/X11/session,/usr/share/xsessions,/usr/share/apps/kdm/sessions';
+ $configHash->{'X-:0-Core'}->{ServerAttempts} = "2";
+
+ return $configHash;
+}
+
+sub setupKDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $kdmVer = "4";
+ my $script = $self->SUPER::setupKDMScript($repoPath);
+
+ # change default theme to openslx-legacy if kdm3
+ if ( $kdmVer == "3" ) {
+ print " * Please change to openslx-legacy theme when using kdm3\n";
+ }
+
+ $script .= "kdmver=$kdmVer\n";
+ $script .= unshiftHereDoc(<<' End-of-Here');
+
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/kde$kdmver/kdm/Xreset \
+ >/mnt/etc/kde$kdmver/kdm/Xreset.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*" - $USER
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null
+ chmod 0400 /tmp/files.removed ) &
+ . /etc/kde$kdmver/kdm/Xreset.system' >/mnt/etc/kde$kdmver/kdm/Xreset
+ chmod a+x /mnt/etc/kde$kdmver/kdm/Xreset*
+
+ rllinker kdm 1 10
+ echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/kwin
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/startkde
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm
new file mode 100644
index 00000000..1022d6e8
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/Distro/Ubuntu_9_04.pm
@@ -0,0 +1,161 @@
+# Copyright (c) 2006..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop/OpenSLX/Distro/Ubuntu_9_04.pm
+# - provides Ubuntu-specific overrides of the distro API for the desktop
+# plugin.
+# -----------------------------------------------------------------------------
+package desktop::OpenSLX::Distro::Ubuntu_9_04;
+
+use strict;
+use warnings;
+
+use base qw(desktop::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub GDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::GDMPathInfo();
+
+ # link gdm.conf-custom instead of gdm.conf
+ $pathInfo->{config} = '/etc/gdm/gdm.conf-custom';
+
+ return $pathInfo;
+}
+
+sub setupGDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupGDMScript($repoPath);
+
+ my $configFile = $self->GDMPathInfo->{config};
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/gdm/PostSession/Default \
+ >/mnt/etc/gdm/PostSession/Default.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*"
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null ) &
+ . /etc/gdm/PostSession/Default.system' >/mnt/etc/gdm/PostSession/Default
+ chmod a+x /mnt/etc/gdm/PostSession/Default*
+ # gdm should be started after dbus/hal
+ rllinker gdm 5 10
+ echo '/usr/sbin/gdm' >/mnt/etc/X11/default-display-manager
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/metacity
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/gnome-session
+ # gdm does not like AUFS/UnionFS on its var directory
+ rm -rf /mnt/var/lib/gdm
+ mkdir -m 1770 /mnt/var/lib/gdm
+ chown root:gdm /mnt/var/lib/gdm
+ sed '/^\\[daemon\\]/ a\\BaseXsession=/etc/gdm/Xsession' \
+ -i /mnt$configFile
+ End-of-Here
+
+ return $script;
+}
+
+sub KDMPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = $self->SUPER::KDMPathInfo();
+ my $kdmVer = "4";
+
+ $pathInfo = {
+ config => "/etc/kde$kdmVer/kdm/kdmrc",
+ paths => [
+ '/var/lib/kdm',
+ '/var/run/kdm',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+sub GDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $configHash = $self->SUPER::GDMConfigHashForWorkstation();
+ $configHash->{'daemon'}->{SessionDesktopDir} =
+ '/etc/X11/session/:/usr/share/xsessions/:/usr/share/gdm/BuiltInSessions/';
+
+ return $configHash;
+}
+
+sub KDMConfigHashForWorkstation
+{
+ my $self = shift;
+
+ my $kdmVer = "4";
+ my $configHash = $self->SUPER::KDMConfigHashForWorkstation();
+ $configHash->{'General'}->{PidFile} = "/var/run/kdm.pid";
+ $configHash->{'X-:0-Core'}->{Setup} = "/etc/kde$kdmVer/kdm/Xsetup";
+ $configHash->{'X-:0-Core'}->{Startup} = "/etc/kde$kdmVer/kdm/Xstartup";
+ $configHash->{'X-:0-Core'}->{Session} = "/etc/kde$kdmVer/kdm/Xsession";
+ $configHash->{'X-:0-Core'}->{Reset} = "/etc/kde$kdmVer/kdm/Xreset";
+ $configHash->{'X-:0-Core'}->{SessionsDirs} =
+ '/etc/X11/session,/usr/share/xsessions,/usr/share/apps/kdm/sessions';
+ $configHash->{'X-:0-Core'}->{ServerAttempts} = "2";
+
+ return $configHash;
+}
+
+sub setupKDMScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $kdmVer = "4";
+ my $script = $self->SUPER::setupKDMScript($repoPath);
+
+ # change default theme to openslx-legacy if kdm3
+ if ( $kdmVer == "3" ) {
+ print " * Please change to openslx-legacy theme when using kdm3\n";
+ }
+
+ $script .= "kdmver=$kdmVer\n";
+ $script .= unshiftHereDoc(<<' End-of-Here');
+
+ # cleanup after users Xorg session
+ sed 's,^#!.*,,' /mnt/etc/kde$kdmver/kdm/Xreset \
+ >/mnt/etc/kde$kdmver/kdm/Xreset.system
+ echo -e '#! /bin/sh\n#\n# modified by desktop plugin in Stage3\n#\n
+ # remove safely any remaining files of the leaving user in /tmp
+ ( su -c "rm -rf /tmp/*" - $USER
+ echo "$USER files removed by $0" >/tmp/files.removed 2>/dev/null
+ chmod 0400 /tmp/files.removed ) &
+ . /etc/kde$kdmver/kdm/Xreset.system' >/mnt/etc/kde$kdmver/kdm/Xreset
+ chmod a+x /mnt/etc/kde$kdmver/kdm/Xreset*
+
+ rllinker kdm 1 10
+ echo '/usr/bin/kdm' > /mnt/etc/X11/default-display-manager
+ chroot /mnt update-alternatives --set x-window-manager /usr/bin/kwin
+ chroot /mnt update-alternatives --set x-session-manager \
+ /usr/bin/startkde
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm b/src/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm
new file mode 100644
index 00000000..7d496483
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/OpenSLX/OSPlugin/desktop.pm
@@ -0,0 +1,712 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# desktop.pm
+# - implementation of the 'desktop' plugin, which installs
+# all needed information for a displaymanager and for the desktop.
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::desktop;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Basename;
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'desktop',
+ };
+
+ my $localGDMThemesDir
+ = "$openslxConfig{'config-path'}/plugins/desktop/themes/gdm";
+ mkpath($localGDMThemesDir) unless -e $localGDMThemesDir;
+ my $localKDMThemesDir
+ = "$openslxConfig{'config-path'}/plugins/desktop/themes/kdm";
+ mkpath($localKDMThemesDir) unless -e $localKDMThemesDir;
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Sets a desktop and creates needed configs, theme can be set as well.
+ End-of-Here
+ precedence => 40,
+ # not really required e.g. for modern autoconfiguring systems like Ubuntu
+ # 10.04
+ # required => [ qw( xserver ) ],
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ # stage3
+ 'desktop::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'desktop'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'desktop::kind' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ which desktop environment shall be used: gnome, kde, or xfce?
+ End-of-Here
+ content_regex => qr{^(gnome|kde|xfce)$},
+ content_descr => '"gnome", "kde" or "xfce"',
+ default => undef,
+ },
+ 'desktop::manager' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ which display manager to start: gdm, kdm or xdm?
+ End-of-Here
+ content_regex => qr{^(gdm|kdm|xdm)$},
+ content_descr => '"gdm", "kdm" or "xdm"',
+ default => undef,
+ },
+ 'desktop::mode' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ which type of operation mode shall be activated:
+ workstattion, kiosk or chooser?
+ End-of-Here
+ content_regex => qr{^(workstation|kiosk|chooser)$},
+ content_descr => '"workstation", "kiosk" or "chooser"',
+ default => 'workstation',
+ },
+ 'desktop::theme' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ name of the theme to apply to the desktop (unset for no theme)
+ End-of-Here
+ content_descr => 'one of the entries in "supported_themes"',
+ default => 'openslx',
+ },
+ 'desktop::allowshutdown' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ allow shutdown of the SLX client via gdm/kdm. "none" disables
+ this functionality, "root" allows only the sysadmin and
+ "users" means free4all.
+ End-of-Here
+ content_regex => qr{^(none|root|users)$},
+ content_descr => 'possible entries "none", "root" or "users"',
+ default => 'users',
+ },
+ 'desktop::rootlogin' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ allow the system administrator to logon to the graphical
+ user interface (1 allow, 0 disallow).
+ End-of-Here
+ content_descr => '1 means allowed - 0 means forbidden',
+ content_regex => qr{^(0|1)$},
+ default => '1',
+ },
+ # kiosk mode just has the option to logon user nobody
+ #'desktop::auto-login' => {
+ # applies_to_systems => 1,
+ # applies_to_clients => 1,
+ # description => unshiftHereDoc(<<' End-of-Here'),
+ # set an arbitrary user which is logged in automatically into
+ # the graphical user interface (none disables, default).
+ # End-of-Here
+ # content_descr => 'none disables - <user> logins in that userid',
+ # default => 'none',
+ #},
+
+ # stage1
+ 'desktop::gdm' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should gdm be available (installed in vendor-OS)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1" or "-" (for unset)',
+ default => undef,
+ },
+ 'desktop::gnome' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should gnome be available (installed in vendor-OS)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1" or "-" (for unset)',
+ default => undef,
+ },
+ 'desktop::kde' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should kde be available (installed in vendor-OS)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1" or "-" (for unset)',
+ default => undef,
+ },
+ 'desktop::kdm' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should kdm be available (installed in vendor-OS)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1" or "-" (for unset)',
+ default => undef,
+ },
+ 'desktop::supported_themes' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ name of all themes that shall be installed in vendor-OS (such
+ that they can be selected via 'desktop::theme' in stage 3).
+ End-of-Here
+ content_descr => 'a comma-separated list of theme names',
+ default => undef,
+ },
+ 'desktop::xdm' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should xdm be available (installed in vendor-OS)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1" or "-" (for unset)',
+ default => undef,
+ },
+ 'desktop::xfce' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should xfce be available (installed in vendor-OS)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1" or "-" (for unset)',
+ default => undef,
+ },
+ };
+}
+
+sub getDefaultAttrsForVendorOS
+{
+ my $self = shift;
+ my $vendorOSName = shift;
+
+ my $attrs = $self->getAttrInfo();
+
+ if ($vendorOSName =~ m{kde}) {
+ $attrs->{'desktop::manager'}->{default} = 'kdm';
+ $attrs->{'desktop::kind'}->{default} = 'kde';
+ }
+ elsif ($vendorOSName =~ m{gnome}) {
+ $attrs->{'desktop::manager'}->{default} = 'gdm';
+ $attrs->{'desktop::kind'}->{default} = 'gnome';
+ }
+ elsif ($vendorOSName =~ m{xfce}) {
+ $attrs->{'desktop::manager'}->{default} = 'xdm';
+ $attrs->{'desktop::kind'}->{default} = 'xcfe';
+ }
+ else {
+ $attrs->{'desktop::manager'}->{default}
+ = $self->{distro}->getDefaultDesktopManager();
+ $attrs->{'desktop::kind'}->{default}
+ = $self->{distro}->getDefaultDesktopKind();
+ }
+ return $attrs;
+}
+
+sub checkStage3AttrValues
+{
+ my $self = shift;
+ my $stage3Attrs = shift;
+ my $vendorOSAttrs = shift;
+
+ my @problems;
+
+ my $manager = $stage3Attrs->{'desktop::manager'} || '';
+ if ($manager eq 'kdm') {
+ if (!defined $vendorOSAttrs->{'desktop::kdm'}
+ || $vendorOSAttrs->{'desktop::kdm'} == 1) {
+ if (!$self->{distro}->isKDMInstalled()) {
+ push @problems, _tr(
+ "KDM is not installed in vendor-OS, so using it as desktop manager wouldn't work!"
+ );
+ }
+ }
+ elsif ($vendorOSAttrs->{'desktop::kdm'} == 0) {
+ push @problems, _tr(
+ "desktop::kdm is 0, so using KDM as desktop manager is not allowed for this vendor-OS!"
+ );
+ }
+ }
+ elsif ($manager eq 'gdm') {
+ if (!defined $vendorOSAttrs->{'desktop::gdm'}
+ || $vendorOSAttrs->{'desktop::gdm'} == 1) {
+ if (!$self->{distro}->isGDMInstalled()) {
+ push @problems, _tr(
+ "GDM is not installed in vendor-OS, so using it as desktop manager wouldn't work!"
+ );
+ }
+ }
+ elsif ($vendorOSAttrs->{'desktop::gdm'} == 0) {
+ push @problems, _tr(
+ "desktop::gdm is 0, so using GDM as desktop manager is not allowed for this vendor-OS!"
+ );
+ }
+ }
+ elsif ($manager eq 'xdm') {
+ if (!defined $vendorOSAttrs->{'desktop::xdm'}
+ || $vendorOSAttrs->{'desktop::xdm'} == 1) {
+ if (!$self->{distro}->isXDMInstalled()) {
+ push @problems, _tr(
+ "XDM is not installed in vendor-OS, so using it as desktop manager wouldn't work!"
+ );
+ }
+ }
+ elsif ($vendorOSAttrs->{'desktop::xdm'} == 0) {
+ push @problems, _tr(
+ "desktop::xdm is 0, so using XDM as desktop manager is not allowed for this vendor-OS!"
+ );
+ }
+ }
+
+ my $kind = $stage3Attrs->{'desktop::kind'} || '';
+ if ($kind eq 'kde') {
+ if (!defined $vendorOSAttrs->{'desktop::kde'}
+ || $vendorOSAttrs->{'desktop::kde'} == 1) {
+ if (!$self->{distro}->isKDEInstalled()) {
+ push @problems, _tr(
+ "KDE is not installed in vendor-OS, so using it as desktop kind wouldn't work!"
+ );
+ }
+ }
+ elsif ($vendorOSAttrs->{'desktop::kde'} == 0) {
+ push @problems, _tr(
+ "desktop::kde is 0, so using KDE as desktop kind is not allowed for this vendor-OS!"
+ );
+ }
+ }
+ elsif ($kind eq 'gnome') {
+ if (!defined $vendorOSAttrs->{'desktop::gnome'}
+ || $vendorOSAttrs->{'desktop::gnome'} == 1) {
+ if (!$self->{distro}->isGNOMEInstalled()) {
+ push @problems, _tr(
+ "GNOME is not installed in vendor-OS, so using it as desktop kind wouldn't work!"
+ );
+ }
+ }
+ elsif ($vendorOSAttrs->{'desktop::gnome'} == 0) {
+ push @problems, _tr(
+ "desktop::gnome is 0, so using GNOME as desktop kind is not allowed for this vendor-OS!"
+ );
+ }
+ }
+ elsif ($kind eq 'xfce') {
+ if (!defined $vendorOSAttrs->{'desktop::xfce'}
+ || $vendorOSAttrs->{'desktop::xfce'} == 1) {
+ if (!$self->{distro}->isXFCEInstalled()) {
+ push @problems, _tr(
+ "XFCE is not installed in vendor-OS, so using it as desktop kind wouldn't work!"
+ );
+ }
+ }
+ elsif ($vendorOSAttrs->{'desktop::xfce'} == 0) {
+ push @problems, _tr(
+ "desktop::xfce is 0, so using XFCE as desktop kind is not allowed for this vendor-OS!"
+ );
+ }
+ }
+
+ my @supportedThemes
+ = split ',', $vendorOSAttrs->{'desktop::supported_themes'} || '';
+ my $theme = $stage3Attrs->{'desktop::theme'};
+ if (defined $theme && !grep { $_ eq $theme } @supportedThemes) {
+ push @problems, _tr(
+ "desktop::theme '%s' does not refer to a supported theme!\nSupported themes are: %s",
+ $theme, $vendorOSAttrs->{'desktop::supported_themes'} || ''
+ );
+ }
+
+ return if !@problems;
+
+ return \@problems;
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
+
+ # We are going to change some of the stage1 attributes during installation
+ # (basically we are filling the ones that are not defined). Since the result
+ # of these changes might change between invocations, we do not want to store
+ # the resulting values, but we want to store the original (undef).
+ # In order to do so, we copy all stage1 attributes directly into the
+ # object hash and change them there.
+ $self->{gdm} = $self->{attrs}->{'desktop::gdm'};
+ $self->{kdm} = $self->{attrs}->{'desktop::kdm'};
+ $self->{xdm} = $self->{attrs}->{'desktop::xdm'};
+ $self->{gnome} = $self->{attrs}->{'desktop::gnome'};
+ $self->{kde} = $self->{attrs}->{'desktop::kde'};
+ $self->{xcfe} = $self->{attrs}->{'desktop::xfce'};
+ $self->{supported_themes} = $self->{attrs}->{'desktop::supported_themes'};
+
+ $self->_installRequiredPackages();
+ $self->_fillUnsetStage1Attrs();
+ $self->_ensureSensibleStage3Attrs();
+
+ # start to actually do something - according to current stage1 attributes
+ if ($self->{gdm}) {
+ $self->_setupGDM();
+ }
+ if ($self->{kdm}) {
+ $self->_setupKDM();
+ }
+ if ($self->{xdm}) {
+ $self->_setupXDM();
+ }
+ $self->_setupSupportedThemes();
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+sub copyRequiredFilesIntoInitramfs
+{
+ my $self = shift;
+ my $targetPath = shift;
+ my $attrs = shift;
+ my $makeInitRamFSEngine = shift;
+
+ my $desktopTheme = $attrs->{'desktop::theme'} || '<none>';
+
+ vlog(1, _tr("desktop-plugin: desktop=%s", $desktopTheme));
+
+ return;
+}
+
+sub _installRequiredPackages
+{
+ my $self = shift;
+
+ my $engine = $self->{'os-plugin-engine'};
+
+ if ($self->{'gnome'} && !$self->{distro}->isGNOMEInstalled()) {
+ $self->{distro}->installGNOME();
+ }
+ if ($self->{'gdm'} && !$self->{distro}->isGDMInstalled()) {
+ $self->{distro}->installGDM();
+ }
+ if ($self->{'kde'} && !$self->{distro}->isKDEInstalled()) {
+ $self->{distro}->installKDE();
+ }
+ if ($self->{'kdm'} && !$self->{distro}->isKDMInstalled()) {
+ $self->{distro}->installKDM();
+ }
+ if ($self->{'xfce'} && !$self->{distro}->isXFCEInstalled()) {
+ $self->{distro}->installXFCE();
+ }
+ if ($self->{'xdm'} && !$self->{distro}->isXDMInstalled()) {
+ $self->{distro}->installXDM();
+ }
+
+ return 1;
+}
+
+sub _fillUnsetStage1Attrs
+{
+ my $self = shift;
+
+ if (!defined $self->{'gnome'}) {
+ $self->{'gnome'} = $self->{distro}->isGNOMEInstalled();
+ }
+ if (!defined $self->{'gdm'}) {
+ $self->{'gdm'} = $self->{distro}->isGDMInstalled();
+ }
+ if (!defined $self->{'kde'}) {
+ $self->{'kde'} = $self->{distro}->isKDEInstalled();
+ }
+ if (!defined $self->{'kdm'}) {
+ $self->{'kdm'} = $self->{distro}->isKDMInstalled();
+ }
+ if (!defined $self->{'xfce'}) {
+ $self->{'xfce'} = $self->{distro}->isXFCEInstalled();
+ }
+ if (!defined $self->{'xdm'}) {
+ $self->{'xdm'} = $self->{distro}->isXDMInstalled();
+ }
+ if (!defined $self->{'supported_themes'}) {
+ $self->{attrs}->{'desktop::supported_themes'}
+ = $self->{'supported_themes'}
+ = join ",", $self->_getAvailableThemes();
+ }
+
+ return 1;
+}
+
+sub _ensureSensibleStage3Attrs
+{
+ my $self = shift;
+
+ # check if current desktop kind is enabled at all and select another
+ # one, if it isn't
+ my $kind = $self->{attrs}->{'desktop::kind'} || '';
+ if (!$self->{$kind}) {
+ my @desktops = map { $self->{$_} ? $_ : () } qw( gnome kde xfce );
+ if (!@desktops) {
+ die _tr(
+ "no desktop kind is possible, plugin 'desktop' wouldn't work!"
+ );
+ }
+ vlog(0, _tr("selecting %s as desktop kind\n", $desktops[0]));
+ $self->{attrs}->{'desktop::kind'} = $desktops[0];
+ }
+
+ # check if current desktop manager is enabled at all and select another
+ # one, if it isn't
+ my $manager = $self->{attrs}->{'desktop::manager'} || '';
+ if (!$self->{$manager}) {
+ my @managers = map { $self->{$_} ? $_ : () } qw( kdm gdm xdm );
+ if (!@managers) {
+ die _tr(
+ "no desktop manager is possible, plugin 'desktop' wouldn't work!"
+ );
+ }
+ vlog(0, _tr("selecting %s as desktop manager\n", $managers[0]));
+ $self->{attrs}->{'desktop::manager'} = $managers[0];
+ }
+
+ # check if current theme is supported at all and select another one, if it
+ # isn't
+ my $theme = $self->{attrs}->{'desktop::theme'} || '';
+ my @supportedThemes = split ",", $self->{'supported_themes'} || '';
+ if (!grep { $_ eq $theme } @supportedThemes) {
+ if (!@supportedThemes) {
+ vlog( 0, _tr("no themes are supported, using no theme!"));
+ $self->{attrs}->{'desktop::theme'} = undef;
+ }
+ else {
+ vlog(0, _tr("selecting %s as theme\n", $supportedThemes[0]));
+ $self->{attrs}->{'desktop::theme'} = $supportedThemes[0];
+ }
+ }
+
+ return 1;
+}
+
+sub _setupGDM
+{
+ my $self = shift;
+
+ my $repoPath = $self->{pluginRepositoryPath};
+ mkpath([
+ "$repoPath/gdm/workstation",
+ "$repoPath/gdm/kiosk",
+ "$repoPath/gdm/chooser",
+ ]);
+
+ $self->_setupGDMScript();
+
+ my $configHash = $self->{distro}->GDMConfigHashForWorkstation();
+ $self->_writeConfigHash($configHash, "$repoPath/gdm/workstation/gdm.conf");
+
+ $configHash = $self->{distro}->GDMConfigHashForKiosk();
+ $self->_writeConfigHash($configHash, "$repoPath/gdm/kiosk/gdm.conf");
+
+ $configHash = $self->{distro}->GDMConfigHashForChooser();
+ $self->_writeConfigHash($configHash, "$repoPath/gdm/chooser/gdm.conf");
+
+ return;
+}
+
+sub _setupGDMScript
+{
+ my $self = shift;
+
+ my $repoPath = $self->{pluginRepositoryPath};
+ my $script = $self->{distro}->setupGDMScript($repoPath);
+
+ spitFile("$repoPath/gdm/desktop.sh", $script);
+
+ return;
+}
+
+sub _setupKDM
+{
+ my $self = shift;
+
+ my $repoPath = $self->{pluginRepositoryPath};
+ mkpath([
+ "$repoPath/kdm/workstation",
+ "$repoPath/kdm/kiosk",
+ "$repoPath/kdm/chooser",
+ ]);
+
+ $self->_setupKDMScript();
+
+ my $configHash = $self->{distro}->KDMConfigHashForWorkstation();
+ $self->_writeConfigHash($configHash, "$repoPath/kdm/workstation/kdmrc");
+
+ $configHash = $self->{distro}->KDMConfigHashForKiosk();
+ $self->_writeConfigHash($configHash, "$repoPath/kdm/kiosk/kdmrc");
+
+ $configHash = $self->{distro}->KDMConfigHashForChooser();
+ $self->_writeConfigHash($configHash, "$repoPath/kdm/chooser/kdmrc");
+
+ return;
+}
+
+sub _setupKDMScript
+{
+ my $self = shift;
+
+ my $repoPath = $self->{pluginRepositoryPath};
+ my $script = $self->{distro}->setupKDMScript($repoPath);
+
+ spitFile("$repoPath/kdm/desktop.sh", $script);
+
+ return;
+}
+
+sub _setupXDM
+{
+ my $self = shift;
+}
+
+sub _writeConfigHash
+{
+ my $self = shift;
+ my $hash = shift || {};
+ my $file = shift;
+
+ my $content = '';
+ for my $domain (sort keys %$hash) {
+ $content .= "[$domain]\n";
+ for my $key (sort keys %{$hash->{$domain}}) {
+ my $value
+ = defined $hash->{$domain}->{$key}
+ ? $hash->{$domain}->{$key}
+ : '';
+ $content .= "$key=$value\n";
+ }
+ $content .= "\n";
+ }
+ spitFile($file, $content);
+
+ return;
+}
+
+sub _setupSupportedThemes
+{
+ my $self = shift;
+
+ my $supportedThemes = $self->{attrs}->{'desktop::supported_themes'} || '';
+ my @supportedThemes = split m{\s*,\s*}, $supportedThemes;
+ return if !@supportedThemes;
+
+ # Every theme is copied from the folder where it is found first, such that
+ # themes in the config folder will be preferred to a theme with the same
+ # name living in the base folder
+ my @themeBaseDirs = (
+ "$self->{openslxConfigPath}/plugins/desktop/themes",
+ "$self->{openslxBasePath}/lib/plugins/desktop/themes",
+ );
+ THEME:
+ for my $theme (@supportedThemes) {
+ THEME_DIR:
+ foreach my $themeBaseDir (@themeBaseDirs) {
+ my $gdmThemeDir = "$themeBaseDir/gdm/$theme";
+ my $kdmThemeDir = "$themeBaseDir/kdm/$theme";
+ next THEME_DIR if !-d $gdmThemeDir && !-d $kdmThemeDir;
+ # any of both dirs is enough
+
+ # copy theme into plugin-repo folder
+ vlog(1, "installing theme '$theme'...");
+ my $gdmThemeTargetPath = "$self->{pluginRepositoryPath}/themes/gdm";
+ mkpath($gdmThemeTargetPath);
+ slxsystem(
+ "cp -a $gdmThemeDir $gdmThemeTargetPath/$theme 2>/dev/null"
+ ) == 0
+ or die _tr('unable to copy GDM-theme %s (%s)', $theme, $!);
+ my $kdmThemeTargetPath = "$self->{pluginRepositoryPath}/themes/kdm";
+ mkpath($kdmThemeTargetPath);
+ slxsystem(
+ "cp -a $kdmThemeDir $kdmThemeTargetPath/$theme 2>/dev/null"
+ ) == 0
+ or die _tr('unable to copy KDM-theme %s (%s)', $theme, $!);
+ next THEME;
+ }
+ warn _tr('theme "%s" not found - skipped!', $theme);
+ }
+
+ return;
+}
+
+sub _getAvailableThemes
+{
+ my $self = shift;
+
+ my %availableThemes;
+
+ # return all themes found in any of these two folders
+ my @themeBaseDirs = (
+ "$self->{openslxConfigPath}/plugins/desktop/themes",
+ "$self->{openslxBasePath}/lib/plugins/desktop/themes",
+ );
+ for my $themeBaseDir (@themeBaseDirs) {
+ my @foundGDMThemes
+ = map { basename $_ } grep { -d $_ } glob("$themeBaseDir/gdm/*");
+ @availableThemes{@foundGDMThemes} = ();
+ my @foundKDMThemes
+ = map { basename $_ } grep { -d $_ } glob("$themeBaseDir/kdm/*");
+ @availableThemes{@foundKDMThemes} = ();
+ }
+
+ vlog(1, _tr("available themes: %s", join ",", keys %availableThemes));
+
+ return keys %availableThemes;
+}
+
+1;
diff --git a/src/os-plugins/plugins/desktop/XX_desktop.sh b/src/os-plugins/plugins/desktop/XX_desktop.sh
new file mode 100644
index 00000000..a8cc71fc
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/XX_desktop.sh
@@ -0,0 +1,33 @@
+# Copyright (c) 2007..2008 - RZ Uni Freiburg
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'desktop' plugin - the runlevel script
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+if [ -e /initramfs/plugin-conf/desktop.conf ]; then
+ . /initramfs/plugin-conf/desktop.conf
+ if [ $desktop_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'desktop' os-plugin ...";
+
+ # problem which occurs if exporting was forgotten (quick fix code)
+ if [ -e /mnt/opt/openslx/plugin-repo/desktop/${desktop_manager}/desktop.sh ]
+ then . /mnt/opt/openslx/plugin-repo/desktop/${desktop_manager}/desktop.sh
+ else
+ error "This shouldn't fail - you might have forgotten to export \
+your system." fatal
+ fi
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'desktop' os-plugin ...";
+
+ fi
+fi
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx-legacy b/src/os-plugins/plugins/desktop/themes/gdm/openslx-legacy
new file mode 120000
index 00000000..d97839a5
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx-legacy
@@ -0,0 +1 @@
+openslx \ No newline at end of file
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/GdmGreeterTheme.desktop b/src/os-plugins/plugins/desktop/themes/gdm/openslx/GdmGreeterTheme.desktop
new file mode 100755
index 00000000..08e5efce
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/GdmGreeterTheme.desktop
@@ -0,0 +1,8 @@
+[GdmGreeterTheme]
+Encoding=UTF-8
+Greeter=theme.xml
+Name=OpenSLX GDM theme
+Description=GDM Port of Daemonic KDM theme for FreeBSD
+Author=MJanc / KDM by aceph <aceph@ventcore.net>
+Copyright=Creative Commons
+Screenshot=screenshot.png \ No newline at end of file
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/color.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/color.png
new file mode 100644
index 00000000..7a0feb03
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/color.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/environment.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/environment.png
new file mode 100644
index 00000000..7ad6783a
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/environment.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/language-selector.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/language-selector.png
new file mode 100644
index 00000000..da016473
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/language-selector.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/language-selector_inactive.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/language-selector_inactive.png
new file mode 100644
index 00000000..bb2c8f69
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/language-selector_inactive.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/main-runner.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/main-runner.png
new file mode 100644
index 00000000..dde10cc8
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/main-runner.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/openslx-logo-main.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/openslx-logo-main.png
new file mode 100644
index 00000000..f98e6517
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/openslx-logo-main.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/openslx-logo.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/openslx-logo.png
new file mode 100644
index 00000000..8cfaaf94
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/openslx-logo.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/sessions.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/sessions.png
new file mode 100644
index 00000000..00d05f29
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/sessions.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/sessions_inactive.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/sessions_inactive.png
new file mode 100644
index 00000000..86bbe642
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/sessions_inactive.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/system.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/system.png
new file mode 100644
index 00000000..f7b9e71f
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/system.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/system_inactive.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/system_inactive.png
new file mode 100644
index 00000000..c3e1719b
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/system_inactive.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/theme.xml b/src/os-plugins/plugins/desktop/themes/gdm/openslx/theme.xml
new file mode 100644
index 00000000..46ef334e
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/theme.xml
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE greeter SYSTEM "greeter.dtd">
+<!--
+GDM-OpenSLX-Theme
+-->
+<greeter id="theme">
+
+ <!-- background -->
+ <item type="pixmap" id="background" background="true">
+ <normal file="color.png"/>
+ <pos x="0" y="0" width="100%" height="100%"/>
+ </item>
+
+ <!-- top / welcome, clock and big logo -->
+ <item type="rect" id="top" background="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="n" x="50%" y="0" width="100%" height="40%"/>
+ <box orientation="vertical" homogeneous="true">
+
+ <item type="pixmap" background="true">
+ <normal file="welcome-time-shadowed.png"/>
+ <pos anchor="n" x="50%" y="0" width="80%" height="44"/>
+ <box orientation="horizontal" homogeneous="true">
+ <!-- Welcome on ... -->
+ <item type="label" background="true">
+ <pos anchor="w" x="10%" y="30%"/>
+ <normal color="#f0f0f0" font="Sans 11"/>
+ <stock type="welcome-label"/>
+ </item>
+ <!-- clock -->
+ <item type="label" id="clock">
+ <pos anchor="e" x="90%" y="30%"/>
+ <normal color="#f0f0f0" font="Sans 11"/>
+ <text>%c</text>
+ </item>
+ </box>
+ </item>
+
+ <item type="rect" id="logo">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="10%" width="100%" height="100%"/>
+ <box orientation="vertical" homogeneous="true">
+ <item type="pixmap">
+ <normal file="openslx-logo-main.png"/>
+ <pos anchor="c" x="50%" y="50%"/>
+ </item>
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ <!-- main part / login, session, menu, ... -->
+ <item type="pixmap" id="main-runner" background="true">
+ <normal file="main-runner.png"/>
+ <pos anchor="c" x="50%" y="50%" width="100%" height="160"/>
+ <box orientation="horizontal" homogeneous="true">
+
+ <item type="rect" background="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="w" x="0%" y="50%" width="100%" height="100%"/>
+ <box orientation="horizontal" homogeneous="true">
+
+ <!-- left part / login -->
+ <item type="rect" background="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="w" x="0" y="50%" width="100%" height="100%"/>
+ <box orientation="horizontal">
+
+ <!-- small logo -->
+ <item type="pixmap" background="true">
+ <normal file="openslx-logo.png"/>
+ <pos anchor="w" x="30" y="50%"/>
+ </item>
+
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="w" x="70" y="50%" width="box" height="box"/>
+ <box homogeneous="true" spacing="5">
+ <!-- username-label -->
+ <item type="label" id="pam-prompt">
+ <pos anchor="nw" x="0" y="0"/>
+ <normal color="#f0f0f0" font="Sans 11"/>
+ <stock type="username-label"/>
+ </item>
+ <!-- username-entry -->
+ <item type="entry" id="user-pw-entry">
+ <normal color="#0f0f0f" font="Sans 11"/>
+ <pos anchor="sw" x="0" y="100%" height="20" width="120"/>
+ </item>
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ <!-- middle part / errors, caps info, gdm logo -->
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="50%" width="90%" height="100%"/>
+ <box orientation="vertical">
+
+ <!-- Login-Error -->
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="n" x="50%" y="10" width="100%" height="30"/>
+ <box>
+ <item type="label" id="pam-error">
+ <normal color="#ff8b00" font="Sans 11"/>
+ <pos anchor="c" x="50%" y="15"/>
+ <text/>
+ </item>
+ </box>
+ </item>
+
+ <item type="pixmap">
+ <normal file="environment.png"/>
+ <pos anchor="c" x="50%" y="50%"/>
+ </item>
+
+ <!-- capslock-warning -->
+ <item type="rect" id="caps-lock-warning">
+ <normal color="#000000" alpha="0.4"/>
+ <pos anchor="s" x="50%" y="-10" width="100%" height="30"/>
+ <box>
+ <item type="label">
+ <normal color="#ff8b00" font="Sans 11"/>
+ <pos anchor="c" x="50%" y="15"/>
+ <stock type="caps-lock-warning"/>
+ </item>
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ <!-- right part / sessions, menu -->
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="e" x="100%" y="50%" width="100%" height="100%"/>
+ <box orientation="vertical" homogeneous="true" spacing="10">
+
+ <!-- session-button -->
+ <item type="rect" id="session_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="se" x="-50" y="100%" width="box" height="box"/>
+ <box orientation="horizontal">
+ <item type="label">
+ <normal color="#bbbbbb" font="Sans 11"/>
+ <prelight color="#f0f0f0" font="Sans 11"/>
+ <active color="#ff8b00" font="Sans 11"/>
+ <pos anchor="e" x="100%" y="-24"/>
+ <stock type="session"/>
+ </item>
+ <item type="rect" id="session_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="50%" width="10"/>
+ </item>
+ <item type="pixmap" id="session_button" button="true">
+ <normal file="sessions_inactive.png"/>
+ <prelight file="sessions.png"/>
+ <pos anchor="se" x="100%" y="100%"/>
+ </item>
+ </box>
+ </item>
+
+ <!-- menu-button -->
+ <item type="rect" id="system_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="ne" x="-50" y="0" width="box" height="box"/>
+ <box orientation="horizontal">
+ <item type="label">
+ <normal color="#bbbbbb" font="Sans 11"/>
+ <prelight color="#f0f0f0" font="Sans 11"/>
+ <active color="#ff8b00" font="Sans 11"/>
+ <pos anchor="e" x="100%" y="24"/>
+ <stock type="system"/>
+ </item>
+ <item type="rect" id="system_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="50%" width="10"/>
+ </item>
+ <item type="pixmap" id="system_button" button="true">
+ <normal file="system_inactive.png"/>
+ <prelight file="system.png"/>
+ <pos anchor="ne" x="100%" y="0%"/>
+ </item>
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ <!-- language-button -->
+ <item type="rect" id="language_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="se" x="-10" y="-10" width="box" height="box"/>
+ <box orientation="horizontal">
+ <item type="label">
+ <normal color="#3e5d72" font="Sans 11"/>
+ <prelight color="#557f9c" font="Sans 11"/>
+ <active color="#ff8b00" font="Sans 11"/>
+ <pos anchor="e" x="100%" y="16"/>
+ <stock type="language"/>
+ </item>
+ <item type="rect" id="language_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="50%" width="10"/>
+ </item>
+ <item type="pixmap" id="language_button" button="true">
+ <normal file="language-selector_inactive.png"/>
+ <prelight file="language-selector.png"/>
+ <pos anchor="ne" x="100%" y="0%"/>
+ </item>
+ </box>
+ </item>
+
+</greeter>
diff --git a/src/os-plugins/plugins/desktop/themes/gdm/openslx/welcome-time-shadowed.png b/src/os-plugins/plugins/desktop/themes/gdm/openslx/welcome-time-shadowed.png
new file mode 100644
index 00000000..79e872c3
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/gdm/openslx/welcome-time-shadowed.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/GdmGreeterTheme.desktop b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/GdmGreeterTheme.desktop
new file mode 100755
index 00000000..da63ec08
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/GdmGreeterTheme.desktop
@@ -0,0 +1,8 @@
+[GdmGreeterTheme]
+Encoding=UTF-8
+Greeter=theme.xml
+Name=OpenSLX KDM theme
+Description=KDM Port of Daemonic KDM theme for FreeBSD
+Author=MJanc / KDM by aceph <aceph@ventcore.net>
+Copyright=Creative Commons
+Screenshot=screenshot.png
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/KdmGreeterTheme.desktop b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/KdmGreeterTheme.desktop
new file mode 100755
index 00000000..3cb9069d
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/KdmGreeterTheme.desktop
@@ -0,0 +1,8 @@
+[KdmGreeterTheme]
+Encoding=UTF-8
+Greeter=theme.xml
+Name=OpenSLX KDM theme
+Description=KDM Port of Daemonic KDM theme for FreeBSD
+Author=MJanc / KDM by aceph <aceph@ventcore.net>
+Copyright=Creative Commons
+Screenshot=screenshot.png
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/color.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/color.png
new file mode 100644
index 00000000..7a0feb03
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/color.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/enter.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/enter.png
new file mode 100644
index 00000000..b646e851
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/enter.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/enter_inactive.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/enter_inactive.png
new file mode 100644
index 00000000..e12cfb8e
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/enter_inactive.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/environment.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/environment.png
new file mode 100644
index 00000000..b9682822
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/environment.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/main-runner.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/main-runner.png
new file mode 100644
index 00000000..5b3cf656
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/main-runner.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/openslx-logo-main.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/openslx-logo-main.png
new file mode 100644
index 00000000..f98e6517
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/openslx-logo-main.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/openslx-logo.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/openslx-logo.png
new file mode 100644
index 00000000..8cfaaf94
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/openslx-logo.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/sessions.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/sessions.png
new file mode 100644
index 00000000..00d05f29
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/sessions.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/sessions_inactive.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/sessions_inactive.png
new file mode 100644
index 00000000..86bbe642
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/sessions_inactive.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/system.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/system.png
new file mode 100644
index 00000000..f7b9e71f
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/system.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/system_inactive.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/system_inactive.png
new file mode 100644
index 00000000..c3e1719b
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/system_inactive.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/theme.xml b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/theme.xml
new file mode 100644
index 00000000..61ae6644
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/theme.xml
@@ -0,0 +1,204 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE greeter SYSTEM "greeter.dtd">
+<!--
+KDM3-OpenSLX-Theme
+-->
+<greeter>
+ <!-- main pic, login pic -->
+ <item type="pixmap">
+ <normal file="color.png"/>
+ <pos x="0" y="0" width="100%" height="100%"/>
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="n" x="50%" y="0" width="100%" height="40%"/>
+
+ <item type="pixmap">
+ <normal file="welcome-time-shadowed.png"/>
+ <pos anchor="n" x="50%" y="0" width="80%" height="44"/>
+
+ <!-- Welcome on ... -->
+ <item type="label">
+ <pos anchor="w" x="5%" y="33%"/>
+ <normal color="#f0f0f0" font="Sans 12"/>
+ <!-- <stock type="welcome-label"/> -->
+ <text>OpenSLX Workstation (%h)</text>
+ </item>
+
+ <!-- clock -->
+ <item type="label" id="clock">
+ <normal color="#f0f0f0" font="Sans 12"/>
+ <pos anchor="e" x="95%" y="33%"/>
+ <text>%c</text>
+ </item>
+
+ </item>
+
+ <item type="pixmap">
+ <normal file="openslx-logo-main.png"/>
+ <pos anchor="n" x="50%" y="20%" height="70%"/>
+ </item>
+
+ </item>
+
+ <item type="pixmap">
+ <normal file="main-runner.png"/>
+ <pos anchor="c" x="50%" y="50%" width="100%" height="160"/>
+
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="w" x="0" y="50%" width="35%" height="100%"/>
+
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="w" x="0" y="50%" width="120" height="100%"/>
+ <item type="pixmap">
+ <normal file="openslx-logo.png"/>
+ <pos anchor="e" x="100%" y="50%"/>
+ </item>
+ </item>
+
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="e" x="-140" y="50%" width="100%" height="100%"/>
+
+ <!-- username-label -->
+ <item type="label">
+ <pos anchor="e" x="-5" y="40%"/>
+ <normal color="#f0f0f0" font="Sans 11"/>
+ <stock type="username-label"/>
+ </item>
+
+ <!-- password-label -->
+ <item type="label">
+ <pos anchor="e" x="-5" y="60%"/>
+ <normal color="#f0f0f0" font="Sans 11"/>
+ <stock type="password-label"/>
+ </item>
+
+ </item>
+
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="e" x="100%" y="50%" width="140" height="100%"/>
+
+ <!-- username-entry -->
+ <item type="entry" id="user-entry">
+ <pos anchor="w" x="0" y="40%" height="22" width="114"/>
+ </item>
+
+ <!-- password-entry -->
+ <item type="entry" id="pw-entry">
+ <pos anchor="w" x="0" y="60%" height="22" width="114"/>
+ </item>
+
+ <item type="pixmap" button="true" id="login_button">
+ <pos anchor="e" x="100%" y="60%" height="22" width="22"/>
+ <normal file="enter_inactive.png"/>
+ <prelight file="enter.png"/>
+ </item>
+
+ </item>
+
+ </item>
+
+ <item type="rect">
+ <normal color="#ff0000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="50%" width="30%" height="160"/>
+
+ <!-- capslock-warning -->
+ <item type="pixmap" id="caps-lock-warning">
+ <normal file="error.png"/>
+ <pos anchor="c" x="50%" y="22" width="100%" height="70"/>
+ <item type="rect" id="caps-lock-warning">
+ <normal color="#000000" alpha="0.4"/>
+ <pos anchor="c" x="50%" y="50%" width="100%" height="box"/>
+ <box orientation="vertical" xpadding="10" ypadding="5" spacing="0">
+ <item type="label">
+ <normal color="#ff8b00" font="Sans 11"/>
+ <pos x="50%" anchor="n"/>
+ <stock type="caps-lock-warning"/>
+ </item>
+ </box>
+ </item>
+ </item>
+
+ <item type="pixmap">
+ <normal file="environment.png"/>
+ <pos anchor="c" x="50%" y="50%" width="186" height="100"/>
+ </item>
+
+ <!-- Login-Error -->
+ <item type="pixmap" id="pam-error">
+ <normal file="error.png"/>
+ <pos anchor="c" x="50%" y="-22" width="100%" height="70"/>
+ <item type="rect">
+ <normal color="#000000" alpha="0.4"/>
+ <pos anchor="c" x="50%" y="50%" width="100%" height="box"/>
+ <box orientation="vertical" xpadding="10" ypadding="5" spacing="0">
+ <item type="label">
+ <normal color="#ff8b00" font="Sans 11"/>
+ <pos anchor="n" x="50%"/>
+ <text>Login failed!</text>
+ <text xml:lang="en">Login failed!</text>
+ <text xml:lang="de">Login fehlgeschlagen!</text>
+ </item>
+ </box>
+ </item>
+ </item>
+
+ </item>
+
+ <!-- icons and text on the left -->
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="e" x="100%" y="50%" width="35%" height="100%"/>
+
+ <!-- session-button -->
+ <item type="rect" id="session_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="se" x="80%" y="50%" width="160" height="50%"/>
+
+ <item type="pixmap" id="session_button" button="true">
+ <normal file="sessions_inactive.png"/>
+ <prelight file="sessions.png"/>
+ <pos anchor="se" x="94%" y="-8" width="48" height="48"/>
+ </item>
+
+ <item type="label">
+ <normal color="#bbbbbb" font="Sans 11"/>
+ <prelight color="#f0f0f0" font="Sans 11"/>
+ <active color="#ff8b00" font="Sans 11"/>
+ <pos anchor="e" x="-70" y="-32"/>
+ <text>Session</text>
+ <text xml:lang="en">Session</text>
+ <text xml:lang="de">Sitzung</text>
+ </item>
+
+ </item>
+
+ <!-- menu-button -->
+ <item type="rect" id="system_button" button="true">
+ <show modes="console" type="system"/>
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="ne" x="80%" y="50%" width="160" height="50%"/>
+ <item type="pixmap" id="system_button" button="true">
+ <normal file="system_inactive.png"/>
+ <prelight file="system.png"/>
+ <pos anchor="ne" x="94%" y="8" width="48" height="48"/>
+ </item>
+ <item type="label">
+ <normal color="#bbbbbb" font="Sans 11"/>
+ <prelight color="#f0f0f0" font="Sans 11"/>
+ <active color="#ff8b00" font="Sans 11"/>
+ <pos anchor="e" x="-70" y="32"/>
+ <text>System Menu</text>
+ <text xml:lang="en">System Menu</text>
+ <text xml:lang="de">System Menü</text>
+ </item>
+ </item>
+
+ </item>
+
+ </item>
+ </item>
+</greeter>
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/welcome-time-shadowed.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/welcome-time-shadowed.png
new file mode 100644
index 00000000..79e872c3
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx-legacy/welcome-time-shadowed.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/KdmGreeterTheme.desktop b/src/os-plugins/plugins/desktop/themes/kdm/openslx/KdmGreeterTheme.desktop
new file mode 100755
index 00000000..3cb9069d
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/KdmGreeterTheme.desktop
@@ -0,0 +1,8 @@
+[KdmGreeterTheme]
+Encoding=UTF-8
+Greeter=theme.xml
+Name=OpenSLX KDM theme
+Description=KDM Port of Daemonic KDM theme for FreeBSD
+Author=MJanc / KDM by aceph <aceph@ventcore.net>
+Copyright=Creative Commons
+Screenshot=screenshot.png
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/color.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/color.png
new file mode 100644
index 00000000..7a0feb03
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/color.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/enter.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/enter.png
new file mode 100644
index 00000000..b646e851
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/enter.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/enter_inactive.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/enter_inactive.png
new file mode 100644
index 00000000..e12cfb8e
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/enter_inactive.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/environment.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/environment.png
new file mode 100644
index 00000000..b9682822
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/environment.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/main-runner.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/main-runner.png
new file mode 100644
index 00000000..dde10cc8
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/main-runner.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/openslx-logo-main.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/openslx-logo-main.png
new file mode 100644
index 00000000..f98e6517
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/openslx-logo-main.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/openslx-logo.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/openslx-logo.png
new file mode 100644
index 00000000..8cfaaf94
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/openslx-logo.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/sessions.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/sessions.png
new file mode 100644
index 00000000..00d05f29
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/sessions.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/sessions_inactive.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/sessions_inactive.png
new file mode 100644
index 00000000..86bbe642
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/sessions_inactive.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/system.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/system.png
new file mode 100644
index 00000000..f7b9e71f
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/system.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/system_inactive.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/system_inactive.png
new file mode 100644
index 00000000..c3e1719b
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/system_inactive.png
Binary files differ
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/theme.xml b/src/os-plugins/plugins/desktop/themes/kdm/openslx/theme.xml
new file mode 100644
index 00000000..d748c776
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/theme.xml
@@ -0,0 +1,232 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE greeter SYSTEM "greeter.dtd">
+<!--
+KDM-OpenSLX-Theme
+-->
+<greeter id="theme">
+ <style font="Sans 11" window-text-color="#f0f0f0" base-color="#f0f0f0" text-color="#000000"/>
+
+ <!-- background -->
+ <item type="pixmap" id="background" background="true">
+ <normal file="color.png"/>
+ <pos x="0" y="0" width="100%" height="100%"/>
+ </item>
+
+ <!-- top / welcome, clock and big logo -->
+ <item type="rect" id="top" background="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="n" x="50%" y="0" width="100%" height="40%"/>
+ <box orientation="vertical" homogeneous="true">
+
+ <item type="pixmap" background="true">
+ <normal file="welcome-time-shadowed.png"/>
+ <pos anchor="n" x="50%" y="0" width="80%" height="44"/>
+ <box orientation="horizontal" homogeneous="true">
+ <!-- Welcome on ... -->
+ <item type="label" background="true">
+ <pos anchor="w" x="10%" y="30%"/>
+ <normal color="#f0f0f0" font="Sans 11"/>
+ <stock type="welcome-label"/>
+ </item>
+ <!-- clock -->
+ <item type="label" id="clock">
+ <pos anchor="e" x="90%" y="30%"/>
+ <normal color="#f0f0f0" font="Sans 11"/>
+ <text>%c</text>
+ </item>
+ </box>
+ </item>
+
+ <item type="rect" id="logo">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="10%" width="100%" height="100%"/>
+ <box orientation="vertical" homogeneous="true">
+ <item type="pixmap">
+ <normal file="openslx-logo-main.png"/>
+ <pos anchor="c" x="50%" y="50%"/>
+ </item>
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ <!-- main part / login, session, menu, ... -->
+ <item type="pixmap" id="main-runner" background="true">
+ <normal file="main-runner.png"/>
+ <pos anchor="c" x="50%" y="50%" width="100%" height="160"/>
+ <box orientation="horizontal" homogeneous="true">
+
+ <item type="rect" background="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="w" x="0%" y="50%" width="100%" height="100%"/>
+ <box orientation="horizontal" homogeneous="true">
+
+ <!-- left part / login -->
+ <item type="rect" background="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="w" x="0" y="50%" width="100%" height="100%"/>
+ <box orientation="horizontal">
+
+ <!-- small logo -->
+ <item type="pixmap" background="true">
+ <normal file="openslx-logo.png"/>
+ <pos anchor="w" x="30" y="50%"/>
+ </item>
+
+ <!-- login -->
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="w" x="70" y="50%" width="box" height="box"/>
+ <box orientation="horizontal" spacing="10">
+
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="sw" x="0" y="100%" width="box" height="100%"/>
+ <box homogeneous="true" spacing="10">
+ <!-- username-label -->
+ <item type="label">
+ <pos anchor="nw" x="0" y="0"/>
+ <normal color="#f0f0f0" font="Sans 11"/>
+ <stock type="username-label"/>
+ </item>
+ <!-- password-label -->
+ <item type="label">
+ <pos anchor="sw" x="0" y="-0"/>
+ <normal color="#f0f0f0" font="Sans 11"/>
+ <stock type="password-label"/>
+ </item>
+ </box>
+ </item>
+
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="nw" x="0" y="0" width="box" height="box"/>
+ <box homogeneous="true" spacing="10">
+ <!-- username-entry -->
+ <item type="entry" id="user-entry">
+ <pos anchor="w" x="0" y="50%" height="20" width="100"/>
+ </item>
+ <!-- password-entry -->
+ <item type="entry" id="pw-entry">
+ <pos anchor="w" x="0" y="50%" height="20" width="100"/>
+ </item>
+ </box>
+ </item>
+
+ <item type="pixmap" button="true" id="login_button">
+ <pos anchor="sw" x="0" y="-0" height="20" width="20"/>
+ <normal file="enter_inactive.png"/>
+ <prelight file="enter.png"/>
+ </item>
+
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ <!-- middle part / errors, caps info, kdm logo -->
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="50%" width="90%" height="100%"/>
+ <box orientation="vertical">
+
+ <!-- Login-Error -->
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="n" x="50%" y="10" width="100%" height="30"/>
+ <box>
+ <item type="label" id="pam-error">
+ <normal color="#ff8b00" font="Sans 11"/>
+ <pos anchor="c" x="50%" y="15"/>
+ <text/>
+ </item>
+ </box>
+ </item>
+
+ <item type="pixmap">
+ <normal file="environment.png"/>
+ <pos anchor="c" x="50%" y="50%"/>
+ </item>
+
+ <!-- capslock-warning -->
+ <item type="rect" id="caps-lock-warning">
+ <normal color="#000000" alpha="0.4"/>
+ <pos anchor="s" x="50%" y="-10" width="100%" height="30"/>
+ <box>
+ <item type="label">
+ <normal color="#ff8b00" font="Sans 11"/>
+ <pos anchor="c" x="50%" y="15"/>
+ <stock type="caps-lock-warning"/>
+ </item>
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ <!-- right part / sessions, menu -->
+ <item type="rect">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="e" x="100%" y="50%" width="100%" height="100%"/>
+ <box orientation="vertical" homogeneous="true" spacing="10">
+
+ <!-- session-button -->
+ <item type="rect" id="session_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="se" x="-50" y="100%" width="box" height="box"/>
+ <box orientation="horizontal">
+ <item type="label">
+ <normal color="#bbbbbb" font="Sans 11"/>
+ <prelight color="#f0f0f0" font="Sans 11"/>
+ <active color="#ff8b00" font="Sans 11"/>
+ <pos anchor="e" x="100%" y="-24"/>
+ <stock type="session"/>
+ </item>
+ <item type="rect" id="session_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="50%" width="10"/>
+ </item>
+ <item type="pixmap" id="session_button" button="true">
+ <normal file="sessions_inactive.png"/>
+ <prelight file="sessions.png"/>
+ <pos anchor="se" x="100%" y="100%"/>
+ </item>
+ </box>
+ </item>
+
+ <!-- menu-button -->
+ <item type="rect" id="system_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="ne" x="-50" y="0" width="box" height="box"/>
+ <box orientation="horizontal">
+ <item type="label">
+ <normal color="#bbbbbb" font="Sans 11"/>
+ <prelight color="#f0f0f0" font="Sans 11"/>
+ <active color="#ff8b00" font="Sans 11"/>
+ <pos anchor="e" x="100%" y="24"/>
+ <stock type="system"/>
+ </item>
+ <item type="rect" id="system_button" button="true">
+ <normal color="#000000" alpha="0.0"/>
+ <pos anchor="c" x="50%" y="50%" width="10"/>
+ </item>
+ <item type="pixmap" id="system_button" button="true">
+ <normal file="system_inactive.png"/>
+ <prelight file="system.png"/>
+ <pos anchor="ne" x="100%" y="0%"/>
+ </item>
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+ </box>
+ </item>
+
+</greeter>
diff --git a/src/os-plugins/plugins/desktop/themes/kdm/openslx/welcome-time-shadowed.png b/src/os-plugins/plugins/desktop/themes/kdm/openslx/welcome-time-shadowed.png
new file mode 100644
index 00000000..79e872c3
--- /dev/null
+++ b/src/os-plugins/plugins/desktop/themes/kdm/openslx/welcome-time-shadowed.png
Binary files differ
diff --git a/src/os-plugins/plugins/dropbear/OpenSLX/OSPlugin/dropbear.pm b/src/os-plugins/plugins/dropbear/OpenSLX/OSPlugin/dropbear.pm
new file mode 100644
index 00000000..fc1b96f8
--- /dev/null
+++ b/src/os-plugins/plugins/dropbear/OpenSLX/OSPlugin/dropbear.pm
@@ -0,0 +1,104 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# dropbear.pm
+# - an dropbear implementation of the OSPlugin API (i.e. an os-plugin)
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::dropbear;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'dropbear',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ dropbear is a simple/small ssh daemon (for stage 3)
+ End-of-Here
+ precedence => 50,
+ };
+}
+
+sub getAttrInfo
+{ # returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system by means
+ # of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'dropbear::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'dropbear'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ my $attrs = $info->{'plugin-attrs'};
+
+ my $filesDir = "$openslxBasePath/lib/plugins/dropbear/files";
+
+ copyFile("$filesDir/dropbearmulti","$pluginRepoPath");
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/dropbear/XX_dropbear.sh b/src/os-plugins/plugins/dropbear/XX_dropbear.sh
new file mode 100644
index 00000000..cb4321ff
--- /dev/null
+++ b/src/os-plugins/plugins/dropbear/XX_dropbear.sh
@@ -0,0 +1,58 @@
+
+# Copyright (c) 2007..2008 - RZ Uni Freiburg
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'dropbear' plugin - the runlevel script
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+if [ -e /initramfs/plugin-conf/dropbear.conf ]; then
+ . /initramfs/plugin-conf/dropbear.conf
+ if [ $dropbear_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'dropbear' os-plugin ...";
+
+ # setup links to multibinary
+ ln -sf /mnt/opt/openslx/plugin-repo/dropbear/dropbearmulti /sbin/dropbear
+ ln -sf /mnt/opt/openslx/plugin-repo/dropbear/dropbearmulti /sbin/dropbearkey
+ ln -sf /mnt/opt/openslx/plugin-repo/dropbear/dropbearmulti /sbin/dropbearconvert
+ ln -sf /mnt/opt/openslx/plugin-repo/dropbear/dropbearmulti /bin/dbclient
+ ln -sf /mnt/opt/openslx/plugin-repo/dropbear/dropbearmulti /bin/scp
+
+ # create dropbear config dir
+ mkdir -p /etc/dropbear
+
+ # touch some files to get rid of error msgs
+ touch /var/log/lastlog
+ touch /var/log/wtmp
+
+ # copy ssh auth keys from stage1
+ cp -r /mnt/root/.ssh /root
+
+ # give root a valid shell
+ sed -i /etc/passwd -e "s/bash/sh/"
+
+ # convert openssh rsa key to dropbear key - if available
+ if [ -e /mnt/etc/ssh/ssh_host_rsa_key ]; then
+ dropbearconvert openssh dropbear /mnt/etc/ssh/ssh_host_rsa_key \
+ /etc/dropbear/dropbear_rsa_host_key
+ else
+ dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
+ fi
+
+ echo "OpenSLX Debugshell (stage3)" >> /etc/motd
+
+ /sbin/dropbear
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'dropbear' os-plugin ...";
+
+ fi
+fi
diff --git a/src/os-plugins/plugins/dropbear/files/dropbearmulti b/src/os-plugins/plugins/dropbear/files/dropbearmulti
new file mode 100755
index 00000000..357e644f
--- /dev/null
+++ b/src/os-plugins/plugins/dropbear/files/dropbearmulti
Binary files differ
diff --git a/src/os-plugins/plugins/dropbear/init-hooks/95-cleanup/dropbear.sh b/src/os-plugins/plugins/dropbear/init-hooks/95-cleanup/dropbear.sh
new file mode 100755
index 00000000..c0c9cffe
--- /dev/null
+++ b/src/os-plugins/plugins/dropbear/init-hooks/95-cleanup/dropbear.sh
@@ -0,0 +1 @@
+killall -9 dropbear >/dev/null 2>&1
diff --git a/src/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm b/src/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm
new file mode 100644
index 00000000..79f0ba48
--- /dev/null
+++ b/src/os-plugins/plugins/example/OpenSLX/OSPlugin/example.pm
@@ -0,0 +1,154 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# example.pm
+# - an example implementation of the OSPlugin API (i.e. an os-plugin)
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::example;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'example',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ just an exemplary plugin that prints a smiley when the client boots
+ End-of-Here
+ precedence => 50,
+ };
+}
+
+sub getAttrInfo
+{ # returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system by means
+ # of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'example::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'example'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+
+ # plugin specific attributes start here ...
+ 'example::preferred_side' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ determines to which side you have to tilt your head in order
+ to read the smiley
+ End-of-Here
+ content_regex => qr{^(left|right)$},
+ content_descr => q{'left' will print ';-)' - 'right' will print '(-;'},
+ default => 'left',
+ },
+ };
+}
+
+sub installationPhase
+{ # called while chrooted to the vendor-OS root in order to give the plugin
+ # a chance to install required files into the vendor-OS.
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ # The folder where the stage1-plugin should store all files
+ # required by the corresponding stage3 runlevel script.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ # A temporary playground that will be cleaned up automatically.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ # the openslx base path (/opt/openslx) bind-mounted into the chroot
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ # the openslx config path (/etc/opt/openlsx) bind-mounted into the
+ # chroot
+ my $attrs = $info->{'plugin-attrs'};
+ # attributes in effect for this installation
+
+ # for this example plugin, we simply create two files:
+ spitFile("$pluginRepoPath/right", "(-;\n");
+ spitFile("$pluginRepoPath/left", ";-)\n");
+
+ # Some plugins have to copy files from their plugin folder into the
+ # vendor-OS. Here's an example for how to do that:
+ #
+ # # get our own name:
+ # my $pluginName = $self->{'name'};
+ #
+ # # get our own base path:
+ # my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName";
+ #
+ # # copy all needed files now:
+ # foreach my $file ( qw( file1, file2 ) ) {
+ # copyFile("$pluginBasePath/$file", "$pluginRepoPath/");
+ # }
+
+ # name of current os
+ # my $vendorOSName = $self->{'os-plugin-engine'}->{'vendor-os-name'}
+
+ return;
+}
+
+sub removalPhase
+{ # called while chrooted to the vendor-OS root in order to give the plugin
+ # a chance to uninstall no longer required files from the vendor-OS.
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ # The folder where the stage1-plugin should store all files
+ # required by the corresponding stage3 runlevel script.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ # A temporary playground that will be cleaned up automatically.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/example/XX_example.sh b/src/os-plugins/plugins/example/XX_example.sh
new file mode 100644
index 00000000..18f2e47d
--- /dev/null
+++ b/src/os-plugins/plugins/example/XX_example.sh
@@ -0,0 +1,47 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# stage3 part of 'example' plugin - the runlevel script
+#
+# This basically is a runlevel script (just like you know them from 'init'),
+# whose purpose is to activate the plugin in stage3. The 'XX' at the beginning
+# of the filename will be replaced with a runlevel precedence number taken
+# from the configuration of the respective plugin. All plugin runlevel scripts
+# will be executed in the order of those precedence numbers.
+#
+# In order to activate the corresponding plugin, each runlevel script should:
+#
+# a) read the corresponding configuration file (in this case:
+# /initramfs/plugin-conf/example.conf)
+#
+# b) analyse the client (look at the available hardware) and decide what
+# needs to be done, taking into account the settings given in the config
+# file
+#
+# c) activate the plugin by copying/linking appropriate plugin-specific files
+# (in this case: from /mnt/opt/openslx/plugins/example/), load required kernel
+# modules and whatever else might be necessary.
+#
+# if you have any questions regarding the use of this file, please drop a mail
+# to: ot@openslx.com, or join the IRC-channel '#openslx' (on freenode).
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+if [ -e /initramfs/plugin-conf/example.conf ]; then
+ . /initramfs/plugin-conf/example.conf
+ if [ $example_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'example' os-plugin ...";
+
+ # for this example plugin, we simply take a filename from the
+ # configuration and cat that file (output the smiley):
+ cat /mnt/opt/openslx/plugin-repo/example/$preferred_side
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'example' os-plugin ...";
+ fi
+fi
diff --git a/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..83570d7d
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Base.pm
@@ -0,0 +1,60 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# infoscreen/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the infoscreen plugin.
+# -----------------------------------------------------------------------------
+package infoscreen::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub getRequirements
+{
+ my $self = shift;
+
+ return ('libxml2', 'libcurl', 'libimlib2', 'libx11');
+}
+
+sub getPackagemanagerCommand
+{
+ my $self = shift;
+
+ return "yum install";
+}
+
+1;
diff --git a/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..6ac025f5
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# infoscreen/OpenSLX/Distro/Debian.pm
+# - provides Debian-specific overrides of the Distro API for the infoscreen
+# plugin.
+# -----------------------------------------------------------------------------
+package infoscreen::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(infoscreen::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Fedora.pm b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Fedora.pm
new file mode 100644
index 00000000..a4252b62
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Fedora.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# infoscreen/OpenSLX/Distro/Fedora.pm
+# - provides Fedora-specific overrides of the Distro API for the infoscreen
+# plugin.
+# -----------------------------------------------------------------------------
+package infoscreen::OpenSLX::Distro::Fedora;
+
+use strict;
+use warnings;
+
+use base qw(infoscreen::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Gentoo.pm b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Gentoo.pm
new file mode 100644
index 00000000..c2730674
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Gentoo.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# infoscreen/OpenSLX/Distro/Gentoo.pm
+# - provides Gentoo-specific overrides of the Distro API for the infoscreen
+# plugin.
+# -----------------------------------------------------------------------------
+package infoscreen::OpenSLX::Distro::Gentoo;
+
+use strict;
+use warnings;
+
+use base qw(infoscreen::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Scilin.pm b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Scilin.pm
new file mode 100644
index 00000000..e89d6d88
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Scilin.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# infoscreen/OpenSLX/Distro/Scilin.pm
+# - provides Scilin-specific overrides of the Distro API for the infoscreen
+# plugin.
+# -----------------------------------------------------------------------------
+package infoscreen::OpenSLX::Distro::Scilin;
+
+use strict;
+use warnings;
+
+use base qw(infoscreen::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..21d02fbb
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# infoscreen/OpenSLX/Distro/Suse.pm
+# - provides Suse-specific overrides of the Distro API for the infoscreen
+# plugin.
+# -----------------------------------------------------------------------------
+package infoscreen::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(infoscreen::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..10360825
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,44 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# infoscreen/OpenSLX/Distro/Ubuntu.pm
+# - provides Debian-specific overrides of the Distro API for the infoscreen
+# plugin.
+# -----------------------------------------------------------------------------
+package infoscreen::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+use base qw(infoscreen::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub getRequirements
+{
+ my $self = shift;
+
+ return ('libxml2', 'libcurl3', 'libimlib2', 'libx11-6');
+}
+
+sub getPackagemanagerCommand
+{
+ my $self = shift;
+
+ return "aptitude install";
+}
+
+
+1;
diff --git a/src/os-plugins/plugins/infoscreen/OpenSLX/OSPlugin/infoscreen.pm b/src/os-plugins/plugins/infoscreen/OpenSLX/OSPlugin/infoscreen.pm
new file mode 100644
index 00000000..dadd8fe0
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/OpenSLX/OSPlugin/infoscreen.pm
@@ -0,0 +1,112 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# infoscreen.pm
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::infoscreen;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'infoscreen',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ infoscreen plugin ..
+ End-of-Here
+ precedence => 82,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'infoscreen::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'infoscreen'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ my $attrs = $info->{'plugin-attrs'};
+
+ my $filesDir = "$openslxBasePath/lib/plugins/infoscreen/files";
+
+ copyFile("$filesDir/empty.xbm","$pluginRepoPath");
+ copyFile("$filesDir/kiosk.dpms","$pluginRepoPath");
+
+
+ my @requirements = $self->{distro}->getRequirements();
+
+ my $pcmd = $self->{distro}->getPackagemanagerCommand();
+ my $req = join(' ', @requirements);
+
+ slxsystem("$pcmd $req") or _tr(
+ "failed to install requirements"
+ );
+
+ slxsystem("tar -xzf $filesDir/infoscreenClient.tgz -C / ");
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/infoscreen/XX_infoscreen.sh b/src/os-plugins/plugins/infoscreen/XX_infoscreen.sh
new file mode 100644
index 00000000..e2176387
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/XX_infoscreen.sh
@@ -0,0 +1,58 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# check if the plugin config directory is generally available or if the client
+# configuration failed somehow
+[ -d /initramfs/plugin-conf ] || error "${init_picfg}" nonfatal
+
+# main script
+if [ -e /initramfs/plugin-conf/infoscreen.conf ]; then
+ . /initramfs/plugin-conf/infoscreen.conf
+
+ if [ $infoscreen_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'infoscreen' os-plugin ...";
+
+ ln -sf /opt/openslx/plugin-repo/infoscreen/kiosk.dpms \
+ /mnt/bin/kiosk.dpms
+
+ # prepare xsession
+ echo "#!/bin/bash" \
+ > /mnt/home/kiosk/.xinitrc
+ echo "xhost +local:" \
+ >> /mnt/home/kiosk/.xinitrc
+ echo "xsetroot -cursor /opt/openslx/plugin-repo/infoscreen/empty.xbm \\" \
+ >> /mnt/home/kiosk/.xinitrc
+ echo "/opt/openslx/plugin-repo/infoscreen/empty.xbm" \
+ >> /mnt/home/kiosk/.xinitrc
+ echo "/usr/bin/dpclient" \
+ >> /mnt/home/kiosk/.xinitrc
+
+ # remove Standby
+ sed -r "s,(Option.*\"(Blank|Standby|Suspend|Off)Time\"[^\"]*)(.*),\1 \"0\" # disabled by infoscreen \3," \
+ -i /mnt/etc/X11/xorg.conf
+ sed -r "s,(Option.*\"(blank|standby|suspend|off) time\"[^\"]*)(.*),\1 \"0\" # disabled by infoscreen \3," \
+ -i /mnt/etc/X11/xorg.conf
+
+ # energy safe
+ # (requires "xhost +local:")
+ sed -r "s,(Section \"Module\"),\1\n Load \"dpms\"," -i /mnt/etc/X11/xorg.conf
+ echo "0 22 * * * root /bin/kiosk.dpms sleep" >> /mnt/etc/crontab
+ echo "0 7 * * * root /bin/kiosk.dpms wakeup" >> /mnt/etc/crontab
+
+
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'infoscreen' os-plugin ...";
+
+ fi
+
+fi
diff --git a/src/os-plugins/plugins/infoscreen/files/empty.xbm b/src/os-plugins/plugins/infoscreen/files/empty.xbm
new file mode 100644
index 00000000..73b5f706
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/files/empty.xbm
@@ -0,0 +1,6 @@
+#define empty_width 16
+#define empty_height 16
+static unsigned char empty_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/src/os-plugins/plugins/infoscreen/files/infoscreenClient.tgz b/src/os-plugins/plugins/infoscreen/files/infoscreenClient.tgz
new file mode 100644
index 00000000..d1a932c0
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/files/infoscreenClient.tgz
Binary files differ
diff --git a/src/os-plugins/plugins/infoscreen/files/kiosk.dpms b/src/os-plugins/plugins/infoscreen/files/kiosk.dpms
new file mode 100755
index 00000000..d8fd57c5
--- /dev/null
+++ b/src/os-plugins/plugins/infoscreen/files/kiosk.dpms
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+case "$1" in
+ "sleep")
+ xset -display :0 dpms force off
+ xset -display :0 dpms 0 0 0
+ exit 0
+ ;;
+ "wakeup")
+ xset -display :0 dpms force on
+ xset -display :0 dpms 0 0 0
+ xset -display :0 s reset
+ xset -display :0 s noblank
+ xset -display :0 s noexpose
+ xset -display :0 s 0 0
+ xset -display :0 s off
+ xset -display :0 -dpms
+ exit 0
+ ;;
+ *)
+ echo "Usage: kiosk.dpms <command>"
+ echo "Commands"
+ echo " sleep : shut monitor down"
+ echo " wakeup : wake monitor up"
+ exit 0
+ ;;
+esac
diff --git a/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..8f7e506d
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Base.pm
@@ -0,0 +1,65 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# kiosk/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the kiosk plugin.
+# -----------------------------------------------------------------------------
+package kiosk::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub getKgettySetupScript
+{
+ my $self = shift;
+
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # written by OpenSLX-plugin 'kiosk'
+
+ kgettyCmd=\$1
+ sed -i /mnt/etc/inittab \\
+ -e "s,^\(1:[^:]*:respawn\):.*tty1,\\1:\$kgettyCmd,"
+
+ End-of-Here
+
+ return $script;
+
+}
+
+
+1;
diff --git a/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..08bb18e7
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# kiosk/OpenSLX/Distro/Debian.pm
+# - provides Debian-specific overrides of the Distro API for the kiosk
+# plugin.
+# -----------------------------------------------------------------------------
+package kiosk::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(kiosk::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Fedora.pm b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Fedora.pm
new file mode 100644
index 00000000..2b9f8ff5
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Fedora.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# kiosk/OpenSLX/Distro/Fedora.pm
+# - provides Fedora-specific overrides of the Distro API for the kiosk
+# plugin.
+# -----------------------------------------------------------------------------
+package kiosk::OpenSLX::Distro::Fedora;
+
+use strict;
+use warnings;
+
+use base qw(kiosk::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Gentoo.pm b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Gentoo.pm
new file mode 100644
index 00000000..c3133f07
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Gentoo.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# kiosk/OpenSLX/Distro/Gentoo.pm
+# - provides Gentoo-specific overrides of the Distro API for the kiosk
+# plugin.
+# -----------------------------------------------------------------------------
+package kiosk::OpenSLX::Distro::Gentoo;
+
+use strict;
+use warnings;
+
+use base qw(kiosk::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Scilin.pm b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Scilin.pm
new file mode 100644
index 00000000..7423a3b8
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Scilin.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# kiosk/OpenSLX/Distro/Scilin.pm
+# - provides Scilin-specific overrides of the Distro API for the kiosk
+# plugin.
+# -----------------------------------------------------------------------------
+package kiosk::OpenSLX::Distro::Scilin;
+
+use strict;
+use warnings;
+
+use base qw(kiosk::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..587d6db3
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# kiosk/OpenSLX/Distro/Suse.pm
+# - provides Suse-specific overrides of the Distro API for the kiosk
+# plugin.
+# -----------------------------------------------------------------------------
+package kiosk::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(kiosk::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..b8fcb25b
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,47 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# kiosk/OpenSLX/Distro/Ubuntu.pm
+# - provides Debian-specific overrides of the Distro API for the kiosk
+# plugin.
+# -----------------------------------------------------------------------------
+package kiosk::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+use base qw(kiosk::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub getKgettySetupScript
+{
+ my $self = shift;
+
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # written by OpenSLX-plugin 'kiosk'
+
+ kgettyCmd=\$1
+ sed -i /mnt/etc/event.d/tty1 \\
+ -e "s,exec.*,exec \$kgettyCmd,"
+
+ End-of-Here
+
+ return $script;
+
+}
+
+1;
diff --git a/src/os-plugins/plugins/kiosk/OpenSLX/OSPlugin/kiosk.pm b/src/os-plugins/plugins/kiosk/OpenSLX/OSPlugin/kiosk.pm
new file mode 100644
index 00000000..bfeeae0a
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/OpenSLX/OSPlugin/kiosk.pm
@@ -0,0 +1,123 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# kiosk.pm
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::kiosk;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'kiosk',
+ };
+
+ mkpath("$openslxConfig{'config-path'}/plugins/kiosk/profiles");
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ kiosk plugin ..
+ End-of-Here
+ precedence => 50,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'kiosk::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'kiosk'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'kiosk::profile' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'kiosk'-plugin setup a specific profile for the
+ kiosk user? (profile data should be placed in
+ /etc/opt/openslx/plugins/kiosk/profiles/<profilename>/)
+ End-of-Here
+ #content_regex => qr{^(0|1)$},
+ content_descr => 'name of profile',
+ default => 'plain',
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ my $attrs = $info->{'plugin-attrs'};
+
+ my $filesDir = "$openslxBasePath/lib/plugins/kiosk/files";
+
+ copyFile("$filesDir/kgetty","$pluginRepoPath");
+
+ system(qq{cp -r $filesDir/profiles/* $openslxConfig{'config-path'}/plugins/kiosk/profiles/});
+
+ my $scriptpath = "$pluginRepoPath/setup.kgetty";
+ my $script = $self->{distro}->getKgettySetupScript();
+
+ spitFile($scriptpath, $script);
+ chmod (0744, "$scriptpath");
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/kiosk/XX_kiosk.sh b/src/os-plugins/plugins/kiosk/XX_kiosk.sh
new file mode 100644
index 00000000..c7e275ad
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/XX_kiosk.sh
@@ -0,0 +1,60 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# check if the plugin config directory is generally available or if the client
+# configuration failed somehow
+[ -d /initramfs/plugin-conf ] || error "${init_picfg}" nonfatal
+
+# main script
+if [ -e /initramfs/plugin-conf/kiosk.conf ]; then
+ . /initramfs/plugin-conf/kiosk.conf
+
+ if [ $kiosk_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'kiosk' os-plugin ...";
+
+
+ profile_path="/etc/opt/openslx/plugins/kiosk/profiles/"
+
+ # avoid ldap conflicts - part I
+ # hide nsswitch.conf
+ if [ -e /mnt/etc/nsswitch.conf ]; then
+ mv /mnt/etc/nsswitch.conf /mnt/etc/nsswitch.conf.bak
+ fi
+
+ if [ -e /mnt/$profile_path/$kiosk_profile/ ]; then
+ # create new user
+ chroot /mnt useradd -s /bin/bash -k $profile_path/$kiosk_profile/ -m kiosk
+ chroot /mnt chown kiosk /home/kiosk/ -R
+ else
+ chroot /mnt useradd -s /bin/bash -k $profile_path/plain/ -m kiosk
+ fi
+
+ # avoid ldap conflicts - part II
+ # restore old nsswitch setup
+ if [ -e /mnt/etc/nsswitch.conf.bak ]; then
+ mv /mnt/etc/nsswitch.conf.bak /mnt/etc/nsswitch.conf
+ fi
+
+ # setup custom rungetty
+ mkdir -p /mnt/root/bin
+ ln -sf /opt/openslx/plugin-repo/kiosk/kgetty /mnt/root/bin/kgetty
+
+ kgettycmd="/root/bin/kgetty --autologin kiosk tty1"
+
+ /mnt/opt/openslx/plugin-repo/kiosk/setup.kgetty "$kgettycmd"
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'kiosk' os-plugin ...";
+
+ fi
+
+fi
diff --git a/src/os-plugins/plugins/kiosk/files/kgetty b/src/os-plugins/plugins/kiosk/files/kgetty
new file mode 100755
index 00000000..a65d96de
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/files/kgetty
Binary files differ
diff --git a/src/os-plugins/plugins/kiosk/files/profiles/plain/.bashrc b/src/os-plugins/plugins/kiosk/files/profiles/plain/.bashrc
new file mode 120000
index 00000000..cee304e6
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/files/profiles/plain/.bashrc
@@ -0,0 +1 @@
+bashrc \ No newline at end of file
diff --git a/src/os-plugins/plugins/kiosk/files/profiles/plain/bashrc b/src/os-plugins/plugins/kiosk/files/profiles/plain/bashrc
new file mode 100644
index 00000000..28694f85
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/files/profiles/plain/bashrc
@@ -0,0 +1,4 @@
+if [ "x$(tty)" == "x/dev/tty1" ]; then
+ startx
+ exit
+fi
diff --git a/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.bash_profile b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.bash_profile
new file mode 100644
index 00000000..099cd106
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.bash_profile
@@ -0,0 +1,2 @@
+# fix for some systems which don't source .bashrc automatically
+. ~/.bashrc \ No newline at end of file
diff --git a/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.bashrc b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.bashrc
new file mode 120000
index 00000000..cee304e6
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.bashrc
@@ -0,0 +1 @@
+bashrc \ No newline at end of file
diff --git a/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.xinitrc b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.xinitrc
new file mode 120000
index 00000000..5539532c
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/.xinitrc
@@ -0,0 +1 @@
+xinitrc \ No newline at end of file
diff --git a/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/bashrc b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/bashrc
new file mode 100644
index 00000000..28694f85
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/bashrc
@@ -0,0 +1,4 @@
+if [ "x$(tty)" == "x/dev/tty1" ]; then
+ startx
+ exit
+fi
diff --git a/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/xinitrc b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/xinitrc
new file mode 100644
index 00000000..7774f4d2
--- /dev/null
+++ b/src/os-plugins/plugins/kiosk/files/profiles/vmchooser/xinitrc
@@ -0,0 +1,7 @@
+# check if we need to include Xsession script generated by out profile
+# plugin
+[ -e /etc/X11/Xsession.d/10slx-home_env ] && \
+ . /etc/X11/Xsession.d/10slx-home_env
+
+/usr/bin/xsetroot -solid navy
+/opt/openslx/plugin-repo/vmchooser/vmchooser -p /dev/null \ No newline at end of file
diff --git a/src/os-plugins/plugins/openvz/OpenSLX/OSPlugin/openvz.pm b/src/os-plugins/plugins/openvz/OpenSLX/OSPlugin/openvz.pm
new file mode 100644
index 00000000..35e12bb2
--- /dev/null
+++ b/src/os-plugins/plugins/openvz/OpenSLX/OSPlugin/openvz.pm
@@ -0,0 +1,110 @@
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# openvz.pm
+# - implementation of the 'openvz' plugin
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::openvz;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'openvz',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Configures openVZ diskless boot, no installation yet.
+ End-of-Here
+ precedence => 20,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'openvz::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'openvz'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ # set active to 0, later set specially created openVZ system to 1
+ default => '0',
+ },
+ # attribute 'imagesrc' defines where we can find openvz images
+ 'openvz::imagesrc' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Where do we store our openvz images? NFS? Filesystem?
+ End-of-Here
+ content_regex => qr{^(/|nfs://)},
+ content_descr => 'local path or URI or "-" (unset)',
+ default => undef,
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+
+ # Copy run-virt.include and template files to the appropriate place for
+ # inclusion in stage4
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath =
+ "$self->{openslxBasePath}/lib/plugins/$pluginName/files";
+
+ foreach my $file ( qw( run-virt.include machine.include ) ) {
+ copyFile("$pluginBasePath/$file", "$self->{pluginRepositoryPath}/");
+ chmod 0644, "$self->{pluginRepositoryPath}/$file";
+ }
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/openvz/XX_openvz.sh b/src/os-plugins/plugins/openvz/XX_openvz.sh
new file mode 100644
index 00000000..721c76a4
--- /dev/null
+++ b/src/os-plugins/plugins/openvz/XX_openvz.sh
@@ -0,0 +1,66 @@
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'openvz' plugin - the runlevel script
+#
+# 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/openvz.conf
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/openvz
+PLUGINDIR=/mnt/${OPENSLX_DEFAULT_DIR}/plugin-repo/openvz
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/openvz
+
+# check if the configuration file is available
+if [ -e ${CONFFILE} ]; then
+
+ # load needed variables
+ . ${CONFFILE}
+
+ # Test if this plugin is activated... more or less useless with the
+ # new plugin system
+ if [ $openvz_active -ne 0 2>/dev/null ]; then
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'openvz' os-plugin ...";
+
+ # load general configuration
+ . /etc/initramfs-setup
+
+ # get source of openvz image server (get type, server and path)
+ if strinstr "/" "${openvz_imagesrc}" ; then
+ vbimgprot=$(uri_token ${openvz_imagesrc} prot)
+ vbimgserv=$(uri_token ${openvz_imagesrc} server)
+ vbimgpath="$(uri_token ${openvz_imagesrc} path)"
+ fi
+ if [ -n "${vbimgserv}" ] ; then
+ # directory where qemu images are expected in
+ mnttarget=${VIRTDIR}
+ # mount the openvz image source readonly (ro)
+ fsmount ${vbimgprot} ${vbimgserv} ${vbimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && \
+ error " * Incomplete information in variable ${openvz_imagesrc}." \
+ nonfatal
+ fi
+
+ # copy virtualization include files to config dir
+ testmkd ${PLUGINCONFDIR}
+ cp ${PLUGINDIR}/*.include ${PLUGINCONFDIR}
+ # copy ${CONFFILE} to ${PLUGINCONFDIR} just in case
+ cp ${CONFFILE} ${PLUGINCONFDIR}
+
+ # activate init files
+
+ fi
+fi
diff --git a/src/os-plugins/plugins/openvz/files/machine.include b/src/os-plugins/plugins/openvz/files/machine.include
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/os-plugins/plugins/openvz/files/machine.include
diff --git a/src/os-plugins/plugins/openvz/files/run-virt.include b/src/os-plugins/plugins/openvz/files/run-virt.include
new file mode 100644
index 00000000..53c982c8
--- /dev/null
+++ b/src/os-plugins/plugins/openvz/files/run-virt.include
@@ -0,0 +1,37 @@
+# run-virt.include
+# -----------------------------------------------------------------------------
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+# -----------------------------------------------------------------------------
+# run-virt.include
+# - Include script for running openVZ on an OpenSLX client via run-virt.sh or
+# run-vmgrid.sh
+################################################################################
+
+################################################################################
+### Include general configuration
+################################################################################
+if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf ]; then
+ . ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf
+else
+ writelog "Problems reading config file of ${self} plugin"
+ exit 1
+fi
+
+################################################################################
+### Declaration of default variables
+################################################################################
+
+PLUGINCONFXEN="${PLUGINCONFROOT}/${self}"
+# create TMPDIR for all users
+mkdir -m 1777 /tmp/${self} 2>/dev/null
+# dir for configs
+confdir="/tmp/${self}/${USER}/${VM_ID}"
diff --git a/src/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh b/src/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100755
index 00000000..d5245234
--- /dev/null
+++ b/src/os-plugins/plugins/openvz/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical to the files of virtualbox and qemukvm plugins)
+#############################################################################
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} 0
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} ${bridge}
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}
diff --git a/src/os-plugins/plugins/profile/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/profile/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..5588a177
--- /dev/null
+++ b/src/os-plugins/plugins/profile/OpenSLX/Distro/Base.pm
@@ -0,0 +1,84 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# profile/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the profile plugin.
+# -----------------------------------------------------------------------------
+package profile::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub getXsessionDPath
+{
+ my $self = shift;
+
+ return "/etc/X11/Xsession.d/10slx-home_env";
+}
+
+
+sub getProfileDPAth
+{
+ my $self = shift;
+
+ return "/etc/profile.d/slx-kdehome.sh";
+}
+
+sub getKdeHome
+{
+ my $self = shift;
+
+ return ".openslx/unknown/kde";
+}
+
+sub getGconfPathConfig
+{
+ my $self = shift;
+
+ return "/etc/gconf/2/path";
+}
+
+
+sub getGconfHome
+{
+ my $self = shift;
+
+ return ".openslx/unknown/gconf";
+}
+
+
+1;
diff --git a/src/os-plugins/plugins/profile/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/profile/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..31ca1e8e
--- /dev/null
+++ b/src/os-plugins/plugins/profile/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# profile/OpenSLX/Distro/Debian.pm
+# - provides Debian-specific overrides of the Distro API for the profile
+# plugin.
+# -----------------------------------------------------------------------------
+package profile::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(profile::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/profile/OpenSLX/Distro/Fedora.pm b/src/os-plugins/plugins/profile/OpenSLX/Distro/Fedora.pm
new file mode 100644
index 00000000..433f6f7f
--- /dev/null
+++ b/src/os-plugins/plugins/profile/OpenSLX/Distro/Fedora.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# profile/OpenSLX/Distro/Fedora.pm
+# - provides Fedora-specific overrides of the Distro API for the profile
+# plugin.
+# -----------------------------------------------------------------------------
+package profile::OpenSLX::Distro::Fedora;
+
+use strict;
+use warnings;
+
+use base qw(profile::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/profile/OpenSLX/Distro/Gentoo.pm b/src/os-plugins/plugins/profile/OpenSLX/Distro/Gentoo.pm
new file mode 100644
index 00000000..240811df
--- /dev/null
+++ b/src/os-plugins/plugins/profile/OpenSLX/Distro/Gentoo.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# profile/OpenSLX/Distro/Gentoo.pm
+# - provides Gentoo-specific overrides of the Distro API for the profile
+# plugin.
+# -----------------------------------------------------------------------------
+package profile::OpenSLX::Distro::Gentoo;
+
+use strict;
+use warnings;
+
+use base qw(profile::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/profile/OpenSLX/Distro/Scilin.pm b/src/os-plugins/plugins/profile/OpenSLX/Distro/Scilin.pm
new file mode 100644
index 00000000..de66f02a
--- /dev/null
+++ b/src/os-plugins/plugins/profile/OpenSLX/Distro/Scilin.pm
@@ -0,0 +1,32 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# profile/OpenSLX/Distro/Scilin.pm
+# - provides Scilin-specific overrides of the Distro API for the profile
+# plugin.
+# -----------------------------------------------------------------------------
+package profile::OpenSLX::Distro::Scilin;
+
+use strict;
+use warnings;
+
+use base qw(profile::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+
+
+1;
diff --git a/src/os-plugins/plugins/profile/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/profile/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..e90e8211
--- /dev/null
+++ b/src/os-plugins/plugins/profile/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,68 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# profile/OpenSLX/Distro/Suse.pm
+# - provides Suse-specific overrides of the Distro API for the profile
+# plugin.
+# -----------------------------------------------------------------------------
+package profile::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(profile::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub _getKdeHomeMap
+{
+ my $self = shift;
+
+ return;
+}
+
+sub getProfileDPAth
+{
+ my $self = shift;
+
+
+ return "/etc/profile.d/slx-kdehome.sh";
+}
+
+sub getKdeHome
+{
+ my $self = shift;
+
+ return ".openslx/suse/kde";
+}
+
+sub getGconfPathConfig
+{
+ my $self = shift;
+
+ return "/etc/gconf/2/path";
+}
+
+
+sub getGconfHome
+{
+ my $self = shift;
+
+ return ".openslx/suse/gconf";
+}
+
+
+
+1;
diff --git a/src/os-plugins/plugins/profile/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/profile/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..26cd9426
--- /dev/null
+++ b/src/os-plugins/plugins/profile/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,66 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# profile/OpenSLX/Distro/Ubuntu.pm
+# - provides Debian-specific overrides of the Distro API for the profile
+# plugin.
+# -----------------------------------------------------------------------------
+package profile::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+use base qw(profile::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub _getKdeHomeMap
+{
+ my $self = shift;
+
+ return;
+}
+
+sub getProfileDPAth
+{
+ my $self = shift;
+
+
+ return "/etc/profile.d/slx-kdehome.sh";
+}
+
+sub getKdeHome
+{
+ my $self = shift;
+
+ return ".openslx/ubuntu/kde";
+}
+
+sub getGconfPathConfig
+{
+ my $self = shift;
+
+ return "/etc/gconf/2/path";
+}
+
+
+sub getGconfHome
+{
+ my $self = shift;
+
+ return ".openslx/ubuntu/gconf";
+}
+
+1;
diff --git a/src/os-plugins/plugins/profile/OpenSLX/Distro/Ubuntu_10.pm b/src/os-plugins/plugins/profile/OpenSLX/Distro/Ubuntu_10.pm
new file mode 100644
index 00000000..3b288e97
--- /dev/null
+++ b/src/os-plugins/plugins/profile/OpenSLX/Distro/Ubuntu_10.pm
@@ -0,0 +1,66 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# profile/OpenSLX/Distro/Ubuntu.pm
+# - provides Debian-specific overrides of the Distro API for the profile
+# plugin.
+# -----------------------------------------------------------------------------
+package profile::OpenSLX::Distro::Ubuntu_10;
+
+use strict;
+use warnings;
+
+use base qw(profile::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub _getKdeHomeMap
+{
+ my $self = shift;
+
+ return;
+}
+
+sub getProfileDPAth
+{
+ my $self = shift;
+
+
+ return "/etc/profile.d/slx-kdehome.sh";
+}
+
+sub getKdeHome
+{
+ my $self = shift;
+
+ return ".openslx/ubuntu-lucid.kde";
+}
+
+sub getGconfPathConfig
+{
+ my $self = shift;
+
+ return "/etc/gconf/2/path";
+}
+
+
+sub getGconfHome
+{
+ my $self = shift;
+
+ return ".openslx.ubuntu-lucid.gconf";
+}
+
+1;
diff --git a/src/os-plugins/plugins/profile/OpenSLX/OSPlugin/profile.pm b/src/os-plugins/plugins/profile/OpenSLX/OSPlugin/profile.pm
new file mode 100644
index 00000000..b9538374
--- /dev/null
+++ b/src/os-plugins/plugins/profile/OpenSLX/OSPlugin/profile.pm
@@ -0,0 +1,174 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# profile.pm
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::profile;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'profile',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ profile plugin ..
+ End-of-Here
+ precedence => 82,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'profile::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'profile'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ };
+}
+
+sub _writeKdehomeEnv
+{
+ my $self = shift;
+
+ my $profileFile = unshiftHereDoc(<<' End-of-Here');
+ # Do not modify this file.
+ # File generated by profile plugin.
+ # For more information have a look at
+ # http://lab.openslx.org/wiki/openslx/profile
+
+ export KDEHOME=${HOME}/%s
+ End-of-Here
+
+ $profileFile = sprintf(
+ $profileFile,
+ $self->{distro}->getKdeHome()
+ );
+
+ spitFile($self->{distro}->getProfileDPAth(), $profileFile);
+
+ return $self->{distro}->getKdeHome();
+}
+
+sub _modifyGconfPaths
+{
+ my $self = shift;
+
+ my $cmd = "sed -i \"s,readwrite:\\\$(HOME)/.gconf,readwrite:\\\$(HOME)/%s,\" %s";
+ $cmd = sprintf (
+ $cmd,
+ $self->{distro}->getGconfHome(),
+ $self->{distro}->getGconfPathConfig()
+ );
+
+ slxsystem($cmd);
+
+ return $self->{distro}->getGconfHome();
+}
+
+sub _writeXsessionScript
+{
+ my $self = shift;
+ my @paths = @_;
+
+ my $xsessionFile= unshiftHereDoc(<<' End-of-Here');
+ # Do not modify this file.
+ # File generated by profile plugin.
+ # For more information have a look at
+ # http://lab.openslx.org/wiki/openslx/profile
+
+ %s
+ End-of-Here
+
+ my $cmd = "mkdir -p ";
+
+ while (@paths) {
+ my $path = shift(@paths);
+ $cmd .= "\${HOME}/$path \\\n";
+ }
+
+ $cmd .= "> /dev/null 2>&1 \n";
+
+ $xsessionFile = sprintf(
+ $xsessionFile,
+ $cmd
+ );
+
+ spitFile($self->{distro}->getXsessionDPath(), $xsessionFile);
+
+ return;
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ my $attrs = $info->{'plugin-attrs'};
+
+ my @slxHomeEnv;
+
+ push (@slxHomeEnv, $self->_writeKdehomeEnv());
+ push (@slxHomeEnv, $self->_modifyGconfPaths());
+
+ $self->_writeXsessionScript(@slxHomeEnv);
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/profile/XX_profile.sh b/src/os-plugins/plugins/profile/XX_profile.sh
new file mode 100644
index 00000000..1589bd61
--- /dev/null
+++ b/src/os-plugins/plugins/profile/XX_profile.sh
@@ -0,0 +1,31 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# check if the plugin config directory is generally available or if the client
+# configuration failed somehow
+[ -d /initramfs/plugin-conf ] || error "${init_picfg}" nonfatal
+
+# main script
+if [ -e /initramfs/plugin-conf/profile.conf ]; then
+ . /initramfs/plugin-conf/profile.conf
+
+ if [ $profile_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'profile' os-plugin ...";
+
+
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'profile' os-plugin ...";
+
+ fi
+
+fi
diff --git a/src/os-plugins/plugins/pvs/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..3425f2ab
--- /dev/null
+++ b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Base.pm
@@ -0,0 +1,46 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# pvs/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the pvs plugin.
+# -----------------------------------------------------------------------------
+package pvs::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+1;
diff --git a/src/os-plugins/plugins/pvs/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..0382d3b9
--- /dev/null
+++ b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,29 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# pvs/OpenSLX/Distro/debian.pm
+# - provides Debian-specific overrides of the Distro API for the pvs
+# plugin.
+# -----------------------------------------------------------------------------
+package pvs::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(pvs::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+1;
diff --git a/src/os-plugins/plugins/pvs/OpenSLX/Distro/Fedora.pm b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Fedora.pm
new file mode 100644
index 00000000..76b8ffa1
--- /dev/null
+++ b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Fedora.pm
@@ -0,0 +1,28 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# pvs/OpenSLX/Distro/Fedora.pm
+# - provides Fedora-specific overrides of the Distro API for the pvs
+# plugin.
+# -----------------------------------------------------------------------------
+package pvs::OpenSLX::Distro::Fedora;
+
+use strict;
+use warnings;
+
+use base qw(pvs::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+1;
diff --git a/src/os-plugins/plugins/pvs/OpenSLX/Distro/Gentoo.pm b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Gentoo.pm
new file mode 100644
index 00000000..b943a63b
--- /dev/null
+++ b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Gentoo.pm
@@ -0,0 +1,28 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# pvs/OpenSLX/Distro/Gentoo.pm
+# - provides Gentoo-specific overrides of the Distro API for the pvs
+# plugin.
+# -----------------------------------------------------------------------------
+package pvs::OpenSLX::Distro::Gentoo;
+
+use strict;
+use warnings;
+
+use base qw(pvs::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+1;
diff --git a/src/os-plugins/plugins/pvs/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..411fa1c9
--- /dev/null
+++ b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,28 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# pvs/OpenSLX/Distro/Suse.pm
+# - provides SUSE-specific overrides of the Distro API for the pvs plugin.
+# -----------------------------------------------------------------------------
+package pvs::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(pvs::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+1;
diff --git a/src/os-plugins/plugins/pvs/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..c7496ac0
--- /dev/null
+++ b/src/os-plugins/plugins/pvs/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,23 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# pvs/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu-specific overrides of the Distro API for the pvs
+# plugin.
+# -----------------------------------------------------------------------------
+package pvs::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+# inherit everything from Debian (as Ubuntu is based on it anyway)
+use base qw(pvs::OpenSLX::Distro::Debian);
+
+1;
diff --git a/src/os-plugins/plugins/pvs/OpenSLX/OSPlugin/pvs.pm b/src/os-plugins/plugins/pvs/OpenSLX/OSPlugin/pvs.pm
new file mode 100644
index 00000000..d0a629e4
--- /dev/null
+++ b/src/os-plugins/plugins/pvs/OpenSLX/OSPlugin/pvs.pm
@@ -0,0 +1,127 @@
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# pvs.pm - plugin to use the pool video switch tools within OpenSLX environment
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::pvs;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+sub new
+{
+ my $class = shift;
+ my $self = {
+ name => 'pvs',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ enables pvs server (user or xorg)
+ End-of-Here
+ # waits for xorg to add configuration if needed
+ precedence => 70,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'pvs::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'pvs' plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+
+ 'pvs::mode' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ set pvs to listen on Xorg user sessions (default), general
+ access to the Xorg server (including displaymanager login) and
+ console framebuffer.
+ End-of-Here
+ content_regex => qr{^(x11user|x11mod|fb)$},
+ content_descr => 'x11user for user, x11mod for access via Xorg module or fb',
+ default => 'x11user',
+ },
+
+ 'pvs::scale' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ scale screen size (e.g. as fraction 2/3 or as decimal 0.5)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepositoryPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+
+ # should we distinguish between the two different packages!?
+ # libvnc should be part of the xorg package!? (so no check needed)
+ #my $engine = $self->{'os-plugin-engine'};
+ #if (!isInPath('pvs')) {
+ # $engine->installPackages(
+ # $engine->getInstallablePackagesForSelection('pvs')
+ # );
+ #} else {
+ # vlog(3, "pvs is already installed");
+ #}
+
+ # get path of files we need to install
+ my $pluginFilesPath = "$openslxBasePath/lib/plugins/$self->{'name'}/files";
+ my $script = $self->{distro}->fillRunlevelScript();
+
+ # copy all needed files now
+ copyFile("$pluginFilesPath/*", "$pluginRepositoryPath");
+
+ # link these files
+
+ #chmod 0755, "/etc/init.d/pvs";
+
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+}
+
+1;
diff --git a/src/os-plugins/plugins/pvs/XX_pvs.sh b/src/os-plugins/plugins/pvs/XX_pvs.sh
new file mode 100644
index 00000000..9a86574f
--- /dev/null
+++ b/src/os-plugins/plugins/pvs/XX_pvs.sh
@@ -0,0 +1,46 @@
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# Check if the plugin config directory is generally available or if the client
+# configuration failed somehow
+[ -d /initramfs/plugin-conf ] || error "${init_picfg}" nonfatal
+
+# main script
+if [ -e /initramfs/plugin-conf/pvs.conf ]; then
+ . /initramfs/plugin-conf/pvs.conf
+ if [ $pvs_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'pvs' os-plugin ...";
+ # location of central pvs configuration files
+ testmkdi /mnt/etc/openslx/pvs
+
+ # add it to the Xserver script (?)
+
+ # link the executables
+ #for tool in poolVS poolVSClient VNCwrapper ; do
+ # ln -s /opt/openslx/plugin-repo/pvs/${tool} /mnt/var/X11R6/bin/${tool}
+ #done
+
+ # write config file
+ #echo "# parameters generated by $0" > /mnt/etc/pvs/pvs.conf
+ #echo "pvs_PARAMS=\"$PARAMS\"" >> /mnt/etc/pvs/pvs.conf
+ #echo "pvs_X11=\"$pvs_X11\"" >> /mnt/etc/pvs/pvs.conf
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'pvs' os-plugin ...";
+
+ fi
+ fi
+else
+ [ $DEBUGLEVEL -gt 2 ] && \
+ echo "No configuration file found for pvs plugin."
+fi
diff --git a/src/os-plugins/plugins/pvs/files/pvs-vncsrv b/src/os-plugins/plugins/pvs/files/pvs-vncsrv
new file mode 100755
index 00000000..966bf1df
--- /dev/null
+++ b/src/os-plugins/plugins/pvs/files/pvs-vncsrv
@@ -0,0 +1,105 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Copyright (c) 2009 - RZ Uni FR
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# pvs-vncsrv
+# - This is a generic wrapper script for starting any userspace VNC server
+# to offer connectivity from the pvs contol console. The script expects
+# start/stop in $1, the port to start on in $2 and the password in $3. The
+# latter one should be changed to piping for security reasons ...
+# -----------------------------------------------------------------------------
+
+# parameters for x11vnc
+X11VNC_PARAMS="-bg -forever -display :0 -passwdfile rm:$HOME/.pvs/vncpasswd -o $HOME/.pvs/log.vncsrv -shared"
+X11VNC_X11="0"
+
+# at the moment the poolVSClient is expected to use the ~/.pvs directory
+[ -d ~/.pvs ] || mkdir ~/.pvs
+
+# write the password file
+echo -e "$3\n__BEGIN_VIEWONLY__\n$3" > ~/.pvs/vncpasswd
+
+# find xauthority file
+find_xauth () {
+ FOUND=0
+ RETRIES=4
+ [ -z "$1" ] || RETRIES="$1"
+
+ [ -e "/var/lib/kdm/" ] &&
+ XAUTHFILE_KDM=`find /var/lib/kdm/ -iname "A\:0-*"`
+ [ -e "/var/run/xauth/" ] &&
+ XAUTHFILE_KDM2=$(find /var/run/xauth/ -iname "A\:0-*")
+ [ -e "/var/lib/xdm/authdir/authfiles/" ] &&
+ XAUTHFILE_XDM=$(find /var/lib/xdm/authdir/authfiles/ -iname "A\:0-*")
+ [ -e "/var/lib/gdm/" ] &&
+ XAUTHFILE_GDM=$(find /var/lib/gdm/ -iname *Xauth*)
+
+ [ -f "$XAUTHFILE_KDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_KDM"
+ [ -f "$XAUTHFILE_KDM2" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_KDM2"
+ [ -f "$XAUTHFILE_XDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_XDM"
+ [ -f "$XAUTHFILE_GDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_GDM"
+
+ if [ "$FOUND" -eq "0" ]; then
+ if [ "$RETRIES" -gt "0" ]; then
+ let "RETRIES-=1"
+ find_xauth "$RETRIES"
+ else
+ echo "start FAILED (can't find way to authenticate myself against X)" \
+ >>~/.pvs/log.vncsrv
+ exit -1
+ fi
+ else
+ echo "found authfile ($XAUTHORITY)" >>~/.pvs/log.vncsrv
+ fi
+}
+
+START_COMMAND="x11vnc"
+
+case "$1" in
+ start)
+ [ -z "$2" -o -z "$3" ] && echo " Port and/or Password not set" \
+ >>~/.pvs/log.vncsrv
+ echo "$2 $3" >>~/.pvs/log.test
+ if [ ! -f ~/.pvs/vncpasswd ]; then
+ echo " Start FAILED (~/.pvs/vncpasswd not found)" >>~/.pvs/log.vncsrv
+ echo " Create it manualy and retry starting x11vnc" >>~/.pvs/log.vncsrv
+ exit -1;
+ fi
+
+ if [ $X11VNC_X11 = 1 ]; then
+ # find_xauth
+ START_COMMAND="$START_COMMAND -auth $XAUTHORITY $X11VNC_PARAMS"
+ else
+ START_COMMAND="$START_COMMAND $X11VNC_PARAMS"
+ fi
+ OUTPUT=$($START_COMMAND -rfbport $2)
+ echo "$START_COMMAND" >>~/.pvs/log.vncsrv
+ echo "$OUTPUT" >>~/.pvs/log.vncsrv
+ ;;
+ stop)
+ pid=$(pidof x11vnc)
+ if [ -z "$pid" ]
+ then
+ echo "x11vnc not running" >>~/.pvs/log.vncsrv
+ exit -1;
+ else
+ kill -9 $pid 2>/dev/null
+ echo "x11vnc stopped" >>~/.pvs/log.vncsrv
+ fi
+ ;;
+ *)
+ echo "x11vnc startscript"
+ echo "Usage: $0 (start|stop)"
+ ;;
+esac
+exit 0
+
diff --git a/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..1e3a9bfe
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Base.pm
@@ -0,0 +1,63 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# qemukvm/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the qemukvm plugin.
+# -----------------------------------------------------------------------------
+package qemukvm::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+ my $location = shift;
+ my $kind = shift;
+
+ my $script = unshiftHereDoc(<<' End-of-Here');
+
+ # cpuvirt=$(grep -e "vmx|svm" /proc/cpuinfo)
+ # modprobe $cpuvirt
+
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..6e2cab9b
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,43 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# qemukvm/OpenSLX/Distro/debian.pm
+# - provides Debian-specific overrides of the Distro API for the qemukvm
+# plugin.
+# -----------------------------------------------------------------------------
+package qemukvm::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(qemukvm::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+ my $location = shift;
+ my $kind = shift;
+
+ my $script = unshiftHereDoc(<<' End-of-Here');
+
+ # something into here ...
+
+ End-of-Here
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..719dae2b
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,42 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# qemukvm/OpenSLX/Distro/Suse.pm
+# - provides SUSE specific overrides of the distro API for the qemukvm
+# plugin.
+# -----------------------------------------------------------------------------
+package qemukvm::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(qemukvm::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+ my $location = shift;
+ my $kind = shift;
+
+ my $script = unshiftHereDoc(<<' End-of-Here');
+
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..ac764d31
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,24 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# qemukvm/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu-specific overrides of the Distro API for the qemukvm
+# plugin.
+# -----------------------------------------------------------------------------
+package qemukvm::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+# inherit everything from Debian (as Ubuntu is based on it anyway)
+use base qw(qemukvm::OpenSLX::Distro::Debian);
+
+
+1;
diff --git a/src/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm b/src/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm
new file mode 100644
index 00000000..14e5917f
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/OpenSLX/OSPlugin/qemukvm.pm
@@ -0,0 +1,256 @@
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# qemukvm.pm
+# - Declares necessary information for the qemukvm plugin
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::qemukvm;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Basename;
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+sub new
+{
+ my $class = shift;
+ my $self = {
+ name => 'qemukvm',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Module for enabling services for the Linux kvm using qemu for
+ IO on an OpenSLX stateless client.
+ End-of-Here
+ precedence => 70,
+ required => [ qw( desktop ) ],
+ };
+}
+
+sub getAttrInfo
+{
+ # Returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system by means
+ # of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'qemukvm::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'qemukvm'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ # attribute 'imagesrc' defines where we can find qemukvm images
+ 'qemukvm::imagesrc' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Where do we store our qemukvm images? NFS? Filesystem?
+ End-of-Here
+ #TODO: check if the input is valid
+ #content_regex => qr{^(0|1)$},
+ content_descr => 'Allowed values: local path or URI',
+ default => '',
+ },
+ # attribute 'bridge' defines if bridged network mode should be
+ # switched on
+ 'qemukvm::bridge' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Should the bridging (direct access of the qemukvm clients
+ to the ethernet the host is connected to) be enabled
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => 'Allowed values: 0 or 1',
+ default => '1',
+ },
+
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
+
+ my $engine = $self->{'os-plugin-engine'};
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+
+ # Different names of the tool (should be unified somehow!?)
+ if (!isInPath('qemu-kvm') || !isInPath('kvm')) {
+ $engine->installPackages(
+ $engine->getInstallablePackagesForSelection('qemu-kvm')
+ );
+ }
+ # Sudo is needed to get access to certain system network commands
+ if (!isInPath('sudo')) {
+ $engine->installPackages($self->{distro}->getPackageName('sudo'));
+ }
+
+ # Copy run-virt.include and template files to the appropriate place for
+ # inclusion in stage4
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName/files";
+ foreach my $file ( qw( run-virt.include ifup ifdown ) ) {
+ copyFile("$pluginBasePath/$file", "$pluginRepoPath/");
+ }
+ chmod 0755, "$pluginRepoPath/ifup", "$pluginRepoPath/ifdown";
+
+ my $initFile = newInitFile();
+ $initFile->setName("qemukvm");
+ $initFile->setDesc("Setup environment for QEMU/KVM");
+
+ # TODO: default dirs als globale funktion anbieten
+ $initFile->
+ addToBlock('head','. /etc/opt/openslx/plugins/qemukvm/network.conf');
+
+ # TODO: remove all runlevel links for qemu-kvm or kvm
+ my $kvm_module = unshiftHereDoc(<<' End-of-Here');
+ # Figure out which module we need.
+ if grep -q ^flags.*\\\<vmx\\\> /proc/cpuinfo; then
+ module=kvm_intel
+ elif grep -q ^flags.*\\\<svm\\\> /proc/cpuinfo; then
+ module=kvm_amd
+ else
+ module=kqemu
+ fi
+ End-of-Here
+
+ my $do_start = unshiftHereDoc(<<' End-of-Here');
+ # loading kvm module
+ kvm_module
+ [ -n "${module}" ] && modprobe -q ${module}
+ # load the tunnel device module
+ modprobe -q tun
+ # TODO: maybe in the ifup-script better solution?
+ # configuring the tap0 interface to the existing bridge configured in stage3
+ #for i in 0 1 2; do
+ # /opt/openslx/uclib-rootfs/sbin/tunctl -t tap${i} >/dev/null 2>&1
+ # ip link set dev tap${i} up
+ #done
+ #/opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tap0
+ #ip addr add ${nataddress} dev tap1
+ #ip addr add ${hoaddress} dev tap2
+ #echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding
+ #echo "1" >/proc/sys/net/ipv4/conf/tap0/forwarding
+ # make /dev/fb0 writable for all
+ # TODO: maybe solve via group or udev, etc...
+ chmod 766 /dev/fb*
+ End-of-Here
+
+ my $do_stop = unshiftHereDoc(<<' End-of-Here');
+ kvm_module
+ [ -n "${module}" ] && modprobe -q -r ${module}
+ modprobe -q -r tun
+ # TODO: tun removed, so this is not necessary
+ #/opt/openslx/uclib-rootfs/usr/sbin/brctl delif br0 tap0
+ #ip addr del ${nataddress} dev tap1
+ #ip addr del ${hoaddress} dev tap2
+ #echo "0" >/proc/sys/net/ipv4/conf/br0/forwarding
+ #echo "0" >/proc/sys/net/ipv4/conf/tap0/forwarding
+ chmod 760 /dev/fb*
+ End-of-Here
+
+ my $do_restart = unshiftHereDoc(<<' End-of-Here');
+ do_stop && do_start
+ End-of-Here
+
+ # add helper functions to initfile
+ # first parameter name of the function
+ # second parameter content of the function
+ $initFile->addFunction('kvm_module', $kvm_module);
+ $initFile->addFunction('do_start', $do_start);
+ $initFile->addFunction('do_stop', $do_stop);
+ $initFile->addFunction('do_restart', $do_restart);
+
+ # place a call of the helper function in the stop block of the init file
+ # first parameter name of the function
+ # second parameter name of the block
+ $initFile->addFunctionCall('do_start', 'start');
+ $initFile->addFunctionCall('do_stop', 'stop');
+ $initFile->addFunctionCall('do_restart', 'restart');
+
+ my $distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0];
+
+ # write qemukvm initfile to plugin path
+ spitFile(
+ "$pluginRepoPath/qemukvm",
+ getInitFileForDistro($initFile, ucfirst($distro))
+ );
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+sub checkStage3AttrValues
+{
+ my $self = shift;
+ my $stage3Attrs = shift;
+ my $vendorOSAttrs = shift;
+ #my @problems;
+
+ #my $vmimg = $stage3Attrs->{'qemukvm::imagesrc'} || '';
+
+ return;
+}
+
+# The bridge configuration needs the bridge module to be present in early
+# stage3
+sub suggestAdditionalKernelModules
+{
+ my $self = shift;
+ my $makeInitRamFSEngine = shift;
+
+ my @suggestedModules;
+
+ push @suggestedModules, qw( bridge );
+
+ return @suggestedModules;
+}
+
+1;
diff --git a/src/os-plugins/plugins/qemukvm/XX_qemukvm.sh b/src/os-plugins/plugins/qemukvm/XX_qemukvm.sh
new file mode 100644
index 00000000..8a41ff3b
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/XX_qemukvm.sh
@@ -0,0 +1,112 @@
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# 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/qemukvm.conf
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/qemukvm
+PLUGINDIR=${OPENSLX_DEFAULT_DIR}/plugin-repo/qemukvm
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/qemukvm
+LOGDIR=/mnt/${OPENSLX_DEFAULT_LOGDIR}
+
+# check if the configuration file is available
+if [ -e ${CONFFILE} ]; then
+
+ # load needed variables
+ . ${CONFFILE}
+
+ # Test if this plugin is activated... more or less useless with the
+ # new plugin system
+ if [ ${qemukvm_active} -ne 0 2>/dev/null ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'qemukvm' os-plugin ...";
+
+ # load general configuration
+ . /initramfs/machine-setup
+
+ # copy virtualization include files and qemukvm.conf to config dir
+ testmkd ${PLUGINCONFDIR}
+ cp /mnt/${PLUGINDIR}/run-virt.include ${PLUGINCONFDIR}
+ cp ${CONFFILE} ${PLUGINCONFDIR}
+
+# # check for the virtualization CPU features
+# if grep -q "vmx" /proc/cpuinfo && modprobe ${MODPRV} kvm_intel ; then
+# [ $DEBUGLEVEL -gt 0 ] && echo " * Loaded kvm_intel module"
+# echo "kvm=intel" >> ${PLUGINCONFDIR}/qemukvm.conf
+# elif grep -q "svm" /proc/cpuinfo && modprobe ${MODPRV} kvm_amd ; then
+# [ $DEBUGLEVEL -gt 0 ] && echo " * Loaded kvm_amd module"
+# echo "kvm=amd" >> ${PLUGINCONFDIR}/qemukvm.conf
+# elif modprobe ${MODPRV} kqemu ; then
+# [ $DEBUGLEVEL -gt 0 ] && \
+# error " * Successfully loaded the kqemu module, but loading of kvm_amd \
+#or kvm_intel\n failed, because no virtualization extenstion found in this \
+#CPU. Please\n enable the extension within your machines BIOS or get another \
+#CPU." nonfatal
+# else
+# error " * All module loading failed including the kqemu module, which \
+#was either\n not found or couldn't be loaded for other reasons. Thus using \
+#qemu(-kvm)\n makes not much sense." nonfatal
+# fi
+
+# # load the tunnel device module
+# modprobe tun 2>/dev/null
+
+ # get source of qemukvm image server (get type, server and path)
+ if strinstr "/" "${qemukvm_imagesrc}" ; then
+ qkimgprot=$(uri_token ${qemukvm_imagesrc} prot)
+ qkimgserv=$(uri_token ${qemukvm_imagesrc} server)
+ qkimgpath="$(uri_token ${qemukvm_imagesrc} path)"
+ fi
+ if [ -n "${qkimgserv}" ] ; then
+ # directory where qemu images are expected in
+ mnttarget=/mnt/var/lib/virt/qemukvm
+ # mount the qemukvm image source readonly (ro)
+ fsmount ${qkimgprot} ${qkimgserv} ${qkimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && error " * Incomplete information in variable \
+${qemukvm_imagesrc}." nonfatal
+ fi
+
+ # create a network configuration template (variables should be setable in
+ # the future, see vmware plugin)
+ natnetwork="192.168.101"
+ honetwork="192.168.102"
+ echo -e "nataddress=${natnetwork}.254/24\nhoaddress=${honetwork}.254/24" \
+ >${PLUGINCONFDIR}/network.conf
+
+ # copy the runlevel script (proper place for all distros??)
+ cp /mnt/${PLUGINDIR}/qemukvm /mnt/etc/init.d
+ chmod 0755 /mnt/etc/init.d/qemukvm
+ rllinker "qemukvm" 22 2
+
+ # copy the /etc/qemu-ifup script and enable extended rights for running
+ # the emulator and certain network commands via sudo
+ ln -sf ${PLUGINDIR}/ifup ${PLUGINCONFDIR}/ifup
+ ln -sf ${PLUGINDIR}/ifdown ${PLUGINCONFDIR}/ifdown
+
+ cat >> /mnt/etc/sudoers << EOF
+# allow to start and stop kvm services / load-/unload kvm modules
+#ALL ALL=NOPASSWD: /etc/init.d/qemukvm
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/sbin/tunctl -t tap*
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tap*
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/bin/ip link set dev tap* up
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/bin/ip addr add * dev tap*
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/usr/sbin/udhcpd -S /tmp/qemukvm/*/udhcpd.conf
+ALL ALL=NOPASSWD: /opt/openslx/uclib-rootfs/bin/cp /tmp/qemukvm/*/forwarding /proc/sys/net/ipv4/conf/tap*/forwarding
+#ALL ALL=NOPASSWD: ${killall} udhcpd
+EOF
+ fi
+else
+ [ $DEBUGLEVEL -gt 0 ] && echo " * Configuration of 'qemukvm' plugin failed"
+fi
diff --git a/src/os-plugins/plugins/qemukvm/files/ifdown b/src/os-plugins/plugins/qemukvm/files/ifdown
new file mode 100644
index 00000000..e741d9ca
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/files/ifdown
@@ -0,0 +1,34 @@
+#!/bin/sh
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# ifdown
+# - Script used for network cleanup of qemukvm in stage4
+# -----------------------------------------------------------------------------
+
+# get VM_ID through tap name
+VM_ID=$(echo $1 | grep -oE "0[0-4]$")
+QKTMPDIR=/tmp/qemukvm/${USER}/${VM_ID}
+touch /tmp/qemukvm/udhcpd.pids
+chmod 666 tmp/qemukvm/udhcpd.pids
+
+case "$1" in
+ tapnat0*)
+ # kill udhcpd
+ cat ${QKTMPDIR}/udhcpd.pid >> /tmp/qemukvm/udhcpd-unused.pid
+ ;;
+ taphost0*)
+ # kill udhcpd
+ cat ${QKTMPDIR}/udhcpd.pid >> /tmp/qemukvm/udhcpd-unused.pid
+ ;;
+esac
+
+# Produce a clean exit status
+exit 0
diff --git a/src/os-plugins/plugins/qemukvm/files/ifup b/src/os-plugins/plugins/qemukvm/files/ifup
new file mode 100644
index 00000000..b3218798
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/files/ifup
@@ -0,0 +1,75 @@
+#!/bin/sh
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# ifup
+# - Script used for network setup of qemukvm in stage4
+# -----------------------------------------------------------------------------
+
+. /etc/opt/openslx/openslx.conf
+
+PLUGINCONFDIR=${OPENSLX_DEFAULT_CONFDIR}/plugins/qemukvm
+
+# get VM_ID through tap name
+VM_ID=$(echo $1 | grep -oE "0[0-4]$")
+QKTMPDIR=/tmp/qemukvm/${USER}/${VM_ID}
+
+# Use the udhcpcd as DHCP server and brctl as provided by default in OpenSLX
+# environments via uclibc-wrapper.
+. ${PLUGINCONFDIR}/network.conf
+
+# Just decide by the virtual network device used which kind of connection
+# should be set up (passed in $1): tap0 = bridge, tap1 = nat, tap2 = hostonly.
+case "$1" in
+ tapbridge0*)
+ sudo ip link set dev $1 up
+ # TODO: forwarding?, where needed
+ echo "1" >${QKTMPDIR}/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/br0/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/$1/forwarding
+ ;;
+ tapnat0*)
+ # Configuring DHCP on host tapnat interface and enable IP masquerading
+ sudo ip addr add ${nataddress} dev $1
+ sudo ip link set dev $1 up
+ # TODO: forwarding?, where needed
+ echo "1" >${QKTMPDIR}/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/br0/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/$1/forwarding
+ # TODO: we use here atatic address, maybe change later
+ sed -e "s,NWIF,$1,;s,CNETWORK,192.168.1${VM_ID}," \
+ -e "s,PIDFILE,${QKTMPDIR}/udhcpd.pid," \
+ -e "s,LEASEFILE,${QKTMPDIR}/udhcpd.leases," \
+ ${OPENSLX_DEFAULT_CONFDIR}/udhcpd.conf \
+ >${QKTMPDIR}/udhcpd.conf
+ touch ${QKTMPDIR}/udhcpd.leases
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \
+ -S ${QKTMPDIR}/udhcpd.conf
+ # iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
+ ;;
+ taphost0*)
+ # Configuring DHCP on host taphost interface
+ sudo ip addr add ${hoaddress} dev $1
+ sudo ip link set dev $1 up
+ # TODO: forwarding?, where needed
+ echo "1" >${QKTMPDIR}/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/br0/forwarding
+ sudo cp ${QKTMPDIR}/forwarding /proc/sys/net/ipv4/conf/$1/forwarding
+ sed -e "s,NWIF,$1,;s,USER,${USER},;s,CNETWORK,192.168.1${VM_ID}," \
+ -e "s,PIDFILE,${QKTMPDIR}/udhcpd.pid," \
+ -e "s,LEASEFILE,${QKTMPDIR}/udhcpd.leases," \
+ ${OPENSLX_DEFAULT_CONFDIR}/udhcpd.conf >${QKTMPDIR}/udhcpd.conf
+ touch ${QKTMPDIR}/udhcpd.leases
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \
+ -S ${QKTMPDIR}/udhcpd.conf
+ ;;
+esac
+
+exit 0
diff --git a/src/os-plugins/plugins/qemukvm/files/run-virt.include b/src/os-plugins/plugins/qemukvm/files/run-virt.include
new file mode 100644
index 00000000..02c70469
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/files/run-virt.include
@@ -0,0 +1,306 @@
+# run-virt.include
+# -----------------------------------------------------------------------------
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+# -----------------------------------------------------------------------------
+# run-virt.include
+# - Include script for running the QEMU/Linux KVM virtual machine on an
+# OpenSLX client via the run-virt.sh or run-vmgrid.sh
+################################################################################
+
+################################################################################
+### Include general configuration
+################################################################################
+if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf ]; then
+ . ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf
+else
+ writelog "Problems reading config file of ${self} plugin"
+ # TODO: exit wenn conf wichtig
+ #exit 1
+fi
+
+################################################################################
+### Declaration of default variables
+################################################################################
+
+PLUGINCONFQK="${PLUGINCONFROOT}/${self}"
+PLUGINDIRQK=${OPENSLX_DEFAULT_DIR}/plugin-repo/${self}
+# create TMPDIR for all users
+mkdir -m 1777 /tmp/${self} 2>/dev/null
+# TMPDIR
+QKTMPDIR="/tmp/${self}/${USER}/${VM_ID}"
+# define dirs and files which can be removed after exit, be carefull!
+RMDIRS="${QKTMPDIR}"
+rm -rf ${RMDIRS} 2>/dev/null
+mkdir -m 1777 -p ${QKTMPDIR} 2>/dev/null
+# vmpath is the path to the vm, here an image (img|qcow*|vmdk)
+diskfile=${vmpath}
+
+# check the file type
+if echo ${imgname} | grep -iE "img|qcow|vmdk" >/dev/null 2>&1; then
+ imgtype=$(echo ${imgname##*.} | tr [a-z] [A-Z])
+else
+ writelog "${imgname} is not a valid image type (img|qcow*|vmdk), exiting!"
+ exit 1
+fi
+
+# hot keys ALT+CTRL+SHIFT
+VIRTCMDOPTS="${VIRTCMDOPTS} -alt-grab"
+
+# display name, remove blanks because of cmdline problems
+displayname=$(echo ${displayname} | sed -e "s, ,-,g")
+VIRTCMDOPTS="${VIRTCMDOPTS} -name ${displayname}"
+
+writelog "Directories:"
+writelog "\tTMPDIR:\t\t\t$QKTMPDIR"
+writelog "Diskimage:"
+writelog "\tDisk type:\t\t$imgtype"
+writelog "\tDisk file:\t\t$diskfile"
+
+################################################################################
+### Hardware checks
+################################################################################
+
+# memory part equal to vmware plugin
+# percentage of memory to use for virtualbox in standard case
+if [ -n "${forcemem}" ]; then
+ mem="${forcemem}"
+else
+ permem=30
+ if [ "${totalmem}" -ge "1600" ]; then
+ permem=40
+ fi
+# # check if /tmp is on harddisk
+# if grep -qe "/dev/.* /tmp " /proc/mounts ; then
+# permem=60
+# id44="1"
+# # Hack, if more than 2,5G RAM use 40% of Ram and write vmem into Ram as well
+# # (40% vmware | 40% confdir(vmem...) | 20% host
+# # VMplayer 2+ issue
+# # TODO: makes this sense for vbox?
+# #if [ "${totalmem}" -ge "2500" ]; then
+# #permem=40
+# #rmdir ${snapshotdir}
+# #snapshotdirold=${snapshotdir}
+# #snapshotdir=/dev/shm/${self}/${USER}/${VM_ID}
+# #mkdir -p ${snapshotdir}
+# #ln -sf ${snapshotdir} ${snapshotdirold}
+# #fi
+# fi
+ mem=$(expr ${totalmem} / 100 \* ${permem})
+ if [ "${id44}" = "1" ]; then
+ memhost=$(expr ${totalmem} - ${mem})
+ else
+ memhost=$(expr ${totalmem} - ${mem} - ${mem})
+ fi
+ # static first
+ permem=50
+ mem=$(expr ${totalmem} / 100 \* ${permem})
+ if [ "${mem}" -lt "256" ] || [ "${memhost}" -lt "256" ]; then
+ writelog "Memory out of range: ${mem} MB (guest) / ${memhost} MB (host)!"
+ writelog "Min. 256 MB for host and guest!"
+ exit 1
+ fi
+fi
+
+VIRTCMDOPTS="${VIRTCMDOPTS} -m ${mem}"
+
+# network adaptor alternatives: rtl8139, pcnet, e1000
+network_card=${network_card:=pcnet}
+VIRTCMDOPTS="${VIRTCMDOPTS} -net nic,macaddr=${macaddr},model=${network_card}"
+
+# define net kind and apply script
+qemu_ifscr="script=${PLUGINCONFQK}/ifup,downscript=${PLUGINCONFQK}/ifdown"
+case "${network_kind}" in
+ bridge*)
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tapbridge${VM_ID},${qemu_ifscr}"
+ sudo /opt/openslx/uclib-rootfs/sbin/tunctl -t tapbridge${VM_ID} -u ${USER} \
+ >/dev/null 2>&1
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tapbridge${VM_ID}
+ POSTRUN="/opt/openslx/uclib-rootfs/sbin/tunctl -d tapbridge${VM_ID}"
+ ;;
+ nat)
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=tapnat${VM_ID},${qemu_ifscr}"
+ sudo /opt/openslx/uclib-rootfs/sbin/tunctl -t tapnat${VM_ID} -u ${USER} \
+ >/dev/null 2>&1
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 tapnat${VM_ID}
+ POSTRUN="/opt/openslx/uclib-rootfs/sbin/tunctl -d tapnat${VM_ID}"
+ ;;
+ host*)
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net tap,ifname=taphost${VM_ID},${qemu_ifscr}"
+ sudo /opt/openslx/uclib-rootfs/sbin/tunctl -t taphost${VM_ID} -u ${USER} \
+ >/dev/null 2>&1
+ sudo /opt/openslx/uclib-rootfs/usr/sbin/brctl addif br0 taphost${VM_ID}
+ POSTRUN="/opt/openslx/uclib-rootfs/sbin/tunctl -d taphost${VM_ID}"
+ ;;
+ *)
+ network_kind="user"
+ VIRTCMDOPTS="${VIRTCMDOPTS} -net user"
+ ;;
+esac
+
+# translate boot, use if set else set to HardDisk
+if [ -n "${boot}" ]; then
+ case ${boot} in
+ n*) # usually support for a,c,d,n, stands for Floppy, HD, CD-ROM, Network
+ boot="n"
+ # TODO: does not work yet, can be removed if tap1 solution better
+ if [ "${network_kind}" = "user" ] && [ -n "${virtualbox_tftpdir}" ]; then
+ VIRTCMDOPTS="${VIRTCMDOPTS},tftp=${virtualbox_tftpdir}"
+ fi
+ ;;
+ # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM
+ *)
+ boot="c"
+ ;;
+ esac
+else
+ boot="c"
+fi
+
+# external GUI port
+vncport="590${VM_ID}"
+
+# TODO: most of the following does not make much sense yet ...
+# virtual fd/cd/dvd and drive devices, floppy b: for configuration
+# if $floppy_0 from run-virt.include set then fdtest="TRUE"
+fdtest=
+fdtest=${floppy_0:+"TRUE"}
+# if $fdtest not set floppy0="FALSE", else "TRUE"
+floppy0=${fdtest:-"FALSE"}
+floppy1="TRUE"
+floppy1name="/var/lib/virt/vmchooser/loopimg/fd.img"
+# if $cdrom_0 from run-virt.include set then cdtest="TRUE"
+cdtest=
+cdtest=${cdrom_0:+"TRUE"}
+# if $cdtest not set cdrom0="FALSE", else "TRUE"
+cdrom0=${cdtest:-"FALSE"}
+# if $cdrom_1 from run-virt.include set then cdtest="TRUE"
+cdtest=
+cdtest=${cdrom_1:+"TRUE"}
+# if $cdtest not set cdrom1="FALSE", else "TRUE"
+cdrom1=${cdtest:-"FALSE"}
+# ide is expected default, test for the virtual disk image type should
+# be done while creating the runscripts ...
+ide="TRUE"
+hddrv="ide"
+
+# TODO: nur bei vmchooser
+#VIRTCMDOPTS="${VIRTCMDOPTS} -fda /dev/fd0"
+#VIRTCMDOPTS="${VIRTCMDOPTS} -fdb ${floppy1name}"
+
+# audio
+VIRTCMDOPTS="${VIRTCMDOPTS} -soundhw all"
+
+# serial
+#VIRTCMDOPTS="${VIRTCMDOPTS} -serial /dev/ttyS0"
+
+writelog "Virtual Hardware:"
+writelog "\tGuest RAM:\t\t${mem} MB"
+# echo nur wenn memhost gesetzt
+[ -n "${memhost}" ] && writelog "\tHost RAM:\t\t${memhost} MB"
+writelog "\tMAC address:\t\t$macaddr"
+writelog "\tNetwork card:\t\t${network_card}"
+writelog "\tNetwork kind:\t\t${network_kind}"
+#writelog "\tCD-ROM1:\t${cdrom0}"
+#writelog "\tCD-ROM2:\t${cdrom1}"
+#writelog "\tFloppy_A:\t${floppy0}"
+#writelog "\tFloppy_B:\t${floppy1}"
+#writelog "\tShared Folders 'home':\t/home/${USER}"
+
+################################################################################
+### finally set env for run-virt.sh
+################################################################################
+
+# TODO: besser drive statt hda?
+#-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]
+# [,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]
+# [,cache=writethrough|writeback|none][,format=f][,serial=s]
+# [,boot=on|off]
+#-snapshot write to temporary files instead of disk image files
+#-usb enable the USB driver (will be the default soon)
+#-usbdevice name add the host or guest USB device 'name'
+#-nographic disable graphical output and redirect serial I/Os to console
+#-vga [std|cirrus|vmware|none] select video card type
+#-vnc display start a VNC server on display
+#-tftp dir allow tftp access to files in dir [-net user]
+#-bootp file advertise file in BOOTP replies
+#-no-fd-bootchk disable boot signature checking for floppy disks
+#-no-acpi disable ACPI
+#-kernel bzImage use 'bzImage' as kernel image
+#-append cmdline use 'cmdline' as kernel command line
+#-initrd file use 'file' as initial ram disk
+#-serial dev redirect the serial port to char device 'dev'
+#-parallel dev redirect the parallel port to char device 'dev'
+#-monitor dev redirect the monitor to char device 'dev'
+#-pidfile file write PID to 'file'
+#-d item1,... output log to /tmp/qemu.log (use -d ? for a list of log items)
+#-L path set the directory for the BIOS, VGA BIOS and keymaps
+#-bios file set the filename for the BIOS
+#-no-kvm disable KVM hardware virtualization
+#-enable-nesting enable support for running a VM inside the VM (AMD only)
+#-no-reboot exit instead of rebooting
+#-no-shutdown stop before shutdown
+#-loadvm [tag|id]
+# start right away with a saved state (loadvm in monitor)
+#-daemonize daemonize QEMU after initializing
+#-kvm-shadow-memory megs set the amount of shadow pages to be allocated
+#-mem-path set the path to hugetlbfs/tmpfs mounted directory, also
+# enables allocation of guest memory with huge pages
+#-mem-prealloc toggles preallocation of -mem-path backed physical memory
+# at startup. Default is enabled.
+#-option-rom rom load a file, rom, into the option ROM space
+#-localtime set the real time clock to local time [default=utc]
+#-startdate select initial date of the clock
+#-icount [N|auto]
+# enable virtual instruction counter with 2^N clock ticks per instruction
+#-echr chr set terminal escape character instead of ctrl-a
+#-virtioconsole c
+# set virtio console
+#-show-cursor show cursor
+
+# check for kvm modules
+if [ -c /dev/kvm ]; then
+ for tool in kvm qemu-kvm; do
+ VIRTCMD=$(which ${tool} 2>/dev/null)
+ [ -n "$VIRTCMD" ] && break
+ done
+else
+ VIRTCMD=$(which qemu 2>/dev/null)
+ writelog "KVM available but /dev/kvm not found!"
+ writelog "Trying fallback to QEMU emulation."
+fi
+
+if [ -z "${VIRTCMD}" ]; then
+ writelog "No QEMU/KVM found, exiting!"
+ rm -rf ${RMDIRS}
+ exit 1
+elif [ "${VIRTCMD##*/}" = "qemu" ]; then
+ writelog "User space emulation:\t\t${VIRTCMD}"
+else
+ writelog "User space virtualization:\t${VIRTCMD}"
+fi
+
+# using snapshots
+VIRTCMDOPTS="${VIRTCMDOPTS} -snapshot"
+
+# TODO: boot als var, -boot n, tftp...
+VIRTCMDOPTS="${VIRTCMDOPTS} -boot c"
+
+# set headless mode
+# define first, you do not want VIRTCMDOPTS from graphical start
+VIRTCMDHL=${VIRTCMD}
+VIRTCMDOPTSHL="${VIRTCMDOPTS} -nographic ${diskfile}"
+
+# graphical start
+# vga std/cirrus/vmware?
+#VIRTCMDOPTS="${VIRTCMDOPTS} -vga std -full-screen ${diskfile}"
+VIRTCMDOPTS="${VIRTCMDOPTS} ${diskfile}"
diff --git a/src/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh b/src/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100644
index 00000000..ccae3381
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical to the files of virtualbox and vmware plugins)
+#############################################################################
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} 0
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} ${bridge}
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}
diff --git a/src/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh b/src/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh
new file mode 100755
index 00000000..b4f02389
--- /dev/null
+++ b/src/os-plugins/plugins/qemukvm/init-hooks/60-have-servconfig/vm-dhcpd.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical in vmware, virtualbox and qemukvm plugins)
+#############################################################################
+
+. /etc/openslx.conf
+
+CONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}
+testmkd ${CONFDIR}
+
+# configuring dhcpd stub for virtual networks
+cat > ${CONFDIR}/udhcpd.conf << EOF
+# general udhcpd configuration file for virtual machines written by
+# $0 during OpenSLX stage3 configuration
+
+# start and end of the IP lease block
+start CNETWORK.20
+end CNETWORK.100
+
+# interface that udhcpd will use
+interface NWIF
+
+# how long an offered address is reserved (leased) in seconds
+offer_time 6000
+
+# location of the leases file
+lease_file LEASEFILE
+
+# location of the pid file
+pidfile PIDFILE
+
+option dns ${domain_name_servers}
+option subnet 255.255.255.0
+option router CNETWORK.1
+option wins CNETWORK.10
+option domain virtual.site ${domain_name}
+
+# additional options known to udhcpd
+#subnet #timezone
+#router #timesvr
+#namesvr #dns
+#logsvr #cookiesvr
+#lprsvr #bootsize
+#domain #swapsvr
+#rootpath #ipttl
+#mtu #broadcast
+#wins #lease
+#ntpsrv #tftp
+#bootfile
+EOF
diff --git a/src/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..ed08c5f3
--- /dev/null
+++ b/src/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm
@@ -0,0 +1,93 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# syslog/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the syslog plugin.
+# -----------------------------------------------------------------------------
+package syslog::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub runlevelInfo
+{
+ my $self = shift;
+ my $kind = shift;
+
+ # most distros (well: Debian & Ubuntu) use a different initscript depending
+ # on which version of syslog is installed ('syslogd', 'syslog-ng' or 'rsyslog')
+ my %nameMap = (
+ 'syslogd' => 'sysklogd',
+ 'syslog-ng' => 'syslog-ng',
+ 'rsyslog' => 'rsyslog',
+ );
+ my $rlInfo = {
+ scriptName => $nameMap{$kind},
+ startAt => 2,
+ stopAt => 15,
+ };
+
+ return $rlInfo;
+}
+
+sub getPackageName
+{
+ my $self = shift;
+ my $name = shift;
+
+ my %nameMap = (
+ 'syslogd' => 'sysklogd',
+ 'syslog-ng' => 'syslog-ng',
+ 'rsyslog' => 'rsyslog',
+ );
+ return $nameMap{$name};
+}
+
+sub getBinaryName
+{
+ my $self = shift;
+ my $name = shift;
+
+ my %nameMap = (
+ 'syslogd' => 'sysklogd',
+ 'syslog-ng' => 'syslog-ng',
+ 'rsyslog' => 'rsyslogd',
+ );
+ return $nameMap{$name};
+}
+
+1;
diff --git a/src/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..7255d6f5
--- /dev/null
+++ b/src/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,41 @@
+# Copyright (c) 2006, 2007 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# syslog/OpenSLX/Distro/Suse.pm
+# - provides SUSE-specific overrides of the Distro API for the syslog plugin.
+# -----------------------------------------------------------------------------
+package syslog::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(syslog::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub runlevelInfo
+{
+ my $self = shift;
+ my $attrs = shift;
+
+ my $rlInfo = $self->SUPER::runlevelInfo($attrs);
+
+ # SUSE uses a script named 'syslog', no matter if syslogd or syslog-ng
+ # is installed
+ $rlInfo->{scriptName} = 'syslog';
+
+ return $rlInfo;
+}
+
+1;
diff --git a/src/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm b/src/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
new file mode 100644
index 00000000..c011bf66
--- /dev/null
+++ b/src/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
@@ -0,0 +1,322 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# syslog.pm
+# - implementation of the 'syslog' plugin, which installs
+# all needed information for a displaymanager and for the syslog.
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::syslog;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Basename;
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'syslog',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Sets up system log service for SLX-clients.
+ End-of-Here
+ precedence => 50,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'syslog::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'syslog'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'syslog::kind' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ kind of syslog to use \(syslogd-ng or old-style syslog\)
+ End-of-Here
+ content_regex => qr{^(syslog-ng|syslogd|rsyslog)$},
+ content_descr => 'allowed: syslog-ng, syslogd, rsyslog',
+ default => 'rsyslog',
+ },
+ 'syslog::host' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ name or IP-address of host where syslog shall be sent to
+ End-of-Here
+ content_regex => undef,
+ content_descr => 'a hostname or an IP address',
+ default => undef,
+ },
+ 'syslog::port' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ port number (UDP) where syslog shall be sent to
+ End-of-Here
+ content_regex => undef,
+ content_descr => 'a port number',
+ default => 514,
+ },
+ 'syslog::file' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ name of file where all log messages shall be written
+ End-of-Here
+ content_regex => undef,
+ content_descr => 'a complete file path',
+ default => '/var/log/messages',
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
+
+ # We are going to change some of the stage1 attributes during installation
+ # (basically we are filling the ones that are not defined). Since the result
+ # of these changes might change between invocations, we do not want to store
+ # the resulting values, but we want to store the original (undef).
+ # In order to do so, we copy all stage1 attributes directly into the
+ # object hash and change them there.
+ $self->{kind} = lc($self->{attrs}->{'syslog::kind'});
+
+ my $engine = $self->{'os-plugin-engine'};
+
+ if ($self->{kind} eq 'rsyslog' && !isInPath($self->{distro}->getBinaryName('rsyslog'))) {
+ $engine->installPackages($self->{distro}->getPackageName('rsyslog'));
+ }
+
+ if ($self->{kind} eq 'syslog-ng' && !isInPath('syslog-ng')) {
+ $engine->installPackages($self->{distro}->getPackageName($self->{distro}->getBinaryName('syslog-ng')));
+ }
+
+ # not sure if we ever should setup this service
+ if ($self->{kind} eq 'syslogd' && !isInPath($self->{distro}->getBinaryName('syslogd'))) {
+ $engine->installPackages($self->{distro}->getPackageName('syslogd'));
+ }
+
+ if (!$self->{kind}) {
+ if (qx{which $self->{distro}->getBinaryName('rsyslog')}) {
+ $self->{kind} = 'rsyslog';
+ }
+ elsif (qx{which $self->{distro}->getBinaryName('syslog-ng')}) {
+ $self->{kind} = 'syslog-ng';
+ }
+ elsif (qx{which $self->{distro}->getBinaryName('syslogd')}) {
+ $self->{kind} = 'syslogd';
+ }
+ else {
+ die _tr(
+ "no syslog daemon available, plugin 'syslog' wouldn't work!"
+ );
+ }
+ print _tr("selecting %s as syslog kind\n", $self->{kind});
+ }
+
+ # start to actually do something - according to current stage1 attributes
+ if ($self->{kind} eq 'rsyslog') {
+ $self->_setupRsyslog($self->{attrs});
+ }
+ elsif ($self->{kind} eq 'syslog-ng') {
+ $self->_setupSyslogNG($self->{attrs});
+ }
+ elsif ($self->{kind} eq 'syslogd') {
+ $self->_setupSyslogd($self->{attrs});
+ }
+ else {
+ die _tr(
+ 'unknown kind "%s" given, only "rsyslog", "syslog-ng" and "syslogd" are supported!',
+ $self->{kind}
+ );
+ }
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+sub _setupRsyslog
+{
+ my $self = shift;
+ my $attrs = shift;
+
+ my $repoPath = $self->{pluginRepositoryPath};
+
+ my $kind = lc($attrs->{'syslog::kind'});
+ my $rlInfo = $self->{distro}->runlevelInfo($kind);
+
+ my $conf = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # written by OpenSLX-plugin 'syslog'
+
+ testmkd /mnt/var/run/rsyslog
+ rllinker $rlInfo->{scriptName} $rlInfo->{startAt} $rlInfo->{stopAt}
+
+ End-of-Here
+ spitFile("$repoPath/syslog.sh", $conf);
+
+ return;
+}
+
+sub _setupSyslogNG
+{
+ my $self = shift;
+ my $attrs = shift;
+
+ my $repoPath = $self->{pluginRepositoryPath};
+
+ my $kind = lc($attrs->{'syslog::kind'});
+ my $rlInfo = $self->{distro}->runlevelInfo($kind);
+
+ my $conf = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # written by OpenSLX-plugin 'syslog'
+
+ cat >/mnt/etc/syslog-ng/syslog-ng.conf <<END
+ # written by OpenSLX-plugin 'syslog'
+ source all {
+ file("/proc/kmsg");
+ unix-dgram("/dev/log");
+ internal();
+ };
+ destination console_all {
+ file("/dev/tty10");
+ };
+ log {
+ source(all);
+ destination(console_all);
+ };
+ END
+
+ if [ -n "\${syslog_host}" ]; then
+ [ -z \${syslog_port} ] && syslog_port=514
+ cat >>/mnt/etc/syslog-ng/syslog-ng.conf <<END
+ destination loghost {
+ udp( "\${syslog_host}" port(\${syslog_port}) );
+ };
+ log {
+ source(all);
+ destination(loghost);
+ };
+ END
+ fi
+
+ if [ -n "\${syslog_file}" ]; then
+ cat >>/mnt/etc/syslog-ng/syslog-ng.conf <<END
+ destination allmessages {
+ file("\${syslog_file}");
+ };
+ log {
+ source(all);
+ destination(allmessages);
+ };
+ END
+ fi
+
+ rllinker $rlInfo->{scriptName} $rlInfo->{startAt} $rlInfo->{stopAt}
+
+ End-of-Here
+ spitFile("$repoPath/syslog.sh", $conf);
+
+ return;
+}
+
+sub _setupSyslogd
+{
+ my $self = shift;
+ my $attrs = shift;
+
+ my $repoPath = $self->{pluginRepositoryPath};
+
+ my $kind = lc($attrs->{'syslog::kind'});
+ my $rlInfo = $self->{distro}->runlevelInfo($kind);
+
+ my $conf = unshiftHereDoc(<<' End-of-Here');
+ #!/bin/sh
+ # written by OpenSLX-plugin 'syslog'
+
+ cat >/mnt/etc/syslog.conf <<END
+ # written by OpenSLX-plugin 'syslog'
+ *.=debug;\
+ auth,authpriv.none;\
+ news.none;mail.none -/var/log/debug
+ *.=info;*.=notice;*.=warn;\
+ auth,authpriv.none;\
+ cron,daemon.none;\
+ mail,news.none -/var/log/messages
+
+ END
+
+ if [ -n "\${syslog_host}" ]; then
+ [ -z \${syslog_port} ] && syslog_port=514
+ cat >/mnt/etc/syslog.conf <<END
+ *.* @${syslog_host}
+ END
+ fi
+
+ if [ -n "\${syslog_file}" ]; then
+ cat >/mnt/etc/syslog.conf <<END
+ *.* ${syslog_file}
+ };
+ END
+ fi
+
+ rllinker $rlInfo->{scriptName} $rlInfo->{startAt} $rlInfo->{stopAt}
+
+ End-of-Here
+ spitFile("$repoPath/syslog.sh", $conf);
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/syslog/XX_syslog.sh b/src/os-plugins/plugins/syslog/XX_syslog.sh
new file mode 100644
index 00000000..0a96814f
--- /dev/null
+++ b/src/os-plugins/plugins/syslog/XX_syslog.sh
@@ -0,0 +1,31 @@
+# Copyright (c) 2007..2008 - RZ Uni Freiburg
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'syslog' plugin - the runlevel script
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# check if the plugin config directory is generally available or if the client
+# configuration failed somehow
+[ -d /initramfs/plugin-conf ] || error "${init_picfg}" nonfatal
+
+if [ -e /initramfs/plugin-conf/syslog.conf ]; then
+ . /initramfs/plugin-conf/syslog.conf
+ if [ $syslog_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'syslog' os-plugin ..."
+
+ . /mnt/opt/openslx/plugin-repo/syslog/syslog.sh
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'syslog' os-plugin ..."
+
+ fi
+fi
diff --git a/src/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh b/src/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh
new file mode 100644
index 00000000..f0ca370f
--- /dev/null
+++ b/src/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh
@@ -0,0 +1,18 @@
+if [ -e /initramfs/plugin-conf/syslog.conf ]; then
+ . /initramfs/plugin-conf/syslog.conf
+ if [ $syslog_active -ne 0 ]; then
+ # TODO: maybe limit the maximum log file size via rotation?
+ params="-s 0"
+ if [ -n "$syslog_host" ]; then
+ if [ -n "${syslog_port}" ]; then
+ host="${syslog_host}:${syslog_port}"
+ else
+ host="${syslog_host}"
+ fi
+ params="$params -R ${host}"
+ fi
+ echo "syslogd $params ..."
+ syslogd $params >/dev/null 2>&1
+ klogd >/dev/null 2>&1
+ fi
+fi
diff --git a/src/os-plugins/plugins/syslog/init-hooks/95-cleanup/syslog.sh b/src/os-plugins/plugins/syslog/init-hooks/95-cleanup/syslog.sh
new file mode 100644
index 00000000..08076c34
--- /dev/null
+++ b/src/os-plugins/plugins/syslog/init-hooks/95-cleanup/syslog.sh
@@ -0,0 +1,12 @@
+if [ -e /initramfs/plugin-conf/syslog.conf ]; then
+ . /initramfs/plugin-conf/syslog.conf
+ if [ $syslog_active -ne 0 ] && [ -n "$syslog_host" ]; then
+ # kill syslogd, as it is going to be replaced by system's syslog soon
+ killall syslogd
+ # remove links to boot.klog, as that will hang (I suppose that is
+ # because we already emptied /dev/kmsg)
+ if [ -e /mnt/etc/init.d/boot.klog ]; then
+ rm /mnt/etc/init.d/boot.d/*.klog
+ fi
+ fi
+fi
diff --git a/src/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm b/src/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm
new file mode 100644
index 00000000..9800c203
--- /dev/null
+++ b/src/os-plugins/plugins/sysrqshutdown/OpenSLX/OSPlugin/sysrqshutdown.pm
@@ -0,0 +1,101 @@
+# Copyright (c) 2007 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# sysrqshutdown.pm
+# - implementation of the 'sysrqshutdow' plugin, which replaces the shutdown
+# binary through a SYSRQ shutdown script
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::sysrqshutdown;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'sysrqshutdown',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Replaces the shutdown binary through a SYSRQ shutdown script
+ End-of-Here
+ precedence => 10,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'sysrqshutdown::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'sysrqshutdown'-plugin be activated?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ if (! -e "/sbin/shutdown.slxorig") {
+ # copy files
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath
+ = "$openslxBasePath/lib/plugins/$pluginName/files";
+
+ system("mv /sbin/shutdown /sbin/shutdown.slxorig");
+ system("cp -p $pluginBasePath/shutdown /sbin/");
+ chmod 0755, "/sbin/shutdown";
+ }
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ if (-e "/sbin/shutdown.slxorig") {
+ system("mv /sbin/shutdown.slxorig /sbin/shutdown");
+ }
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/sysrqshutdown/XX_sysrqshutdown.sh b/src/os-plugins/plugins/sysrqshutdown/XX_sysrqshutdown.sh
new file mode 100644
index 00000000..66a728da
--- /dev/null
+++ b/src/os-plugins/plugins/sysrqshutdown/XX_sysrqshutdown.sh
@@ -0,0 +1,38 @@
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# 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/sysrqshutdown.conf"
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/sysrqshutdown
+
+if [ -f $CONFFILE ]; then
+
+ # load needed variables
+ . $CONFFILE
+
+ if [ ${sysrqshutdown_active} -ne 0 ] ; then
+ [ ${DEBUGLEVEL} -gt 0 ] && echo "executing the 'sysrqshutdown' plugin ..."
+
+ testmkd ${PLUGINCONFDIR}
+ cp $CONFFILE ${PLUGINCONFDIR}/sysrqshutdown.conf
+
+ # finished ...
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'sysrqshutdown' plugin ..."
+ fi
+else
+ [ $DEBUGLEVEL -gt 0 ] && echo " * config of 'sysrqshutdown' plugin failed"
+fi
+
diff --git a/src/os-plugins/plugins/sysrqshutdown/files/shutdown b/src/os-plugins/plugins/sysrqshutdown/files/shutdown
new file mode 100644
index 00000000..7f4e9a1f
--- /dev/null
+++ b/src/os-plugins/plugins/sysrqshutdown/files/shutdown
@@ -0,0 +1,54 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Copyright (c) 2010 - RZ Uni FR
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# shutdown
+# - Script for SYSRQ shutdown
+################################################################################
+
+. /etc/opt/openslx/openslx.conf
+
+################################################################################
+### Define default dirs / get configs
+################################################################################
+
+PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins
+PLUGINCONFVMGRID=${PLUGINCONFROOT}/sysrqshutdown
+# include general configuration from vmgrid
+if [ -f ${PLUGINCONFVMGRID}/sysrqshutdown.conf ]; then
+ . ${PLUGINCONFVMGRID}/sysrqshutdown.conf
+else
+ sysrqshutdown_active=0
+fi
+
+if [ ${sysrqshutdown_active} -eq 1 ]; then
+ # check if reboot or halt
+ case "$@" in
+ '-r now')
+ for i in $(echo s u b); do
+ echo $i > /proc/sysrq-trigger &
+ done
+ exit 0
+ ;;
+ '-h now')
+ for i in $(echo s u o); do
+ echo $i > /proc/sysrq-trigger &
+ done
+ exit 0
+ ;;
+ esac
+fi
+# else use orig shutdown
+shutdown.slxorig $@
+
+exit 0
+
diff --git a/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..d26cdfcc
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm
@@ -0,0 +1,59 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# virtualbox/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the VirtualBox plugin.
+# -----------------------------------------------------------------------------
+package virtualbox::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub installVbox
+{
+ my $self = shift;
+
+ my $engine = $self->{'engine'};
+
+ # lets try it... we can't loose anything :)
+ $engine->installPackages('virtualbox-ose');
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..edd117ca
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,52 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# virtualbox/OpenSLX/Distro/debian.pm
+# - provides Debian-specific overrides of the Distro API for the VirtualBox
+# plugin.
+# -----------------------------------------------------------------------------
+package virtualbox::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(virtualbox::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub installVbox
+{
+ my $self = shift;
+
+ my $engine = $self->{'engine'};
+ my $release = `lsb_release -rs`;
+ chomp($release);
+
+ # lenny(5.0) has v1.6
+ # testing is ok. but no clue which lsb_release -rs it has...
+ if ( $release eq "999999.0") {
+ #the usual "in stage1 chroot we get another kernel vers. problem"
+ # kernel modules need to be installed from the cloned system
+ #$engine->installPackages('virtualbox-ose');
+ #system('/etc/init.d/virtualbox-ose setup');
+ } else {
+ print "Couldn't install VirtualBox, no package from distribution\n";
+ exit;
+ }
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..9af3191e
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,48 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# virtualbox/OpenSLX/Distro/Suse.pm
+# - provides SUSE specific overrides of the distro API for the VirtualBox
+# plugin.
+# -----------------------------------------------------------------------------
+package virtualbox::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(virtualbox::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub installVbox
+{
+ my $self = shift;
+
+ my $engine = $self->{'engine'};
+ # should be replaced by proper function
+ my $release = `lsb_release -rs`;
+ chomp($release);
+
+ if ( $release eq "11.1" || $release eq "11.0" || $release eq "10.3") {
+ $engine->installPackages('virtualbox-ose');
+ } else {
+ print "Couldn't install VirtualBox, no package from distribution\n";
+ exit;
+ }
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..44695680
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,54 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# virtualbox/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu-specific overrides of the Distro API for the virtualbox
+# plugin.
+# -----------------------------------------------------------------------------
+package virtualbox::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+# inherit everything from Debian (as Ubuntu is based on it anyway)
+use base qw(virtualbox::OpenSLX::Distro::Debian);
+use base qw(virtualbox::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+
+################################################################################
+#### interface methods
+################################################################################
+sub installVbox
+{
+ my $self = shift;
+
+ my $engine = $self->{'engine'};
+ my $release = `lsb_release -rs`;
+ chomp($release);
+
+ # hardy (8.04LTS): only version VBox v1.5
+ if ( $release eq "8.10" || $release eq "9.04") {
+ #the usual "in stage1 chroot we get another kernel vers. problem"
+ # kernel modules need to be installed from the cloned system
+ #$engine->installPackages("virtualbox-ose");
+ #system('/etc/init.d/virtualbox-ose setup');
+ } else {
+ print "Couldn't install VirtualBox, no package from distribution!\n";
+ exit;
+ }
+
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm b/src/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
new file mode 100644
index 00000000..07ec9dc0
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
@@ -0,0 +1,284 @@
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# virtualbox.pm
+# - declares necessary information for the virtualbox plugin
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::virtualbox;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Basename;
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+sub new
+{
+ my $class = shift;
+ my $self = {
+ name => 'virtualbox',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Module for enabling services for the VirtualBox on an OpenSLX
+ stateless client.
+ End-of-Here
+ precedence => 70,
+ # headless mode does not require a desktop!
+ #required => [ qw( desktop ) ],
+ };
+}
+
+sub getAttrInfo
+{
+ # Returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system by means
+ # of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'virtualbox::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'virtualbox'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 for active, 0 for inactive',
+ default => '1',
+ },
+ # attribute 'imagesrc' defines where we can find virtualbox images
+ 'virtualbox::imagesrc' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Where do we store our virtualbox images? NFS? Filesystem?
+ End-of-Here
+ content_regex => qr{^(/|nfs://)},
+ content_descr => 'local path or URI or "-" (unset)',
+ default => undef,
+ },
+ # attribute 'bridge' defines if bridged network mode should be
+ # switched on
+ # TODO: change to net -> nat, bridge, hostonly?
+ # TODO: since we use def in XML maybe use to override
+ 'virtualbox::bridge' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Should the bridging (direct access of the virtualbox clients
+ to the ethernet the host is connected to) be enabled
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '0 or 1',
+ default => '1',
+ },
+ # attribute 'mem' defines if memory should be forced
+ 'virtualbox::mem' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Do you want to force a ralative amount of RAM?
+ (Not implemented right now!)
+ End-of-Here
+ content_regex => qr{^(\d\d??)$},
+ content_descr => 'Between 0 - 99',
+ default => undef,
+ },
+ # attribute 'kvm' defines if KVM modules should be forced
+ 'virtualbox::kvm' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Do you want to force the usage of KVM modules where applicable?
+ (Not implemented right now!)
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '0 or 1',
+ default => undef,
+ },
+ # attribute 'tftpdir' defines TFTP dir for network boots /w NAT
+ 'virtualbox::tftpdir' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Do you want to define a stage 4 TFTP dir for netwoork boots when
+ using NAT?
+ Hint: Mount your TFTP ro via NFS to a local dir
+ End-of-Here
+ content_regex => qr{^(/)},
+ content_descr => 'local path or "-" (unset)',
+ default => '/var/lib/virt/virtualbox',
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
+
+ my $engine = $self->{'os-plugin-engine'};
+
+ # Different names of the tool (should be unified somehow!?)
+ if (!isInPath('VirtualBox')) {
+ # todo: fix this
+ $self->{distro}->installVbox();
+ }
+ if (!isInPath('VirtualBox')) {
+ print
+ "VirtualBox is not installed. VirtualBox Plugin won't be installed!\n"
+ ;
+ #exit
+ }
+
+ $self->_writeRunlevelScript();
+
+ # Copy run-virt.include and template files to the appropriate place for
+ # inclusion in stage4
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath =
+ "$self->{openslxBasePath}/lib/plugins/$pluginName/files";
+ foreach my $file ( qw( run-virt.include virtualbox.include machine.include
+ empty-diff.vdi.gz rwimg.vdi.gz ) ) {
+ copyFile("$pluginBasePath/$file", "$self->{pluginRepositoryPath}/");
+ chmod 0644, "$self->{pluginRepositoryPath}/$file";
+ }
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+sub checkStage3AttrValues
+{
+ my $self = shift;
+ my $stage3Attrs = shift;
+ my $vendorOSAttrs = shift;
+ #my @problems;
+
+ #my $vmimg = $stage3Attrs->{'virtualbox::imagesrc'} || '';
+
+ return;
+}
+
+# Write the runlevelscript
+sub _writeRunlevelScript
+{
+ my $self = shift;
+ my $initfile = newInitFile();
+ my $script = "";
+
+ $initfile->setName("vbox-slx");
+ $initfile->setDesc("Setup environment for virtualbox. Part of OpenSLX virtualbox plugin.");
+
+ # todo: Function need to be formated proper... not important right now
+ $initfile->addFunction(
+ 'running',
+ 'lsmod | grep -q "$1[^_-]"'
+ );
+ #
+ $script = unshiftHereDoc(<<' End-of-Here');
+ if running vboxdrv; then
+ if running vboxnetflt; then
+ echo "VirtualBox kernel modules (vboxdrv and vboxnetflt) are loaded."
+ else
+ echo "VirtualBox kernel module is loaded."
+ fi
+ #TODO: check it: ignore user check. handling our own way:
+ for i in /tmp/.vbox-*-ipc; do
+ echo "Running: "
+ $(VBoxManage -q list runningvms | sed -e 's/^".*"//' 2>/dev/null)
+ done
+ else
+ echo "VirtualBox kernel module(s) are not loaded."
+ fi
+ End-of-Here
+ $initfile->addFunction(
+ "vmstatus",
+ "$script"
+ );
+ $initfile->addFunction(
+ 'start',
+ ' modprobe -qa vboxdrv vboxnetflt vboxnetadp',
+ );
+ $initfile->addFunction(
+ 'stop',
+ ' rmmod vboxnetadp vboxnetflt vboxdrv',
+ );
+ $initfile->addToCase(
+ 'start',
+ 'start'
+ );
+ $initfile->addToCase(
+ 'stop',
+ 'stop'
+ );
+ $initfile->addToCase(
+ 'status',
+ 'vmstatus'
+ );
+ $initfile->addToCase(
+ 'restart',
+ 'stop && start'
+ );
+
+ # get distro version
+ my $distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0];
+ my $runlevelscript = getInitFileForDistro($initfile, $distro);
+
+ spitFile("$self->{'pluginRepositoryPath'}/vbox-slx", $runlevelscript);
+}
+
+# The bridge configuration needs the bridge module to be present in early
+# stage3
+sub suggestAdditionalKernelModules
+{
+ my $self = shift;
+ my $makeInitRamFSEngine = shift;
+
+ my @suggestedModules;
+
+ push @suggestedModules, qw( bridge );
+
+ return @suggestedModules;
+}
+
+1;
diff --git a/src/os-plugins/plugins/virtualbox/XX_virtualbox.sh b/src/os-plugins/plugins/virtualbox/XX_virtualbox.sh
new file mode 100644
index 00000000..b54b4bec
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/XX_virtualbox.sh
@@ -0,0 +1,98 @@
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# 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/virtualbox.conf
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualbox
+PLUGINDIR=/mnt/${OPENSLX_DEFAULT_DIR}/plugin-repo/virtualbox
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/virtualbox
+
+# check if the configuration file is available
+if [ -e ${CONFFILE} ]; then
+
+ # load needed variables
+ . ${CONFFILE}
+
+ # Test if this plugin is activated... more or less useless with the
+ # new plugin system
+ if [ $virtualbox_active -ne 0 2>/dev/null ]; then
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'virtualbox' os-plugin ...";
+
+ # load general configuration
+ . /etc/initramfs-setup
+
+ # get source of virtualbox image server (get type, server and path)
+ if strinstr "/" "${virtualbox_imagesrc}" ; then
+ vbimgprot=$(uri_token ${virtualbox_imagesrc} prot)
+ vbimgserv=$(uri_token ${virtualbox_imagesrc} server)
+ vbimgpath="$(uri_token ${virtualbox_imagesrc} path)"
+ fi
+ if [ -n "${vbimgserv}" ] ; then
+ # directory where qemu images are expected in
+ mnttarget=${VIRTDIR}
+ # mount the virtualbox image source readonly (ro)
+ fsmount ${vbimgprot} ${vbimgserv} ${vbimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && \
+ error " * Incomplete information in variable ${virtualbox_imagesrc}." \
+ nonfatal
+ fi
+
+ # copy virtualization include files to config dir
+ testmkd ${PLUGINCONFDIR}
+ cp ${PLUGINDIR}/*.include ${PLUGINCONFDIR}
+ # copy ${CONFFILE} to ${PLUGINCONFDIR} just in case
+ cp ${CONFFILE} ${PLUGINCONFDIR}
+
+# # TODO: create rawdisk if requested
+# # create raw disk
+# for part in $(grep -qE " 44 | 45 " /etc/disk.partition); do
+# case "${part}" in
+# * 45 *)
+# id4x=$(grep " 45 " /etc/disk.partition | grep -E " 44 | 45 " \
+# | awk '{print $1}' | cut -c -8)
+# break
+# ;;
+# * 44 *)
+# id4x=$(grep " 44 " /etc/disk.partition | grep -E " 44 | 45 " \
+# | awk '{print $1}' | cut -c -8)
+# break
+# ;;
+# esac
+# if [ -n "${id4x}" ]; then
+# mount --bind /dev /mnt/dev
+# chroot /mnt VBoxManage -q internalcommands createrawvmdk -filename \
+# ${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualbox/raw.vmdk -rawdisk ${id4x}
+# chmod 777 ${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualbox/raw.vmdk
+# umount -f /mnt/dev 2>/dev/null
+# fi
+
+ # copy and activate init file
+ cp ${PLUGINDIR}/vbox-slx /mnt/etc/init.d/
+ chmod 755 /mnt/etc/init.d/vbox-slx
+ rllinker "vbox-slx" 20 2
+
+ mknod -m 0660 /dev/vboxdrv c 10 59
+ chown root:vboxusers /dev/vboxdrv
+
+ # finished ...
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'virtualbox' os-plugin ..."
+ fi
+else
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo " * Configuration of 'virtualbox' plugin failed"
+fi
diff --git a/src/os-plugins/plugins/virtualbox/files/empty-diff.vdi.gz b/src/os-plugins/plugins/virtualbox/files/empty-diff.vdi.gz
new file mode 100644
index 00000000..24697b58
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/files/empty-diff.vdi.gz
Binary files differ
diff --git a/src/os-plugins/plugins/virtualbox/files/machine.include b/src/os-plugins/plugins/virtualbox/files/machine.include
new file mode 100644
index 00000000..96acd7a2
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/files/machine.include
@@ -0,0 +1,132 @@
+# Include file (machine template) for run-virt.include of the virtualbox plugin
+cat << EOF > "${machconfig}"
+<?xml version="1.0"?>
+<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.9-linux">
+ <Machine uuid="{${machineuuid}}" name="${vm_name}" OSType="${vmostype}">
+ <ExtraData>
+ <ExtraDataItem name="GUI/AutoresizeGuest" value="on"/>
+ <ExtraDataItem name="GUI/Fullscreen" value="on"/>
+ <ExtraDataItem name="GUI/LastCloseAction" value="powerOff"/>
+ <ExtraDataItem name="GUI/MiniToolBarAlignment" value="top"/>
+ <ExtraDataItem name="GUI/MiniToolBarAutoHide" value="on"/>
+ <ExtraDataItem name="GUI/SaveMountedAtRuntime" value="yes"/>
+ <ExtraDataItem name="GUI/Seamless" value="off"/>
+ <ExtraDataItem name="GUI/ShowMiniToolBar" value="yes"/>
+ </ExtraData>
+ <Hardware version="2">
+ <CPU count="${cpu_cores}">
+ <HardwareVirtEx enabled="${enablevt}" exclusive="true"/>
+ <HardwareVirtExNestedPaging enabled="${npaging}"/>
+ <HardwareVirtExVPID enabled="false"/>
+ <PAE enabled="true"/>
+ </CPU>
+ <Memory RAMSize="${mem}"/>
+ <Boot>
+ <Order position="1" device="${boot}"/> <!-- HardDisk, DVD, Network, Floppy -->
+ <Order position="2" device="None"/>
+ <Order position="3" device="None"/>
+ <Order position="4" device="None"/>
+ </Boot>
+ <Display VRAMSize="24" monitorCount="1" accelerate3D="false" accelerate2DVideo="false"/>
+ <!-- authType="External", "Guest", "Null" -->
+ <RemoteDisplay enabled="false" port="${vrdpport}" authType="Null" authTimeout="5000"/>
+ <BIOS>
+ <ACPI enabled="true"/>
+ <IOAPIC enabled="true"/>
+ <Logo fadeIn="false" fadeOut="false" displayTime="0"/>
+ <BootMenu mode="MessageAndMenu"/>
+ <TimeOffset value="0"/>
+ <PXEDebug enabled="false"/>
+ </BIOS>
+ <USBController enabled="true" enabledEhci="true"/>
+ <Network>
+ <Adapter slot="0" enabled="true" MACAddress="${macaddr}" cable="true" speed="0" type="${vb_network_card}">
+ <${network_kind}/>
+ </Adapter>
+ <Adapter slot="1" enabled="false" MACAddress="0800279312FB" cable="true" speed="0" type="Am79C973"/>
+ <Adapter slot="2" enabled="false" MACAddress="080027A3A3CA" cable="true" speed="0" type="Am79C973"/>
+ <Adapter slot="3" enabled="false" MACAddress="0800277356F6" cable="true" speed="0" type="Am79C973"/>
+ <Adapter slot="4" enabled="false" MACAddress="080027CEA83A" cable="true" speed="0" type="Am79C973"/>
+ <Adapter slot="5" enabled="false" MACAddress="0800271B8D7A" cable="true" speed="0" type="Am79C973"/>
+ <Adapter slot="6" enabled="false" MACAddress="08002771BBD7" cable="true" speed="0" type="Am79C973"/>
+ <Adapter slot="7" enabled="false" MACAddress="080027EB6A12" cable="true" speed="0" type="Am79C973"/>
+ </Network>
+ <UART>
+ <Port slot="0" enabled="false" IOBase="0x3f8" IRQ="4" hostMode="Disconnected"/>
+ <Port slot="1" enabled="false" IOBase="0x3f8" IRQ="4" hostMode="Disconnected"/>
+ </UART>
+ <LPT>
+ <Port slot="0" enabled="false" IOBase="0x378" IRQ="4"/>
+ <Port slot="1" enabled="false" IOBase="0x378" IRQ="4"/>
+ </LPT>
+ <AudioAdapter controller="AC97" driver="Alsa" enabled="${audio}"/> <!-- OSS, Alsa, Pulse (HANGS!) -->
+ <SharedFolders>
+ <SharedFolder name="${sharename}" hostPath="${sharepath}" writable="true"/>
+ </SharedFolders>
+ <Clipboard mode="Bidirectional"/>
+ <Guest memoryBalloonSize="0" statisticsUpdateInterval="0"/>
+ <!--
+ <GuestProperties>
+ <GuestProperty name="/VirtualBox/HostGuest/SysprepExec" value="" timestamp="1268140071072779000" flags="TRANSIENT, RDONLYGUEST"/>
+ <GuestProperty name="/VirtualBox/HostGuest/SysprepArgs" value="" timestamp="1268140071072939000" flags="TRANSIENT, RDONLYGUEST"/>
+ <GuestProperty name="/VirtualBox/GuestInfo/OS/Product" value="Linux" timestamp="1268140265864540000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/OS/Release" value="2.6.27.21" timestamp="1268140265894019000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/OS/Version" value="#3 SMP Fri Feb 26 16:38:21 CET 2010" timestamp="1268140265898448000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/OS/ServicePack" value="" timestamp="1268140265899571000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestAdd/Revision" value="57640" timestamp="1268140265900144000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestAdd/Version" value="3.1.4" timestamp="1268140265899937000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/OS/LoggedInUsers" value="1" timestamp="1268164075148440000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/Count" value="4" timestamp="1268164075148790000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/0/V4/IP" value="132.230.4.224" timestamp="1268164075149053000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/0/V4/Broadcast" value="132.230.4.255" timestamp="1268164075149297000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/0/V4/Netmask" value="255.255.255.0" timestamp="1268164075149596000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/0/Status" value="Up" timestamp="1268164075149829000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/1/V4/IP" value="192.168.112.1" timestamp="1268164075150037000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/1/V4/Broadcast" value="192.168.112.255" timestamp="1268164075150238000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/1/V4/Netmask" value="255.255.255.0" timestamp="1268164075150439000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/1/Status" value="Up" timestamp="1268164075150635000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/2/V4/IP" value="192.168.54.1" timestamp="1268164075150835000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/2/V4/Broadcast" value="192.168.54.255" timestamp="1268164075151072000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/2/V4/Netmask" value="255.255.255.0" timestamp="1268164075151282000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/2/Status" value="Up" timestamp="1268164075151479000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/OS/NoLoggedInUsers" value="false" timestamp="1268140276063587000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestAdd/Vbgl/Video/SavedMode" value="1024x768x32" timestamp="1268140287190297000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestAdd/HostVerLastChecked" value="3.1.4" timestamp="1268140310962236000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/3/V4/IP" value="192.168.122.1" timestamp="1268164075152293000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/3/V4/Broadcast" value="192.168.122.255" timestamp="1268164075152615000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/3/V4/Netmask" value="255.255.255.0" timestamp="1268164075152828000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/3/Status" value="Up" timestamp="1268164075153029000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/4/V4/IP" value="169.254.4.104" timestamp="1265728007966805000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/4/V4/Broadcast" value="169.254.255.255" timestamp="1265728007967184000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/4/V4/Netmask" value="255.255.0.0" timestamp="1265728007967487000" flags=""/>
+ <GuestProperty name="/VirtualBox/GuestInfo/Net/4/Status" value="Up" timestamp="1265728007967829000" flags=""/>
+ <GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="de_DE" timestamp="1268140070610343000" flags=""/>
+ <GuestProperty name="/VirtualBox/HostInfo/VBoxVer" value="3.1.4" timestamp="1268154582522485000" flags="TRANSIENT, RDONLYGUEST"/>
+ <GuestProperty name="/VirtualBox/HostInfo/VBoxRev" value="57640" timestamp="1268154582522507000" flags="TRANSIENT, RDONLYGUEST"/>
+ <GuestProperty name="/VirtualBox/GuestInfo/OS/LoggedInUsersList" value="vmuser" timestamp="1268164075147867000" flags=""/>
+ </GuestProperties>
+ -->
+ </Hardware>
+ <StorageControllers>
+ <StorageController name="IDE-Controller" type="PIIX4" PortCount="2">
+ <AttachedDevice type="HardDisk" port="0" device="0">
+ <Image uuid="{${imageuuid}}"/>
+ </AttachedDevice> <!-- PLEASE DO NOT REMOVE THIS COMMENT (HD)!!! -->
+ <AttachedDevice passthrough="false" type="DVD" port="0" device="1">
+ <HostDrive src="${cdrom_0}"/>
+ </AttachedDevice> <!-- PLEASE DO NOT REMOVE THIS COMMENT (CD)!!! -->
+ </StorageController>
+ <!--
+ <StorageController name="Disketten-Controller" type="I82078" PortCount="1">
+ <AttachedDevice type="Floppy" port="0" device="0"/>
+ </StorageController>
+ <StorageController name="SCSI-Controller" type="LsiLogic" PortCount="16">
+ <AttachedDevice type="HardDisk" port="0" device="0">
+ <Image uuid="{812c82bf-bd1a-4f59-a5b6-b54ae2f6c669}"/>
+ </AttachedDevice>
+ </StorageController>
+ -->
+ </StorageControllers>
+ </Machine>
+</VirtualBox>
+EOF
diff --git a/src/os-plugins/plugins/virtualbox/files/run-virt.include b/src/os-plugins/plugins/virtualbox/files/run-virt.include
new file mode 100644
index 00000000..53120f2c
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/files/run-virt.include
@@ -0,0 +1,372 @@
+# run-virt.include
+# -----------------------------------------------------------------------------
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+# -----------------------------------------------------------------------------
+# run-virt.include
+# - Include script for running the VirtualBox on an OpenSLX client via the
+# run-virt.sh or run-vmgrid.sh
+################################################################################
+
+################################################################################
+### Include general configuration
+################################################################################
+if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf ]; then
+ . ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf
+else
+ writelog "Problems reading config file of ${self} plugin"
+ exit 1
+fi
+
+################################################################################
+### Declaration of default variables
+################################################################################
+
+PLUGINCONFVIRTUALBOX="${PLUGINCONFROOT}/${self}"
+PLUGINDIRVIRTUALBOX="${OPENSLX_DEFAULT_DIR}/plugin-repo/${self}"
+# create TMPDIR for all users
+TMPDIR=/tmp/${self}
+mkdir -m 1777 ${TMPDIR} 2>/dev/null
+# dir for configs
+confdir="/tmp/${self}/${USER}/${VM_ID}"
+# use alternate configuration directory instead of $HOME/.VirtualBox
+export VBOX_USER_HOME=${confdir}
+# define dirs and files which can be removed after exit, be carefull!
+RMDIRS="${snapshotdir} ${confdir} /tmp/.vbox-${USER}-ipc"
+rm -rf ${RMDIRS} 2>/dev/null
+machfolder="${confdir}/Machines"
+# use vm_shortname for dir and config names since vm_name can be very long
+machconfig="${machfolder}/${vm_shortname}/${vm_shortname}.xml"
+diskfolder="${confdir}/HardDisks"
+snapshotdir=${machfolder}/${vm_shortname}/Snapshots
+mkdir -p ${diskfolder} ${snapshotdir} 2>/dev/null
+# check if diskless var empty?
+[ -z "${diskless}" ] && diskless=0
+
+# configure our own rwimg, empty image which we support
+if [ "${imgmode}" = "rwimg" ]; then
+ # what is our rwimg called?
+ imgname="${vm_shortname}.vdi"
+ vmpath=${imgpath}/${imgname}
+ if ! [ -e "${vmpath}" ]; then
+ cat ${PLUGINDIRVIRTUALBOX}/rwimg.vdi.gz | gunzip > "${vmpath}"
+ fi
+fi
+
+# link to image
+diskfile="${diskfolder}/${imgname}"
+[ ${diskless} -eq 0 ] && ln -sf ${vmpath} ${diskfile}
+
+# check the file type
+if echo ${imgname} | grep -qiE "vdi|vmdk|vhd" && [ ${diskless} -eq 0 ]; then
+ imgfmt=$(echo ${imgname##*.} | tr [a-z] [A-Z])
+elif [ ${diskless} -eq 0 ]; then
+ writelog "${imgname} is not a valid image format (vdi|vmdk|vhd), exiting!"
+ cleanexit 1
+fi
+
+# TODO: maybe rewrite, to reduce checks, merge it with network option,
+# so we can have a "compatibility to vmware config" section
+case "${vmostype}" in
+ winxp*|windowsxp*)
+ vmostype="WindowsXP"
+ ;;
+ winvista*|windowsvista*)
+ vmostype="WindowsVista"
+ ;;
+ windows7*)
+ vmostype="Windows7"
+ ;;
+ linux*|*ubuntu*|*suse*|debian*|*sci*)
+ if echo "${vmostype}" | grep -q "64"; then
+ vmostype="Linux26_64"
+ # check for vtflag
+ if [ ${vtflag} -ne 1 ]; then
+ writelog "You are trying to boot a 64 bit OS without a VT enabled CPU"
+ writelog "This is not supported, exiting!"
+ cleanexit 1
+ fi
+ # check if host is only 32 bit, then use only 1 cpu (only 1 supported)
+ if echo "${host_arch}" | grep -qE "i.86"; then
+ cpu_cores=1
+ fi
+ else
+ vmostype="Linux26"
+ fi
+ ;;
+esac
+
+writelog "Directories:"
+writelog "\tConfig dir:\t\t$confdir"
+writelog "\tMachines dir:\t\t$machfolder"
+writelog "\tMachine config:\t\t$machconfig"
+[ ${diskless} -eq 0 ] && writelog "\tHardDisks dir:\t\t$diskfolder"
+
+################################################################################
+### Hardware checks
+################################################################################
+
+# remove ':' from MAC addr for vbox
+macaddr=$(echo ${macaddr} | sed 's/://g')
+
+# machine UUID, MAC addr part of it
+machineuuid="00000000-0000-0000-0000-${macaddr}"
+# cosmetical, since UUID in lower case
+machineuuid=$(echo ${machineuuid} | tr [A-Z] [a-z])
+# get UUID of VBox image, if not diskless
+[ ${diskless} -eq 0 ] && diskuuid=$(VBoxManage -q showvdiinfo ${diskfile} \
+ | grep UUID | awk '{print $2}')
+# make disk immutable
+imgtype="Immutable"
+# snapshot UUID is static
+snapshotuuid="88bc8b6d-f248-468a-95fe-318084904f8b"
+# imageuuid in machine.include, dafault snapshotuuid
+imageuuid=${snapshotuuid}
+
+# check if rw image
+# remove disk and add rwimg if set
+if echo "${imgmode}" | grep -q rw; then
+ # lock existing?
+ if [ -e "${vmpath}.lock" ]; then
+ writelog "This rw image is already in use."
+ writelog "Found lock: ${vmpath}.lock, exiting!"
+ writelog "Remove lock if you are sure that this is not the case"
+ cleanexit 1
+ # image rw?
+ elif ! [ -w ${vmpath} ]; then
+ writelog "You defined mode rw, but image ${vmpath} is not rw! \c"
+ writelog "Please correct, exiting!"
+ cleanexit 1
+ fi
+ # add lock
+ touch "${vmpath}.lock"
+ # remove lock after VM stopped
+ RMDIRS="${RMDIRS} ${vmpath}.lock"
+ imgtype="Normal"
+ # replace image uuid in machine config
+ imageuuid=${diskuuid}
+elif [ ${diskless} -eq 0 ]; then
+ # use temp disk as snapshot
+ cat ${PLUGINDIRVIRTUALBOX}/empty-diff.vdi.gz \
+ | gunzip > "${snapshotdir}/{${snapshotuuid}}.vdi"
+fi
+
+# TODO: MEM muss noch angepasst werden. Maschine crasht wenn nehr als 50% MEM
+# memory part equal to vmware plugin
+# percentage of memory to use for virtualbox in standard case
+#if [ -n "${forcemem}" ]; then
+# mem="${forcemem}"
+#else
+# permem=30
+# if [ "${totalmem}" -ge "1600" ]; then
+# permem=40
+# fi
+# # check if /tmp is on harddisk
+# if grep -qe "/dev/.* /tmp " /proc/mounts ; then
+# permem=60
+# id44="1"
+# # Hack, if more than 2,5G RAM use 40% of Ram and write vmem into Ram as well
+# # (40% vmware | 40% confdir(vmem...) | 20% host
+# # VMplayer 2+ issue
+# # TODO: makes this sense for vbox?
+# #if [ "${totalmem}" -ge "2500" ]; then
+# #permem=40
+# #rmdir ${snapshotdir}
+# #snapshotdirold=${snapshotdir}
+# #snapshotdir=/dev/shm/${self}/${USER}/${VM_ID}
+# #mkdir -p ${snapshotdir}
+# #ln -sf ${snapshotdir} ${snapshotdirold}
+# #fi
+# fi
+# mem=$(expr ${totalmem} / 100 \* ${permem})
+# if [ "${id44}" = "1" ]; then
+# hostmem=$(expr ${totalmem} - ${mem})
+# else
+# hostmem=$(expr ${totalmem} - ${mem} - ${mem})
+# fi
+# #permem=40
+# #mem=$(expr ${totalmem} * ${permem})
+# if [ "${mem}" -lt "256" ] || [ "${hostmem}" -lt "256" ]; then
+# writelog "Memory out of range: ${mem} MB (guest) / ${hostmem} MB (host)!"
+# writelog "Min. 256 MB for host and guest!"
+# cleanexit 1
+# fi
+#fi
+
+# translate network cards
+case "${network_card}" in
+ e1000)
+ vb_network_card="82540EM"
+ ;;
+ virtio)
+ vb_network_card="virtio"
+ ;;
+ *)
+ network_card="pcnet"
+ vb_network_card="Am79C973"
+esac
+
+# translate network kinds (nat, bridged, host-only)
+case "${network_kind}" in
+ bridge*)
+ network_kind='BridgedInterface name="br0"'
+ ;;
+ host*)
+ network_kind='HostOnlyInterface name="vboxnet0"'
+ ;;
+ *)
+ network_kind="NAT"
+esac
+
+# translate boot, use if set else set to HardDisk
+# usually support for a,c,d,n, stands for Floppy, HD, CD-ROM, Network
+# support nfs and tftp as well
+case ${boot} in
+ n*|tftp)
+ boot="Network"
+ if [ "${network_kind}" = "NAT" ] && [ -n "${virtualbox_tftpdir}" ]; then
+ # use vm_shortname to avoid Problems /w TFTP in NAT
+ vm_name=${vm_shortname}
+ # link TFTP dir for NAT TFTP boots
+ mkdir -p ${confdir}/TFTP
+ if [ -e ${virtualbox_tftpdir}/pxelinux.0 ]; then
+ cp ${virtualbox_tftpdir}/pxelinux.0 ${confdir}/TFTP/${vm_name}.pxe
+ else
+ writelog "${virtualbox_tftpdir}/pxelinux.0 not found!"
+ writelog "Network boot won't work, exiting!"
+ cleanexit 1
+ fi
+ for i in $(ls ${virtualbox_tftpdir}); do
+ ln -sf ${virtualbox_tftpdir}/${i} ${confdir}/TFTP/${i}
+ done
+ fi
+ ;;
+ # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM
+ *)
+ boot="HardDisk"
+ ;;
+esac
+
+# nested paging
+npaging="false"
+# enable VT
+enablevt="false"
+# check for VT, if not available use only 1 cpu (only 1 supported)
+[ ${vtflag} -eq 0 ] && cpu_cores=1
+[ ${vtflag} -eq 1 ] && enablevt="true"
+
+# external GUI
+vrdpport=${remotedesktopport}
+
+[ ${diskless} -eq 0 ] && writelog "\tSnapshots dir:\t\t$snapshotdir"
+writelog "Diskimage:"
+[ ${diskless} -eq 0 ] && writelog "\tDisk file:\t\t$diskfile"
+[ ${diskless} -eq 0 ] && writelog "\tDisk format:\t\t$imgfmt"
+[ ${diskless} -eq 0 ] && writelog "\tDisk type:\t\t$imgtype"
+ writelog "\tVMostype:\t\t$vmostype"
+ writelog "\tMachine UUID:\t\t$machineuuid"
+[ ${diskless} -eq 0 ] && writelog "\tDisk UUID:\t\t$diskuuid"
+writelog "Virtual Hardware:"
+writelog "\tCPU cores:\t\t${cpu_cores}\c"
+[ ${vtflag} -eq 0 ] && writelog ""
+[ ${vtflag} -eq 1 ] && writelog " (VT enabled CPU)"
+writelog "\tGuest RAM:\t\t${mem} MB"
+# echo nur wenn hostmem gesetzt
+[ -n "${hostmem}" ] && writelog "\tHost RAM:\t\t${hostmem} MB"
+writelog "\tMAC address:\t\t$macaddr"
+writelog "\tNetwork card:\t\t${vb_network_card}"
+writelog "\tNetwork kind:\t\t${network_kind}"
+writelog "\tBooting from:\t\t${boot}\c"
+[ ${diskless} -eq 0 ] && writelog ""
+[ ${diskless} -eq 1 ] && writelog " 'diskless'"
+# TODO: server start activate via xml, etc...
+#writelog "\tGuest VRDP port:\t${vrdpport}"
+writelog "\tCD-ROM1:\t\t${cdrom0}"
+#writelog "\tCD-ROM2:\t\t${cdrom1}"
+#writelog "\tFloppy_A:\t\t${floppy0}"
+#writelog "\tFloppy_B:\t\t${floppy1}"
+# defined in run-virt.sh and run-vmgrid.sh
+writelog "\tShared Folders '${sharename}':\t${sharepath}"
+
+################################################################################
+### Pepare and configure virtual machine and disk image
+################################################################################
+
+# create Virtualbox.xml
+. ${PLUGINCONFVIRTUALBOX}/virtualbox.include
+
+# remove snapshot disk when using rw images
+if [ "${imgtype}" != "Immutable" ]; then
+ sed -i "/${snapshotuuid}/d" "${confdir}/VirtualBox.xml"
+fi
+
+# TODO: add rawdisk if requested
+#"raw.vmdk" format="VMDK" type="Writethrough"/>
+
+# create machine.xml
+. ${PLUGINCONFVIRTUALBOX}/machine.include
+
+# remove CD-ROM
+if [ "${cdrom0}" != "TRUE" ]; then
+ sed -i "/HostDrive/d" ${machconfig}
+ sed -i '/AttachedDevice.*type="DVD"/d' ${machconfig}
+ sed -i "/<!-- PLEASE DO NOT REMOVE THIS COMMENT (CD)!!! -->/d" ${machconfig}
+fi
+
+# if diskless remove all disks
+if [ ${diskless} -eq 1 ]; then
+ sed -i "/<HardDisk/d;/<\/HardDisk/d" "${confdir}/VirtualBox.xml"
+ sed -i "/${imageuuid}/d" ${machconfig}
+ sed -i '/AttachedDevice type="HardDisk"/d' ${machconfig}
+ sed -i "/<!-- PLEASE DO NOT REMOVE THIS COMMENT (HD)!!! -->/d" ${machconfig}
+fi
+
+# define redirects
+if [ ${redirects} -ge 1 ]; then
+ (( i=1 ))
+ writelog "\tGuest redirects:\t\c"
+ while [ ${i} -le ${redirects} ]; do
+ extradataitem='<ExtraDataItem name="VBoxInternal/Devices'
+ extradataitem="${extradataitem}/${network_card}/0/LUN#0/Config"
+ extradataitem="${extradataitem}/${redirect_name[$i]}/"
+ extradataprotocol="Protocol\" value=\"${redirect_proto[$i]}\"/>"
+ extradatahostport="HostPort\" value=\"${redirect_hport[$i]}\"/>"
+ extradataguestport="GuestPort\" value=\"${redirect_gport[$i]}\"/>"
+ sed -i "s,</ExtraData>, ${extradataitem}${extradataguestport}\n\
+ ${extradataitem}${extradatahostport}\n\
+ ${extradataitem}${extradataprotocol}\n\
+ </ExtraData>," "${machconfig}"
+ writelog "${tabspace}${redirect_name[$i]} port: ${redirect_hport[$i]}"
+ tabspace='\t\t\t\t'
+ (( i=$i+1 ))
+ done
+fi
+
+################################################################################
+### finally set env for run-virt.sh
+################################################################################
+
+# wait for a certain command to settle
+# get the PID of the right process
+# kill PID, seems to work
+VBMANPID=$(pstree -p | grep VBoxXPCOMIPCD | grep -ivE "VirtualBox|VBoxHeadless"\
+ | sed -e "s/.*VBoxXPCOMIPCD(\(.*\)).*/\1/")
+for i in $(echo ${VBMANPID}); do
+ kill -9 ${VBMANPID} >/dev/null 2>&1
+done
+
+# set the variables appropriately (several interfaces with different names)
+VIRTCMD=$(which VirtualBox 2>/dev/null)
+VIRTCMDOPTS="--startvm ${machineuuid} --start-running"
+
+# set headless mode (-v off to disable vrdp)
+VIRTCMDHL=$(which VBoxHeadless 2>/dev/null)
+VIRTCMDOPTSHL="-s ${machineuuid}"
diff --git a/src/os-plugins/plugins/virtualbox/files/rwimg.vdi.gz b/src/os-plugins/plugins/virtualbox/files/rwimg.vdi.gz
new file mode 100644
index 00000000..e2133d6d
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/files/rwimg.vdi.gz
Binary files differ
diff --git a/src/os-plugins/plugins/virtualbox/files/virtualbox.include b/src/os-plugins/plugins/virtualbox/files/virtualbox.include
new file mode 100644
index 00000000..9576fc9c
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/files/virtualbox.include
@@ -0,0 +1,47 @@
+# Include file (general template) for run-virt.include of the virtualbox plugin
+cat << EOF > "${confdir}/VirtualBox.xml"
+<?xml version="1.0"?>
+<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.9-linux"> <!-- 1.7-linux -->
+ <Global>
+ <ExtraData>
+ <ExtraDataItem name="GUI/Input/AutoCapture" value="true"/>
+ <ExtraDataItem name="GUI/Input/HostKey" value="65300"/> <!-- scroll lock / Rollen -->
+ <ExtraDataItem name="GUI/LastVMSelected" value="${machineuuid}"/>
+ <ExtraDataItem name="GUI/LicenseAgreed" value="1,2,3,4,5,6,7,8,9"/>
+ <ExtraDataItem name="GUI/MaxGuestResolution" value="any"/> <!-- auto, width,height -->
+ <ExtraDataItem name="GUI/SUNOnlineData" value="triesLeft=0"/>
+ <ExtraDataItem name="GUI/SuppressMessages" value=",remindAboutAutoCapture,confirmInputCapture,remindAboutWrongColorDepth,confirmGoingFullscreen,remindAboutMouseIntegrationOn,remindAboutMouseIntegrationOff,showRuntimeError.warning.DevATA_DISKFULL,remindAboutPausedVMInput,confirmVMReset,showRuntimeError.warning.HostAudioNotResponding"/>
+ <ExtraDataItem name="GUI/TrayIcon/Enabled" value="false"/>
+ <ExtraDataItem name="GUI/UpdateCheckCount" value="2"/>
+ <ExtraDataItem name="GUI/UpdateDate" value="never"/>
+ </ExtraData>
+ <MachineRegistry>
+ <MachineEntry uuid="{${machineuuid}}" src="Machines/${vm_shortname}/${vm_shortname}.xml"/>
+ </MachineRegistry>
+ <MediaRegistry>
+ <HardDisks>
+ <HardDisk uuid="{${diskuuid}}" location="${diskfile}" format="${imgfmt}" type="${imgtype}">
+ <HardDisk uuid="{${snapshotuuid}}" location="${snapshotdir}/{${snapshotuuid}}.vdi" format="VDI" autoReset="true"/>
+ </HardDisk>
+ </HardDisks>
+ <!--
+ <DVDImages>
+ <Image uuid="{dcd1e32a-729f-4faa-b319-67adca15e4a4}" location="/.../gpxe-1.0.0+-virtio-net.iso"/>
+ <Image uuid="{b71450c6-b8ff-43c1-a290-2a793b3023d8}" location="/.../gpxe-1.0.0+-e1000.iso"/>
+ </DVDImages>
+ -->
+ <FloppyImages/>
+ </MediaRegistry>
+ <NetserviceRegistry>
+ <DHCPServers>
+ <DHCPServer networkName="HostInterfaceNetworking-vboxnet0" IPAddress="192.168.56.100" networkMask="255.255.255.0" lowerIP="192.168.56.101" upperIP="192.168.56.254" enabled="1"/>
+ <!--
+ <DHCPServer networkName="HostInterfaceNetworking-vboxnet1" IPAddress="0.0.0.0" networkMask="0.0.0.0" lowerIP="0.0.0.0" upperIP="0.0.0.0" enabled="0"/>
+ -->
+ </DHCPServers>
+ </NetserviceRegistry>
+ <SystemProperties defaultMachineFolder="${machfolder}" defaultHardDiskFolder="${diskfolder}" defaultHardDiskFormat="VDI" remoteDisplayAuthLibrary="VRDPAuth" webServiceAuthLibrary="VRDPAuth" LogHistoryCount="3"/>
+ <USBDeviceFilters/>
+ </Global>
+</VirtualBox>
+EOF
diff --git a/src/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh b/src/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100644
index 00000000..a6d335c5
--- /dev/null
+++ b/src/os-plugins/plugins/virtualbox/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical to the files of virtualbox and qemukvm plugins)
+#############################################################################
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} 0
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} ${bridge}
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}
diff --git a/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..43e4ea1f
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Base.pm
@@ -0,0 +1,64 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmchooser/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the vmchooser plugin.
+# -----------------------------------------------------------------------------
+package vmchooser::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use File::Basename;
+use File::Path;
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+
+sub copyDefaultSession
+{
+ my $self = shift;
+ my $pluginroot = shift;
+
+
+ # Take the default path of SuSE
+ # (as we have the most experience with it)
+ if( -f "/etc/X11/session/default.desktop") {
+ rename("/etc/X11/session/default.desktop",
+ "/etc/X11/session/default.desktop.back")
+ }
+ copyFile("$pluginroot/default.desktop","/etc/X11/session");
+
+ return 1;
+} \ No newline at end of file
diff --git a/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..173f249e
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,49 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmchooser/OpenSLX/Distro/Debian.pm
+# - provides Debian implementation of the Distro API for the vmchooser plugin.
+# -----------------------------------------------------------------------------
+package vmchooser::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use base qw(vmchooser::OpenSLX::Distro::Base);
+
+use File::Basename;
+use File::Path;
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub copyDefaultSession
+{
+ my $self = shift;
+ my $pluginroot = shift;
+
+
+ # Take the default path of SuSE
+ # (as we have the most experience with it)
+ if( -f "/usr/share/xsessions/default.desktop") {
+ rename("/usr/share/xsessions/default.desktop",
+ "/usr/share/xsessions/default.desktop.back")
+ }
+ copyFile("$pluginroot/default.desktop","/usr/share/xsessions");
+
+ return 1;
+} \ No newline at end of file
diff --git a/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..c93a066b
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,47 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmchooser/OpenSLX/Distro/Suse.pm
+# - provides Suse implementation of the Distro API for the vmchooser plugin.
+# -----------------------------------------------------------------------------
+package vmchooser::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use base qw(vmchooser::OpenSLX::Distro::Base);
+
+use File::Basename;
+use File::Path;
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub copyDefaultSession
+{
+ my $self = shift;
+ my $pluginroot = shift;
+
+ # Take the default path of SuSE
+ # (as we have the most experience with it)
+ if( -f "/etc/X11/session/default.desktop") {
+ rename("/etc/X11/session/default.desktop",
+ "/etc/X11/session/default.desktop.back")
+ }
+ copyFile("$pluginroot/default.desktop","/etc/X11/session");
+ return 1;
+} \ No newline at end of file
diff --git a/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..1677321f
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,50 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmchooser/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu implementation of the Distro API for the vmchooser plugin.
+# -----------------------------------------------------------------------------
+package vmchooser::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use base qw(vmchooser::OpenSLX::Distro::Base);
+
+use File::Basename;
+use File::Path;
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+sub copyDefaultSession
+{
+ my $self = shift;
+ my $pluginroot = shift;
+
+
+ # Take the default path of SuSE
+ # (as we have the most experience with it)
+ if( -f "/usr/share/xsessions/default.desktop") {
+ rename("/usr/share/xsessions/default.desktop",
+ "/usr/share/xsessions/default.desktop.back")
+ }
+ copyFile("$pluginroot/default.desktop","/usr/share/xsessions");
+
+ return 1;
+} \ No newline at end of file
diff --git a/src/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm b/src/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm
new file mode 100644
index 00000000..71ce3637
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/OpenSLX/OSPlugin/vmchooser.pm
@@ -0,0 +1,143 @@
+# Copyright (c) 2008, 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmchooser.pm
+# - allows user to pick from a list of virtual machine images
+#
+# - serves as base for virtualizer plugins / and requires one of these
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::vmchooser;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'vmchooser',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ allows user to pick from a list of different virtual machine images
+ based on xml-files, which tell about available images. One of the
+ virtualization tools like vmware*, virtualbox or qemu/kvm is
+ required.
+ End-of-Here
+ precedence => 50,
+ required => [ qw( desktop ) ],
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'vmchooser::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'vmchooser'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'vmchooser::env' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ environment, seperates pools based on XML configuration
+ End-of-Here
+ #TODO:
+ #content_regex => qr{^(0|1)$},
+ content_descr => 'name of environment',
+ default => 'default',
+ },
+ 'vmchooser::xmlpath' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ location of XML configuration for virtual images
+ End-of-Here
+ #TODO:
+ #content_regex => qr{^(0|1)$},
+ content_descr => 'path to xml files',
+ default => '/var/lib/virt',
+ },
+
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+
+ # copy all needed files now:
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName/files";
+ foreach my $file ( qw( vmchooser printer.sh scanner.sh xmlfilter.sh
+ default.desktop mesgdisp run-virt.sh ) ) {
+ copyFile("$pluginBasePath/$file", "$pluginRepoPath/");
+ chmod 0755, "$pluginRepoPath/$file";
+ }
+
+ # set ditro-specific default session
+ $self->{distro}->copyDefaultSession($pluginRepoPath);
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+sub copyRequiredFilesIntoInitramfs
+{
+ my $self = shift;
+ my $targetPath = shift;
+ my $attrs = shift;
+ my $makeInitRamFSEngine = shift;
+ my $pluginRepoPath = "$openslxConfig{'base-path'}/lib/plugins/vmchooser";
+
+ $makeInitRamFSEngine->addCMD(
+ "cp -a $pluginRepoPath/files/mkdosfs $targetPath/bin"
+ );
+
+ vlog(1, _tr("vmchooser-plugin: ..."));
+
+ return;
+}
+
+1;
+
diff --git a/src/os-plugins/plugins/vmchooser/README b/src/os-plugins/plugins/vmchooser/README
new file mode 100644
index 00000000..29434bcc
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/README
@@ -0,0 +1,21 @@
+
+VirtualMachine Chooser - plugin
+===============================
+
+This Plugin uses an additionally provided program to display a list of virtual
+machine sessions (vm's provided by other plugins), from which a user can choose.
+
+This Programm is included in binary format. You can look into the sources at
+svn://svn.openslx.org/srv/svn/openslx/openslx-src-tools/os-plugins/plugins/vmchooser/
+
+There you can change the program to your needs and compile it with the included
+Makefile.
+
+Additionally the plugin provides a script to start a specific virtual machine
+preconfigured. Parts of the configuration are taken from an xml file which
+should be provided with each container file. You will find additional infor-
+mation online at: http://lab.openslx.org/wiki/openslx/Vmchooser
+
+Use at your own risk! No warranty is given by the author of this software for
+any purposes!
+
diff --git a/src/os-plugins/plugins/vmchooser/XX_vmchooser.sh b/src/os-plugins/plugins/vmchooser/XX_vmchooser.sh
new file mode 100644
index 00000000..168bcda1
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/XX_vmchooser.sh
@@ -0,0 +1,57 @@
+# Copyright (c) 2008, 2009 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# 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"
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser
+BINDIR=/mnt/${OPENSLX_DEFAULT_BINDIR}
+PLUGINDIR=${OPENSLX_DEFAULT_DIR}/plugin-repo/vmchooser
+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 ${PLUGINCONFDIR}/loopimg
+ testmkd ${PLUGINCONFDIR}/fd-loop 1777
+ cp $CONFFILE ${PLUGINCONFDIR}/vmchooser.conf
+ ln -s ${PLUGINDIR}/run-virt.sh ${BINDIR}/run-virt.sh
+ ln -s ${PLUGINDIR}/vmchooser ${BINDIR}/vmchooser
+
+ # setup all generic virtualization / starting stuff like the floppy image
+ # loop file for exchanging information between linux and vm guest
+ if modprobe ${MODPRV} loop; then
+ mdev -s
+ else
+ : #|| error "" nonfatal
+ 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 ${PLUGINCONFDIR}/loopimg
+ # create an empty floppy image of 1.4MByte size
+ dd if=/dev/zero of=${PLUGINCONFDIR}/loopimg/fd.img count=2880 bs=512 \
+ 2>/dev/null
+ chmod 0777 ${PLUGINCONFDIR}/loopimg/fd.img
+ # use dos formatter copied into stage3
+ mkdosfs ${PLUGINCONFDIR}/loopimg/fd.img >/dev/null 2>&1 #|| error
+ mount -n -t msdos -o loop,umask=000 ${PLUGINCONFDIR}/loopimg/fd.img \
+ ${PLUGINCONFDIR}/fd-loop
+
+ # finished ...
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'vmchooser' os-plugin ..."
+ fi
+fi
diff --git a/src/os-plugins/plugins/vmchooser/files/default.desktop b/src/os-plugins/plugins/vmchooser/files/default.desktop
new file mode 100644
index 00000000..91540228
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/files/default.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=virtual machine chooser (default)
+Name[de]=Virtuelle Maschine auswählen
+Comment=This session starts the vm session chooser
+Comment[de]=Diese Sitzung startet das Auswahlmenü für die vorhandenen Sitzungen
+Exec=/opt/openslx/plugin-repo/vmchooser/vmchooser
+TryExec=/opt/openslx/plugin-repo/vmchooser/vmchooser
+Icon=
+Type=Application
diff --git a/src/os-plugins/plugins/vmchooser/files/mesgdisp b/src/os-plugins/plugins/vmchooser/files/mesgdisp
new file mode 100755
index 00000000..41e3721c
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/files/mesgdisp
Binary files differ
diff --git a/src/os-plugins/plugins/vmchooser/files/mkdosfs b/src/os-plugins/plugins/vmchooser/files/mkdosfs
new file mode 120000
index 00000000..c3fa8102
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/files/mkdosfs
@@ -0,0 +1 @@
+busybox \ No newline at end of file
diff --git a/src/os-plugins/plugins/vmchooser/files/printer.sh b/src/os-plugins/plugins/vmchooser/files/printer.sh
new file mode 100755
index 00000000..8f1d5ffa
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/files/printer.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+#echo "<printer name=\"info\" path=\"//printserver/info\"> some pseudo printer </printer>"
+
+for(( i=0; $i<10; i=$i+1)); do
+ echo -e "printserver$i\tprinter$i\tPrinter Description $i"
+done
+
+echo -e "printserver.ruf.uni-freiburg.de\treal-printer-name\tSome really long printer Description"
+
diff --git a/src/os-plugins/plugins/vmchooser/files/run-virt.sh b/src/os-plugins/plugins/vmchooser/files/run-virt.sh
new file mode 100644
index 00000000..23f026c7
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/files/run-virt.sh
@@ -0,0 +1,402 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Copyright (c) 2007..2010 - RZ Uni FR
+# Copyright (c) 2007..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# run-virt.sh
+# - This is the generic wrapper for the several virtualization solutions.
+# The idea is to setup a set of variables used by at least two different
+# tools and then include the specific plugin which configures the speci-
+# fied virtualization tool.
+################################################################################
+
+. /etc/opt/openslx/openslx.conf
+
+################################################################################
+### Define default dirs / get configs
+################################################################################
+
+PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins
+PLUGINCONFDIR=${PLUGINCONFROOT}/vmchooser
+# include general configuration from vmchooser
+[ -f ${PLUGINCONFROOT}/vmchooser/vmchooser.conf ] && \
+ . ${PLUGINCONFROOT}/vmchooser/vmchooser.conf
+# load general virtualization information
+[ -f ${PLUGINCONFROOT}/virtualization/virtualization.conf ] && \
+ . ${PLUGINCONFROOT}/virtualization/virtualization.conf
+
+################################################################################
+### Functions used throughout the script
+################################################################################
+
+# function to write to stdout and logfile
+LOGFILE=${OPENSLX_DEFAULT_LOGDIR}/run-virt.${USER}.$$.log
+writelog () {
+ # write to stdout
+ echo -e "$1"
+ # log into file
+ echo -e "$1" >> ${LOGFILE}
+}
+
+# remove config dirs when exit
+cleanexit () {
+ if echo "${RMDIRS}" 2>/dev/null | grep -q ${xmlvirt}; then
+ writelog "${xmlvirt} exited. Cleanning up... \c"
+ rm -rf ${RMDIRS} >/dev/null 2>&1
+ writelog "done"
+ fi
+
+ exit "$1"
+}
+
+# Check for important files used
+filecheck ()
+{
+ filecheck=$(LANG=us ls -lh ${diskfile} 2>&1)
+ writelog "Filecheck:\n${filecheck}\n"
+ noimage=$(echo ${filecheck} | grep -i "no such file or directory" | wc -l)
+ rightsfile=${diskfile}
+
+ # Check if link
+ if [ -L "${diskfile}" ]; then
+ # take link target
+ rightsfile=$(ls -lh ${diskfile} 2>&1 | awk -F '-> *' '{print $2}')
+ rightsfile=${vmdir}/${rightsfile}
+ filecheck=$(LANG=us ls -lh ${rightsfile} 2>&1)
+ fi
+
+ # Does file exist
+ if [ "${noimage}" -ge "1" ]; then
+ writelog "Virtual Machine Image Problem:\c "
+ writelog "\tThe image you've specified doesn't exist."
+ writelog "Filecheck says:\c "
+ writelog "\t\t${diskfile}:\n\t\t\tNo such file or directory"
+ writelog "Hint:\c "
+ writelog "\t\t\tCompare spelling of the image with your options.\n"
+ exit 1
+ fi
+
+ # Readable by calling user
+ if ! [ -r "${diskfile}" >/dev/null 2>&1 \
+ -o -r "${diskfile}" >/dev/null 2>&1 ]; then
+ writelog "Vmware Image Problem:\c "
+ writelog "\tThe image you've specified has wrong rights."
+ writelog "Filecheck says:\t\t$(echo ${filecheck} \
+ | awk '{print $1" "$3" "$4}') ${rightsfile}"
+ writelog "Hint:\t\t\tChange rights with: chmod a+r ${rightsfile}\n"
+ exit 1
+ fi
+
+ # Writable (for persistent-mode)?
+ if ! [ -w "${diskfile}" >/dev/null 2>&1 \
+ -o -w "${diskfile}" >/dev/null 2>&1 ] \
+ && [ "${np}" = "independent-persistent" ]; then
+ writelog "Vmware Image Problem:\c "
+ writelog "\tThe image you have specified has wrong rights."
+ writelog "Filecheck says:\t\t$(echo ${filecheck} \
+ | awk '{print $1" "$3" "$4}') ${rightsfile}"
+ writelog "Hint:\t\t\tUse nonpersistent-mode or change rights to rw\n"
+ exit 1
+ fi
+}
+
+################################################################################
+### Get XML file and dir
+################################################################################
+
+# absolute or relative path?
+xmlfile=$1
+if ls ${xmlfile} 2>/dev/null | grep '/' >/dev/null 2>&1; then
+ xmlpath=$(dirname ${xmlfile})
+ xmlfile=$(basename ${xmlfile})
+else
+ xmlpath=${vmchooser_xmlpath}
+fi
+# full path
+xmlfile="${xmlpath}/${xmlfile%.xml}.xml"
+
+################################################################################
+### Sanity checks
+################################################################################
+
+# test if the xml file is valid
+if ! [ -r "${xmlfile}" ]; then
+ writelog "${xmlfile} not a readable XML file!"
+ exit 1
+fi
+
+# test if XML file
+if ! grep '<?xml' "${xmlfile}" >/dev/null 2>&1; then
+ writelog \
+ "Submitted configuration file ${xmlfile} seems to have wrong XML format"
+ exit 1
+fi
+
+# Theck for running in graphical environment otherwise no much use here
+[ -z "$DISPLAY" ] && echo -e "\n\tStart only within a graphical desktop!\n" \
+ && exit 1
+
+################################################################################
+### Logo for console
+################################################################################
+
+cat <<EOL
+ __ __
+ .----.--.--.-----.___.--.--.|__|.----.| |_
+ | _| | | |___| | || || _|| _|
+ |__| |_____|__|__| \___/ |__||__| |____|
+ OpenSLX virtual machine environment preparation script ...
+
+EOL
+
+################################################################################
+### Read needed variables from XML file
+################################################################################
+
+writelog "Starting configuration..."
+writelog "\tLogfile:\t\t${LOGFILE}"
+writelog "\t/tmp info:\t\t$(df -h | grep " /tmp$" | awk '{print $2}') \c"
+writelog "$(grep "/tmp " /proc/mounts | awk '{print $1" "$2" "$3" "$4}')"
+writelog "\tVM XML dir:\t\t$(dirname ${xmlfile})"
+writelog "\tXML file:\t\t${xmlfile}"
+writelog "VM config:"
+
+# name of the virt image
+imgname=$(grep -io '<image_name param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+
+# imagename /w full path
+if echo ${imgname} 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then
+ imgpath=$(dirname ${imgname})
+ imgname=$(basename ${imgname})
+ vmpath=${imgpath}/${imgname}
+# if old vmchooser binary stuff
+# we do not need folder name as it is already included by vmchooser
+elif echo ${xmlfile} 2>/dev/null | grep -q '^/tmp/' >/dev/null 2>&1; then
+ vmpath=$imgname
+ imgname=$(basename ${imgname})
+# else use same path as xml
+else
+ imgpath=${xmlpath}
+ vmpath=${imgpath}/${imgname}
+fi
+
+# check if virtual machine container file exists
+if ! [ -e "${vmpath}" ]; then
+ writelog "Virtual machine image ${vmpath} not found!"
+ exit 1
+fi
+
+# name of the virt machine, sed because of Windows formatting
+vm_name=$(grep -o 'short_description param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+# if ${vm_name} not defined use ${xmlfile}
+vm_name=${vm_name:-${xmlfile%.xml}}
+
+# define vm_shortname since vm_name can be very long
+vm_shortname=$(basename ${xmlfile%.xml} | sed -e "s, ,-,g")
+
+# vm_name = displayname, define for old scripts
+displayname=${vm_name}
+
+# image is for the following virtual machine
+xmlvirt=$(grep -o 'virtualmachine param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+
+# make a guess from the filename extension if ${xmlvirt} is empty
+# (not set within the XML file)
+# TODO: implement possibility to submit own configuration files
+if [ -z "${xmlvirt}" ] && [ -n "${additional_config}" ]; then
+ writelog "No virtual machine parameter defined in ${xmlfile}"
+ writelog "Trying to guess VM...\c"
+ case "$(cat ${additional_config} | tr [A-Z] [a-z])" in
+ *config.version*|*virtualhw.version*|*independent-nonpersistent*|*vmdk*)
+ xmlvirt="vmware"
+ ;;
+ *innotek*|*virtualbox*)
+ xmlvirt="virtualbox"
+ ;;
+ *qemu*|*kvm*)
+ xmlvirt="qemukvm"
+ ;;
+ *)
+ xmlvirt="none"
+ ;;
+ esac
+elif [ -z "${xmlvirt}" ]; then
+ case "$(echo ${imgname##*.} | tr [A-Z] [a-z])" in
+ vmdk)
+ xmlvirt="vmware"
+ ;;
+ vbox)
+ xmlvirt="virtualbox"
+ ;;
+ img|qcow*)
+ xmlvirt="qemukvm"
+ ;;
+ *)
+ xmlvirt="none"
+ ;;
+ esac
+ writelog "result:\t${xmlvirt}"
+fi
+
+# definition of the client system
+vmostype=$(grep -io '<os param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }' \
+ | tr [A-Z] [a-z])
+
+# definition of the networking the client system is connected to
+network_kind=$(grep -io '<network param=.*"' ${xmlfile} \
+ | awk -F '"' '{ print $2 }' | tr [A-Z] [a-z])
+network_card=$(grep -io '<netcard param=.*"' ${xmlfile} \
+ | awk -F '"' '{ print $2 }'| tr [A-Z] [a-z])
+
+# set redirects to 0, see vmgrid if you want to define some
+redirects=0
+
+# Serial/parallel ports defined (e.g. "ttyS0" or "autodetect")
+serial=$(grep -io '<serialport param=.*"' ${xmlfile} \
+ | awk -F '"' '{ print $2 }')
+parallel=$(grep -io '<parport param=.*"' ${xmlfile} \
+ | awk -F '"' '{ print $2 }')
+
+writelog "\tVirtualization:\t\t$xmlvirt"
+writelog "\tVM name:\t\t$vm_name"
+writelog "\tVM short name:\t\t$vm_shortname"
+
+###############################################################################
+### Declaration of default variables
+###############################################################################
+
+# VM-ID static (00)
+VM_ID="00"
+
+# make sure cpu_cores is not empty
+cpu_cores=${cpu_cores:-"1"}
+
+# total amount of memory defined in stage 3
+permem=50
+# get a result which can be divided through 4
+mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
+if [ -n "${mainvirtmem}" ]; then
+ forcemem=$(expr ${mainvirtmem} / 4 \* 4)
+ mem=${forcemem}
+fi
+hostmem=$(expr ${totalmem} - ${mem})
+
+# configuring ethernet mac address: first 3 bytes are fixed (00:50:56)
+# 4th byte is the VM-ID (0D)
+# last two bytes are taken from the bridge of the host
+# define one MAC per guest
+macguestpart="00:50:56:${VM_ID}"
+machostpart=$(echo ${hostmacaddr} | awk -F ":" '{print $(NF-1)":"$NF}')
+macaddr=$(echo "${macguestpart}:${machostpart}" | tr [a-z] [A-Z])
+
+# virtual fd/cd/dvd and drive devices, floppy b: for configuration
+# if $floppy_0 from run-virt.include set then fdtest="TRUE"
+fdtest=
+fdtest=${floppy_0:+"TRUE"}
+# if $fdtest not set floppy0="FALSE", else "TRUE"
+floppy0=${fdtest:-"FALSE"}
+floppy1="TRUE"
+floppy1name="${PLUGINCONFDIR}/loopimg/fd.img"
+# if $cdrom_0 from run-virt.include set then cdtest="TRUE"
+cdtest=
+cdtest=${cdrom_0:+"TRUE"}
+# if $cdtest not set cdrom0="FALSE", else "TRUE"
+cdrom0=${cdtest:-"FALSE"}
+# if $cdrom_1 from run-virt.include set then cdtest="TRUE"
+cdtest=
+cdtest=${cdrom_1:+"TRUE"}
+# if $cdtest not set cdrom1="FALSE", else "TRUE"
+cdrom1=${cdtest:-"FALSE"}
+# ide is expected default, test for the virtual disk image type should
+# be done while creating the runscripts ...
+ide="TRUE"
+scsi="FALSE"
+hddrv="ide"
+audio="true"
+remotedesktopport="590${VM_ID}"
+
+# Display resolution within the host system
+hostres=$(xvidtune -show 2>/dev/null| grep -ve "^$")
+xres=$(echo "${hostres}" | awk '{print $3}')
+yres=$(echo "${hostres}" | awk '{print $7}')
+
+# enable 3D
+enable3d=$(grep -i "<enable3d param=.*" ${xmlfile} 2>/dev/null | \
+ awk -F '=' {'print $2'})
+
+# add rw share
+sharepath="${HOME}"
+sharename="home"
+
+# set hostname: using original hostname and adding string
+hostname="virt-$(hostname)"
+
+writelog "\tVM Hostname:\t\t$hostname"
+
+################################################################################
+### Setup the rest of the environment and run the configured vm
+################################################################################
+
+# Adjust sound volume
+writelog "Unmuting sound...\c "
+amixer -q sset Master 80% unmute 2>/dev/null
+amixer -q sset PCM 80% unmute 2>/dev/null
+amixer -q sset CD 80% unmute 2>/dev/null
+amixer -q sset Headphone 80% unmute 2>/dev/null
+amixer -q sset Front 80% umute 2>/dev/null # in SUSE 11.0 it's headphone
+amixer -q sset Speaker 0 mute 2>/dev/null # annoying built-in speaker
+writelog "finished\n"
+
+# Copy guest configuration (with added information) config.xml to be accessed
+# via virtual floppy
+# fixme -> to be changed (vmchooser adapts the file content!?)
+#TODO: wozu echo?
+#echo "Please fix the config.xml generation"
+cp ${xmlfile} ${PLUGINCONFDIR}/fd-loop/config.xml
+
+# Check if virtual machine container file exists
+#filecheck
+
+# Get all virtual machine specific stuff from the respective include file
+if [ -e ${PLUGINCONFROOT}/${xmlvirt}/run-virt.include ] ; then
+ self=${xmlvirt}
+ . ${PLUGINCONFROOT}/${xmlvirt}/run-virt.include
+ # start a windowmanager for easier handling
+ # (expect problems /w windows opening in background /w vmware without wm)
+ for dm in xfwm4 metacity openbox blackbox kwin fvwm2 ; do
+ if which $dm >/dev/null 2>&1 ; then
+ if [ "$dm" = "fvwm2" ] ; then
+ echo "EdgeScroll 0 0" > ${redodir}/fvwm
+ fvwm2 -f ${redodir}/fvwm >/dev/null 2>&1 &
+ else
+ $dm >/dev/null 2>&1 &
+ fi
+ break
+ fi
+ done
+ ${VIRTCMD} ${VIRTCMDOPTS}
+ writelog "Bye."
+ cleanexit 0
+else
+ writelog "Failed because of missing ${xmlvirt} plugin."
+ cleanexit 1
+fi
+
+# postrun for scripts after virtualization finishes
+if [ -n "${POSTRUN}" ]; then
+ eval ${POSTRUN} >/dev/null 2>&1
+fi
+
+cleanexit 0
+exit 0
diff --git a/src/os-plugins/plugins/vmchooser/files/scanner.sh b/src/os-plugins/plugins/vmchooser/files/scanner.sh
new file mode 100755
index 00000000..dcb94c68
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/files/scanner.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+
+echo -e "scanserver\tscanner1hp\tThis is a test Scanner"
diff --git a/src/os-plugins/plugins/vmchooser/files/vm-template.xml b/src/os-plugins/plugins/vmchooser/files/vm-template.xml
new file mode 100755
index 00000000..f6b59fea
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/files/vm-template.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<settings>
+ <entry>
+ <!-- "vmware", "virtualbox", "qemu" -->
+ <virtualmachine param="vmware"/>
+ <!-- VM-name with ending .vmdk, .img, .vdi, .qcow2 -->
+ <image_name param="vm-image.vmdk"/>
+ <!-- sort after parameters then alphabet, values 0(top) - 9(bottom) -->
+ <priority param="5"/>
+ <!-- title shown in the menu -->
+ <title param="My VM Image"/>
+ <!-- description shown when image is chosen -->
+ <description>Image for lectures with a lot of software: office, ...
+ </description>
+ <!-- if active="true" the image is selectable via vmchooser -->
+ <active param="true"/>
+ <!-- in which environment this image will be selectable via vmchooser -->
+ <environment param="default"/>
+ <!-- image locked with a password? -->
+ <locked param="false"/>
+ <creator param="Your Name"/>
+ <email param="your@e-mail.add"/>
+ <phone param="0123-12345678"/>
+ <!-- when should this image be deactivated automatically -->
+ <valid_until param="DD-MM-YY"/>
+ <!-- type of the OS: if you do not know use "other" -->
+ <!-- vmware refer to: http://sanbarrow.com/vmx/vmx-guestos.html -->
+ <os param="winxppro"/>
+ <!-- "nat", "bridge", "hostonly" -->
+ <network param="nat"/>
+ <!-- use a different virtual network card than default -->
+ <netcard param="e1000"/>
+ <!-- activate serial port: "ttyS0", "auto" (recommended) -->
+ <serialport param="false"/>
+ <!-- activate parallel port: "parport0" (recommended) -->
+ <parport param="false"/>
+ <!-- enable 3D support -->
+ <enable3d param="true"/>
+ <!-- which shared folders should be connected -->
+ <shared_folders param="true">
+ <!-- name="Home" path="/home/$USER" for internal VMware sf -->
+ <shared_folder name="" path="" pass=""></shared_folder>
+ </shared_folders>
+ <!-- which printers should be connected -->
+ <printers>
+ <printer name="" path="">Human readable description</printer>
+ </printers>
+ <!-- which scanners should be connected -->
+ <scanners>
+ <scanner name="" path="">Description</scanner>
+ </scanners>
+ <!-- added automatically through vmchooser when started
+ <username param="user-id"/>
+ -->
+ <!-- obsolete, maybe for future implementations
+ <xdm param="false">
+ </xdm>
+ -->
+ </entry>
+</settings>
diff --git a/src/os-plugins/plugins/vmchooser/files/vmchooser b/src/os-plugins/plugins/vmchooser/files/vmchooser
new file mode 100644
index 00000000..fc12e0fe
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/files/vmchooser
Binary files differ
diff --git a/src/os-plugins/plugins/vmchooser/files/xmlfilter.sh b/src/os-plugins/plugins/vmchooser/files/xmlfilter.sh
new file mode 100755
index 00000000..5196992c
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/files/xmlfilter.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Copyright (c) 2007..2009 - RZ Uni FR
+# Copyright (c) 2007..2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xmlfilter.sh
+# - This script is invoked by the vmchooser tool. It simply filters xml-
+# files (taking the path to these files in $1). You might modify it in any
+# way to match your needs, e.g. ask some database instead. You can re-
+# implement it in any other programming language too. You simply have to
+# return a list of proper xml files to be interpreted by the vmchooser
+# binary). Please check for vmchooser.sh too ...
+# -----------------------------------------------------------------------------
+
+# This script .
+#
+# currently:
+# - filter for slxgrp (which comes from /etc/machine-setup)
+#
+
+# include default directories
+. /etc/opt/openslx/openslx.conf
+
+if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf ]; then
+ . ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf
+fi
+
+for FILE in $1/*.xml; do
+ # filter all xmls which aren't set active
+ if [ $(grep "<active param=.*true.*" ${FILE} | wc -l) -eq 1 ]; then
+ if [ -n ${vmchooser_env} ]; then
+ # filter all xmls with pool-param not equal to vmchooser::env
+ if [ $(grep "<pools param=\"${vmchooser_env}\"" ${FILE} | wc -l) -eq 1 ];\
+ then
+ echo ${FILE};
+ fi
+ else
+ # if there is no pool set, just take all available xmls
+ echo -e ${active}
+ fi
+ fi
+done
diff --git a/src/os-plugins/plugins/vmchooser/init-hooks/40-started-hw-config/run-virt.sh b/src/os-plugins/plugins/vmchooser/init-hooks/40-started-hw-config/run-virt.sh
new file mode 100644
index 00000000..7f1ae20d
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/init-hooks/40-started-hw-config/run-virt.sh
@@ -0,0 +1,21 @@
+# Copyright (c) 2009 - RZ Uni Freiburg
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Stage3 part of 'vmchooser' plugin - this script detects additionally to the
+# the standard hardware configuration the availability of optical and floppy
+# drives for virtual machines.
+#
+# The script is included from init via the "." load function - thus it has all
+# variables and functions available.
+
+waitfor /tmp/hwcfg
+( hwinfo --cdrom | grep -i "Device File:" | awk {'print $3'} >/etc/hwinfo.cdrom ) &
+( hwinfo --floppy | grep -i "Device File:" | awk {'print $3'} >/etc/hwinfo.floppy ) &
diff --git a/src/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh b/src/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh
new file mode 100644
index 00000000..73a65ac5
--- /dev/null
+++ b/src/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh
@@ -0,0 +1,144 @@
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# virtual virtualization plugin
+# make sure that this file is the same in vmgrid and vmchooser plugin!
+
+# include default directories
+. /etc/openslx.conf
+
+CONFFILEVMCHOOSER="/initramfs/plugin-conf/vmchooser.conf"
+CONFFILEVMGRID="/initramfs/plugin-conf/vmgrid.conf"
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization
+
+# check if plugins available
+active=0
+[ -f ${CONFFILEVMCHOOSER} ] && . ${CONFFILEVMCHOOSER}
+[ "x${vmchooser_active}" = "x1" ] && active=1
+[ -f ${CONFFILEVMGRID} ] && . ${CONFFILEVMGRID}
+[ "x${vmgrid_active}" = "x1" ] && active=1
+
+[ $DEBUGLEVEL -gt 0 ] \
+ && echo -e "Executing the 'virtualization' plugin ... \c"
+
+if [ ${active} -ne 0 ] ; then
+
+ # load general configuration
+ . /etc/initramfs-setup
+ # include functions
+ . /etc/functions
+
+ testmkd ${PLUGINCONFDIR}
+
+ # check if vmgrid active and change free mem
+ totalmem=$(expr $(grep -i "memtotal" /proc/meminfo \
+ | awk '{print $2}') / 1024)
+ echo "totalmem=${totalmem}" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ if [ "x${vmgrid_active}" = "x1" ]; then
+
+ totalmemtest=$(expr $(echo ${vmgrid_memratio} \
+ | awk -F ',' '{print $1" + "$2" + "$3" + "$4" + "$5" + "$6}'))
+
+ # not more than 100% memory assigned
+ if [ ${totalmemtest} -le 100 2>/dev/null ]; then
+
+ # host mem
+ hostratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $6}')
+ hostmem=$(expr ${totalmem} \* ${hostratio} / 100 2>/dev/null)
+ if [ ${hostmem} -lt 256 2>/dev/null ]; then
+ # min. 256 MB for host
+ hostmem=256
+ fi
+
+ # main vm mem (vmchooser)
+ if [ "x${vmchooser_active}" = "x1" ]; then
+ mainvirtratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $5}')
+ mainvirtmem=$(expr ${totalmem} \* ${mainvirtratio} / 100 2>/dev/null)
+ if [ ${mainvirtmem} -lt 512 2>/dev/null ]; then
+ # min. 512 for vmchooser
+ mainvirtmem=512
+ fi
+ else
+ mainvirtratio=0
+ mainvirtmem=0
+ fi
+
+ cat << EOF >> ${PLUGINCONFDIR}/virtualization.conf
+hostratio=${hostratio}
+hostmem=${hostmem}
+mainvirtratio=${mainvirtratio}
+mainvirtmem=${mainvirtmem}
+EOF
+
+ fi
+ fi
+
+ # cpu cores
+ CPU_CORES=$(grep 'processor.*:' /proc/cpuinfo | wc -l)
+ if [ "${CPU_CORES}" -gt "1" 2>/dev/null ]; then
+ echo "cpu_cores=${CPU_CORES}" \
+ >> ${PLUGINCONFDIR}/virtualization.conf
+ else
+ echo 'cpu_cores=1' >> ${PLUGINCONFDIR}/virtualization.conf
+ fi
+
+ # arch
+ echo "host_arch=$(uname -m)" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ # VT enabled cpu?
+ if grep -q ^flags.*\\\<vmx\\\> /proc/cpuinfo; then
+ echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf
+ echo 'kvm_module="kvm_intel"' >> ${PLUGINCONFDIR}/virtualization.conf
+ elif grep -q ^flags.*\\\<svm\\\> /proc/cpuinfo; then
+ echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf
+ echo 'kvm_module="kvm_amd"' >> ${PLUGINCONFDIR}/virtualization.conf
+ else
+ echo "vtflag=0" >> ${PLUGINCONFDIR}/virtualization.conf
+ fi
+
+ # write mac
+ echo "hostmacaddr=${macaddr}" >> ${PLUGINCONFDIR}/virtualization.conf
+ # ip addr
+ echo "hostip=${clientip}" >> ${PLUGINCONFDIR}/virtualization.conf
+ # hostname
+ echo "hostname=${host_name}" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ # get further hw information
+ waitfor /etc/hwinfo.cdrom
+ j=0
+ for i in $(cat /etc/hwinfo.cdrom); do
+ echo "cdrom_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf
+ j=$(expr $j + 1)
+ done
+
+ waitfor /etc/hwinfo.floppy
+ j=0
+ for i in $(cat /etc/hwinfo.floppy); do
+ echo "floppy_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf
+ j=$(expr $j + 1)
+ done
+
+ # copy host information to rwshare of vmgrid plugin
+ if [ "x${vmgrid_active}" = "x1" ]; then
+ cp ${PLUGINCONFDIR}/virtualization.conf ${vmgrid_rwmnt}/host.conf
+ fi
+
+ # finished ...
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo "ok"
+else
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo "failed"
+fi
diff --git a/src/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm b/src/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm
new file mode 100644
index 00000000..0965b482
--- /dev/null
+++ b/src/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm
@@ -0,0 +1,319 @@
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+# -----------------------------------------------------------------------------
+# vmgrid.pm
+# - ...
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::vmgrid;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'vmgrid',
+ };
+
+ return bless $self, $class;
+}
+
+# TODO: desc
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ ...
+ End-of-Here
+ precedence => 80,
+ #required => [ qr{^(vmware|virtualbox|qemukvm|xen)$} ],
+ #openvz|vserver
+ # TODO: virtaul plugin (requires, provides?)
+ #required => [ qw( virtualization ) ],
+ #provided => [ qw( virtualization ) ],
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'vmgrid::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'vmgrid'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'vmgrid::virt' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ which virtualization technique schould be used?
+ End-of-Here
+ content_regex => qr{^(virtualbox|qemukvm|xen)$},
+ #openvz|vserver
+ content_descr => 'virtualbox, qemukvm, xen',
+ #openvz, vserver
+ default => undef,
+ },
+ 'vmgrid::roshare' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ do you want to mount external resources?
+ e.g. NFS share /w virt images ...
+ will be mounted to /var/lib/virt/vmgrid
+ End-of-Here
+ content_regex => qr{^nfs://},
+ content_descr => 'NFS share as URI (nfs://...)',
+ default => undef,
+ },
+ 'vmgrid::rwshare' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ do you want a persistent storage device?
+ use local hard drive (ID45) or NFS share.
+ will be mounted to /var/opt/openslx/plugins/vmgrid/share
+ End-of-Here
+ content_regex => qr{^(id45|nfs://)},
+ content_descr => 'NFS share as URI (nfs://...) or "id45"',
+ default => undef,
+ },
+ 'vmgrid::imgpath' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ location of virtual images
+ for starts /w relative path
+ End-of-Here
+ content_descr => 'absolute path to vm image files',
+ default => '/var/lib/virt/vmgrid/images',
+ },
+ 'vmgrid::xmlpath' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ location of XML configuration for virtual images
+ for starts /w relative path
+ End-of-Here
+ content_descr => 'absolute path to vm xml files',
+ default => '/var/lib/virt/vmgrid/xml',
+ },
+ 'vmgrid::startvms' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ which virtaul machines should be started per default
+ comma separated list. first will be started first,
+ second second, and so on, max. 4 VMs
+ End-of-Here
+ content_descr => 'name of xml file e.g. scilin-5.4-wn(.xml)',
+ default => undef,
+ },
+ 'vmgrid::vt' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ use hardware virtualization, if applicable
+ override the settings of the corresponding virt plugin
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '"0", "1" or "-" (for unset)',
+ default => undef,
+ },
+ 'vmgrid::maxvcpus' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ use this number of vcpus as maximum for one vm
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(1|2|4|8|16)$},
+ content_descr => '1, 2, 4, 8, 16',
+ default => undef,
+ },
+ 'vmgrid::minvcpus' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ use this number of vcpus as minimum for one vm
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(1|2|4|8|16)$},
+ content_descr => '1, 2, 4, 8, 16',
+ default => undef,
+ },
+ 'vmgrid::memratio' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ define memory ratio in nn%
+ order: grid client 1, 2, 3, 4, other VMs, host
+ if desktop virtualization defined the free memory will be
+ distributed between the remaining grid clients,
+ according to their ratio
+ if less than 4 VMs defined in startvms the memory is being
+ reserved for a later manual start
+ set to 0 if you do not intend to start them manually
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(\d\d??,\d\d??,\d\d??,\d\d??,\d\d??,\d\d??)$},
+ content_descr => '\d\d??,\d\d??,\d\d??,\d\d??,\d\d??,\d\d??',
+ default => '40,0,0,0,40,20',
+ },
+ 'vmgrid::maxmem' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ maximum RAM used by one vm
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(\d\d\d\d??\d??)$},
+ content_descr => 'absolute amount: \d\d\d\d??\d??',
+ default => undef,
+ },
+ 'vmgrid::minmem' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ minimum RAM used by one vm
+ (only if supported by plugin)
+ End-of-Here
+ content_regex => qr{^(\d\d\d\d??\d??)$},
+ content_descr => 'absolute amount: \d\d\d\d??\d??',
+ default => undef,
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+
+ $self->_writeRunlevelScript();
+
+ # copy all needed files now:
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath = "$openslxBasePath/lib/plugins/$pluginName/files";
+ foreach my $file ( qw( vmgrid run-vmgrid.sh ) ) {
+ copyFile("$pluginBasePath/$file", "$pluginRepoPath/");
+ chmod 0755, "$pluginRepoPath/$file";
+ }
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+# Write the runlevelscript
+sub _writeRunlevelScript
+{
+ my $self = shift;
+ my $initfile = newInitFile();
+
+ $initfile->setName("vmgrid");
+ $initfile->setDesc("Setup environment for vmgrid. Part of OpenSLX vmgrid plugin.");
+
+ # todo: Function need to be formated proper... not important right now
+ #$initfile->addFunction(
+ # 'running',
+ # 'lsmod | grep -q "$1[^_-]"'
+ #);
+
+# # Is a VM running?
+# my $runningvms = unshiftHereDoc(<<' End-of-Here');
+# if [ -e /tmp/vmgrid/vmgrid.pids ]; then
+# for pid in $(cat /tmp/vmgrid/vmgrid.pids); do
+# if ps aux | grep " ${pid} " | grep vmgrid; then
+# echo "Running: ${pid}"
+# fi
+# done
+# fi
+# End-of-Here
+
+ # Kill all VMS!
+ my $killvms = unshiftHereDoc(<<' End-of-Here');
+ if [ -e /tmp/vmgrid/vmgrid.pids ]; then
+ for pid in $(cat /tmp/vmgrid/vmgrid.pids); do
+ if ps aux | grep " ${pid} " | grep vmgrid; then
+ kill ${pid}
+ fi
+ done
+ fi
+ End-of-Here
+
+ # FORCE: Kill all VMS!
+ my $fkillvms = unshiftHereDoc(<<' End-of-Here');
+ if [ -e /tmp/vmgrid/vmgrid.pids ]; then
+ for pid in $(cat /tmp/vmgrid/vmgrid.pids); do
+ if ps aux | grep " ${pid} " | grep vmgrid; then
+ kill -9 ${pid}
+ fi
+ done
+ fi
+ End-of-Here
+
+ $initfile->addFunction(
+ 'start',
+ ' vmgrid',
+ );
+ $initfile->addToCase(
+ 'kill',
+ 'killvms'
+ );
+ $initfile->addToCase(
+ 'force-kill',
+ 'fkillvms'
+ );
+ $initfile->addToCase(
+ 'status',
+ 'runningvms'
+ );
+ $initfile->addToCase(
+ 'restart',
+ 'stop && start'
+ );
+
+# # get distro version
+# my $distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0];
+# my $runlevelscript = getInitFileForDistro($initfile, $distro);
+#
+# spitFile("$self->{'pluginRepositoryPath'}/vmgrid-slx", $runlevelscript);
+}
+
+1;
diff --git a/src/os-plugins/plugins/vmgrid/XX_vmgrid.sh b/src/os-plugins/plugins/vmgrid/XX_vmgrid.sh
new file mode 100644
index 00000000..16f5fbd1
--- /dev/null
+++ b/src/os-plugins/plugins/vmgrid/XX_vmgrid.sh
@@ -0,0 +1,104 @@
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# 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/vmgrid.conf"
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/vmgrid
+VIRTUALIZATIONPLUGIN=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization
+#RWSHARE=/mnt/${OPENSLX_DEFAULT_VARDIR}/plugins/vmgrid/share
+RWSHARE=/mnt/var/opt/openslx/plugins/vmgrid/share
+RWSHAREMNT=/mnt/var/opt/openslx/mnt/vmgrid
+BINDIR=/mnt/${OPENSLX_DEFAULT_BINDIR}
+PLUGINDIR=${OPENSLX_DEFAULT_DIR}/plugin-repo/vmgrid
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/vmgrid
+
+if [ -f $CONFFILE ]; then
+
+ # load needed variables
+ . $CONFFILE
+
+ if [ ${vmgrid_active} -ne 0 ] ; then
+ [ ${DEBUGLEVEL} -gt 0 ] && echo "executing the 'vmgrid' os-plugin ..."
+
+ # load general configuration
+ . /etc/initramfs-setup
+ # include functions
+ . /etc/functions
+
+ testmkd ${PLUGINCONFDIR}
+ testmkd ${VIRTDIR}
+ cp $CONFFILE ${PLUGINCONFDIR}/vmgrid.conf
+ # create link to binpath
+ ln -fs ${PLUGINDIR}/vmgrid ${BINDIR}/vmgrid
+ ln -fs ${PLUGINDIR}/run-vmgrid.sh ${BINDIR}/run-vmgrid.sh
+
+ # mount nfs virt ro share
+ if strinstr "nfs://" "${vmgrid_roshare}"; then
+ virtsrcprot=$(uri_token ${vmgrid_roshare} prot)
+ virtsrcserv=$(uri_token ${vmgrid_roshare} server)
+ virtsrcpath="$(uri_token ${vmgrid_roshare} path)"
+ if [ -n "${virtsrcprot}" -a -n "${virtsrcserv}" -a -n "${virtsrcpath}" ];
+ then
+ virtsrctarget=${VIRTDIR}
+ # mount the vmgrid source ro
+ fsmount ${virtsrcprot} ${virtsrcserv} ${virtsrcpath} ${virtsrctarget} \
+ ro
+ fi
+ fi
+
+ # create rw share
+ testmkd ${RWSHARE}
+ # bind mount id 45 to ${RWSHARE}
+ if strinstr "id45" "${vmgrid_rwshare}" ; then
+ id45part=$(grep " 45 " /etc/disk.partition | awk '{print $1}' | \
+ cut -f 3,3 -d /)
+ if [ -n "${id45part}" ]; then
+ testmkd /mnt/media/${id45part}/vmgrid
+ mount --bind -n /mnt/media/${id45part}/vmgrid ${RWSHARE} \
+ >>/tmp/vmgrid.log 2>&1
+ fi
+ # mount nfs rw share
+ elif strinstr "nfs://" "${vmgrid_rwshare}" ; then
+ rwshareprot=$(uri_token ${vmgrid_rwshare} prot)
+ rwshareserv=$(uri_token ${vmgrid_rwshare} server)
+ rwsharepath="$(uri_token ${vmgrid_rwshare} path)"
+ if [ -n "${rwshareprot}" -a -n "${rwshareserv}" -a -n "${rwsharepath}" ];
+ then
+ # mount to a dir fist to create spec host dir, then bind mount
+ testmkd ${RWSHAREMNT}
+ rwtarget=${RWSHAREMNT}
+ # mount the vmgrid source rw
+ fsmount ${rwshareprot} ${rwshareserv} ${rwsharepath} ${rwtarget} rw
+ # hostname?
+ host_name=${host_name:=$clientip}
+ testmkd ${RWSHAREMNT}/${host_name}
+ mount --bind ${RWSHAREMNT}/${host_name} ${RWSHARE} \
+ >>/tmp/vmgrid.log 2>&1
+ fi
+ else
+ testmkd /mnt/tmp/vmgrid
+ mount --bind -n /mnt/tmp/vmgrid ${RWSHARE} >>/tmp/vmgrid.log 2>&1
+ fi
+ # chmod so that everybody can write
+ chmod 1777 ${RWSHARE}
+ echo "vmgrid_rwmnt=${RWSHARE#/mnt}" >> ${PLUGINCONFDIR}/vmgrid.conf
+
+ # finished ...
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'vmgrid' os-plugin ..."
+ fi
+else
+ [ $DEBUGLEVEL -gt 0 ] && echo " * configuration of 'vmgrid' os-plugin failed"
+fi
diff --git a/src/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/src/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
new file mode 100644
index 00000000..51cb5dbc
--- /dev/null
+++ b/src/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
@@ -0,0 +1,430 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Copyright (c) 2010 - RZ Uni FR
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmgrid
+# - This is the generic wrapper for the several virtualization solutions...
+################################################################################
+
+. /etc/opt/openslx/openslx.conf
+
+################################################################################
+### Define default dirs / get configs
+################################################################################
+
+PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins
+PLUGINCONFVMGRID=${PLUGINCONFROOT}/vmgrid
+RWSHARE=/var/opt/openslx/plugins/vmgrid/share
+# include general configuration from vmgrid
+[ -f ${PLUGINCONFVMGRID}/vmgrid.conf ] && \
+ . ${PLUGINCONFVMGRID}/vmgrid.conf
+# load general virtualization information
+[ -f ${PLUGINCONFROOT}/virtualization/virtualization.conf ] && \
+ . ${PLUGINCONFROOT}/virtualization/virtualization.conf
+# get the vmchooser_active var
+[ -f ${PLUGINCONFROOT}/vmchooser/vmchooser.conf ] && \
+ . ${PLUGINCONFROOT}/vmchooser/vmchooser.conf
+
+################################################################################
+### Functions used throughout the script
+################################################################################
+
+# function to write to stdout and logfile
+LOGFILE=${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log
+writelog () {
+ # write to stdout
+ echo -e "$1"
+ # log into file
+ echo -e "$1" >> ${LOGFILE}
+ # log into share dir, so that log is available in vm as well
+ echo -e "$1" >> ${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log
+}
+
+# remove config dirs when exit
+cleanexit () {
+ if echo "${RMDIRS}" 2>/dev/null | grep -q ${vmgrid_virt}; then
+ writelog "${vmgrid_virt} exited. Cleanning up... \c"
+ rm -rf ${RMDIRS} >/dev/null 2>&1
+ writelog "done"
+ fi
+
+ exit "$1"
+}
+
+################################################################################
+### Get XML file and dir
+################################################################################
+
+# check if mem, nice or graphical mode set
+headless=1
+unice=19
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h|--help)
+ echo -e "Usage: run-vmgrid.sh [-g] [--mem <memory size in MB>] \c"
+ echo -e "[--nice <nice level>] [/path/]filename[.xml]"
+ exit
+ ;;
+ -g)
+ headless=0
+ ;;
+ --mem)
+ # get a result which can be divided through 4
+ if echo $2 | grep -qE \
+ '^[2-9][0-9][0-9]$|^[1-9][0-9][0-9][0-9]$|^1[0-9][0-9][0-9][0-9]$';
+ then
+ forcemem=$(expr $2 / 4 \* 4)
+ else
+ echo "memory $2 not supported (200-19999)!"
+ exit 1
+ fi
+ shift
+ ;;
+ --nice)
+ # set nice level
+ if echo $2 | grep -qE '^-[1-9]$|-1[0-9]$|^-20$|^[0-9]$|^1[0-9]$'; then
+ unice=$2
+ else
+ echo "nice level $2 does not exist!"
+ exit 1
+ fi
+ shift
+ ;;
+ *)
+ xmlfile=$@
+ break
+ ;;
+ esac
+ shift
+done
+
+# absolute or relative path?
+if ls ${xmlfile} 2>/dev/null | grep '/' >/dev/null 2>&1; then
+ xmlpath=$(dirname ${xmlfile})
+ xmlfile=$(basename ${xmlfile})
+else
+ xmlpath=${vmgrid_xmlpath}
+fi
+# full path
+xmlfile="${xmlpath}/${xmlfile%.xml}.xml"
+
+################################################################################
+### Sanity checks
+################################################################################
+
+# test if the xml file is valid
+if ! [ -r "${xmlfile}" ]; then
+ writelog "${xmlfile} not a readable XML file!"
+ run-vmgrid.sh -h &
+ exit 1
+fi
+
+# start to log, create shrare log dir
+mkdir -m 1777 -p ${vmgrid_rwmnt}/logs
+echo "Starting to log at $(date)" \
+ >${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log
+
+# test how many instances running
+runningvms=$(ps aux | grep "run-vmgrid.sh " | grep -v grep | wc -l)
+# 2 steps, /w only one is seems not to work
+runningvms=$(expr ${runningvms} - 1)
+# if Xen use different method
+if [ "${vmgrid_virt}" = "xen" ]; then
+ runningvms=$(xm list 2>/dev/null | grep -vE "Domain-0|Name.*ID" | wc -l)
+ runningvms=$(expr ${runningvms} + 1)
+fi
+# check value
+if [ ${runningvms} -le 0 ]; then
+ writelog "Error in value: Running VMs: ${runningvms}. Exit!"
+ exit 1
+fi
+# check if vmchooser plugin installed
+if [ -n "${vmchooser_active}" ] && [ ${runningvms} -gt 1 ]; then
+ # only allow one instance of vmgrid
+ writelog "Already 1 VMs running and vmchooser plugin is active."
+ writelog "Can't start ${xmlfile}, exiting!"
+ exit 1
+# else allow max. 4 instances
+elif [ ${runningvms} -gt 4 ]; then
+ writelog "Already 4 VMs running, exiting!"
+ exit 1
+fi
+VM_ID="0${runningvms}"
+
+# test if XML file
+if ! grep '<?xml' "${xmlfile}" >/dev/null 2>&1; then
+ writelog \
+ "Submitted configuration file ${xmlfile} seems to have wrong XML format"
+ exit 1
+fi
+
+################################################################################
+### Logo for console
+################################################################################
+
+cat <<EOL
+ __ __
+ .----.--.--.-----.___.--.--.--------.-----.----.|__|.--| |
+ | _| | | |___| | | | _ | _|| || _ |
+ |__| |_____|__|__| \___/|__|__|__|___ |__| |__||_____|
+ |_____|
+ OpenSLX virtual machine environment preparation script ...
+
+EOL
+
+################################################################################
+### Read needed variables from XML file
+################################################################################
+
+writelog "Starting configuration..."
+writelog "\tVM-ID:\t\t\t${VM_ID}"
+writelog "\tLogfile:\t\t${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log"
+writelog "\t/tmp info:\t\t$(df -h | grep " /tmp$" | awk '{print $2}') \c"
+writelog "$(grep "/tmp " /proc/mounts | awk '{print $1" "$2" "$3" "$4}')"
+writelog "\tVM XML dir:\t\t$(dirname ${xmlfile})"
+writelog "\tXML file:\t\t${xmlfile}"
+writelog "VM config:"
+
+# name of the virt image or dir
+imgname=$(grep -io '<image_name param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+
+# image mode
+imgmode=$(grep -io '<image_mode param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+
+# get boot attr
+boot=$(grep -io 'boot param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }')
+diskless=0
+
+# special rw image
+if [ "${imgmode}" = "rwimg" ]; then
+ # maybe you want to use an empty rw imgae?
+ # define only for writelog, will be set in the plugin include again!
+ vmpath="{special rw image}"
+ # add new path for rwimg
+ imgpath=${vmgrid_rwmnt}/specialrwimages
+ unset $imgname
+ mkdir -m 1777 -p ${imgpath}
+# diskless boot
+elif [ "${boot}" = "n" ] && [ -z "${imgname}" ]; then
+ diskless=1
+ vmpath="{diskless boot}"
+# imagename /w full path
+elif echo ${imgname} 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then
+ imgpath=$(dirname ${imgname})
+ imgname=$(basename ${imgname})
+ vmpath=${imgpath}/${imgname}
+# get path from var
+else
+ imgpath=${vmgrid_imgpath}
+ vmpath=${imgpath}/${imgname}
+fi
+
+# check if virtual machine container file exists, only if not rwimg
+if ! [ -e "${vmpath}" ] && [ "${imgmode}" != "rwimg" ] && [ ${diskless} -eq 0 ];
+then
+ writelog "Virtual machine image or directory ${vmpath} not found!"
+ exit 1
+fi
+
+# name of the virt machine, sed because of Windows formatting
+vm_name=$(grep -o 'short_description param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+# if ${vm_name} not defined use ${xmlfile}
+vm_name=${vm_name:-${xmlfile%.xml}}
+
+# define vm_shortname since vm_name can be very long
+vm_shortname=$(basename ${xmlfile%.xml} | sed -e "s, ,-,g")
+
+# vm_name = displayname, define for old scripts
+displayname=${vm_name}
+
+[ "${imgmode}" != "rwimg" ] && [ ${diskless} -eq 0 ] \
+ && writelog "\tVM Image dir:\t\t${imgpath}"
+writelog "\tVM file/dir:\t\t$vmpath"
+
+# is there an additional configuration provided?
+additional_config=$(grep -o 'additional_config param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+
+# image is for the following virtual machine
+xmlvirt=$(grep -o 'virtualmachine param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+
+# make a guess from the filename extension if ${xmlvirt} is empty
+# (not set within the XML file)
+# TODO: implement possibility to submit own configuration files
+if [ -z "${xmlvirt}" ] && [ -n "${additional_config}" ]; then
+ writelog "No virtual machine parameter defined in ${xmlfile}"
+ writelog "Trying to guess VM...\c"
+ case "$(cat ${additional_config} | tr [A-Z] [a-z])" in
+ *config.version*|*virtualhw.version*|*independent-nonpersistent*|*vmdk*)
+ xmlvirt="vmware"
+ ;;
+ *innotek*|*virtualbox*)
+ xmlvirt="virtualbox"
+ ;;
+ *qemu*|*kvm*)
+ xmlvirt="qemukvm"
+ ;;
+ *)
+ xmlvirt="none"
+ ;;
+ esac
+elif [ -z "${xmlvirt}" ]; then
+ case "$(echo ${imgname##*.} | tr [A-Z] [a-z])" in
+ vmdk)
+ xmlvirt="vmware"
+ ;;
+ vbox)
+ xmlvirt="virtualbox"
+ ;;
+ img|qcow*)
+ xmlvirt="qemukvm"
+ ;;
+ *)
+ xmlvirt="none"
+ ;;
+ esac
+ writelog "result:\t${xmlvirt}"
+fi
+
+# check for virt
+if [ "${vmgrid_virt}" != "${xmlvirt}" ]; then
+ writelog "The virtual machine specified in ${xmlfile}"
+ writelog "does not match the virtualization used here (${vmgrid_virt})"
+ exit 1
+fi
+
+# definition of the client system
+vmostype=$(grep -io '<os param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }' \
+ | tr [A-Z] [a-z])
+
+# definition of the networking the client system is connected to
+network_kind=$(grep -io '<network param=.*"' ${xmlfile} \
+ | awk -F '"' '{ print $2 }' | tr [A-Z] [a-z])
+network_card=$(grep -io '<netcard param=.*"' ${xmlfile} \
+ | awk -F '"' '{ print $2 }'| tr [A-Z] [a-z])
+
+# define redirects
+redirects=$(grep -ic '<redirect name=.*"' ${xmlfile})
+[ -z "${redirects}" ] && redirects=0
+(( i=1 ))
+while [ ${i} -le ${redirects} ]; do
+ # get only the $i-th line
+ redirect_name[$i]=$(grep -m ${i} -io '<redirect.*' ${xmlfile} | tail -n 1 \
+ | grep -o "name=\".*" | awk -F '"' '{ print $2 }')
+ redirect_proto[$i]=$(grep -m ${i} -io '<redirect.*' ${xmlfile} | tail -n 1 \
+ | grep -o "proto=\".*" | awk -F '"' '{ print $2 }')
+ redirect_hport[$i]=$(grep -m ${i} -io '<redirect.*' ${xmlfile} | tail -n 1 \
+ | grep -o "hostport=\".*" | awk -F '"' '{ print $2 }')
+ redirect_gport[$i]=$(grep -m ${i} -io '<redirect.*' ${xmlfile} | tail -n 1 \
+ | grep -o "guestport=\".*" | awk -F '"' '{ print $2 }')
+ (( i=$i+1 ))
+done
+
+writelog "\tVirtualization:\t\t$xmlvirt"
+writelog "\tVM name:\t\t$vm_name"
+writelog "\tVM short name:\t\t$vm_shortname"
+
+###############################################################################
+### Declaration of default variables
+###############################################################################
+
+# make sure cpu_cores is not empty
+cpu_cores=${cpu_cores:-"1"}
+#vmgrid::maxvcpus
+#vmgrid::minvcpus
+# check for CPU virtualization flags
+#vmgrid::vt
+
+# total amount of memory defined in stage 3
+permem=60
+# get a result which can be divided through 4
+mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
+#vmgrid::maxmem
+#vmgrid::minmem
+
+# configuring ethernet mac address: first 3 bytes are fixed (00:50:56)
+# 4th byte is the VM-ID
+# last two bytes are taken from the bridge of the host
+# define one MAC per guest
+macguestpart="00:50:56:${VM_ID}"
+machostpart=$(echo ${hostmacaddr} | awk -F ":" '{print $(NF-1)":"$NF}')
+macaddr=$(echo "${macguestpart}:${machostpart}" | tr [a-z] [A-Z])
+
+# ide is expected default, test for the virtual disk image type should
+# be done while creating the runscripts ...
+# TODO: cdrom / floppy?
+ide="TRUE"
+scsi="FALSE"
+hddrv="ide"
+cdrom0="FALSE"
+audio="false"
+remotedesktopport="590${VM_ID}"
+
+# add rw share
+sharepath="${vmgrid_rwmnt}/folders/${vm_shortname}"
+mkdir -p ${sharepath}
+chmod -f 1777 "${vmgrid_rwmnt}/folders"
+sharename="share"
+
+# set hostname: using original hostname and adding string
+hostname="vmgrid${VM_ID}-$(hostname)"
+
+writelog "\tVM Hostname:\t\t$hostname"
+
+################################################################################
+### Setup the rest of the environment and run the configured vm
+################################################################################
+
+# Copy guest configuration (with added information) config.xml to be accessed
+# via virtual floppy
+# TODO: virt-floppy needed?
+
+# Get all virtual machine specific stuff from the respective include file
+if [ -e ${PLUGINCONFROOT}/${vmgrid_virt}/run-virt.include ] ; then
+ writelog "Starting ${vmgrid_virt} specific part ..."
+ self=${vmgrid_virt}
+ . ${PLUGINCONFROOT}/${vmgrid_virt}/run-virt.include
+else
+ writelog "Failed because of missing ${vmgrid_virt} plugin"
+ exit 1
+fi
+
+# start graphical mode
+if [ ${headless} -eq 0 ]; then
+ if [ -z "${VIRTCMD}" ]; then
+ writelog "Grapical mode not available, exiting!"
+ cleanexit 1
+ fi
+ writelog "Starting ${vmgrid_virt} in graphical mode /w nice level ${unice}..."
+ # start /w low nice level
+ nice -n ${unice} ${VIRTCMD} ${VIRTCMDOPTS} 2>/dev/null
+# start headless
+elif [ -n "${VIRTCMDHL}" ]; then
+ writelog "Starting ${vmgrid_virt} in headless mode /w nice level ${unice}..."
+ # start /w low nice level
+ nice -n ${unice} ${VIRTCMDHL} ${VIRTCMDOPTSHL} 2>/dev/null
+else
+ writelog "${vmgrid_virt}: No headless mode defined, exiting!"
+ cleanexit 1
+fi
+
+# postrun for scripts after virtualization finishes
+if [ -n "${POSTRUN}" ]; then
+ eval ${POSTRUN} >/dev/null 2>&1
+fi
+
+cleanexit 0
+exit 0
diff --git a/src/os-plugins/plugins/vmgrid/files/vmgrid b/src/os-plugins/plugins/vmgrid/files/vmgrid
new file mode 100644
index 00000000..2bb91481
--- /dev/null
+++ b/src/os-plugins/plugins/vmgrid/files/vmgrid
@@ -0,0 +1,154 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Copyright (c) 2010 - RZ Uni FR
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmgrid
+# - Script for autostarts defined in vmgrid::startvms
+################################################################################
+
+# include default directories
+. /etc/opt/openslx/openslx.conf
+
+################################################################################
+### Manual Start
+################################################################################
+
+if [ -n "$1" ]; then
+ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
+ echo -e "Usage: vmgrid [[-g] [--mem <memory size in MB>] \c"
+ echo -e "[--nice <nice level>] [/path/]filename[.xml]]"
+ exit 0
+ else
+ echo "Starting run-vmgrid.sh with options '$@'"
+ run-vmgrid.sh $@ 2>/dev/null
+ exit
+ fi
+fi
+
+################################################################################
+### Define default dirs / get configs
+################################################################################
+
+PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins
+PLUGINCONFDIR=${PLUGINCONFROOT}/vmgrid
+RWSHARE=/var/opt/openslx/plugins/vmgrid/share
+# include general configuration from vmgrid
+[ -f ${PLUGINCONFDIR}/vmgrid.conf ] && \
+ . ${PLUGINCONFDIR}/vmgrid.conf
+# load general virtualization information
+[ -f ${PLUGINCONFROOT}/virtualization/virtualization.conf ] && \
+ . ${PLUGINCONFROOT}/virtualization/virtualization.conf
+
+################################################################################
+### Functions used throughout the script
+################################################################################
+
+# function to write to stdout and logfile
+writelog () {
+ # write to stdout
+ echo -e "$1"
+ # log into file
+ echo -e "$1" >> ${OPENSLX_DEFAULT_LOGDIR}/vmgrid.${USER}.$$.log
+ # log into share dir, so that log is available in vm as well
+ echo -e "$1" >> ${vmgrid_rwmnt}/logs/vmgrid.${USER}.$$.log
+}
+
+################################################################################
+### Configure VMs for autostart and set RAM
+################################################################################
+
+# start to log, create share log dir
+mkdir -m 1777 -p ${vmgrid_rwmnt}/logs
+mkdir -m 1777 -p /tmp/vmgrid
+mkdir -p /tmp/vmgrid/${USER}
+echo "Starting to log at $(date)" \
+ >${vmgrid_rwmnt}/logs/vmgrid.${USER}.$$.log
+
+if [ -z "${hostratio}" ]; then
+ writelog "There has been an error in the memory configuration in stage 3"
+ writelog "Please check your memory ratio settings, exiting!"
+ exit 1
+fi
+
+if [ -z "${hostratio}" ]; then
+ writelog "There has been an error in the memory configuration in stage 3"
+ writelog "Please check your memory ratio settings, exiting!"
+ exit 1
+fi
+
+# remove blanks
+vmgrid_startvms=$(echo ${vmgrid_startvms} | sed -e "s, *,,g")
+vmgrid_memratio=$(echo ${vmgrid_memratio} | sed -e "s, *,,g")
+
+# hostmem, mainvirt from virtualization plugin
+# ratio minus other vms and host
+restratio=$(expr 100 - ${hostratio} - ${mainvirtratio})
+
+# hostmem, totalmem, mainvirtmem from virtualization plugin
+# calculate freemem
+freemem=$(expr ${totalmem} - ${hostmem} - ${mainvirtmem} 2>/dev/null)
+if [ ${freemem} -lt 512 2>/dev/null ]; then
+ writelog "Not enough free RAM for this plugin, free: ${freemem} MB"
+ exit 1
+fi
+
+# get clients mem ratio
+vmsumratios=0
+for i in {1..4}; do
+ vm[$i]=$(echo ${vmgrid_startvms} | awk -F ',' '{print $1}')
+ # remove ${vm[$i]} from list because of '{print $1}'
+ vmgrid_startvms=$(echo ${vmgrid_startvms} | sed -e "s,${vm[$i]}\,*,,")
+ vmratio[$i]=$(echo ${vmgrid_memratio} | awk -F ',' '{print $1}')
+ # remove ${vmratio[$i]} from list because of '{print $1}'
+ vmgrid_memratio=$(echo ${vmgrid_memratio} | sed -e "s/${vmratio[$i]},*//")
+ vmsumratios=$(expr ${vmsumratios} + ${vmratio[$i]} 2>/dev/null)
+done
+
+for i in {1..4}; do
+ # calculate VMs mem: mem = $freemem * $vmratio/100 * 100/$restratio
+ # multiple of 4
+ vmmem[$i]=$(expr ${freemem} \* ${vmratio[$i]} / ${restratio} / 4 \* 4 \
+ 2>/dev/null)
+ if [ -n "${vm[$i]}" ] && [ ${vmmem[$i]} -lt 512 2>/dev/null ]; then
+ writelog "Not enough free RAM for ${vm[$i]} (min. 512 MB), \c"
+ writelog "free: ${vmmem[$i]} MB"
+ unset vm[$i]
+ fi
+done
+
+################################################################################
+### Start the VMs
+################################################################################
+
+# start vms
+for i in {1..4}; do
+ if [ -n "${vm[$i]}" ]; then
+ alreadyrunning=$(ps aux | grep run-vmgrid.sh | grep -v grep \
+ | grep "${vm[$i]}" | wc -l)
+ # if Xen use different method
+ if [ "${vmgrid_virt}" = "xen" ]; then
+ alreadyrunning=$(xm list 2>/dev/null | grep -vE "Domain-0|Name.*ID" \
+ | grep "${vm[$i]}-0.$" | wc -l)
+ fi
+ if [ ${alreadyrunning} -gt 0 2>/dev/null ]; then
+ writelog "${vm[$i]} already running, skipping!"
+ else
+ writelog "Starting ${vm[$i]} via run-vmgrid.sh with ${vmmem[$i]} MB RAM"
+ run-vmgrid.sh --mem ${vmmem[$i]} ${vm[$i]} 2>/dev/null &
+ echo $! > /tmp/vmgrid/${USER}/vmgrid.pids
+ # wait 10 secs for the next vm to start
+ sleep 10
+ fi
+ fi
+done
+
+exit 0
diff --git a/src/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh b/src/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh
new file mode 100644
index 00000000..73a65ac5
--- /dev/null
+++ b/src/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh
@@ -0,0 +1,144 @@
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# virtual virtualization plugin
+# make sure that this file is the same in vmgrid and vmchooser plugin!
+
+# include default directories
+. /etc/openslx.conf
+
+CONFFILEVMCHOOSER="/initramfs/plugin-conf/vmchooser.conf"
+CONFFILEVMGRID="/initramfs/plugin-conf/vmgrid.conf"
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization
+
+# check if plugins available
+active=0
+[ -f ${CONFFILEVMCHOOSER} ] && . ${CONFFILEVMCHOOSER}
+[ "x${vmchooser_active}" = "x1" ] && active=1
+[ -f ${CONFFILEVMGRID} ] && . ${CONFFILEVMGRID}
+[ "x${vmgrid_active}" = "x1" ] && active=1
+
+[ $DEBUGLEVEL -gt 0 ] \
+ && echo -e "Executing the 'virtualization' plugin ... \c"
+
+if [ ${active} -ne 0 ] ; then
+
+ # load general configuration
+ . /etc/initramfs-setup
+ # include functions
+ . /etc/functions
+
+ testmkd ${PLUGINCONFDIR}
+
+ # check if vmgrid active and change free mem
+ totalmem=$(expr $(grep -i "memtotal" /proc/meminfo \
+ | awk '{print $2}') / 1024)
+ echo "totalmem=${totalmem}" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ if [ "x${vmgrid_active}" = "x1" ]; then
+
+ totalmemtest=$(expr $(echo ${vmgrid_memratio} \
+ | awk -F ',' '{print $1" + "$2" + "$3" + "$4" + "$5" + "$6}'))
+
+ # not more than 100% memory assigned
+ if [ ${totalmemtest} -le 100 2>/dev/null ]; then
+
+ # host mem
+ hostratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $6}')
+ hostmem=$(expr ${totalmem} \* ${hostratio} / 100 2>/dev/null)
+ if [ ${hostmem} -lt 256 2>/dev/null ]; then
+ # min. 256 MB for host
+ hostmem=256
+ fi
+
+ # main vm mem (vmchooser)
+ if [ "x${vmchooser_active}" = "x1" ]; then
+ mainvirtratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $5}')
+ mainvirtmem=$(expr ${totalmem} \* ${mainvirtratio} / 100 2>/dev/null)
+ if [ ${mainvirtmem} -lt 512 2>/dev/null ]; then
+ # min. 512 for vmchooser
+ mainvirtmem=512
+ fi
+ else
+ mainvirtratio=0
+ mainvirtmem=0
+ fi
+
+ cat << EOF >> ${PLUGINCONFDIR}/virtualization.conf
+hostratio=${hostratio}
+hostmem=${hostmem}
+mainvirtratio=${mainvirtratio}
+mainvirtmem=${mainvirtmem}
+EOF
+
+ fi
+ fi
+
+ # cpu cores
+ CPU_CORES=$(grep 'processor.*:' /proc/cpuinfo | wc -l)
+ if [ "${CPU_CORES}" -gt "1" 2>/dev/null ]; then
+ echo "cpu_cores=${CPU_CORES}" \
+ >> ${PLUGINCONFDIR}/virtualization.conf
+ else
+ echo 'cpu_cores=1' >> ${PLUGINCONFDIR}/virtualization.conf
+ fi
+
+ # arch
+ echo "host_arch=$(uname -m)" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ # VT enabled cpu?
+ if grep -q ^flags.*\\\<vmx\\\> /proc/cpuinfo; then
+ echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf
+ echo 'kvm_module="kvm_intel"' >> ${PLUGINCONFDIR}/virtualization.conf
+ elif grep -q ^flags.*\\\<svm\\\> /proc/cpuinfo; then
+ echo "vtflag=1" >> ${PLUGINCONFDIR}/virtualization.conf
+ echo 'kvm_module="kvm_amd"' >> ${PLUGINCONFDIR}/virtualization.conf
+ else
+ echo "vtflag=0" >> ${PLUGINCONFDIR}/virtualization.conf
+ fi
+
+ # write mac
+ echo "hostmacaddr=${macaddr}" >> ${PLUGINCONFDIR}/virtualization.conf
+ # ip addr
+ echo "hostip=${clientip}" >> ${PLUGINCONFDIR}/virtualization.conf
+ # hostname
+ echo "hostname=${host_name}" >> ${PLUGINCONFDIR}/virtualization.conf
+
+ # get further hw information
+ waitfor /etc/hwinfo.cdrom
+ j=0
+ for i in $(cat /etc/hwinfo.cdrom); do
+ echo "cdrom_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf
+ j=$(expr $j + 1)
+ done
+
+ waitfor /etc/hwinfo.floppy
+ j=0
+ for i in $(cat /etc/hwinfo.floppy); do
+ echo "floppy_$j=$i" >> ${PLUGINCONFDIR}/virtualization.conf
+ j=$(expr $j + 1)
+ done
+
+ # copy host information to rwshare of vmgrid plugin
+ if [ "x${vmgrid_active}" = "x1" ]; then
+ cp ${PLUGINCONFDIR}/virtualization.conf ${vmgrid_rwmnt}/host.conf
+ fi
+
+ # finished ...
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo "ok"
+else
+ [ $DEBUGLEVEL -gt 0 ] \
+ && echo "failed"
+fi
diff --git a/src/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..d59227ad
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm
@@ -0,0 +1,47 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmware/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the vmware plugin.
+# -----------------------------------------------------------------------------
+package vmware::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+
+}
+
+sub initialize
+{
+ my $self = shift;
+ my $engine = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+1;
diff --git a/src/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..fb7b4998
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,227 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmware/OpenSLX/Distro/debian.pm
+# - provides Debian-specific overrides of the Distro API for the vmware
+# plugin.
+# -----------------------------------------------------------------------------
+package vmware::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(vmware::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+ my $location = shift;
+ my $kind = shift;
+
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # Ubuntu/Debian specific start/stop script, generated via stage1 'vmware'
+ # plugin install
+ # inspiration taken from vmware start script:
+ # Copyright 1998-2007 VMware, Inc. All rights reserved.
+ #
+ # This script manages the services needed to run VMware software
+
+ # Basic support for the Linux Standard Base Specification 1.3
+ ### BEGIN INIT INFO
+ # Provides: VMware
+ # Required-Start: \$syslog
+ # Required-Stop:
+ # Default-Start: 2 3 5
+ # Default-Stop: 0 6
+ # Short-Description: Manages the services needed to run VMware software
+ # Description: Manages the services needed to run VMware software
+ ### END INIT INFO
+
+ load_modules() {
+ End-of-Here
+
+ # Load modules
+ if ($kind eq 'local' || $kind eq 'local25' || $kind eq 'local30') {
+ if ($kind eq 'local30') {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ # vmplayer 3.0 specific stuff
+ insmod /lib/modules/\$(uname -r)/misc/vsock.ko || return 1
+ insmod /lib/modules/\$(uname -r)/misc/vmci.ko || return 1
+ End-of-Here
+ }
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ # to be filled in via the stage1 configuration script
+ insmod /lib/modules/\$(uname -r)/misc/vmmon.ko || return 1
+ insmod /lib/modules/\$(uname -r)/misc/vmnet.ko || return 1
+ insmod /lib/modules/\$(uname -r)/misc/vmblock.o 2>/dev/null || return 0
+ End-of-Here
+ } elsif ($kind eq 'vmpl1.0') {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ vmware_kind_path=/opt/openslx/plugin-repo/vmware/${kind}/
+ module_src_path=\${vmware_kind_path}/vmroot/modules
+ insmod \${module_src_path}/vmmon.ko
+ insmod \${module_src_path}/vmnet.ko
+ End-of-Here
+ } elsif ($kind eq "vmpl2.0") {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ vmware_kind_path=/opt/openslx/plugin-repo/vmware/${kind}/
+ module_src_path=\${vmware_kind_path}/vmroot/modules
+ insmod \${module_src_path}/vmmon.ko
+ insmod \${module_src_path}/vmnet.ko
+ insmod \${module_src_path}/vmblock.ko
+ End-of-Here
+ } elsif ($kind eq 'vmpl2.5') {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ vmware_kind_path=/opt/openslx/plugin-repo/vmware/${kind}/
+ module_src_path=\${vmware_kind_path}/vmroot/modules
+ insmod \${module_src_path}/vmmon.ko
+ insmod \${module_src_path}/vmnet.ko
+ insmod \${module_src_path}/vmblock.ko
+ End-of-Here
+ } elsif ($kind eq 'vmpl3.0') {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ vmware_kind_path=/opt/openslx/plugin-repo/vmware/${kind}/
+ module_src_path=\${vmware_kind_path}/vmroot/modules
+ insmod \${module_src_path}/vmmon.ko
+ insmod \${module_src_path}/vmnet.ko
+ insmod \${module_src_path}/vmblock.ko
+ insmod \${module_src_path}/vsock.ko
+ insmod \${module_src_path}/vmci.ko
+ End-of-Here
+ }
+
+ # unload modules
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ }
+
+ unload_modules() {
+ # to be filled with the proper list within via the stage1
+ # configuration script
+ rmmod vmmon vmblock vmnet vmmon vmci vsock 2>/dev/null
+ }
+ End-of-Here
+
+ # setup vmnet0 and vmnet8
+ # depends on specific stage3 setting. I let this if in the code
+ # because else this whole if-reducing process will become more
+ # complicated and the code will get less understandable
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ # the bridged interface
+ setup_vmnet0() {
+ if [ -n "\$vmnet0" ] ; then
+ # the path might be directly point to the plugin dir
+ End-of-Here
+ if ($kind eq 'vmpl2.5' || $kind eq 'vmpl3.0' || $kind eq 'local25' || $kind eq 'local30') {
+ $script .= " $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid -n 0\n";
+ } else {
+ $script .= " $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0\n";
+ }
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ fi
+ }
+ # we definately prefer the hostonly interface for NATed operation too
+ # distinction is made via enabled forwarding
+ setup_vmnet1() {
+ if [ -n "\$vmnet1" ] ; then
+ # the path might be directly point to the plugin dir
+ $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\
+ /dev/vmnet1 vmnet1
+ dhcpif="\$dhcpif vmnet1"
+ ip addr add \$vmnet1 dev vmnet1
+ ip link set vmnet1 up
+ if [ -n "\$vmnet1nat" ] ; then
+ # needs refinement interface name for eth0 is known in stage3 already
+ echo "1" > /proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null
+ echo "1" > /proc/sys/net/ipv4/conf/eth0/forwarding 2>/dev/null
+ #iptables -A -s vmnet1 -d eth0
+ fi
+ $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet1.conf -lf \\
+ /var/run/vmware/dhcpd-vmnet1.leases \\
+ -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet1 2>/dev/null # or logfile
+ fi
+ }
+ # incomplete ...
+ setup_vmnet8() {
+ if [ -n "\$vmnet8" ] ; then
+ # we don't need the following test. It's handled by
+ # XX_vmware.sh
+ #test -c /dev/vmnet8 || mknod c 119 8 /dev/vmnet8
+ $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet8.pid \\
+ /dev/vmnet8 vmnet8
+ ip addr add \$vmnet8 dev vmnet8
+ ip link set vmnet8 up
+ # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50
+ $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \\
+ -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf 2>/dev/null # or logfile
+ $location/vmnet-dhcpd -cf /etc/vmware/dhcpd-vmnet8.conf \\
+ -lf /var/run/vmware/dhcpd-vmnet8.leases \\
+ -pf /var/run/vmnet-dhcpd-vmnet8.pid vmnet8 2>/dev/null # or logfile
+ fi
+ }
+ # initialize the lsb status messages
+ . /lib/lsb/init-functions
+
+ case \$1 in
+ start)
+ log_daemon_msg "Starting vmware background services ..." "vmware"
+ # include default directories
+ . /etc/opt/openslx/openslx.conf
+ # load the configuration file
+ . \${OPENSLX_DEFAULT_CONFDIR}/plugins/vmware/vmware.conf
+ mkdir -p /var/run/vmware
+ touch /var/run/vmware/dhcpd-vmnet1.leases
+ touch /var/run/vmware/dhcpd-vmnet8.leases
+ load_modules || log_warning_msg "The loading of vmware modules failed"
+ setup_vmnet0 || log_warning_msg "Problems setting up vmnet0 interface"
+ setup_vmnet1 || log_warning_msg "Problems setting up vmnet1 interface"
+ setup_vmnet8 || log_warning_msg "Problems setting up vmnet8 interface"
+ log_end_msg $?
+ ;;
+ stop)
+ # message output should match the given vendor-os
+ log_daemon_msg "Stopping vmware background services ..." "vmware"
+ killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\
+ vmware-tray vmnet-dhcpd 2>/dev/null
+ # wait for shutting down of interfaces. vmnet needs kinda
+ # long
+ sleep 1
+ unload_modules
+ log_end_msg $?
+ ;;
+ # we don't need a status yet... at least as long as it is
+ # unclear in which path the corresponding binary (see original
+ # /etc/init.d/vmware) is in our case
+ #status)
+ # log_daemon_msg "Say something useful here ..."
+ #;;
+ restart)
+ \$0 stop
+ \$0 start
+ exit $?
+ ;;
+ *)
+ log_success_msg "Usage: \$0 {start|stop|restart}"
+ exit 2
+ ;;
+ esac
+ exit 0
+ End-of-Here
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm
new file mode 100644
index 00000000..912bdfa0
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Fedora.pm
@@ -0,0 +1,29 @@
+# Copyright (c) 2007..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmware/OpenSLX/Distro/Fedora.pm
+# - provides Fedora-specific overrides of the Distro API for the vmware
+# plugin.
+# -----------------------------------------------------------------------------
+package vmware::OpenSLX::Distro::Fedora;
+
+use strict;
+use warnings;
+
+use base qw(vmware::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+1;
diff --git a/src/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm
new file mode 100644
index 00000000..2e1197d8
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm
@@ -0,0 +1,28 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmware/OpenSLX/Distro/Gentoo.pm
+# - provides Gentoo-specific overrides of the Distro API for the vmware
+# plugin.
+# -----------------------------------------------------------------------------
+package vmware::OpenSLX::Distro::Gentoo;
+
+use strict;
+use warnings;
+
+use base qw(vmware::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+1;
diff --git a/src/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..c1b2ecf4
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,28 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmware/OpenSLX/Distro/Suse.pm
+# - provides SUSE-specific overrides of the Distro API for the vmware plugin.
+# -----------------------------------------------------------------------------
+package vmware::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(vmware::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+1;
diff --git a/src/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..922fb34f
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,23 @@
+# Copyright (c) 2007..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmware/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu-specific overrides of the Distro API for the vmware
+# plugin.
+# -----------------------------------------------------------------------------
+package vmware::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+# inherit everything from Debian (as Ubuntu is based on it anyway)
+use base qw(vmware::OpenSLX::Distro::Debian);
+
+1;
diff --git a/src/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/src/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
new file mode 100644
index 00000000..7e55019c
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
@@ -0,0 +1,836 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# vmware.pm
+# - declares necessary information for the vmware plugin
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::vmware;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Basename;
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'vmware',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Module for enabling services of VMware Inc. on an OpenSLX stateless
+ client. This plugin might use pre-existing installations of VMware
+ tools or install addional variants and versions.
+ End-of-Here
+ precedence => 70,
+ required => [ qw( desktop ) ],
+ };
+}
+
+sub getAttrInfo
+{
+ # returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system by means
+ # of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'vmware::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'vmware'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ # attribute 'imagesrc' defines where we can find vmware images
+ 'vmware::imagesrc' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Where do we store our vmware images? NFS? Filesystem?
+ End-of-Here
+ #TODO: check if the input is valid
+ #content_regex => qr{^(0|1)$},
+ content_descr => 'Allowed values: path or URI',
+ default => '',
+ },
+ # attribute 'bridge' defines if bridged network mode should be
+ # switched on
+ 'vmware::bridge' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Should the bridging (direct access of the vmware clients
+ to the ethernet the host is connected to) be enabled
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => 'Allowed values: 0 or 1',
+ default => '1',
+ },
+ # attribute 'vmnet1' defines if the host connection network mode
+ # should be switched on and NAT should be enabled
+ 'vmware::vmnet1' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Format ServerIP/Netprefix without NAT
+ Format ServerIP/Netprefix,NAT enables NAT/Masquerading
+ End-of-Here
+ #TODO: check if the input is valid
+ #content_regex => qr{^(0|1)$},
+ content_descr => 'Allowed value: IP/Prefix[,NAT]',
+ default => '192.168.101.1/24,NAT',
+ },
+ # attribute 'vmnet8' defines if vmware specific NATed network mode
+ # should be switched on
+ 'vmware::vmnet8' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Format ServerIP/Netprefix. Last octet will be omitted
+ End-of-Here
+ #TODO: check if the input is valid
+ #content_regex => qr{^(0|1)$},
+ content_descr => 'Allowed value: IP/Prefix. Last octet will be omitted',
+ default => '192.168.102.x/24',
+ },
+ # attribute 'kind' defines which set of VMware binaries should be
+ # activated ('local' provided with the main installation set).
+ 'vmware::kind' => {
+ applies_to_vendor_os => 0,
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Which set of VMware binaries to use: installed (local) or provided by the
+ plugin itself (vmpl1.0, vmpl2.0, vmpl2.5, vmpl3.X)?
+ End-of-Here
+ # only allow the supported once...
+ # TODO: modify if we know which of them work
+ #content_regex => qr{^(local|vmws(5\.5|6.0)|vmpl(1\.0|2\.0))$},
+ content_regex => qr{^(local|vmpl3\.0||vmpl2\.0|vmpl1\.0|vmpl2\.5)$},
+ content_descr => 'Allowed values: local, vmpl2.0',
+ #TODO: what if we don't have a local installation. default
+ # is still local. Someone has a clue how to test
+ # it and change the default value?
+ default => 'local',
+ },
+ ##
+ ## only stage1 setup options: different kinds to setup
+ 'vmware::local' => {
+ applies_to_vendor_os => 1,
+ applies_to_system => 0,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Set's up stage1 configuration for a local installed
+ vmplayer or vmware workstation
+ End-of-Here
+ content_regex => qr{^(1|0)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'vmware::vmpl2.0' => {
+ applies_to_vendor_os => 1,
+ applies_to_system => 0,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Install and configure vmplayer v2
+ End-of-Here
+ content_regex => qr{^(1|0)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '0',
+ },
+ 'vmware::vmpl2.5' => {
+ applies_to_vendor_os => 1,
+ applies_to_system => 0,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Install and configure vmplayer v2
+ End-of-Here
+ content_regex => qr{^(1|0)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '0',
+ },
+ 'vmware::vmpl1.0' => {
+ applies_to_vendor_os => 1,
+ applies_to_system => 0,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Install and configure vmplayer v1
+ End-of-Here
+ content_regex => qr{^(1|0)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '0',
+ },
+ 'vmware::pkgpath' => {
+ applies_to_vendor_os => 1,
+ applies_to_system => 0,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Path to VMware packages
+ End-of-Here
+ #TODO
+ #content_regex => qr{^(1|0)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '/root/vmware-pkgs',
+ },
+ # ** set of attributes for the installation of VM Workstation/Player
+ # versions. More than one package could be installed in parallel.
+ # To be matched to/triggerd by 'vmware::kind'
+ };
+}
+
+
+sub preInstallationPhase()
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
+ $self->{vendorOsPath} = $info->{'vendor-os-path'};
+
+ my $pkgpath = $self->{attrs}->{'vmware::pkgpath'};
+ my $vmpl10 = $self->{attrs}->{'vmware::vmpl1.0'};
+ my $vmpl20 = $self->{attrs}->{'vmware::vmpl2.0'};
+ my $vmpl25 = $self->{attrs}->{'vmware::vmpl2.5'};
+ my $local = $self->{attrs}->{'vmware::local'};
+
+ if ($local == 0 && $vmpl10 == 0 && $vmpl20 == 0 && $vmpl25 == 0) {
+ print "\n\n * At least one kind needs to get installed/activated:\n";
+ print " vmware::local=1 or\n";
+ print " vmware::vmpl1.0=1 or\n";
+ print " vmware::vmpl2.0=1\n";
+ print " vmware::vmpl2.5=1\n";
+ print " * vmware plugin was not installed!\n\n";
+ exit 1;
+ }
+
+ if (! -d $pkgpath && ($vmpl10 == 1 || $vmpl20 == 1 || $vmpl25 == 1)) {
+ print "\n\n * vmware::pkgpath: no such directory $pkgpath!\n";
+ print " See wiki about vmware Plugin\n";
+ print " * vmware plugin was not installed!\n\n";
+ exit 1;
+ }
+
+ # test just for the case we only set up local vmware
+ if (-d $pkgpath && ($vmpl10 == 1 || $vmpl20 == 1 || $vmpl25 == 1)) {
+ # todo: ask oliver about a similiar function
+ # like copyFile() just for directorys
+ # or fix the manual after checked the source of
+ # copyFile() function. check if copyFile etc. perldoc
+ # is somewhere in the wiki documented else do it!
+ system("cp -r $pkgpath $self->{pluginRepositoryPath}/packages");
+ }
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
+
+ # copy common part of run-virt.include to the appropriate place for
+ # inclusion in stage4
+ copyFile("$self->{openslxBasePath}/lib/plugins/vmware/files/run-virt.include",
+ "$self->{pluginRepositoryPath}/");
+
+ # kinds we will configure and install
+ # TODO: write a list of installed/setted up and check it in stage3
+ # this will avoid conflict of configured vmware version in
+ # stage3 which are not setted up or installed in stage1
+ if ($self->{attrs}->{'vmware::local'} == 1) {
+ $self->_localInstallation();
+ }
+ if ($self->{attrs}->{'vmware::vmpl2.0'} == 1) {
+ $self->_vmpl2Installation();
+ }
+ if ($self->{attrs}->{'vmware::vmpl1.0'} == 1) {
+ $self->_vmpl1Installation();
+ }
+ if ($self->{attrs}->{'vmware::vmpl2.5'} == 1) {
+ $self->_vmpl25Installation();
+ }
+
+ ## prepration for our faster wrapper script
+ # rename the default vmplayer script and create a link.
+ # uninstall routine takes care about plugin remove.
+ # stage3 copys our own wrapper script
+ if (-e "/usr/bin/vmplayer" && ! -e "/usr/bin/vmplayer.slx-back") {
+ rename("/usr/bin/vmplayer", "/usr/bin/vmplayer.slx-bak");
+ }
+ # the same with vmware, if ws is installed
+ if (-e "/usr/bin/vmware" && ! -e "/usr/bin/vmware.slx-bak") {
+ rename("/usr/bin/vmware", "/usr/bin/vmware.slx-bak");
+ }
+
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ # restore old start scripts - to be discussed
+ my @files = qw( vmware vmplayer );
+ foreach my $file (@files) {
+ if (-e "/usr/bin/$file.slx-bak") {
+ unlink("/usr/bin/$file");
+ rename("/usr/bin/$file.slx-bak", "/usr/bin/$file");
+ }
+ }
+ return;
+}
+
+sub checkStage3AttrValues
+{
+ my $self = shift;
+ my $stage3Attrs = shift;
+ my $vendorOSAttrs = shift;
+ my @problems;
+
+ my $vm_kind = $stage3Attrs->{'vmware::kind'} || '';
+ my $vmimg = $stage3Attrs->{'vmware::imagesrc'} || '';
+
+ if ($vm_kind eq 'local' && ! -x "/usr/lib/vmware/bin/vmplayer") {
+ push @problems, _tr(
+ "No local executeable installation of vmware found! Using it as virtual machine wouldn't work!"
+ );
+ }
+
+ if ($vm_kind eq 'local' &&
+ ! -d "/opt/openslx/plugin-repo/vmware/local") {
+ push @problems, _tr(
+ "local vmware installation not configured by slxos-plugin!"
+ );
+ }
+
+ if ($vm_kind eq 'vmpl1.0' &&
+ ! -d "/opt/openslx/plugin-repo/vmware/vmpl1.0/vmroot") {
+ push @problems, _tr(
+ "No OpenSLX installation of VMware Player 1 found or installation failed. Using it as virtual machine wouldn't work!"
+ );
+ }
+
+ if ($vm_kind eq 'vmpl2.0' &&
+ ! -d "/opt/openslx/plugin-repo/vmware/vmpl2.0/vmroot") {
+ push @problems, _tr(
+ "No OpenSLX installation of VMware Player 2.0 found or installation failed. Using it as virtual machine wouldn't work!"
+ );
+ }
+
+ if ($vm_kind eq 'vmpl2.5' &&
+ ! -d "/opt/openslx/plugin-repo/vmware/vmpl2.5/vmroot") {
+ push @problems, _tr(
+ "No OpenSLX installation of VMware Player 2.5 found or installation failed. Using it as virtual machine wouldn't work!"
+ );
+ }
+
+ if ($vm_kind eq 'vmpl3.X' &&
+ ! -d "/opt/openslx/plugin-repo/vmware/vmpl3.X/vmroot") {
+ push @problems, _tr(
+ "No OpenSLX installation of VMware Player 3.X found or installation failed. Using it as virtual machine wouldn't work!"
+ );
+ }
+
+ return if !@problems;
+
+ return \@problems;
+}
+
+
+#######################################
+## local, non-general OpenSLX functions
+#######################################
+
+# Write the runlevelscript
+# usage: _writeRunlevelScript("$vmpath", "$kind")
+sub _writeRunlevelScript
+{
+ my $self = shift;
+ my $vmpath = shift;
+ my $kind = shift;
+ my $initfile = newInitFile();
+
+ my $script = "";
+ my $modpath = "";
+ my $modlist = "";
+ # vmpath is to be redefined here ...
+ if ($kind =~ /local*/) {
+ $vmpath = "";
+ $modpath = "/lib/modules/\$(uname -r)/misc";
+ } elsif ($kind =~ /vmpl*/) {
+ $vmpath = "/opt/openslx/plugin-repo/vmware/${kind}";
+ $modpath = "${vmpath}/vmroot/modules";
+ }
+
+ $initfile->setName("vmware-slx");
+ $initfile->setDesc("Setup environment for VMware Workstation or Player ($kind).");
+
+ # functions ...
+ $modlist = "vmnet vmmon";
+ $script = unshiftHereDoc(<<" End-of-Here");
+ # VMplayer common stuff
+ insmod ${modpath}/vmmon.ko || return 1
+ insmod ${modpath}/vmnet.ko || return 1
+ End-of-Here
+ if ($kind eq 'local3X' || $kind eq 'vmpl3.X') {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ # VMplayer 3.X specific stuff
+ insmod ${modpath}/vmci.ko
+ insmod ${modpath}/vmblock.ko
+ insmod ${modpath}/vsock.ko
+ End-of-Here
+ $modlist .= "vsock vmci vmblock";
+ } elsif ($kind eq 'local20' || $kind eq 'local25' || $kind eq 'vmpl2.0' || $kind eq 'vmpl2.5') {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ # VMplayer 2.X specific stuff
+ insmod ${modpath}/vmblock.ko
+ End-of-Here
+ $modlist .= "vmblock";
+ }
+ $initfile->addFunction(
+ "load_modules",
+ "$script"
+ );
+ $initfile->addFunction(
+ "unload_modules",
+ "rmmod $modlist 2>/dev/null"
+ );
+ # vmnet0,1,8 (bridge, nat, host-only) interface definition
+ $script = unshiftHereDoc(<<" End-of-Here");
+ # let point the path directly to the directory where the binary lives
+ location="$vmpath/usr/bin"
+ if [ -n "\$vmnet0" ] ; then
+ # the path might be directly point to the plugin dir
+ End-of-Here
+ if ($kind eq 'vmpl1.0' || $kind eq 'vmpl2.0' || $kind eq 'local10' || $kind eq 'local20') {
+ $script .= " \$location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid /dev/vmnet0 eth0\n";
+ } else {
+ $script .= " \$location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid -n 0\n";
+ }
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ fi
+ if [ -n "\$vmnet1" ] ; then
+ \$location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \\
+ /dev/vmnet1 vmnet1
+ ip addr add \$vmnet1 dev vmnet1
+ ip link set vmnet1 up
+ if [ -n "\$vmnet1nat" ] ; then
+ echo "1" >/proc/sys/net/ipv4/conf/vmnet1/forwarding 2>/dev/null
+ echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null
+ #iptables -A -s vmnet1 -d br0
+ fi
+ /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \\
+ -S /etc/vmware/udhcpd/udhcpd-vmnet1.conf
+ fi
+ if [ -n "\$vmnet8" ] ; then
+ \$location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet8.pid \\
+ /dev/vmnet8 vmnet8
+ ip addr add \$vmnet8 dev vmnet8
+ ip link set vmnet8 up
+ echo "1" >/proc/sys/net/ipv4/conf/vmnet8/forwarding 2>/dev/null
+ echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null
+ iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE
+ /opt/openslx/uclib-rootfs/usr/sbin/udhcpd \\
+ -S /etc/vmware/udhcpd/udhcpd-vmnet8.conf
+ fi
+ End-of-Here
+ $initfile->addFunction(
+ "vmnetif",
+ "$script"
+ );
+ # vmblock for handling e.g. removable USB devices
+ $script = unshiftHereDoc(<<" End-of-Here");
+ # let point the path directly to the directory where the binary lives
+ $vmpath/usr/bin/vmware-usbarbitrator
+ End-of-Here
+ $initfile->addFunction(
+ "vmblock",
+ "$script"
+ );
+ $script = unshiftHereDoc(<<" End-of-Here");
+ # include default directories
+ . /etc/opt/openslx/openslx.conf
+ # load the configuration file
+ . \${OPENSLX_DEFAULT_CONFDIR}/plugins/vmware/vmware.conf
+ # hack to access the first serial/parallel port
+ chmod a+rw /dev/ttyS0
+ chmod a+rw /dev/parport0
+ load_modules
+ vmnetif
+ End-of-Here
+ # start the USB arbitrator on higher VMware/player versions (3.0+)
+ if ($kind eq 'vmpl3.X' || $kind eq 'local3X') {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ vmblock
+ End-of-Here
+ }
+ $initfile->addToCase(
+ "start",
+ "$script"
+ );
+ $script = unshiftHereDoc(<<" End-of-Here");
+ killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\
+ vmware-tray vmnet-dhcpd 2>/dev/null
+ # might take a while until all services are shut down
+ sleep 1
+ unload_modules
+ End-of-Here
+ $initfile->addToCase(
+ "stop",
+ "$script"
+ );
+ $initfile->addToCase(
+ "status",
+ "vmstatus"
+ );
+ $initfile->addToCase(
+ "restart",
+ "\$0 stop && \$0 start"
+ );
+
+ my $distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0];
+ my $runlevelscript = getInitFileForDistro($initfile, $distro);
+ # todo: because we dont have distribution or version dependend
+ # init scripts we could put it directly into /etc/init.d...
+ spitFile("$self->{'pluginRepositoryPath'}/vmware-slx", $runlevelscript);
+}
+
+
+# writes the wrapper script for vmware workstation and player, depending
+# on the flag. If player: just player wrapper, if ws: ws+player wrapper
+# usage: _writeWrapperScript("$vmpath", "$kind", "player")
+# _writeWrapperScript("$vmpath", "$kind", "ws")
+sub _writeWrapperScript
+{
+ my $self = shift;
+ my $vmpath = shift;
+ my $kind = shift;
+ my $type = shift;
+ my @files;
+
+ if ("$type" eq "ws") {
+ @files = qw(vmware vmplayer);
+ } else {
+ @files = qw(vmplayer);
+ }
+
+ foreach my $file (@files) {
+ # create our own simplified version of the vmware and player wrapper
+ # Depending on the configured kind it will be copied in stage3
+ # because of tempfs of /var but not /usr we link the file
+ # to /var/..., where we can write in stage3
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # written by OpenSLX-plugin 'vmware' in Stage1
+ # radically simplified version of the original script $file by VMware Inc.
+ End-of-Here
+
+ # kinda ugly and we only need it for local. Preserves errors
+ if ($kind ne "local") {
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ export LD_LIBRARY_PATH=$vmpath/lib
+ export GDK_PIXBUF_MODULE_FILE=$vmpath/libconf/etc/gtk-2.0/gdk-pixbuf.loaders
+ export GTK_IM_MODULE_FILE=$vmpath/libconf/etc/gtk-2.0/gtk.immodules
+ export FONTCONFIG_PATH=$vmpath/libconf/etc/fonts
+ export PANGO_RC_FILE=$vmpath/libconf/etc/pango/pangorc
+ # possible needed... but what are they good for?
+ #export GTK_DATA_PREFIX=
+ #export GTK_EXE_PREFIX=
+ #export GTK_PATH=
+ End-of-Here
+ }
+
+ $script .= unshiftHereDoc(<<" End-of-Here");
+ PREFIX=$vmpath # depends on the vmware location
+ exec "\$PREFIX"'/lib/wrapper-gtk24.sh' \\
+ "\$PREFIX"'/lib' \\
+ "\$PREFIX"'/bin/$file' \\
+ "\$PREFIX"'/libconf' "\$@"
+ End-of-Here
+
+ # TODO: check if these will be overwritten if we have more as
+ # local defined (add the version/type like vmpl1.0, vmws5.5, ...)
+ # then we have a lot of files easily distinguishable by there suffix
+ spitFile("$self->{'pluginRepositoryPath'}/$kind/$file", $script);
+ chmod 0755, "$self->{'pluginRepositoryPath'}/$kind/$file";
+ }
+}
+
+sub _writeVmwareConfigs {
+ my $self = shift;
+ my $kind = shift;
+ my $vmpath = shift;
+ my %versionhash = (vmversion => "", vmbuildversion => "");
+ my $vmversion = "";
+ my $vmbuildversion = "";
+ my $config = "";
+
+ %versionhash = _getVersion($vmpath);
+
+ $config .= "version=\"".$versionhash{vmversion}."\"\n";
+ $config .= "buildversion=\"".$versionhash{vmbuildversion}."\"\n";
+ spitFile("$self->{'pluginRepositoryPath'}/$kind/vmware.conf", $config);
+ chmod 0755, "$self->{'pluginRepositoryPath'}/$kind/vmware.conf";
+
+ $config = "libdir = \"$vmpath\"\n";
+ spitFile("$self->{'pluginRepositoryPath'}/$kind/config", $config);
+ chmod 0755, "$self->{'pluginRepositoryPath'}/$kind/config";
+}
+
+sub _getVersion {
+
+ my $vmpath = shift;
+ my $vmversion = "";
+ my $vmbuildversion = "";
+ my %versioninfo = (vmversion => "", vmbuildversion => "");
+
+ # get version information about installed vmplayer
+ if (open(FH, "$vmpath/bin/vmplayer")) {
+ $/ = undef;
+ my $data = <FH>;
+ close FH;
+ # depending on the installation it could differ and has multiple build
+ # strings
+ if ($data =~ m{[^\d\.](\d\.\d) build-(\d+)}) {
+ $vmversion = $1;
+ $vmbuildversion = $2;
+ }
+ if ($data =~ m{\0(2\.[05])\.[0-9]}) {
+ $vmversion = $1;
+ }
+ # else { TODO: errorhandling if file or string doesn't exist }
+ chomp($vmversion);
+ chomp($vmbuildversion);
+
+
+ $versioninfo{vmversion} = $vmversion;
+ $versioninfo{vmbuildversion} = $vmbuildversion;
+ }
+ return %versioninfo;
+}
+
+########################################################################
+## Functions, which setup the different environments (local, ws-v(5.5|6),
+## player-v(1|2)
+## Seperation makes this file more readable. Has a bigger benefit as
+## one big copy function. Makes integration of new versions easier.
+########################################################################
+
+# local installation
+sub _localInstallation
+{
+ my $self = shift;
+
+ my $kind = "local";
+ my $vmpath = "/usr/lib/vmware";
+ my $vmbin = "/usr/bin";
+ my %versionhash = (vmversion => "", vmbuildversion => "");
+ my $vmversion = "";
+ my $vmbuildversion = "";
+
+ # if vmware ws is installed, vmplayer is installed, too.
+ # we will only use vmplayer
+ if (-e "/usr/lib/vmware/bin/vmplayer") {
+
+ ## Get and write version information
+ %versionhash = _getVersion($vmpath);
+ $vmversion = $versionhash{vmversion};
+ $vmbuildversion = $versionhash{vmbuildversion};
+
+ # set version information
+ # VMplayer 2.0
+ if ($vmversion eq "2.0" || $vmversion eq "6.0") {
+ $kind="local20";
+ # VMplayer 2.5
+ } elsif ($vmversion eq "2.5" || $vmversion eq "6.5") {
+ $kind="local25";
+ # VMplayer 3.0, 3.1, Workstation 7.0, 7.1
+ } elsif ($vmversion eq "3.0" || $vmversion eq "7.0" ||
+ $vmversion eq "3.1" || $vmversion eq "7.1") { $kind="local3X";
+ }
+ # Create runlevel script depending on detected version
+ $self->_writeRunlevelScript("$vmpath", "$kind");
+
+ # Create wrapper scripts, kind of localNN is set to local
+ if ( $kind =~ /local*/ ) { $kind = "local"; }
+ if (-e "/usr/lib/vmware/bin/vmware") {
+ $self->_writeWrapperScript("$vmpath", "$kind", "ws");
+ }
+ if (-e "/usr/lib/vmware/bin/vmplayer") {
+ $self->_writeWrapperScript("$vmpath", "$kind", "player");
+ }
+
+ # copy nvram file
+ my $pluginFilesPath
+ = "$self->{'openslxBasePath'}/lib/plugins/$self->{'name'}/files";
+ my @files = qw(nvram);
+ foreach my $file (@files) {
+ copyFile("$pluginFilesPath/$file", "$self->{'pluginRepositoryPath'}/$kind");
+ }
+
+ } # else { TODO: errorhandling if file or string doesn't exist }
+
+ ## creating needed config /etc/vmware/config
+ $self->_writeVmwareConfigs("$kind", "$vmpath");
+}
+
+sub _vmpl2Installation {
+ my $self = shift;
+
+ my $kind = "vmpl2.0";
+ my $vmpath = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/lib/vmware";
+ my $vmbin = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/bin";
+
+ my $pluginFilesPath
+ = "$self->{'openslxBasePath'}/lib/plugins/$self->{'name'}/files";
+ my $installationPath = "$self->{'pluginRepositoryPath'}/$kind";
+
+ mkpath($installationPath);
+
+ ##
+ ## Copy needed files
+
+ # copy 'normal' needed files
+ my @files = qw( nvram install-vmpl.sh );
+ foreach my $file (@files) {
+ copyFile("$pluginFilesPath/$file", "$installationPath");
+ }
+
+ # Install the binarys from given pkgpath
+ system("/bin/sh /opt/openslx/plugin-repo/$self->{'name'}/$kind/install-vmpl.sh $kind");
+
+ # Create runlevel script
+ $self->_writeRunlevelScript($vmpath, $kind);
+
+ # Create wrapperscripts
+ $self->_writeWrapperScript("$vmpath", "$kind", "player");
+
+ # Creating needed config /etc/vmware/config
+ $self->_writeVmwareConfigs("$kind", "$vmpath");
+
+}
+
+sub _vmpl25Installation {
+ my $self = shift;
+
+ my $kind = "vmpl2.5";
+ my $vmpath = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/lib/vmware";
+ my $vmbin = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/bin";
+ my $vmversion = "6.5";
+ my $vmbuildversion = "TODO_we_need_it_for_enhanced_runvmware_config_in_stage1";
+
+ my $pluginFilesPath
+ = "$self->{'openslxBasePath'}/lib/plugins/$self->{'name'}/files";
+ my $installationPath = "$self->{'pluginRepositoryPath'}/$kind";
+
+ mkpath($installationPath);
+
+ # copy 'normal' needed files
+ my @files = qw( nvram install-vmpl.sh );
+ foreach my $file (@files) {
+ copyFile("$pluginFilesPath/$file", "$installationPath");
+ }
+
+ # Install the binarys from given pkgpath
+ system("/bin/sh /opt/openslx/plugin-repo/$self->{'name'}/$kind/install-vmpl.sh $kind");
+
+ # Create runlevel script
+ $self->_writeRunlevelScript($vmpath, $kind);
+
+ # Create wrapperscripts
+ $self->_writeWrapperScript("$vmpath", "$kind", "player");
+
+ # Creating needed config /etc/vmware/config
+ $self->_writeVmwareConfigs("$kind", "$vmpath");
+
+}
+
+sub _vmpl1Installation {
+ my $self = shift;
+
+ my $kind = "vmpl1.0";
+ my $vmpath = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/lib/vmware";
+ my $vmbin = "/opt/openslx/plugin-repo/vmware/$kind/vmroot/bin";
+ my $vmversion = "5.5";
+ my $vmbuildversion = "TODO_we_need_it_for_enhanced_runvmware_config_in_stage1";
+
+ my $pluginFilesPath
+ = "$self->{'openslxBasePath'}/lib/plugins/$self->{'name'}/files";
+ my $installationPath = "$self->{'pluginRepositoryPath'}/$kind";
+
+ mkpath($installationPath);
+
+ # copy 'normal' needed files
+ my @files = qw( nvram install-vmpl.sh );
+ foreach my $file (@files) {
+ copyFile("$pluginFilesPath/$file", "$installationPath");
+ }
+
+ # Download and install the binarys
+ system("/bin/sh /opt/openslx/plugin-repo/$self->{'name'}/$kind/install-vmpl.sh $kind");
+
+ # Create runlevel script
+ $self->_writeRunlevelScript($vmpath, $kind);
+
+ # create wrapper scripts
+ $self->_writeWrapperScript("$vmpath", "$kind", "player");
+
+ # creating needed config /etc/vmware/config
+ $self->_writeVmwareConfigs("$kind", "$vmpath");
+
+}
+
+# The bridge configuration needs the bridge module to be present in early
+# stage3
+sub suggestAdditionalKernelModules
+{
+ my $self = shift;
+ my $makeInitRamFSEngine = shift;
+
+ my @suggestedModules;
+
+ push @suggestedModules, qw( bridge );
+
+ return @suggestedModules;
+}
+
+1;
diff --git a/src/os-plugins/plugins/vmware/XX_vmware.sh b/src/os-plugins/plugins/vmware/XX_vmware.sh
new file mode 100644
index 00000000..26b49cc5
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/XX_vmware.sh
@@ -0,0 +1,201 @@
+# Copyright (c) 2007..2009 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# TODO:
+# configs nach /etc/opt/openslx/plugins/vmware
+# cp nach run-virt.include
+
+# TODO: nvram,functions
+# write /etc/vmware/config (if a non-standard location of vmware basedir is
+# to be configured), /etc/init.d/vmware
+
+# include default directories
+. /etc/openslx.conf
+
+ETCDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}
+PLUGINCONFDIR=${ETCDIR}/plugins/vmware
+BINDIR=/mnt/${OPENSLX_DEFAULT_BINDIR}
+PLUGINDIR=/mnt/${OPENSLX_DEFAULT_DIR}/plugin-repo/vmware
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}
+
+# check if the configuration file is available
+if [ -e /initramfs/plugin-conf/vmware.conf ]; then
+
+ # load needed variables
+ . /initramfs/plugin-conf/vmware.conf
+
+ # Test if this plugin is activated... more or less useless with the
+ # new plugin system
+ if [ $vmware_active -ne 0 ]; then
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'vmware' os-plugin ...";
+ # Load general configuration
+ . /initramfs/machine-setup
+
+ testmkd /mnt/tmp/vmware 1777
+ testmkd /dev/shm/vmware 1777
+ testmkd /mnt/var/run/vmware 1777
+ testmkd ${PLUGINCONFDIR}
+ testmkd /mnt/etc/vmware/udhcpd
+
+ # write the ${PLUGINCONFDIR}/vmware.conf file
+ # check for the several variables and write the several files:
+ # dhcpd.conf for vmnet* interfaces
+ # nat.conf for the NAT configuration of vmnet8
+ # TODO: vmnet-natd-8.mac not clear if really needed and which mac it
+ # should contain (seems to be an average one)
+ echo -e "# configuration file for vmware background services written in \
+stage3 setup" > ${PLUGINCONFDIR}/vmware.conf
+ if [ "$vmware_bridge" = 1 ] ; then
+ echo "vmnet0=true" >> ${PLUGINCONFDIR}/vmware.conf
+ fi
+
+ # variable might contain ",NAT" which is to be taken off
+ if [ -n "$vmware_vmnet1" ] ; then
+ local vmnet1=${vmware_vmnet1%,*} # x.x.x.x/yy,NAT => 'x.x.x.x/yy'
+ local vmnat=${vmware_vmnet1#$vmnet1*} # x.x.x.x/yy,NAT => ',NAT'
+ local vmip=${vmnet1%/*} # x.x.x.x/yy => 'x.x.x.x'">
+ local vmpx=${vmnet1#*/} # x.x.x.x/yy => 'yy'
+ local vmsub=$(echo $vmip |sed 's,\(.*\)\..*,\1,') # x.x.x.x => x.x.x
+ echo -e "vmnet1=$vmnet1" >> ${PLUGINCONFDIR}/vmware.conf
+ [ -n "$vmnat" ] && echo "vmnet1nat=true" >> ${PLUGINCONFDIR}/vmware.conf
+ # setting up the udhcpd configuration
+ sed -e "s,NWIF,vmnet1,;s,/misc/,/vmware/," \
+ -e "s,CNETWORK,$vmsub,;s,PIDFILE,/var/run/vmware/udhcpd-vmnet1.pid," \
+ -e "s,LEASEFILE,/var/run/vmware/udhcpd-vmnet1.leases," \
+ /mnt/etc/opt/openslx/udhcpd.conf >/mnt/etc/vmware/udhcpd/udhcpd-vmnet1.conf
+ fi
+
+ # vmware nat interface configuration
+ if [ -n "$vmware_vmnet8" ] ; then
+ local vmnet8ip=${vmware_vmnet8%/*}
+ local vmpx=${vmware_vmnet8#*/}
+ local vmsub=$(echo $vmnet8ip |sed 's,\(.*\)\..*,\1,') # x.x.x.x => x.x.x">
+ # vmip is user for vmnet8 device
+ # vmnet is user for config files nat.conf/dhcp
+ local vmip="${vmsub}.1"
+ local vmnet="${vmsub}.2"
+ echo -e "vmnet8=$vmip/$vmpx" >>${PLUGINCONFDIR}/vmware.conf
+ # setting up the udhcpd configuration
+ sed -e "s,NWIF,vmnet8,;s,/misc/,/vmware/," \
+ -e "s,CNETWORK,$vmsub,;s,PIDFILE,/var/run/vmware/udhcpd-vmnet8.pid," \
+ -e "s,LEASEFILE,/var/run/vmware/udhcpd-vmnet8.leases," \
+ /mnt/etc/opt/openslx/udhcpd.conf >/mnt/etc/vmware/udhcpd/udhcpd-vmnet8.conf
+ # might be not needed any more ...
+ echo -e "# Linux NAT configuration file" \
+ > /mnt/etc/vmware/nat.conf
+ echo -e "[host]" \
+ >> /mnt/etc/vmware/nat.conf
+ echo -e "ip = $vmnet/$vmpx" \
+ >> /mnt/etc/vmware/nat.conf
+ echo -e "device = /dev/vmnet8" \
+ >> /mnt/etc/vmware/nat.conf
+ echo -e "activeFTP = 1" \
+ >> /mnt/etc/vmware/nat.conf
+ echo -e "[udp]" \
+ >> /mnt/etc/vmware/nat.conf
+ echo -e "timeout = 60" \
+ >> /mnt/etc/vmware/nat.conf
+ echo -e "[incomingtcp]" \
+ >> /mnt/etc/vmware/nat.conf
+ echo -e "[incomingudp]" \
+ >> /mnt/etc/vmware/nat.conf
+ echo "00:50:56:F1:30:50" > /mnt/etc/vmware/vmnet-natd-8.mac
+ fi
+ # copy the runlevel script to the proper place and activate it
+ sed "s/eth0/$nwif/g" ${PLUGINDIR}/vmware-slx > /mnt/etc/init.d/vmware-env \
+ || echo " * Error copying runlevel script. Shouldn't happen."
+ chmod a+x /mnt/etc/init.d/vmware-env
+ rllinker "vmware-env" 20 2
+
+ ############################################################################
+ # vmware stuff first part: two scenarios
+ # * VM images in /usr/share/vmware - then simply link
+ # * VM images via additional mount (mount source NFS, NBD, ...)
+
+ # get source of vmware image server (get type, server and path)
+ if strinstr "/" "${vmware_imagesrc}" ; then
+ vmimgprot=$(uri_token ${vmware_imagesrc} prot)
+ vmimgserv=$(uri_token ${vmware_imagesrc} server)
+ vmimgpath="$(uri_token ${vmware_imagesrc} path)"
+ fi
+ if [ -n "${vmimgserv}" -a -n ${vmimgpath} -a -n ${vmimgprot} ] ; then
+ mnttarget=${VIRTDIR}/vmware
+ # mount the vmware image source readonly (ro)
+ fsmount ${vmimgprot} ${vmimgserv} ${vmimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && error " * Incomplete information in variable \
+${vmware_imagesrc}." nonfatal
+ fi
+
+ ############################################################################
+ # vmware stuff second part: setting up the environment
+ # make udhcpd more silent
+ touch /mnt/var/run/vmware/udhcpd-vmnet1.leases \
+ /mnt/var/run/vmware/udhcpd-vmnet8.leases
+
+ # create the needed devices which effects all vmware options
+ # they are not created automatically via module load
+ for i in "/dev/vmnet0 c 119 0" "/dev/vmnet1 c 119 1" \
+ "/dev/vmnet8 c 119 8" "/dev/vmmon c 10 165"; do
+ mknod $i
+ done
+ chmod 0700 /dev/vmnet*
+
+ echo -e "usbfs\t\t/proc/bus/usb\tusbfs\t\tauto\t\t 0 0" >> /mnt/etc/fstab
+ # needed for VMware 5.5.4 and versions below
+ echo -e "\tmount -t usbfs usbfs /proc/bus/usb 2>/dev/null" \
+ >>/mnt/etc/init.d/boot.slx
+
+ # allow VMware swapping if RamZSWAP is enabled
+ if grep -E "^ramzswap.*1 -.*" /proc/modules ; then
+ echo -e '.encoding = "UTF-8"\nprefvmx.minVmMemPct = "50"
+prefvmx.useRecommendedLockedMemSize = "TRUE"' | sed -e "s/^ *//" \
+ >/mnt/etc/vmware/config
+ else
+ # disable VMware swapping else
+ echo -e '.encoding = "UTF-8"\nprefvmx.minVmMemPct = "100"
+prefvmx.useRecommendedLockedMemSize = "TRUE"' | sed -e "s/^ *//" \
+ >/mnt/etc/vmware/config
+ fi
+
+ # copy virtualization include files to config dir
+ cp ${PLUGINDIR}/run-virt.include ${PLUGINCONFDIR}
+ # copy version depending files
+ cp ${PLUGINDIR}/${vmware_kind}/vmplayer ${BINDIR}/vmplayer
+ if [ -e ${PLUGINDIR}/${vmware_kind}/vmware ]; then
+ cp ${PLUGINDIR}/${vmware_kind}/vmware ${BINDIR}/vmware
+ fi
+
+ # affects only kernel and config depending configuration of not
+ # local installed versions
+ cat ${PLUGINDIR}/${vmware_kind}/config >>/mnt/etc/vmware/config
+ chmod 644 /mnt/etc/vmware/config
+ echo "# stage1 variables produced during plugin install" \
+ >>${PLUGINCONFDIR}/vmware.conf
+ cat ${PLUGINDIR}/${vmware_kind}/vmware.conf >>${PLUGINCONFDIR}/vmware.conf
+
+ # if /tmp resides on nfs: create an empty container file for vmware *.vmem
+ # it does not like to live on NFS exports (still needed??)
+ #if [ cat /proc/mounts|grep -qe "^/tmp "|grep -qe "nfs" ] ; then
+ # dd if=/dev/zero of=/mnt/tmp/vm-container count=1 seek=2048000
+ # diskfm /mnt/tmp/vm-container /mnt/tmp/vmware
+ # chmod a+rwxt /mnt/tmp/vmware
+ #fi
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'vmware' os-plugin ..."
+
+ fi
+else
+ [ $DEBUGLEVEL -gt 0 ] && echo " * Configuration of vmware plugin failed"
+fi
diff --git a/src/os-plugins/plugins/vmware/files/README b/src/os-plugins/plugins/vmware/files/README
new file mode 100644
index 00000000..ae8bf1e7
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/files/README
@@ -0,0 +1,12 @@
+Files
+- nvram (version from VMware5)
+ This nvram supports a second Floppy drive. Helpfull if you want to
+ get some data from linux to your Windows VirtualMachine (like
+ Scanner-IP or Userinformation)
+- run-virt.include
+ The main include script for the vmchooser plugin run-virt.sh vir-
+ tualization environments start script. All vmware related stuff like
+ the creation of the configuration file is handled within this script.
+- install-vmpl.sh
+ Install script, can handle different vmware version installations
+
diff --git a/src/os-plugins/plugins/vmware/files/install-vmpl.sh b/src/os-plugins/plugins/vmware/files/install-vmpl.sh
new file mode 100644
index 00000000..e0795b30
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/files/install-vmpl.sh
@@ -0,0 +1,284 @@
+#!/bin/sh
+
+cd /opt/openslx/plugin-repo/vmware/
+
+### Check if player are still installed
+if [ -d ${1}/vmroot/ ]; then
+ echo " * $1 seems to be installed. There shouldn't be a need for a new installation."
+ echo " If you want to reinstall $1 press \"y\" else we will exit"
+ read
+ if [ "${REPLY}" != "y" ]; then
+ echo " * $1 is already installed. Nothing to do."
+ exit
+ fi
+ echo " * $1 will be reinstalled"
+fi
+
+
+### Now define values
+if [ "$1" = "vmpl1.0" ]; then
+ vmplversion="vmpl1.0"
+ tgzfile=$(ls packages/VMware-player-1.0.*|sort|tail -n 1)
+elif [ "$1" = "vmpl2.0" ]; then
+ vmplversion="vmpl2.0"
+ tgzfile=$(ls packages/VMware-player-2.0.*|sort|tail -n 1)
+elif [ "$1" = "vmpl2.5" ]; then
+ vmplversion="vmpl2.5"
+ tgzfile=$(ls packages/VMware-Player-2.5.*.bundle|sort|tail -n 1)
+else
+ echo "Attribute of install-vmpl.sh isn't valid!"
+ echo "This shouldn't happen! Fix vmware.pm!"
+ exit 1;
+fi
+
+
+### Main installation part
+if [ "${vmplversion}" != "vmpl2.5" ]; then
+ # tgz Installation of vmpl1.0 and vmpl2.0
+ cd ${vmplversion}
+
+ echo " * Unpacking vmplayer ${vmplversion}"
+ tar xfz ../${tgzfile}
+ # TODO: errorcheck if tgz wasnt downloaded properly.
+ # ask on mailinglist if theres a way how to handle it
+ # in preInstallation() "exit 1" is enough. Perhaps it will work
+ # here, too. Try first, and then document it in the wiki
+
+ # reduce some errors
+ echo " * deleting old files if available"
+ rm -rf vmroot
+
+ echo " * copying files..."
+ mkdir vmroot
+ mkdir -p vmroot/modules
+ mkdir -p vmroot/lib
+ mv vmware-player-distrib/lib vmroot/lib/vmware
+ mv vmware-player-distrib/bin vmroot/
+ if [ "${vmplversion}" != "vmpl1.0" ]; then
+ mv vmware-player-distrib/sbin vmroot/
+ fi
+ mv vmware-player-distrib/doc vmroot/
+ rm -rf vmware-player-distrib/
+ rm -rf vmroot/lib/vmware/modules/binary
+
+ echo " * fixing file permission"
+ chmod 04755 vmroot/lib/vmware/bin/vmware-vmx
+
+ # I don't want to understand what vmware is doing, but without this
+ # step we need to have LD_LIBRARY_PATH with 53 entrys. welcome to
+ # library hell
+ echo " * fixing librarys..."
+ cd vmroot/lib/vmware/lib
+ mkdir test
+ mv lib* test
+ mv test/lib*/* .
+ rm -rf test
+ cd ../../../..
+
+ echo " * fixing gdk and pango config files"
+ sed -i \
+ "s,/build/mts/.*/vmui/../libdir/libconf,/opt/openslx/plugin-repo/vmware/${vmplversion}/vmroot/lib/vmware/libconf," \
+ vmroot/lib/vmware/libconf/etc/gtk-2.0/gdk-pixbuf.loaders
+ sed -i \
+ "s,/build/mts/.*/vmui/../libdir/libconf,/opt/openslx/plugin-repo/vmware/${vmplversion}/vmroot/lib/vmware/libconf," \
+ vmroot/lib/vmware/libconf/etc/gtk-2.0/gtk.immodules
+ sed -i \
+ "s,/build/mts/.*/vmui/../libdir/libconf,/opt/openslx/plugin-repo/vmware/${vmplversion}/vmroot/lib/vmware/libconf," \
+ vmroot/lib/vmware/libconf/etc/pango/pango.modules
+ sed -i \
+ "s,/build/mts/.*/vmui/../libdir/libconf,/opt/openslx/plugin-repo/vmware/${vmplversion}/vmroot/lib/vmware/libconf," \
+ vmroot/lib/vmware/libconf/etc/pango/pangorc
+ sed -i \
+ "s,/etc/pango/pango/,/etc/pango/," \
+ vmroot/lib/vmware/libconf/etc/pango/pangorc
+
+ echo " * creating /etc/vmware"
+ rm -rf /etc/vmware
+ mkdir -p /etc/vmware
+
+ echo " * unpacking kernel modules"
+ cd vmroot/lib/vmware/modules/source
+ tar xf vmnet.tar
+ tar xf vmmon.tar
+ if [ "${vmplversion}" != "vmpl1.0" ]; then
+ tar xf vmblock.tar
+ fi
+
+ echo " * building vmblock module"
+ if [ "${vmplversion}" != "vmpl1.0" ]; then
+ cd vmblock-only/
+ sed -i "s%^VM_UNAME = .*%VM_UNAME = $(find /boot/vmlinuz* -maxdepth 0|sed 's,/boot/vmlinuz-,,g'|sort|tail -n 1)%" Makefile
+ make -s
+ mv vmblock.ko vmblock.o ../../../../../modules
+ cd ..
+ fi
+
+ echo " * building vmmon module"
+ cd vmmon-only
+ sed -i "s%^VM_UNAME = .*%VM_UNAME = $(find /boot/vmlinuz* -maxdepth 0|sed 's,/boot/vmlinuz-,,g'|sort|tail -n 1)%" Makefile
+ make -s
+ mv vmmon.ko vmmon.o ../../../../../modules
+ cd ..
+
+ echo " * building vmnet module"
+ cd vmnet-only
+ sed -i "s%^VM_UNAME = .*%VM_UNAME = $(find /boot/vmlinuz* -maxdepth 0|sed 's,/boot/vmlinuz-,,g'|sort|tail -n 1)%" Makefile
+ make -s
+ mv vmnet.ko vmnet.o ../../../../../modules
+ cd ../../../../../..
+
+ echo " * setting up EULA"
+ mv vmroot/doc/EULA vmroot/lib/vmware/share/EULA.txt
+
+ echo " * finishing installation"
+
+
+else
+ # bundle Installation of vmpl2.5
+ # note: the rpm just include the stupid .bundle file...
+ cd ${vmplversion}
+
+ echo " * Manipulating and extracting vmplayer ${vmplversion} package. this may take a while"
+
+ # fool non-root user extraction... just for testing
+ sed -i 's/ exit 1/ echo 1/' ../${tgzfile}
+ # don't use deinstallation stuff and checks of /etc...
+ # and don't modify file size, else it wont work!
+ sed -i 's/ migrate_networks/ echo te_networks/' ../${tgzfile}
+ sed -i 's/ uninstall_legacy/ echo tall_legacy/' ../${tgzfile}
+ sed -i 's/ uninstall_rpm/ echo tall_rpm/' ../${tgzfile}
+ sed -i 's/ uninstall_bundle/ echo tall_bundle/' ../${tgzfile}
+ # this won't work as root on our clients... I hope it don't break
+ # anything on our clients in stage1
+ sh ../${tgzfile} -x temp
+ # TODO: errorcheck if rpm wasnt downloaded properly.
+ # ask on mailinglist if theres a way how to handle it
+ # in preInstallation() "exit 1" is enough. Perhaps it will work
+ # here, too. Try first, and then document it in the wiki
+
+ # reduce some errors
+ echo " * deleting old files if available"
+ rm -rf vmroot
+
+ echo " * copying files..."
+ mkdir -p vmroot
+ mkdir -p vmroot/lib
+ mkdir -p vmroot/modules
+
+ mv temp/vmware-player/lib vmroot/lib/vmware
+ mv temp/vmware-player/sbin vmroot/
+ # the following shouldn't be needed, just to have it 1:1 self-created
+ # copy of /usr/lib/vmware
+ # Todo: clean it out when everything is running
+ mv temp/vmware-installer vmroot/lib/vmware/installer
+ rm -rf vmroot/lib/vmware/installer/.installer
+ rm -rf vmroot/lib/vmware/installer/bootstrap
+ mkdir -p vmroot/lib/vmware/setup
+ mv temp/vmware-player-setup/vmware-config vmroot/lib/vmware/setup
+ mv temp/vmware-player/doc vmroot/
+ mv temp/vmware-player/bin vmroot/
+
+ ##
+ ## left files/dirs
+ ##
+ # temp/vmware-player/files/index.theme ... hopefully not needed,
+ # temp/vmware-player/share => /usr/share ... icons
+ # temp/vmware-player/etc/... => /etc
+ # temp/vmware-player/build => unknown... not found...
+
+
+ # etc/vmware/
+ # bootstrap => Path definitions. confusing due of version 1.0
+ # which looks like the instller version
+ # perhaps just for installer... hopefully
+ # config => path definition, networking, different configurations
+ # database => sqlite3 db. includes all files mapped to component
+ # hopefully just used by installer and some path config
+ # networking => networking config... has options which are in
+ # dhcpd.conf, hopefully not needed
+ # vmnet(1|8) => we know it from v1/v2
+
+ echo " * fixing file permission"
+ chmod 755 vmroot/lib/vmware/bin/*
+ chmod 04755 vmroot/lib/vmware/bin/vmware-vmx
+ chmod 04755 vmroot/lib/vmware/bin/vmware-vmx-debug
+ chmod 04755 vmroot/lib/vmware/bin/vmware-vmx-stats
+ chmod 755 vmroot/bin/*
+ chmod 755 vmroot/lib/vmware/lib/wrapper-gtk24.sh
+
+ # I don't want to understand what vmware is doing, but without this
+ # step we need to have LD_LIBRARY_PATH with 53 entrys. welcome to
+ # library hell
+ # if this fact is still valid for 2.5 is unclear, but lets do it
+ echo " * fixing librarys..."
+ cd vmroot/lib/vmware/lib
+ mkdir test
+ mv lib* test
+ mv test/lib*/* .
+ rm -rf test
+ cd ../../../..
+
+ echo " * fixing gdk and pango config files"
+ sed -i \
+ "s,@@LIBCONF_DIR@@,/opt/openslx/plugin-repo/vmware/${vmplversion}/vmroot/lib/vmware/libconf," \
+ vmroot/lib/vmware/libconf/etc/gtk-2.0/gdk-pixbuf.loaders
+ sed -i \
+ "s,@@LIBCONF_DIR@@,/opt/openslx/plugin-repo/vmware/${vmplversion}/vmroot/lib/vmware/libconf," \
+ vmroot/lib/vmware/libconf/etc/gtk-2.0/gtk.immodules
+ sed -i \
+ "s,@@LIBCONF_DIR@@,/opt/openslx/plugin-repo/vmware/${vmplversion}/vmroot/lib/vmware/libconf," \
+ vmroot/lib/vmware/libconf/etc/pango/pango.modules
+ sed -i \
+ "s,@@LIBCONF_DIR@@,/opt/openslx/plugin-repo/vmware/${vmplversion}/vmroot/lib/vmware/libconf," \
+ vmroot/lib/vmware/libconf/etc/pango/pangorc
+ sed -i \
+ "s,/etc/pango/pango/,/etc/pango/," \
+ vmroot/lib/vmware/libconf/etc/pango/pangorc
+
+ echo " * creating /etc/vmware"
+ rm -rf /etc/vmware
+ mkdir -p /etc/vmware
+
+ echo " * unpacking kernel modules"
+ cd vmroot/lib/vmware/modules/source
+ tar xf vmnet.tar
+ tar xf vmmon.tar
+ tar xf vmblock.tar
+ #tar xf vmci.tar # just for 2 or more VMs => not needed
+ #tar xf vmppuser.tar # we don't need it
+ tar xf vsock.tar
+
+ echo " * building vmblock module"
+ cd vmblock-only/
+ sed -i "s%^VM_UNAME = .*%VM_UNAME = $(find /boot/vmlinuz* -maxdepth 0|sed 's,/boot/vmlinuz-,,g'|sort|tail -n 1)%" Makefile
+ make -s
+ mv vmblock.ko vmblock.o ../../../../../modules
+ cd ..
+
+ echo " * building vmmon module"
+ cd vmmon-only
+ sed -i "s%^VM_UNAME = .*%VM_UNAME = $(find /boot/vmlinuz* -maxdepth 0|sed 's,/boot/vmlinuz-,,g'|sort|tail -n 1)%" Makefile
+ make -s
+ mv vmmon.ko vmmon.o ../../../../../modules
+ cd ..
+
+ echo " * building vmnet module"
+ cd vmnet-only
+ sed -i "s%^VM_UNAME = .*%VM_UNAME = $(find /boot/vmlinuz* -maxdepth 0|sed 's,/boot/vmlinuz-,,g'|sort|tail -n 1)%" Makefile
+ make -s
+ mv vmnet.ko vmnet.o ../../../../../modules
+ cd ..
+
+ echo " * building vmsock module"
+ cd vsock-only
+ sed -i "s%^VM_UNAME = .*%VM_UNAME = $(find /boot/vmlinuz* -maxdepth 0|sed 's,/boot/vmlinuz-,,g'|sort|tail -n 1)%" Makefile
+ make -s
+ mv vsock.ko vsock.o ../../../../../modules
+ cd ../../../../../..
+
+ echo " * setting up EULA"
+ mv vmroot/doc/EULA vmroot/lib/vmware/share/EULA.txt
+
+ echo " * finishing installation"
+
+fi
diff --git a/src/os-plugins/plugins/vmware/files/nvram b/src/os-plugins/plugins/vmware/files/nvram
new file mode 100644
index 00000000..85125f1e
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/files/nvram
Binary files differ
diff --git a/src/os-plugins/plugins/vmware/files/run-virt.include b/src/os-plugins/plugins/vmware/files/run-virt.include
new file mode 100644
index 00000000..2010dc4b
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/files/run-virt.include
@@ -0,0 +1,448 @@
+# run-virt.include
+# -----------------------------------------------------------------------------
+# Copyright (c) 2009..2010 - RZ Uni Freiburg
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# run-virt.include
+# - component for vmware/player of the vmchooser plugin run-virt.sh
+################################################################################
+
+# configuration writer functions
+################################################################################
+
+runvmwareconfheader ()
+{
+echo "# This configuration file was generated by $0" >${conffile}
+
+case "$vmversion" in
+ *)
+ svga_autodetect="TRUE"
+ numvcpus="1"
+ shared_folder="FALSE"
+ echo ".encoding = \"UTF-8\"
+# version specific stuff - all versions
+config.version = \"8\"" >>${conffile}
+ ;;
+esac
+case "$vmversion" in
+ 2.*|3.*|6.*|7.*)
+ shared_folder="TRUE"
+ echo "
+# version specific stuff - ver. 2.*|3.*|6.*|7.*
+sharedFolder.option = \"alwaysEnabled\"" >>${conffile}
+ ;;
+esac
+case "$vmversion" in
+ 2.5|3.*|6.5|7.*)
+ if [ "${cpu_cores}" -ge "2" 2>/dev/null ]; then
+ numvcpus="2"
+ fi
+ cap3d="TRUE" # helper var for loging output
+ echo "
+# version specific stuff - ver. 2.5|3.*|6.5|7.*
+ehci.present = \"TRUE\"
+mks.enable3d = \"${enable3d}\"" >>${conffile}
+ ;;
+esac
+case "$vmversion" in
+ 3.*|7.*)
+ numvcpus="${cpu_cores}"
+ # svga_autodetect="FALSE" # if defined manual, see below
+ echo "
+# version specific stuff - ver. 3.*|7.*
+cpuid.coresPerSocket = \"${cpu_cores}\"
+maxvcpus = \"4\"
+# svga.numDisplays = "2"
+# svga.maxWidth = "2560"
+# svga.maxHeight = "2048"
+# svga.vramSize = "134217728"
+monitor.virtual_mmu = \"automatic\"
+monitor.virtual_exec = \"automatic\"
+floppy1.clientDevice = \"FALSE\"
+floppy1.readonly = \"TRUE\"" >>${conffile}
+ ;;
+esac
+
+echo "
+# id
+virtualHW.version = \"${hwver}\"
+displayName = \"${displayname}\"
+guestOS = \"${vmostype}\"
+
+# CPU/MEM
+numvcpus = \"${numvcpus}\"
+memsize = \"${mem}\"
+MemAllowAutoScaleDown = \"FALSE\"
+MemTrimRate = \"-1\"
+
+# ide-disks
+ide0:0.present = \"${ide}\"
+ide0:0.fileName = \"${diskfile}\"
+ide0:0.mode = \"independent-nonpersistent\"
+ide1:0.present = \"${cdrom0}\"
+ide1:0.autodetect = \"TRUE\"
+ide1:0.fileName = \"auto detect\"
+ide1:0.deviceType = \"cdrom-raw\"
+ide1:1.present = \"${cdrom1}\"
+ide1:1.autodetect = \"TRUE\"
+ide1:1.fileName = \"auto detect\"
+ide1:1.deviceType = \"cdrom-raw\"
+
+# scsi-disks
+scsi0.present = \"${scsi}\"
+scsi0:0.present = \"${scsi}\"
+scsi0:0.fileName = \"${diskfile}\"
+scsi0.virtualDev = \"${hddrv}\"
+scsi0:0.mode = \"independent-nonpersistent\"
+
+# floppies
+floppy0.present = \"${floppy0}\"
+floppy0.startConnected = \"FALSE\"
+floppy0.autodetect = \"TRUE\"
+floppy0.fileName = \"auto detect\"
+# we need floppy b: for our windows client configuration
+floppy1.present = \"${floppy1}\"
+floppy1.startConnected = \"TRUE\"
+floppy1.fileType = \"file\"
+floppy1.fileName = \"${floppy1name}\"
+
+# nics
+ethernet0.present = \"TRUE\"
+ethernet0.addressType = \"static\"
+${network_virtualDev}
+ethernet0.connectionType = \"${network_kind}\"
+#ethernet1.connectionType = \"custom\"
+#ethernet1.vnet = \"/dev/vmnet2\"
+ethernet0.address = \"00:50:56:${VM_ID}:${machostpart}\"
+ethernet0.wakeOnPcktRcv = \"FALSE\"
+
+# sound
+sound.present = \"TRUE\"
+sound.fileName = \"-1\"
+sound.autodetect = \"TRUE\"
+
+# svga
+svga.autodetect = \"${svga_autodetect}\"
+
+# usb
+usb.present = \"TRUE\"
+usb.generic.autoconnect = \"TRUE\"
+
+# shared folders
+sharedFolder0.present = \"TRUE\"
+sharedFolder0.enabled = \"${shared_folder}\"
+sharedFolder0.expiration = \"never\"
+sharedFolder0.guestName = \"${sharename}\"
+sharedFolder0.hostPath = \"${sharepath}\"
+sharedFolder0.readAccess = \"TRUE\"
+sharedFolder0.writeAccess = \"TRUE\"
+sharedFolder.maxNum = \"1\"
+
+# dirs/configs
+tmpDirectory = \"${redodir}\"
+redoLogDir = \"${redodir}\"
+mainMem.useNamedFile = \"TRUE\"
+snapshot.disabled = \"TRUE\"
+tools.syncTime = \"TRUE\"
+isolation.tools.hgfs.disable = \"FALSE\"
+hgfs.mapRootShare = \"TRUE\"
+isolation.tools.dnd.disable = \"FALSE\"
+isolation.tools.copy.enable = \"TRUE\"
+isolation.tools.paste.enabled = \"TRUE\"
+
+# serial port
+serial0.present = \"${serial}\"
+${serialdev}
+
+# parallel port
+parallel0.present = \"${parallel}\"
+parallel0.bidirectional = \"${paralbidi}\"
+${paraldev}" >>${conffile}
+
+# set the appropriate permissions for the vmware config file
+chmod u+rwx ${conffile} >/dev/null 2>&1
+}
+
+preferencesheader ()
+{
+echo ".encoding = \"UTF-8\"
+# This configuration file was generated by $0
+
+# updates/tips
+webUpdate.enabled = \"FALSE\"
+pref.downloadPermission = \"deny\"
+pref.vmplayer.downloadPermission = \"deny\"
+pref.vmplayer.webUpdateOnStartup = \"FALSE\"
+pref.tip.startup = \"FALSE\"
+hints.hideAll = \"TRUE\"
+hint.vmui.showAllUSBDevs = \"FALSE\"
+
+# configs
+prefvmx.defaultVMPath = \"${vmhome}\"
+prefvmx.mru.config = \"${conffile}:\"
+
+# hot keys
+pref.hotkey.control = \"true\"
+pref.hotkey.alt = \"true\"
+pref.hotkey.shift = \"true\"
+pref.hotkey.gui = \"true\"
+gui.restricted = \"true\"
+
+# fullscreen/mouse/keyboard
+pref.fullscreen.toolbarPixels = \"0\"
+pref.vmplayer.fullscreen.autohide = \"TRUE\"
+pref.grabOnMouseClick = \"TRUE\"
+pref.grabOnKeyPress = \"FALSE\"
+pref.motionGrab = \"TRUE\"
+pref.motionUngrab = \"TRUE\"
+pref.hideCursorOnUngrab = \"TRUE\"
+pref.autoFit = \"TRUE\"
+pref.autoFitFullScreen = \"fitGuestToHost\"
+pref.vmplayer.exit.vmAction = \"poweroff\"
+pref.vmplayer.confirmOnExit = \"TRUE\"
+
+# shared folders
+pref.enableAllSharedFolders = \"TRUE\"
+
+# eula
+pref.eula.size = \"2\"
+pref.eula.0.appName = \"VMware Player\"
+pref.eula.0.buildNumber = \"${vmbuild}\"
+pref.eula.1.appName = \"VMware Workstation\"
+pref.eula.1.buildNumber = \"${vmbuild}\"" >${vmhome}/preferences
+}
+
+
+# declaration of default variables
+################################################################################
+
+# VM-ID static (0D), remove if changed to 00
+VM_ID="0D"
+# temporary disk space for logs, etc...
+redodir=/tmp/vmware/${USER}
+# dir for configs and vmem file
+confdir=${redodir}
+# configfile
+conffile="${confdir}/run-vmware.conf"
+# diskfile
+diskfile=${vmpath}
+# users vmware config folder
+vmhome="${HOME}/.vmware"
+
+# get several version infos for vmware/player
+. ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmware/vmware.conf
+vmbuild=$buildversion
+vmversion=$version
+
+# VMware start options
+# "-X": start in fullscreen
+vmopt="-X"
+
+
+# hardware checks
+################################################################################
+
+# use different network card
+if [ -n "${network_card}" ]; then
+ network_virtualDev='ethernet0.virtualDev = "e1000"'
+else
+ network_virtualDev='# using default virtualDev for ethernet0'
+fi
+
+case "$enable3d" in
+ *true*|*TRUE*|*yes*|*YES*)
+ enable3d="TRUE"
+ ;;
+ *)
+ enable3d="FALSE"
+ ;;
+esac
+
+# serial/parallel port defined (e.g. "ttyS0, lp0" or "autodetect")
+case "$serial" in
+ tty*)
+ serialdev="serial0.filename = \"/dev/${serial}\""
+ serial="TRUE"
+ ;;
+ auto*)
+ serialdev="serial0.autodetect = \"TRUE\""
+ serial="TRUE"
+ ;;
+ *)
+ serialdev="# no serial port configured"
+ serial="FALSE"
+ ;;
+esac
+case "$parallel" in
+ lp*|parport*)
+ paraldev="parallel0.filename = \"/dev/${parallel}\""
+ paralbidi="TRUE"
+ parallel="TRUE"
+ ;;
+ auto*)
+ paraldev="parallel0.autodetect = \"TRUE\""
+ paralbidi="TRUE"
+ parallel="TRUE"
+ ;;
+ *)
+ paraldev="# no parallel port configured"
+ paralbidi="FALSE"
+ parallel="FALSE"
+ ;;
+esac
+
+# adjust memory available for vmware guests
+#if [ -n "${forcemem}" ]; then
+# mem="${forcemem}"
+#else
+# case "$vmversion" in
+# 2.*|6.*)
+# permem=30
+# ;;
+# 3.*|7.*)
+# permem=25
+# ;;
+# esac
+# if [ "${totalmem}" -ge "2500" ]; then
+# permem=40
+# fi
+# # check if /tmp is on harddisk
+# if grep -qe "/dev/.* /tmp " /proc/mounts ; then
+# permem=60
+# id44="1"
+# # Hack, if more than 2,5G RAM use 40% of Ram and write vmem into Ram as well
+# # (40% vmware | 40% confdir(vmem...) | 20% host
+# # VMplayer 2+ issue
+# if [ "${totalmem}" -ge "2500" ]; then
+# permem=40
+# confdir=/dev/shm/vmware/$USER
+# conffile=${confdir}/run-vmware.conf
+# mkdir -p /dev/shm/vmware/$USER
+# fi
+# fi
+# mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
+# if [ "${id44}" = "1" ]; then
+# hostmem=$(expr ${totalmem} - ${mem})
+# else
+# hostmem=$(expr ${totalmem} - ${mem} - ${mem})
+# fi
+#fi
+
+# check if ide/scsi and hwver of image
+# read only the first 30 lines to be shure
+imghead=$(head -30 ${diskfile})
+hddrv=$(echo "${imghead}" | grep -m1 -ia "ddb.adapterType" |\
+ awk -F '"' '{print $2}')
+hwver=$(echo "${imghead}" | grep -m1 -ia "ddb.virtualHWVersion" |\
+ awk -F '"' '{print $2}')
+case "${hddrv}" in
+ ide)
+ ide="TRUE"
+ scsi="FALSE"
+ ;;
+ lsilogic|buslogic)
+ ide="FALSE"
+ scsi="TRUE"
+ ;;
+esac
+
+
+# write configuration files
+################################################################################
+
+# create vmware directories
+mkdir -p ${redodir} >/dev/null 2>&1
+mkdir -p ${confdir} >/dev/null 2>&1
+mkdir -p ${vmhome} >/dev/null 2>&1
+
+# create preferences
+preferencesheader
+
+# create VMware startup file
+runvmwareconfheader
+# link to conffile if confdir != redodir
+ln -s ${conffile} ${redodir}/run-vmware.conf >/dev/null 2>&1
+
+# sync is needed to ensure that data is really written to virtual disk
+sync
+
+# own nvram. We need it for floppy drive b, default nvram has just drive a
+# TODO: optimize, currently kinda inefficient, too much copys, but we
+# don't know which one is installed...
+for i in /opt/openslx/plugin-repo/vmware/*; do
+ cp ${i}/nvram ${confdir}/nvram 2>/dev/null
+done
+
+
+# logging and stdout
+################################################################################
+
+# log script information
+writelog "# File created by $0 (VMversion ${vmversion})\n# on $(date)\n"
+writelog "Starting with non-persistent mode ...\n"
+
+# check memory range
+if [ "${mem}" -lt "256" ] || [ "${hostmem}" -lt "256" ]; then
+ writelog "\tMemory out of range: ${mem} MB (guest) / ${hostmem} MB (host)!"
+ writelog "\tMin. 256 MB for host and guest!"
+ exit 1
+fi
+
+# write all results to logfile
+# log disksetup
+writelog "Directories:"
+writelog "\tConfdir:\t${confdir}"
+writelog "\tConffile:\t${conffile}"
+writelog "\tRedodir:\t${redodir}"
+writelog "\tVMhome:\t\t${vmhome}"
+writelog "\t/tmp info: \
+ $(grep "/tmp " /proc/mounts) $(df -h | grep " /tmp$" | awk '{print $2}')"
+# hw setup
+writelog "Hardware:"
+writelog "\tMAC:\t\t00:50:56:${VM_ID}:${machostpart}"
+if [ -n "${network_card}" ]; then
+ writelog "\tNet Adaptor:\t${network_card}"
+fi
+writelog "\tMem:\t\t${mem} MB"
+# echo nur wenn hostmem gesetzt
+[ -n "${hostmem}" ] && writelog "\tHostmem:\t${hostmem} MB"
+writelog "\tMax. res.:\t${xres}x${yres}"
+writelog "\tCD-ROM1:\t${cdrom0}"
+writelog "\tCD-ROM2:\t${cdrom1}"
+writelog "\tFloppy_A:\t${floppy0}"
+if [ "${serial}" = "TRUE" ]; then
+ writelog "\tSerial Port:\t${serialdev}"
+fi
+if [ "${parallel}" = "TRUE" ]; then
+ writelog "\tParallel Port:\t${paraldev}"
+fi
+# image
+writelog "Diskimage:"
+writelog "\tDiskfile:\t${diskfile}"
+writelog "\tDisktype:\t${hddrv}"
+writelog "\tHWVersion:\t${hwver}"
+writelog "\tVMostype:\t${vmostype}"
+# misc
+writelog "Misc:"
+writelog "\tDisplayname:\t${displayname}"
+if [ "${cap3d}" = "TRUE" -a "${enable3d}" = "TRUE" ]; then
+ writelog "\t3D Graphics:\tenabled"
+fi
+# empty line at end
+writelog ""
+
+
+# finally set env for run-virt.sh
+################################################################################
+
+# using the modified version of the wrapper script
+VIRTCMD="${OPENSLX_DEFAULT_BINDIR}/vmplayer"
+VIRTCMDOPTS="${vmopt} ${conffile}"
diff --git a/src/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh b/src/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100755
index 00000000..3ae7e946
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright (c) 2009..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical to the files of virtualbox and qemukvm plugins)
+#############################################################################
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} 0
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} ${bridge}
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}
diff --git a/src/os-plugins/plugins/vmware/init-hooks/60-have-servconfig/vm-dhcpd.sh b/src/os-plugins/plugins/vmware/init-hooks/60-have-servconfig/vm-dhcpd.sh
new file mode 100755
index 00000000..b4f02389
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/init-hooks/60-have-servconfig/vm-dhcpd.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical in vmware, virtualbox and qemukvm plugins)
+#############################################################################
+
+. /etc/openslx.conf
+
+CONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}
+testmkd ${CONFDIR}
+
+# configuring dhcpd stub for virtual networks
+cat > ${CONFDIR}/udhcpd.conf << EOF
+# general udhcpd configuration file for virtual machines written by
+# $0 during OpenSLX stage3 configuration
+
+# start and end of the IP lease block
+start CNETWORK.20
+end CNETWORK.100
+
+# interface that udhcpd will use
+interface NWIF
+
+# how long an offered address is reserved (leased) in seconds
+offer_time 6000
+
+# location of the leases file
+lease_file LEASEFILE
+
+# location of the pid file
+pidfile PIDFILE
+
+option dns ${domain_name_servers}
+option subnet 255.255.255.0
+option router CNETWORK.1
+option wins CNETWORK.10
+option domain virtual.site ${domain_name}
+
+# additional options known to udhcpd
+#subnet #timezone
+#router #timesvr
+#namesvr #dns
+#logsvr #cookiesvr
+#lprsvr #bootsize
+#domain #swapsvr
+#rootpath #ipttl
+#mtu #broadcast
+#wins #lease
+#ntpsrv #tftp
+#bootfile
+EOF
diff --git a/src/os-plugins/plugins/vmware/init-hooks/80-after-plugins/adapt-tmpfs.sh b/src/os-plugins/plugins/vmware/init-hooks/80-after-plugins/adapt-tmpfs.sh
new file mode 100644
index 00000000..a28a8c6f
--- /dev/null
+++ b/src/os-plugins/plugins/vmware/init-hooks/80-after-plugins/adapt-tmpfs.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to adapt the tmpfs size for VMware/Player
+# (should be kept identical to the files of virtualbox plugin)
+#############################################################################
+
+# adapt tmpfs size (overbook)
+case $(grep tmpfs /proc/mounts) in
+ */tmp*)
+ mount -o remount,size=160% /mnt/tmp
+ ;;
+ */uniontmp*)
+ mount -o remount,size=160% /mnt/uniontmp
+ ;;
+esac
diff --git a/src/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm b/src/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm
new file mode 100644
index 00000000..ab1c614e
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm
@@ -0,0 +1,154 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# wlanboot.pm
+# - an wlanboot extension to the stage3 system
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::wlanboot;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Path;
+
+use Data::Dumper;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'wlanboot',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ wlanboot is an extension for stage 3
+ End-of-Here
+ precedence => 50,
+ };
+}
+
+sub getAttrInfo
+{ # returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system by means
+ # of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'wlanboot::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'wlanboot'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'wlanboot::activenics' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ kernel modules to load ..
+ End-of-Here
+ content_regex => '',
+ content_descr => 'space seperated list of kernel modules (without .ko)',
+ default => 'iwl3945 arc4 ecb',
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ my $attrs = $info->{'plugin-attrs'};
+
+ my $filesDir = "$openslxBasePath/lib/plugins/wlanboot/files";
+ slxsystem("cp -r $filesDir $pluginRepoPath/");
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+
+ return;
+}
+
+sub suggestAdditionalKernelModules
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $attrs = $info->{'attrs'};
+
+ my @suggestedKernelModules;
+
+ print Dumper(split(/ /, $attrs->{'wlanboot::activenics'}));
+ push(@suggestedKernelModules, split(/ /, $attrs->{'wlanboot::activenics'} ));
+
+ return @suggestedKernelModules;
+}
+
+sub copyRequiredFilesIntoInitramfs
+{
+ my $self = shift;
+ my $targetPath = shift;
+ my $attrs = shift;
+ my $makeInitRamFSEngine = shift;
+ my $pluginRepoPath = "$openslxConfig{'base-path'}/lib/plugins/wlanboot";
+
+ $makeInitRamFSEngine->addCMD(
+ "cp -p $pluginRepoPath/files/bin/* $targetPath/bin/"
+ );
+ $makeInitRamFSEngine->addCMD(
+ "cp -a $pluginRepoPath/files/firmware $targetPath/lib"
+ );
+ $makeInitRamFSEngine->addCMD(
+ "cp -a $pluginRepoPath/files/lib $targetPath/"
+ );
+ vlog(1, _tr("wlanboot-plugin: ..."));
+
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/wlanboot/XX_wlanboot.sh b/src/os-plugins/plugins/wlanboot/XX_wlanboot.sh
new file mode 100644
index 00000000..c33c1e19
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/XX_wlanboot.sh
@@ -0,0 +1,27 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'wlanboot' plugin - the runlevel script
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+if [ -e /initramfs/plugin-conf/wlanboot.conf ]; then
+ . /initramfs/plugin-conf/wlanboot.conf
+ if [ $wlanboot_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'wlanboot' os-plugin ...";
+ #iwconfig wlan0 essid "wlanboottest"
+ #ip link set wlan0 up
+ #udhcpc -i wlan0
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'wlanboot' os-plugin ...";
+
+ fi
+fi
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwconfig b/src/os-plugins/plugins/wlanboot/files/bin/iwconfig
new file mode 100755
index 00000000..42c18ca1
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwconfig
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwevent b/src/os-plugins/plugins/wlanboot/files/bin/iwevent
new file mode 100755
index 00000000..bf9b921b
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwevent
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwgetid b/src/os-plugins/plugins/wlanboot/files/bin/iwgetid
new file mode 100755
index 00000000..a310ee85
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwgetid
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwlist b/src/os-plugins/plugins/wlanboot/files/bin/iwlist
new file mode 100755
index 00000000..9597d4d4
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwlist
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwpriv b/src/os-plugins/plugins/wlanboot/files/bin/iwpriv
new file mode 100755
index 00000000..a9fd399e
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwpriv
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwspy b/src/os-plugins/plugins/wlanboot/files/bin/iwspy
new file mode 100755
index 00000000..2bded1e1
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwspy
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/bin/iwtest b/src/os-plugins/plugins/wlanboot/files/bin/iwtest
new file mode 100644
index 00000000..c6846702
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/bin/iwtest
@@ -0,0 +1 @@
+test file for plugin wlanboot.
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/README b/src/os-plugins/plugins/wlanboot/files/firmware/README
new file mode 100644
index 00000000..0845746d
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/README
@@ -0,0 +1,8 @@
+Put all the required firmwares of WLAN adapters you would like to use in
+your setup here into this subdirectory. They are copied into the InitRamFS
+to be present for device configuration via modprobe/mdev in stage3.
+
+For more information on the "wlanboot" plugin have a look at the project
+page!
+
+The OpenSLX Team
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-1.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-1.ucode
new file mode 100644
index 00000000..14dc7aac
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-1.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-2.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-2.ucode
new file mode 100644
index 00000000..c1ea0aab
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-3945-2.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-1.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-1.ucode
new file mode 100644
index 00000000..6d67a882
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-1.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-2.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-2.ucode
new file mode 100644
index 00000000..8cf429d3
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-4965-2.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-5000-1.ucode b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-5000-1.ucode
new file mode 100644
index 00000000..5519149b
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/firmware/iwlwifi-5000-1.ucode
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/files/lib/libiw.so b/src/os-plugins/plugins/wlanboot/files/lib/libiw.so
new file mode 120000
index 00000000..ee7675c6
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/lib/libiw.so
@@ -0,0 +1 @@
+libiw.so.29 \ No newline at end of file
diff --git a/src/os-plugins/plugins/wlanboot/files/lib/libiw.so.29 b/src/os-plugins/plugins/wlanboot/files/lib/libiw.so.29
new file mode 100755
index 00000000..1fde3844
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/files/lib/libiw.so.29
Binary files differ
diff --git a/src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh b/src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh
new file mode 100755
index 00000000..fee893d4
--- /dev/null
+++ b/src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh
@@ -0,0 +1,75 @@
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 init-hook 10 of 'wlanboot' plugin - firing up the wlan connection
+
+#setting udhcpc up
+mkdir -p /usr/share/udhcpc
+echo -e "#!/bin/ash\nunset infomsg HOME IFS mask lease interface DEBUGLEVEL \
+BOOT_IMAGE\nset >/tmp/ipstuff" >/usr/share/udhcpc/default.script
+chmod u+x /usr/share/udhcpc/default.script
+
+echo "! shutting down watchdog for debugging";
+killall watchdog;
+
+essid=$(sed -n 's/.*essid=\([^[:blank:]]*\) .*/\1/p' /proc/cmdline);
+[ $DEBUGLEVEL -gt 0 ] && echo "set essid to ${essid}";
+#value of essid unchecked yet
+
+
+# load network adaptor modules
+#modprobe iwl3945
+cd /lib/modules/$(ls /lib/modules/)/kernel/drivers/net/wireless
+for mod in $(find . | grep .ko | sed 's,.*/\([^/]*\).ko,\1',); do
+ echo "Mod:";
+ echo $mod;
+ modprobe $mod || echo "module $mod did not load for some reason"
+ usleep 10000
+done
+cd /
+
+wlanif=$(iwconfig 2>/dev/null|sed -n "/ESSID:/p"|sed "s/ .*//")
+[ $DEBUGLEVEL -gt 0 ] && echo "wlancard recognized as ${wlanif}";
+
+if [ -n "$wlanif" ] ; then
+ ip link set dev ${wlanif} up
+ if iwconfig ${wlanif} mode managed essid "${essid}"; then
+ nwif=${wlanif}
+ else
+ error " Unable to configure the WLAN interface."
+ fi
+
+
+ ( sleep 6 ; killall udhcpc >/dev/null 2>&1 ) &
+ udhcpc -f -n -q $vci -s /usr/share/udhcpc/default.script -i $nwif 2>/dev/null
+ if grep "ip=" /tmp/ipstuff >/dev/null 2>&1 ; then
+ . /tmp/ipstuff
+ for i in $dns ; do
+ echo "nameserver $i" >>/etc/resolv.conf
+ done
+ # simply add a single dns server for passing via kernel cmdline to stage3
+ # (quickhack, just the last, list of dns might be better ...)
+ echo "dnssrv=$i" >>/tmp/ipstuff
+ return
+ else
+ if [ $i -eq 1 ] ; then
+ sleep 1
+ else
+ echo "Did not get any proper IP configuration"; /bin/ash
+ fi
+ fi
+
+ ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $nwif
+ ip route add default via $router
+ [ $DEBUGLEVEL -gt 0 ] && echo "IP-Configuration: $ip on interface $wlanif."
+else
+ error " No wireless LAN capable interface found. Did you provide the \
+proper kernel\n modules and firmware?"
+fi \ No newline at end of file
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..1e6a97a5
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Base.pm
@@ -0,0 +1,94 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the x11vnc plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #! /bin/sh
+ # completely generic start/stop script, generated via stage1 'x11vnc' plugin
+ # install
+ #
+ # This script manages the services needed to run x11vnc software
+
+ # Basic support for the Linux Standard Base Specification 1.3
+ ### BEGIN INIT INFO
+ # Provides: x11vnc
+ # Required-Start:
+ # Required-Stop:
+ # Default-Start:
+ # Default-Stop:
+ # Short-Description: Manages the services needed to run x11vnc software
+ # Description: Manages the services needed to run x11vnc software
+ ### END INIT INFO
+
+ [ -f /opt/openslx/plugin-repo/x11vnc/x11vnc-init ] \\
+ && CMD="/opt/openslx/plugin-repo/x11vnc/x11vnc-init"
+
+ case \$1 in
+ start)
+ echo "Starting x11vnc ..."
+ \$CMD start
+ ;;
+ stop)
+ # message output should match the given vendor-os
+ echo "Stopping x11vnc ..."
+ \$CMD stop
+ ;;
+ #status)
+ # echo "Say something useful here ..."
+ #;;
+ restart)
+ "\$0" stop
+ "\$0" start
+ ;;
+ esac
+ exit 0
+ End-of-Here
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..6623d22f
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,88 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/debian.pm
+# - provides Debian-specific overrides of the Distro API for the x11vnc
+# plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(x11vnc::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # Ubuntu/Debian specific start/stop script, generated via stage1 'x11vnc'
+ # plugin install
+ # inspiration taken from x11vnc start script:
+ # Copyright 1998-2007 x11vnc, Inc. All rights reserved.
+ #
+ # This script manages the services needed to run x11vnc software
+
+ # Basic support for the Linux Standard Base Specification 1.3
+ ### BEGIN INIT INFO
+ # Provides: x11vnc
+ # Required-Start: \$syslog
+ # Required-Stop:
+ # Default-Start: 2 3 5
+ # Default-Stop: 0 6
+ # Short-Description: Manages the services needed to run x11vnc software
+ # Description: Manages the services needed to run x11vnc software
+ ### END INIT INFO
+
+ # initialize the lsb status messages
+ . /lib/lsb/init-functions
+
+ [ -f /opt/openslx/plugin-repo/x11vnc/x11vnc-init ] \\
+ && CMD="/opt/openslx/plugin-repo/x11vnc/x11vnc-init"
+
+ case \$1 in
+ start)
+ log_daemon_msg "Starting x11vnc background services ..." "x11vnc"
+ \$CMD start
+ log_end_msg \$?
+ ;;
+ stop)
+ log_daemon_msg "Stopping x11vnc background services ..." "x11vnc"
+ \$CMD stop
+ log_end_msg \$?
+ ;;
+ #status)
+ # log_daemon_msg "Say something useful here ..."
+ #;;
+ restart)
+ \$0 stop
+ \$0 start
+ exit $?
+ ;;
+ *)
+ log_success_msg "Usage: \$0 {start|stop|restart}"
+ exit 2
+ ;;
+ esac
+ exit 0
+ End-of-Here
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm
new file mode 100644
index 00000000..a1678912
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Fedora.pm
@@ -0,0 +1,30 @@
+# Copyright (c) 2006, 2007 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Fedora.pm
+# - provides Fedora-specific overrides of the Distro API for the x11vnc
+# plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Fedora;
+
+use strict;
+use warnings;
+
+use base qw(x11vnc::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+# TODO: implement!
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm
new file mode 100644
index 00000000..1bacf1d8
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Gentoo.pm
@@ -0,0 +1,30 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Gentoo.pm
+# - provides Gentoo-specific overrides of the Distro API for the x11vnc
+# plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Gentoo;
+
+use strict;
+use warnings;
+
+use base qw(x11vnc::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+
+################################################################################
+### interface methods
+################################################################################
+
+# TODO: implement!
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..f43a3893
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,91 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Suse.pm
+# - provides SUSE-specific overrides of the Distro API for the x11vnc plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(x11vnc::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub fillRunlevelScript
+{
+ my $self = shift;
+
+ my $script = unshiftHereDoc(<<" End-of-Here");
+ #!/bin/sh
+ # SuSE compatible start/stop script, generated via stage1 'x11vnc' plugin
+ # installation
+ #
+ # inspiration taken from x11vnc start script:
+ # Copyright 1998-2007 x11vnc, Inc. All rights reserved.
+ #
+ # This script manages the services needed to run x11vnc software
+
+ # Basic support for the Linux Standard Base Specification 1.3
+ ### BEGIN INIT INFO
+ # Provides: x11vnc
+ # Required-Start: \$syslog
+ # Required-Stop:
+ # Default-Start: 2 3 5
+ # Default-Stop: 0 6
+ # Short-Description: Manages the services needed to run x11vnc software
+ # Description: Manages the services needed to run x11vnc software
+ ### END INIT INFO
+
+ # load the helper stuff
+ . /etc/rc.status
+ # reset the script status
+ rc_reset
+
+ [ -f /opt/openslx/plugin-repo/x11vnc/x11vnc-init ] \\
+ && CMD="/opt/openslx/plugin-repo/x11vnc/x11vnc-init"
+
+ case \$1 in
+ start)
+ echo -n "Starting x11vnc background services ..."
+ \$CMD start
+ rc_status -v
+ ;;
+ stop)
+ # message output should match the given vendor-os
+ echo -n "Stopping x11vnc background services ..."
+ rc_reset
+ \$CMD stop
+ rc_status -v
+ ;;
+ #status)
+ # echo -n "Say something useful here ..."
+ #;;
+ restart)
+ "\$0" stop
+ "\$0" start
+ ;;
+ *)
+ echo "Usage: `basename "\$0"` {start|stop|restart}"
+ exit 1
+ ;;
+ esac
+ exit 0
+ End-of-Here
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..3379f14d
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,23 @@
+# Copyright (c) 2006, 2007 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu-specific overrides of the Distro API for the x11vnc
+# plugin.
+# -----------------------------------------------------------------------------
+package x11vnc::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+# inherit everything from Debian (as Ubuntu is based on it anyway)
+use base qw(x11vnc::OpenSLX::Distro::Debian);
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm b/src/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm
new file mode 100644
index 00000000..fe06648c
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/OpenSLX/OSPlugin/x11vnc.pm
@@ -0,0 +1,221 @@
+# Copyright (c) 2007, 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# x11vnc.pm
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::x11vnc;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+sub new
+{
+ my $class = shift;
+ my $self = {
+ name => 'x11vnc',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ enables x11vnc server (user or xorg)
+ End-of-Here
+ # waits for xorg to add configuration if needed
+ precedence => 70,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'x11vnc::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'x11vnc' plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+
+ 'x11vnc::mode' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ set x11vnc to listen on Xorg user sessions (default), general
+ access to the Xorg server (including displaymanager login) and
+ console framebuffer.
+ End-of-Here
+ content_regex => qr{^(x11user|x11mod|fb)$},
+ content_descr => 'x11user for user, x11mod for access via Xorg module or fb',
+ default => 'x11user',
+ },
+
+ 'x11vnc::scale' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ scale screen size (e.g. as fraction 2/3 or as decimal 0.5)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+
+ 'x11vnc::shared' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ by default x11vnc is always called with the -shared option
+ End-of-Here
+ content_regex => qr{^(yes|no|1|0)$},
+ content_descr => 'use 1 or yes to enable - 0 or no to disable',
+ default => 'yes',
+ },
+
+ 'x11vnc::force_viewonly' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ disable user interaction with vnc
+ End-of-Here
+ content_regex => qr{^(yes|no|1|0)$},
+ content_descr => 'use 1 or yes to enable - 0 or no to disable',
+ default => 'no',
+ },
+
+ 'x11vnc::auth_type' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ set authentication type of the vnc connection. rfbauth is
+ available for x11user and fb only.
+ End-of-Here
+ content_regex => qr{^(passwd|rfbauth|none)$},
+ content_descr => 'choose: passwd, rfbauth, none',
+ default => 'passwd',
+ },
+
+ 'x11vnc::allowed_hosts' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ set allowed hosts (multiple hosts are seperated by semicolons,
+ (simple) subnets are possible too e.g. "192.168.")
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+
+ 'x11vnc::force_localhost' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ force x11vnc to only accept local connections and only listen
+ on the loopback device
+ End-of-Here
+ content_regex => qr{^(1|0|yes|no)$},
+ content_descr => 'use 1 or yes to enable - 0 or no to disable',
+ default => 'no',
+ },
+
+ 'x11vnc::pass' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ viewonly password (you can add multiple passwords seperated
+ by semicolons, if you're using rfbauth only the first one is
+ used)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+
+ 'x11vnc::viewonlypass' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ viewonly password (you can add multiple passwords seperated by
+ semicolons, disabled with rfb-auth)
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'viewonly',
+ },
+
+ 'x11vnc::logging' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ enable logging
+ End-of-Here
+ content_regex => qr{^(1|0|yes|no)$},
+ content_descr => 'use 1 or yes to enable - 0 or no to disable',
+ default => 'yes',
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepositoryPath = $info->{'plugin-repo-path'};
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ my $openslxBasePath = $info->{'openslx-base-path'};
+
+ # should we distinguish between the two different packages!?
+ # libvnc should be part of the xorg package!? (so no check needed)
+ my $engine = $self->{'os-plugin-engine'};
+ if (!isInPath('x11vnc')) {
+ $engine->installPackages(
+ $engine->getInstallablePackagesForSelection('x11vnc')
+ );
+ } else {
+ vlog(3, "x11vnc is already installed");
+ }
+
+ # get path of files we need to install
+ my $pluginFilesPath = "$openslxBasePath/lib/plugins/$self->{'name'}/files";
+ my $script = $self->{distro}->fillRunlevelScript();
+
+ # copy all needed files now
+ copyFile("$pluginFilesPath/x11vnc-init", "$pluginRepositoryPath");
+
+ spitFile("/etc/init.d/x11vnc", $script);
+ chmod 0755, "/etc/init.d/x11vnc";
+
+ vlog(3, "install init file");
+
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+}
+
+1;
diff --git a/src/os-plugins/plugins/x11vnc/XX_x11vnc.sh b/src/os-plugins/plugins/x11vnc/XX_x11vnc.sh
new file mode 100644
index 00000000..3970e468
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/XX_x11vnc.sh
@@ -0,0 +1,135 @@
+# Copyright (c) 2007..2009 - RZ Uni Freiburg
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# check if the plugin config directory is generally available or if the client
+# configuration failed somehow
+[ -d /initramfs/plugin-conf ] || error "${init_picfg}" nonfatal
+
+# function to add vnc functionality to xorg server
+addvnc2xorg () {
+ sed -e '/^# autog/a# modified by x11vnc plugin (adding vnc module config)' \
+ -e '/\"Module\"/a\\ \ Load "vnc"' \
+ -e '/n \"Device\"/a\\ \ Option "usevnc" "yes"' \
+ -e '/n \"Device\"/a\\ \ Option "rfbauth" "/etc/X11/vncpasswd"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "VNC Keyboard" "ExtraKeyboard"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "VNC Mouse" "ExtraPointer"' \
+ -e '/\"CorePointer\"/ {
+a\
+EndSection\
+Section "InputDevice"\
+ Identifier "VNC Keyboard"\
+ Driver "rfbkeyb"\
+EndSection\
+Section "InputDevice"\
+ Identifier "VNC Mouse"\
+ Driver "rfbmouse"
+}' -i /mnt/etc/X11/xorg.conf
+}
+
+# main script
+if [ -e /initramfs/plugin-conf/x11vnc.conf ]; then
+ . /initramfs/plugin-conf/x11vnc.conf
+ if [ $x11vnc_active -ne 0 ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'x11vnc' os-plugin ...";
+ # configure x11vnc user mode or framebuffer
+ if [ "$x11vnc_mode" = "x11user" -o "$x11vnc_mode" = "fb" ] ; then
+ # create config dir for stage 3
+ mkdir -p /mnt/etc/x11vnc
+ # default parameters
+ PARAMS="-bg -forever"
+ # client restrictions
+ if [ -z x11vnc_allowed_hosts ]; then
+ PARAMS="$PARAMS -allow $x11vnc_allowd_hosts"
+ fi
+ # mode
+ case "$x11vnc_mode" in
+ x11user)
+ PARAMS="$PARAMS -display :0"
+ X11VNC_X11=1
+ ;;
+ fb)
+ PARAMS="$PARAMS -rawfb console"
+ ;;
+ esac
+ # auth type
+ case "$x11vnc_auth_type" in
+ passwd)
+ # use x11vnc passwd style - recommended
+ echo "$x11vnc_pass" > /mnt/etc/x11vnc/passwd
+ echo "__BEGIN_VIEWONLY__" >> /mnt/etc/x11vnc/passwd
+ echo "$x11vnc_viewonlypass" >> /mnt/etc/x11vnc/passwd
+ # multiuser handling
+ sed -i "s/,/\n/" /mnt/etc/x11vnc/passwd
+ # add parameter to commandline
+ PARAMS="$PARAMS -passwdfile rm:/etc/x11vnc/passwd"
+ ;;
+ rfbauth)
+ # use rfbauth
+ vncpasswd "$x11vnc_pass" > /mnt/etc/x11vnc/passwd
+ PARAMS="$PARAMS -rfbauth /etc/x11vnc/passwd"
+ ;;
+ *)
+ # no password
+ PARAMS="$PARAMS -nopw"
+ ;;
+ esac
+
+ # force viewonly
+ if [ "$x11vnc_force_viewonly" = "1" \
+ -o "$x11vnc_force_viewonly" = "yes" ]; then
+ PARAMS="$PARAMS -viewonly"
+ fi
+
+ # force localhost
+ if [ "$x11vnc_force_localhost" = "1" \
+ -o "$x11vnc_force_localhost" = "yes" ]; then
+ PARAMS="$PARAMS -localhost"
+ fi
+
+ # enable logging
+ if [ "$x11vnc_logging" = "1" -o "$x11vnc_logging" = "yes" ]; then
+ PARAMS="$PARAMS -o /var/log/x11vnc.log"
+ fi
+
+ # shared desktops
+ if [ "$x11vnc_shared" = "1" -o "$x11vnc_shared" = "yes" ]; then
+ PARAMS="$PARAMS -shared"
+ fi
+
+ # scale desktop
+ if [ "$x11vnc_scale" != "" ]; then
+ PARAMS="$PARAMS -scale $x11vnc_scale"
+ fi
+
+ # write config file
+ echo "# parameters generated by $0" > /mnt/etc/x11vnc/x11vnc.conf
+ echo "X11VNC_PARAMS=\"$PARAMS\"" >> /mnt/etc/x11vnc/x11vnc.conf
+ echo "X11VNC_X11=\"$X11VNC_X11\"" >> /mnt/etc/x11vnc/x11vnc.conf
+
+ rllinker "x11vnc" 30 10
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'x11vnc' os-plugin ...";
+
+ # x11mod offers access to the running X server via module
+ elif [ "$x11vnc_mode" = "x11mod" ]; then
+ # password setting (use stage4 environment)
+ echo -e "$x11vnc_pass\n$x11vnc_viewonlypass" | chroot /mnt vncpasswd -f \
+ > /mnt/etc/X11/vncpasswd
+ ( waitfor /mnt/etc/X11/xorg.conf 10000; addvnc2xorg ) &
+ fi
+ fi
+else
+ [ $DEBUGLEVEL -gt 2 ] && \
+ echo "No configuration file found for x11vnc plugin."
+fi
diff --git a/src/os-plugins/plugins/x11vnc/files/x11vnc-init b/src/os-plugins/plugins/x11vnc/files/x11vnc-init
new file mode 100755
index 00000000..548b2114
--- /dev/null
+++ b/src/os-plugins/plugins/x11vnc/files/x11vnc-init
@@ -0,0 +1,83 @@
+#!/bin/bash
+# --------------------------------
+# /etc/init.d/x11vnc
+# --------------------------------
+
+if [ -f /etc/x11vnc/x11vnc.conf ]
+then
+ . /etc/x11vnc/x11vnc.conf
+fi
+
+# find xauthority file
+find_xauth () {
+ FOUND=0
+ RETRIES=4
+ [ -z "$1" ] || RETRIES="$1"
+
+ [ -e "/var/lib/kdm/" ] &&
+ XAUTHFILE_KDM=`find /var/lib/kdm/ -iname "A\:0-*"`
+ [ -e "/var/run/xauth/" ] &&
+ XAUTHFILE_KDM2=`find /var/run/xauth/ -iname "A\:0-*"`
+ [ -e "/var/lib/xdm/authdir/authfiles/" ] &&
+ XAUTHFILE_XDM=`find /var/lib/xdm/authdir/authfiles/ -iname "A\:0-*"`
+ [ -e "/var/lib/gdm/" ] &&
+ XAUTHFILE_GDM=`find /var/lib/gdm/ -iname *Xauth*`
+
+ [ -f "$XAUTHFILE_KDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_KDM"
+ [ -f "$XAUTHFILE_KDM2" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_KDM2"
+ [ -f "$XAUTHFILE_XDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_XDM"
+ [ -f "$XAUTHFILE_GDM" ] && FOUND=1 && XAUTHORITY="$XAUTHFILE_GDM"
+
+ if [ "$FOUND" -eq "0" ]; then
+ if [ "$RETRIES" -gt "0" ]; then
+ let "RETRIES-=1"
+ find_xauth "$RETRIES"
+ else
+ echo "start FAILED (can't find way to authenticate myself against X)" >>/var/log/x11vnc.debug
+ exit -1
+ fi
+ else
+ echo "found authfile ($XAUTHORITY)" >>/var/log/x11vnc.debug
+ fi
+}
+
+START_COMMAND="x11vnc"
+
+case "$1" in
+ start)
+
+ if [ ! -f /etc/x11vnc/passwd ]; then
+ echo " start FAILED (/etc/x11vnc/passwd not found)" >>/var/log/x11vnc.debug
+ echo " Create it manualy and retry starting x11vnc" >>/var/log/x11vnc.debug
+ exit -1;
+ fi
+
+ #su -c "$COMMAND" -l x11vnc &
+ if [ $X11VNC_X11 = 1 ]; then
+ find_xauth
+ START_COMMAND="$START_COMMAND -auth $XAUTHORITY $X11VNC_PARAMS"
+ else
+ START_COMMAND="$START_COMMAND $X11VNC_PARAMS"
+ fi
+ OUTPUT=`$START_COMMAND`
+ echo "$START_COMMAND" >>/var/log/x11vnc.debug
+ echo "$OUTPUT" >>/var/log/x11vnc.debug
+ ;;
+ stop)
+ pid=`pidof x11vnc`
+ if [ -z "$pid" ]
+ then
+ echo "x11vnc not running" >>/var/log/x11vnc.debug
+ exit -1;
+ else
+ kill -9 $pid
+ echo "x11vnc stopped" >>/var/log/x11vnc.debug
+ fi
+
+ ;;
+ *)
+ echo "x11vnc startscript"
+ echo "Usage: $0 (start|stop)"
+ ;;
+esac
+exit 0
diff --git a/src/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm b/src/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm
new file mode 100644
index 00000000..12331983
--- /dev/null
+++ b/src/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm
@@ -0,0 +1,185 @@
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xen.pm
+# - implementation of the 'xen' plugin
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::xen;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'xen',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Configures Xen diskless boot, no installation yet.
+ End-of-Here
+ precedence => 10,
+ };
+}
+
+sub getAttrInfo
+{
+ my $self = shift;
+
+ return {
+ 'xen::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'xen'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ # set active to 0, later set specially created Xen system to 1
+ default => '0',
+ },
+ # attribute 'imagesrc' defines where we can find xen images
+ 'xen::imagesrc' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Where do we store our xen images? NFS? Filesystem?
+ End-of-Here
+ content_regex => qr{^(/|nfs://)},
+ content_descr => 'local path or URI or "-" (unset)',
+ default => undef,
+ },
+ # attribute 'tftpdir' defines TFTP dir for network boots /w NAT
+ 'xen::tftpdir' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Do you want to define a stage 4 TFTP dir for netwoork boots?
+ Needed to boot Xen via NFS, we only need the initramfs
+ Hint: Mount your TFTP ro via NFS to a local dir
+ End-of-Here
+ content_regex => qr{^(/)},
+ content_descr => 'local path or "-" (unset)',
+ default => undef,
+ },
+ };
+}
+
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+
+ # Copy run-virt.include and template files to the appropriate place for
+ # inclusion in stage4
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath =
+ "$self->{openslxBasePath}/lib/plugins/$pluginName/files";
+
+ foreach my $file ( qw( run-virt.include machine.include hvm.include ) ) {
+ copyFile("$pluginBasePath/$file", "$self->{pluginRepositoryPath}/");
+ chmod 0644, "$self->{pluginRepositoryPath}/$file";
+ }
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
+sub suggestAdditionalKernelModules
+{
+ my $self = shift;
+ my $makeInitRamFSEngine = shift;
+
+ my @suggestedModules;
+
+ # Xen needs bridge module, for guests xennet and maybe xenblk
+ # earlier versions needed netloop
+ push @suggestedModules, qw( bridge xennet xenblk );
+
+ return @suggestedModules;
+}
+
+#sub _xenLabel
+#{
+# # set label for each Xen system
+# foreach my $info (@$systemInfos) {
+# if ($info->{xen::active} eq 1) {
+# my $label = $info->{label} || '';
+# if (!length($label) || $label eq $info->{name}) {
+# if ($info->{name} =~ m{^(.+)::(.+)$}) {
+# my $system = $1;
+# my $exportType = $2;
+# $label = $system . "-xen" . ' ' x (36-length($system))
+# . $exportType;
+# } else {
+# $label = $info->{name};
+# }
+# }
+# }
+# $info->{pxeLabel} = $label;
+# }
+# return $info; #???
+#}
+
+#sub _xenBootEntry
+#{
+# # Xen entries look different
+# # Example:
+# # KERNEL mboot.c32 vendor-os/xen.gz dom0_mem=128000 ---
+# # vendor-os/vmlinuz-xen debug=3 --- vendor-os/initramfs-1
+# # TODO: versionsort oder per attr?
+# if ($info->{xen::active} eq 1) {
+# my $xenKernel = slxsystem(ls /boot/xen* | sort | tail -n 1);
+# $append .= " file=$bootURI" if length($bootURI);
+# $append .= " file=$tftpPrefix" if length($tftpPrefix);
+# $append .= " $clientAppend";
+# $append .= " --- $pxePrefix$vendorOSName/$info->{'initramfs-name'}";
+# $slxLabels .= "LABEL openslx-$info->{'external-id'}-xen\n";
+# # $slxLabels .= $pxeDefault;
+# $slxLabels .= "\tMENU LABEL ^$info->{pxeLabel}\n";
+# $slxLabels .= "\tKERNEL mboot.c32\n";
+# $slxLabels .= "\tAPPEND $pxePrefix$vendorOSName/$xenKernel";
+# # $slxLabels .= " dom0_mem=128000";
+# $slxLabels .= " --- $pxePrefix$vendorOSName/$kernelName";
+# $slxLabels .= " --- $append\n";
+# $slxLabels .= "\tIPAPPEND 3\n";
+# }
+# return $slxLabels;
+#}
+
+1;
diff --git a/src/os-plugins/plugins/xen/XX_xen.sh b/src/os-plugins/plugins/xen/XX_xen.sh
new file mode 100644
index 00000000..7dddeee0
--- /dev/null
+++ b/src/os-plugins/plugins/xen/XX_xen.sh
@@ -0,0 +1,73 @@
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'xen' plugin - the runlevel script
+#
+# 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/xen.conf
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/xen
+PLUGINDIR=/mnt/${OPENSLX_DEFAULT_DIR}/plugin-repo/xen
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/xen
+
+# check if the configuration file is available
+if [ -e ${CONFFILE} ]; then
+
+ # load needed variables
+ . ${CONFFILE}
+
+ # Test if this plugin is activated... more or less useless with the
+ # new plugin system
+ if [ $xen_active -ne 0 2>/dev/null ]; then
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'xen' os-plugin ...";
+
+ # load general configuration
+ . /etc/initramfs-setup
+
+ # get source of xen image server (get type, server and path)
+ if strinstr "/" "${xen_imagesrc}" ; then
+ vbimgprot=$(uri_token ${xen_imagesrc} prot)
+ vbimgserv=$(uri_token ${xen_imagesrc} server)
+ vbimgpath="$(uri_token ${xen_imagesrc} path)"
+ fi
+ if [ -n "${vbimgserv}" ] ; then
+ # directory where qemu images are expected in
+ mnttarget=${VIRTDIR}
+ # mount the xen image source readonly (ro)
+ fsmount ${vbimgprot} ${vbimgserv} ${vbimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && \
+ error " * Incomplete information in variable ${xen_imagesrc}." \
+ nonfatal
+ fi
+
+ # copy virtualization include files to config dir
+ testmkd ${PLUGINCONFDIR}
+ testmkd /mnt/var/log/xen
+ testmkd /mnt/var/run/xend
+ testmkd /mnt/var/run/xenstored
+ cp ${PLUGINDIR}/*.include ${PLUGINCONFDIR}
+ # copy ${CONFFILE} to ${PLUGINCONFDIR} just in case
+ cp ${CONFFILE} ${PLUGINCONFDIR}
+
+ # activate init files
+ # TODO: in xen-slx start
+ # increase loop devices for loop images
+ modprobe -q loop max_loop=64 >/tmp/xen.log 2>&1
+ rllinker "xendomains" 14 8
+ rllinker "xend" 13 9
+ fi
+fi
diff --git a/src/os-plugins/plugins/xen/files/hvm.include b/src/os-plugins/plugins/xen/files/hvm.include
new file mode 100644
index 00000000..beb9315a
--- /dev/null
+++ b/src/os-plugins/plugins/xen/files/hvm.include
@@ -0,0 +1,209 @@
+# This is an machine template for run-virt.include of the Xen plugin.
+# This template was taken from an example in openSUSE 11.2
+# HVM template
+
+cat <<EOF
+# -*- mode: python; -*-
+#============================================================================
+# Python configuration setup for 'xm create'.
+# This configuration was created through $0 on $(date)
+#============================================================================
+
+import os, re
+
+arch_libdir = 'lib'
+arch = os.uname()[4]
+if os.uname()[0] == 'Linux' and re.search('64', arch):
+ arch_libdir = 'lib64'
+
+#----------------------------------------------------------------------------
+# Kernel image file.
+kernel = "/usr/lib/xen/boot/hvmloader"
+
+# The domain build function. HVM domain uses 'hvm'.
+builder='hvm'
+
+# Initial memory allocation (in megabytes) for the new domain.
+memory = ${mem}
+
+# Shadow pagetable memory for the domain, in MB.
+# If not explicictly set, xend will pick an appropriate value.
+# Should be at least 2KB per MB of domain memory, plus a few MB per vcpu.
+#shadow_memory = 8
+
+# A name for your domain. All domains must have different names.
+name = "${vm_name}"
+
+#-----------------------------------------------------------------------------
+# The number of cpus guest platform has, default=1
+#vcpus=1
+
+# Enable/disable HVM guest PAE, default=1 (enabled)
+#pae=1
+
+# Enable/disable HVM guest ACPI, default=1 (enabled)
+#acpi=1
+
+# Enable/disable HVM APIC mode, default=1 (enabled)
+# Note that this option is ignored if vcpus > 1
+#apic=1
+
+# Enable/disable extended power management support within HVM guest, i.e., beyond
+# S3, S4, S5 within guest like exposing battery meter.
+# 0 (default option, extended power management support disabled)
+# 1 (pass-through mode; uses pass-through as needed; efficient but limited in scope)
+# 2 (non pass-through mode; extended scope, likely to work on all applicable environment
+# but comparitively less efficient than pass-through mode)
+# xen_extended_power_mgmt=0
+
+# List of which CPUS this domain is allowed to use, default Xen picks
+#cpus = "" # leave to Xen to pick
+#cpus = "0" # all vcpus run on CPU0
+#cpus = "0-3,5,^1" # all vcpus run on cpus 0,2,3,5
+#cpus = ["2", "3"] # VCPU0 runs on CPU2, VCPU1 runs on CPU3
+
+#----------------------------------------------------------------------------
+# Optionally define mac and/or bridge for the network interfaces.
+# Random MACs are assigned if not given.
+#vif = [ 'type=ioemu, mac=00:16:3e:00:00:11, bridge=xenbr0, model=ne2k_pci' ]
+# type=ioemu specify the NIC is an ioemu device not netfront
+#vif = [ 'type=ioemu, bridge=xenbr0' ]
+vif = [ '${xen_vif}' ]
+
+#----------------------------------------------------------------------------
+# Define the disk devices you want the domain to have access to, and
+# what you want them accessible as.
+# Each disk entry is of the form phy:UNAME,DEV,MODE
+# where UNAME is the device, DEV is the device name the domain will see,
+# and MODE is r for read-only, w for read-write.
+#disk = [ 'phy:hda1,hda1,r' ]
+#disk = [ 'file:/var/lib/xen/images/disk.img,ioemu:hda,w', ',hdc:cdrom,r' ]
+disk = [ '${xen_disk}' ]
+
+#----------------------------------------------------------------------------
+# Configure the behaviour when a domain exits. There are three 'reasons'
+# for a domain to stop: poweroff, reboot, and crash. For each of these you
+# may specify:
+# "destroy", meaning that the domain is cleaned up as normal;
+# "restart", meaning that a new domain is started in place of the old
+# one;
+# "preserve", meaning that no clean-up is done until the domain is
+# manually destroyed (using xm destroy, for example); or
+# "rename-restart", meaning that the old domain is not cleaned up, but is
+# renamed and a new domain started in its place.
+# In the event a domain stops due to a crash, you have the additional options:
+# "coredump-destroy", meaning dump the crashed domain's core and then destroy;
+# "coredump-restart', meaning dump the crashed domain's core and the restart.
+# The default is
+# on_poweroff = 'destroy'
+# on_reboot = 'restart'
+# on_crash = 'restart'
+#on_poweroff = 'destroy'
+#on_reboot = 'restart'
+#on_crash = 'restart'
+
+#============================================================================
+# HVM specific
+#============================================================================
+# Device Model to be used
+device_model = '/usr/' + arch_libdir + '/xen/bin/qemu-dm'
+
+#-----------------------------------------------------------------------------
+# boot on floppy (a), hard disk (c), Network (n) or CD-ROM (d)
+# default: hard disk, cd-rom, floppy
+#boot="cda"
+
+#-----------------------------------------------------------------------------
+# write to temporary files instead of disk image files
+#snapshot=1
+
+#----------------------------------------------------------------------------
+# enable SDL library for graphics, default = 0
+sdl=0
+
+#----------------------------------------------------------------------------
+# enable OpenGL for texture rendering inside the SDL window, default = 1
+# valid only if sdl is enabled.
+opengl=1
+
+#----------------------------------------------------------------------------
+# enable VNC library for graphics, default = 1
+vnc=1
+
+#----------------------------------------------------------------------------
+# address that should be listened on for the VNC server if vnc is set.
+# default is to use 'vnc-listen' setting from /etc/xen/xend-config.sxp
+#vnclisten="127.0.0.1"
+
+#----------------------------------------------------------------------------
+# set VNC display number, default = domid
+#vncdisplay=1
+
+#----------------------------------------------------------------------------
+# try to find an unused port for the VNC server, default = 1
+#vncunused=1
+
+#----------------------------------------------------------------------------
+# set password for domain's VNC console
+# default is depents on vncpasswd in xend-config.sxp
+vncpasswd=''
+
+#----------------------------------------------------------------------------
+# no graphics, use serial port
+#nographic=0
+
+#----------------------------------------------------------------------------
+# enable stdvga, default = 0 (use cirrus logic device model)
+stdvga=0
+
+#-----------------------------------------------------------------------------
+# serial port re-direct to pty deivce, /dev/pts/n
+# then xm console or minicom can connect
+serial='pty'
+
+
+#-----------------------------------------------------------------------------
+# Qemu Monitor, default is disable
+# Use ctrl-alt-2 to connect
+#monitor=1
+
+
+#-----------------------------------------------------------------------------
+# enable sound card support, [sb16|es1370|all|..,..], default none
+#soundhw='sb16'
+
+
+#-----------------------------------------------------------------------------
+# set the real time clock to local time [default=0 i.e. set to utc]
+#localtime=1
+
+
+#-----------------------------------------------------------------------------
+# set the real time clock offset in seconds [default=0 i.e. same as dom0]
+#rtc_timeoffset=3600
+
+#-----------------------------------------------------------------------------
+# start in full screen
+#full-screen=1
+
+
+#-----------------------------------------------------------------------------
+# Enable USB support (specific devices specified at runtime through the
+# monitor window)
+#usb=1
+# Enable USB mouse support (only enable one of the following, `mouse' for
+# PS/2 protocol relative mouse, `tablet' for
+# absolute mouse)
+#usbdevice='mouse'
+#usbdevice='tablet'
+
+#-----------------------------------------------------------------------------
+# Set keyboard layout, default is en-us keyboard.
+#keymap='de'
+
+#-----------------------------------------------------------------------------
+# Enable/disable xen platform PCI device, default=1 (enabled)
+#xen_platform_pci=1
+
+#============================================================================
+EOF
diff --git a/src/os-plugins/plugins/xen/files/machine.include b/src/os-plugins/plugins/xen/files/machine.include
new file mode 100644
index 00000000..06848949
--- /dev/null
+++ b/src/os-plugins/plugins/xen/files/machine.include
@@ -0,0 +1,167 @@
+# This is an machine template for run-virt.include of the Xen plugin.
+# This template was taken from an example in openSUSE 11.2
+
+cat <<EOF
+# -*- mode: python; -*-
+#============================================================================
+# Python configuration setup for 'xm create'.
+# This configuration was created through $0 on $(date)
+#============================================================================
+
+#----------------------------------------------------------------------------
+# Kernel image file and (optional) ramdisk (initrd).
+kernel = "${xen_kernel}"
+ramdisk = "${xen_ramdisk}"
+
+# Or use domUloader instead of kernel/ramdisk to get kernel from domU FS
+#bootloader = "/usr/lib/xen/boot/domUloader.py"
+#bootentry = "hda1:/${xen_kernel},/${xen_ramdisk}"
+# TODO: check these:
+#bootargs="--entry=xvda2:/boot/vmlinuz-xen,/boot/initrd-xen"
+
+localtime=0
+
+# The domain build function. Default is 'linux', HVM domain uses 'hvm'.
+builder = 'linux'
+
+# Initial memory allocation (in megabytes) for the new domain.
+memory = ${mem}
+
+# A name for your domain. All domains must have different names.
+name = "${vm_name}"
+
+# List of which CPUS this domain is allowed to use, default Xen picks
+#cpus = "" # leave to Xen to pick
+#cpus = "0" # all vcpus run on CPU0
+#cpus = "0-3,5,^1" # run on cpus 0,2,3,5
+#cpus = "${xen_cpus}"
+
+# Number of Virtual CPUS to use, default is 1
+#vcpus = ${xen_vcpus}
+
+#----------------------------------------------------------------------------
+# Define network interfaces.
+
+# By default, no network interfaces are configured. You may have one created
+# with sensible defaults using an empty vif clause:
+# vif = [ '' ]
+# or optionally override backend, bridge, ip, mac, script, type, or vifname:
+# vif = [ 'mac=00:16:3e:00:00:11, bridge=xenbr0' ]
+# or more than one interface may be configured:
+# vif = [ '', 'bridge=xenbr1' ]
+vif = [ '${xen_vif}' ]
+
+#----------------------------------------------------------------------------
+# Define the disk devices you want the domain to have access to, and
+# what you want them accessible as.
+# Each disk entry is of the form phy:UNAME,DEV,MODE
+# where UNAME is the device, DEV is the device name the domain will see,
+# and MODE is r for read-only, w for read-write.
+# disk = [ 'phy:hda1,hda1,w' ]
+${xen_disk}
+
+#----------------------------------------------------------------------------
+# Define frame buffer device.
+# By default, no frame buffer device is configured.
+# To create one using the SDL backend and sensible defaults:
+# vfb = [ 'type=sdl' ]
+# This uses environment variables XAUTHORITY and DISPLAY. You
+# can override that:
+# vfb = [ 'type=sdl,xauthority=/home/bozo/.Xauthority,display=:1' ]
+# To create one using the VNC backend and sensible defaults:
+# vfb = [ 'type=vnc' ]
+# The backend listens on 127.0.0.1 port 5900+N by default, where N is
+# the domain ID. You can override both address and N:
+# vfb = [ 'type=vnc,vnclisten=127.0.0.1,vncdisplay=1' ]
+# Or you can bind the first unused port above 5900:
+# vfb = [ 'type=vnc,vnclisten=0.0.0.0,vnunused=1' ]
+# You can override the password:
+# vfb = [ 'type=vnc,vncpasswd=MYPASSWD' ]
+# Empty password disables authentication. Defaults to the vncpasswd
+# configured in xend-config.sxp.
+
+#----------------------------------------------------------------------------
+# Define to which TPM instance the user domain should communicate.
+# The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
+# where INSTANCE indicates the instance number of the TPM the VM
+# should be talking to and DOM provides the domain where the backend
+# is located.
+# Note that no two virtual machines should try to connect to the same
+# TPM instance. The handling of all TPM instances does require
+# some management effort in so far that VM configration files (and thus
+# a VM) should be associated with a TPM instance throughout the lifetime
+# of the VM / VM configuration file. The instance number must be
+# greater or equal to 1.
+#vtpm = [ 'instance=1,backend=0' ]
+
+#----------------------------------------------------------------------------
+# Set the kernel command line for the new domain.
+# You only need to define the IP parameters and hostname if the domain's
+# IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
+# You can use 'extra' to set the runlevel and custom environment
+# variables used by custom rc scripts (e.g. VMID=, usr= ).
+
+# Set if you want dhcp to allocate the IP address.
+dhcp="${xen_dhcp}"
+# Set netmask.
+#netmask=
+# Set default gateway.
+#gateway=
+# Set the hostname.
+hostname= "${hostname}"
+
+# Set root device (eg. /dev/hda1).
+root = "${xen_root}"
+
+# Root device for nfs.
+#root = "/dev/nfs"
+# The nfs server.
+#nfs_server = '169.254.1.0'
+# Root directory on the nfs server.
+#nfs_root = '/full/path/to/root/directory'
+
+# Extra arguments to pass to the kernel.
+# Eg: set runlevel
+extra = "${xen_extra}"
+
+#----------------------------------------------------------------------------
+# Configure the behaviour when a domain exits. There are three 'reasons'
+# for a domain to stop: poweroff, reboot, and crash. For each of these you
+# may specify:
+# "destroy", meaning that the domain is cleaned up as normal;
+# "restart", meaning that a new domain is started in place of the old
+# one;
+# "preserve", meaning that no clean-up is done until the domain is
+# manually destroyed (using xm destroy, for example); or
+# "rename-restart", meaning that the old domain is not cleaned up, but is
+# renamed and a new domain started in its place.
+# In the event a domain stops due to a crash, you have the additional options:
+# "coredump-destroy", meaning dump the crashed domain's core and then destroy;
+# "coredump-restart', meaning dump the crashed domain's core and the restart.
+# The default is
+# on_poweroff = 'destroy'
+# on_reboot = 'restart'
+# on_crash = 'restart'
+#on_poweroff = 'destroy'
+#on_reboot = 'restart'
+#on_crash = 'restart'
+
+#-----------------------------------------------------------------------------
+# Configure PVSCSI devices:
+# PDEV gives physical SCSI device to be attached to specified guest
+# domain by one of the following identifier format.
+# - XX:XX:XX:XX (4-tuples with decimal notation which shows
+# "host:channel:target:lun")
+# - /dev/sdxx or sdx
+# - /dev/stxx or stx
+# - /dev/sgxx or sgx
+# - result of 'scsi_id -gu -s'.
+# ex. # scsi_id -gu -s /block/sdb
+# 36000b5d0006a0000006a0257004c0000
+# VDEV gives virtual SCSI device by 4-tuples (XX:XX:XX:XX) as
+# which the specified guest domain recognize.
+#vscsi = [ 'PDEV, VDEV' ]
+#vscsi = [ '/dev/sdx, 0:0:0:0' ]
+
+#============================================================================
+EOF
diff --git a/src/os-plugins/plugins/xen/files/run-virt.include b/src/os-plugins/plugins/xen/files/run-virt.include
new file mode 100644
index 00000000..36a1d1f4
--- /dev/null
+++ b/src/os-plugins/plugins/xen/files/run-virt.include
@@ -0,0 +1,157 @@
+# run-virt.include
+# -----------------------------------------------------------------------------
+# Copyright (c) 2010 - RZ Uni Freiburg
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+# -----------------------------------------------------------------------------
+# run-virt.include
+# - Include script for running Xen on an OpenSLX client via the run-virt.sh
+# or run-vmgrid.sh
+################################################################################
+
+################################################################################
+### Include general configuration
+################################################################################
+if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf ]; then
+ . ${OPENSLX_DEFAULT_CONFDIR}/plugins/${self}/${self}.conf
+else
+ writelog "Problems reading config file of ${self} plugin"
+ exit 1
+fi
+
+################################################################################
+### Declaration of default variables
+################################################################################
+
+PLUGINCONFXEN="${PLUGINCONFROOT}/${self}"
+# create TMPDIR for all users
+mkdir -m 1777 /tmp/${self} 2>/dev/null
+# dir for configs
+confdir="/tmp/${self}/${USER}/${VM_ID}"
+# use vm_shortname for VM name since vm_name can be very long
+# add id so we can start more tahn one of the same image
+vm_name="${vm_shortname}-${VM_ID}"
+conffile=${confdir}/${vm_name}
+# define dirs and files which can be removed after exit, be carefull!
+rm -rf ${confdir} 2>/dev/null
+mkdir -p ${confdir} 2>/dev/null
+
+xen_kernel=${kernel:-"/boot/vmlinuz-xen"}
+xen_ramdisk=${initramfs:-"/boot/initrd-xen"}
+xen_extra="xencons=tty 3"
+[ -n "${imgname}" ] && xen_disk="disk = [ 'file:${vmpath},hda1,r' ]"
+
+writelog "Directories:"
+writelog "\tConfig dir:\t\t$confdir"
+
+################################################################################
+### Hardware checks
+################################################################################
+
+# memory part equal to vmware plugin
+# percentage of memory to use for virtualbox in standard case
+if [ -n "${forcemem}" ]; then
+ mem="${forcemem}"
+else
+ permem=30
+ if [ "${totalmem}" -ge "1600" ]; then
+ permem=40
+ fi
+ # check if /tmp is on harddisk
+ if grep -qe "/dev/.* /tmp " /proc/mounts ; then
+ permem=60
+ id44="1"
+ # Hack, if more than 2,5G RAM use 40% of Ram and write vmem into Ram as well
+ # (40% vmware | 40% confdir(vmem...) | 20% host
+ # VMplayer 2+ issue
+ # TODO: makes this sense for vbox?
+ #if [ "${totalmem}" -ge "2500" ]; then
+ #permem=40
+ #rmdir ${snapshotdir}
+ #snapshotdirold=${snapshotdir}
+ #snapshotdir=/dev/shm/${self}/${USER}/${VM_ID}
+ #mkdir -p ${snapshotdir}
+ #ln -sf ${snapshotdir} ${snapshotdirold}
+ #fi
+ fi
+ mem=$(expr ${totalmem} / 100 \* ${permem})
+ if [ "${id44}" = "1" ]; then
+ memhost=$(expr ${totalmem} - ${mem})
+ else
+ memhost=$(expr ${totalmem} - ${mem} - ${mem})
+ fi
+ #permem=40
+ #mem=$(expr ${totalmem} * ${permem})
+ if [ "${mem}" -lt "256" ] || [ "${memhost}" -lt "256" ]; then
+ writelog "Memory out of range: ${mem} MB (guest) / ${memhost} MB (host)!"
+ writelog "Min. 256 MB for host and guest!"
+ exit 1
+ fi
+fi
+
+# translate network kinds (nat, bridged, host-only)
+case "${network_kind}" in
+ bridge*)
+ xen_vif="mac=$macaddr, bridge=br0"
+ ;;
+ *)
+ xen_vif="mac=$macaddr"
+esac
+xen_dhcp="dhcp" # off
+
+# translate boot, use if set else set to disk
+xen_root=/dev/hda1
+case ${boot} in
+ n*|tftp)
+ pxe_label=$(grep -o 'pxe_label param=.*"' ${xmlfile} \
+ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+ pxe_label=$(grep -A 3 "^LABEL *${pxe_label}" \
+ ${xen_tftpdir}/pxelinux.cfg/default 2>/dev/null \
+ | grep "^ *KERNEL ")
+ if [ -n "${pxe_label}" ] && [ -n "${xen_tftpdir}" ]; then
+ xen_root=/dev/nfs
+ xen_kernel="${xen_tftpdir}/$(echo ${pxe_label} \
+ | awk -F " --- " '{print $2}' | awk '{print $1}')"
+ xen_ramdisk="${xen_tftpdir}/$(echo ${pxe_label} \
+ | awk -F " --- " '{print $3}')"
+ fi
+ ;;
+ # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM
+ *)
+ xen_root=/dev/hda1
+ ;;
+esac
+
+[ ${diskless} -eq 0 ] && writelog "Diskimage:"
+[ ${diskless} -eq 0 ] && writelog "\tMachine diskfile:\t$vmpath"
+writelog "Virtual Hardware:"
+writelog "\tGuest RAM:\t\t${mem} MB"
+# echo nur wenn memhost gesetzt
+[ -n "${memhost}" ] && writelog "\tHost RAM:\t\t${memhost} MB"
+writelog "\tMAC address:\t\t$macaddr"
+
+################################################################################
+### Pepare and configure virtual machine and disk image
+################################################################################
+
+. ${PLUGINCONFXEN}/machine.include > ${conffile}
+
+################################################################################
+### finally set env for run-virt.sh
+################################################################################
+
+# set the variables appropriately (several interfaces with different names)
+VIRTCMD=$(which xm 2>/dev/null)
+# '-c' for console, no graphical output available, later vnc possible
+VIRTCMDOPTS="create -c ${conffile}"
+
+# set headless mode
+VIRTCMDHL=$(which xm 2>/dev/null)
+VIRTCMDOPTSHL="create ${conffile}"
diff --git a/src/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh b/src/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh
new file mode 100644
index 00000000..d514b68d
--- /dev/null
+++ b/src/os-plugins/plugins/xen/init-hooks/10-nw-if-config/xennet.sh
@@ -0,0 +1,4 @@
+# load xennet if necessary, usualy within a NFS VM
+if grep -q "Xen Virtual Ethernet Card" /etc/hwinfo.netcard-usbctrl; then
+ modprobe xennet >/tmp/xennet.log 2>&1
+fi
diff --git a/src/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh b/src/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh
new file mode 100755
index 00000000..d5245234
--- /dev/null
+++ b/src/os-plugins/plugins/xen/init-hooks/20-nw-bridge-config/bridge.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# Copyright (c) 2009 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# Init hook to create a bridge on the active network interface
+# (should be kept identical to the files of virtualbox and qemukvm plugins)
+#############################################################################
+
+local bridge=br0
+local brnwif=${nwif}
+local nwifmac=${macaddr}
+
+# bridge 0 already defined or some other problem
+brctl addbr ${bridge} || exit 0
+brctl stp ${bridge} 0
+brctl setfd ${bridge} 0.000000000001
+ip link set addr ${nwifmac} ${bridge}
+ip link set dev ${nwif} up
+brctl addif ${bridge} ${nwif}
+
+# fixme: sending back the variable to init does not work properly at the
+# moment
+nwif=${bridge}
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm
new file mode 100644
index 00000000..51c1c60b
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm
@@ -0,0 +1,212 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Base.pm
+# - provides base implementation of the Distro API for the xserver plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use File::Basename;
+use File::Path;
+use Scalar::Util qw( weaken );
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+sub new
+{
+ my $class = shift;
+ my $self = {};
+ return bless $self, $class;
+}
+
+sub initialize
+{
+ my $self = shift;
+ $self->{engine} = shift;
+ weaken($self->{engine});
+ # avoid circular reference between plugin and its engine
+
+ return 1;
+}
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $pathInfo = $self->XserverPathInfo();
+ my $configFile = $pathInfo->{config};
+
+ my $script = unshiftHereDoc(<<' End-of-Here');
+ # xserver.sh (base part)
+ # written by OpenSLX-plugin 'xserver' (via xserver/Distro/Base.pm module)
+
+ # generating the base configuration file (might be split into several
+ # files for newer Xorg servers)
+ echo -e "# ${xfc#/mnt*}\n# autogenerated X hardware configuration by \
+ the xserver plugin in OpenSLX stage3\n# DO NOT EDIT THIS FILE BUT THE PLUGIN \
+ INSTEAD" >${xfc}
+ # using variables defined in XX_xserver.sh
+ echo -e "${x_modpath}\n${x_srvflags}\n${x_modules}" >>${xfc}
+ echo -e "${x_keyboard}\n${x_mouse}\n${x_videocard}" >>${xfc}
+ echo -e "${x_monitor}\n${x_screen}\n${x_srvlayout}\n${x_dri}" >>${xfc}
+ # if no module was detected, stick to vesa module
+ if [ -n "$xmodule" ] ; then
+ sed "s/vesa/$xmodule/;s/\"us\"/\"${XKEYBOARD}\"/" -i ${xfc}
+ else
+ sed "s/\"us\"/\"${XKEYBOARD}\"/" -i ${xfc}
+ fi
+ if [ -n "${BUSID}" ]; then
+ sed -e "s,^#.*BusID .*, BusID \"${BUSID}\",g" -i ${xfc}
+ fi
+ # end of base xorg.conf generation
+
+ End-of-Here
+
+ return $script;
+}
+
+# not used yet, kept as example
+sub XserverPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = {
+ config => '/etc/X11/xorg.conf',
+ paths => [
+ '/usr/bin',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+
+# looks for the NVIDIA-installer and extracts it
+sub installNvidia
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my @paths = glob $repopath.$pkgpath."/NVIDIA-Linux-x86*\n";
+ my $paths = @paths;
+
+ if ($paths > 1)
+ {
+ print "Found more than one NVIDIA-Linux-x86 installer. Taking first one.\n";
+ }
+ if ($paths == 0)
+ {
+ print "Found no NVIDIA-Linux-x86 installer. Quitting NVIDIA installation!\n";
+ return "error";
+ }
+
+ if ( ! -X $paths[0] )
+ {
+ system("chmod +x ".$paths[0]);
+ }
+ system($paths[0]." -x --target $repopath/nvidia/temp >/dev/null 2>&1");
+
+ if($? == -1 )
+ {
+ print "Failed to execute ".$paths[0]."\n";
+ return "error";
+ }
+
+ system("mv $repopath/nvidia/temp/usr/src $repopath/nvidia/temp/");
+ system("mv $repopath/nvidia/temp/usr/ $repopath/nvidia/");
+ rmtree("$repopath/nvidia/usr/share/");
+
+ return "$repopath/nvidia/temp/src/nv";
+}
+
+
+sub installAti
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my @paths = glob $repopath."/".$pkgpath."/ati-driver-installer*";
+ my $paths = @paths;
+
+ if ($paths > 1)
+ {
+ print "Found more than one ati-driver-installer. Taking first one.\n";
+ }
+ if ($paths == 0)
+ {
+ print "Found no ati-driver-installer. Quitting ATI installation!\n";
+ return "error";
+ }
+
+ if ( ! -X $paths[0] )
+ {
+ system("chmod +x ".$paths[0]);
+ }
+ system($paths[0]." --extract $repopath/ati/temp >/dev/null 2>&1");
+
+ if($? == -1 )
+ {
+ print "Failed to execute ".$paths[0]."\n";
+ return "error";
+ }
+
+ # TODO: allow x86_64 driver installation (libs)
+ my $arch = "x86";
+
+ rmtree("$repopath/ati/usr");
+ system("mv $repopath/ati/temp/common/usr $repopath/ati/");
+ if (!-d "$repopath/ati/usr/lib" ) {
+ mkdir "$repopath/ati/usr/lib";
+ }
+ system("mv $repopath/ati/temp/arch/$arch/usr/X11R6/lib/* $repopath/ati/usr/lib/");
+ system("mv $repopath/ati/temp/arch/$arch/usr/lib/* $repopath/ati/usr/lib/");
+ rmtree("$repopath/ati/usr/share/");
+
+ my $cmd='gcc --version | head -n 1 | sed -e "s/[^0-9. ]//g;s/^ *//;s/^\(.\)\..*$/\1/"';
+ my $gcc_ver_maj =`$cmd`;
+ chomp($gcc_ver_maj);
+
+ system("mv $repopath/ati/temp/arch/$arch/lib/modules/fglrx/build_mod/libfglrx_ip.a.GCC$gcc_ver_maj $repopath/ati/temp/common/lib/modules/fglrx/build_mod/");
+
+
+ return "$repopath/ati/temp/common/lib/modules/fglrx/build_mod";
+}
+
+# get dkms with wget/tar and put it into /sbin
+sub getdkms
+{
+ if( !-f "/sbin/dkms") {
+ if(!-f "dkms-2.0.21.1.tar.gz" ) {
+ system("wget http://linux.dell.com/dkms/permalink/dkms-2.0.21.1.tar.gz >/dev/null 2>&1");
+ die("Could not download dkms tarball! Exiting!") if($? > 0 );
+ }
+ if(!-f "dkms-2.0.21.1/dkms" ) {
+ system("tar -zxvf dkms-2.0.21.1.tar.gz dkms-2.0.21.1/dkms >/dev/null 2>&1");
+ die("Could not extract dkms script from tarball! Exiting!") if($? > 0 );
+ }
+ copyFile("dkms-2.0.21.1/dkms","/sbin");
+ chmod 0755, "/sbin/dkms";
+ }
+}
+
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Debian.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Debian.pm
new file mode 100644
index 00000000..29156e60
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Debian.pm
@@ -0,0 +1,50 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Debian.pm
+# - provides Debian-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Debian;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # Debian specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb
+ End-of-Here
+
+ return $script;
+}
+
+# stage3 script might need to add special path /var/X11R6/bin to the PATH variable
+# # fixme!! add path directly to /etc/profile!?
+# #[ "x$addpath" != "x" ] && \
+# # echo -e "# added path component by $0: $date\n\
+# #PATH=\"\$PATH:/var/X11R6/bin\"" >>/mnt/etc/profile
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
new file mode 100644
index 00000000..7a706019
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm
@@ -0,0 +1,89 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+use Data::Dumper;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ # add stuff to the script generated via Base.pm
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # SuSE specific extension to stage3 xserver.sh
+ testmkd /mnt/etc/X11/xorg.conf.d
+ # Add InputClass to proper setup the keyboard and other input
+ echo 'Section "InputClass"
+ Identifier "evdev pointer catchall"
+ MatchIsPointer "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection
+ Section "InputClass"
+ Identifier "evdev keyboard catchall"
+ MatchIsKeyboard "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection
+ Section "InputClass"
+ Identifier "evdev touchpad catchall"
+ MatchIsTouchpad "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection
+ Section "InputClass"
+ Identifier "evdev tablet catchall"
+ MatchIsTablet "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection
+ Section "InputClass"
+ Identifier "evdev touchscreen catchall"
+ MatchIsTouchscreen "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "evdev"
+ EndSection' >/mnt/etc/X11/xorg.conf.d/10-evdev.conf
+ # Xorg hardware is autodetected, so no module information provided
+ [ -z "${xmodule}" ] && \
+ sed "/Section \"Device\"/,/EndSection/d" -i ${xfc}
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/lib/X11
+ testmkd /mnt/var/lib/xdm/authdir/authfiles 0700
+ ln -s /usr/bin/Xorg /mnt/var/lib/X11/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10.pm
new file mode 100644
index 00000000..f0c3ebb8
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_10.pm
@@ -0,0 +1,63 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse_10.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse_10;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # suse specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/X11R6/bin
+ ln -s /usr/bin/Xorg /mnt/var/X11R6/bin/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ # use the old kbd keyboard driver instead of evdev
+ sed "s/\"evdev\"/,/\"kbd\"/" -i ${xfc}
+ # relevant for older xservers only: check for kind of xorg module used
+ # and patch the i8,9XX VGA BIOS if needed
+ #if strinfile '"i810"' $xfc && [ -f /etc/hwinfo.display ] ; then
+ # highres=$(sort -run /etc/hwinfo.display|grep -i x -m 1)
+ # 915resolution -l|sed -n "s/Mode //;/32 bits/p" > /tmp/915res
+ # strinfile ${highres} /tmp/915res || {
+ # 915resolution $(grep -i x -m 1 /tmp/915res|sed "s/\ :.*//") $(echo \
+ # $highres|sed "s/x/\ /") 2>&1 >/dev/null;
+ # # for some reason the above does not work for a Dell laptop with Intel
+ # # 855 chipset, so add another mode too
+ # 915resolution 3c $(echo $highres|sed "s/x/\ /") 2>&1 >/dev/null; }
+ #fi
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm
new file mode 100644
index 00000000..4117c421
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_0.pm
@@ -0,0 +1,360 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse_11_0.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse_11_0;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+use Data::Dumper;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # SuSE specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/X11R6/bin
+ testmkd /mnt/var/lib/xdm/authdir/authfiles 0700
+ ln -s /usr/bin/Xorg /mnt/var/X11R6/bin/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ End-of-Here
+
+ return $script;
+}
+
+# This function needs wget installed
+sub installNvidia
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $tmpdir = "$repopath/nvidia/temp";
+ if( !-d $tmpdir ) {
+ mkdir( $tmpdir );
+ }
+ else {
+ system("rm -rf $tmpdir/*");
+ }
+
+ my $mykernel = getKernelVersionForDistro("/boot");
+ my $kver = $mykernel->{'version'};
+ my $ksuffix = $mykernel->{'suffix'};
+
+ my $srinfo = `head -n1 /etc/SuSE-release`;
+ my @data = split (/ /, $srinfo);
+ chomp(@data);
+
+ my $version = $data[1];
+ my $chost = substr($data[2],1,-1);
+
+ my $url = "ftp://download.nvidia.com/opensuse/$version/$chost";
+
+ print " * Downloading NVIDIA rpm from ftp://download.nvidia.com/opensuse/$version\n";
+
+ system("wget -P $tmpdir -t2 -T2 $url/nvidia-gfxG01-kmp-$ksuffix* >/dev/null 2>&1");
+
+ if($? > 0) {
+ print "Could not download nvidia kernel module rpm!\n";
+ }
+
+ my @rpm = glob "$tmpdir/nvidia-gfxG01*.rpm";
+ my $rpm = @rpm;
+ $rpm[0] =~ /nvidia-gfxG01-kmp-$ksuffix-(.*?)_(.*?)-.*?\.$chost.rpm/;
+
+ my $nv_kver = $2;
+ $nv_kver =~ s/_/-/g;
+
+ if($rpm == 0) {
+ print "Could not download nvidia kernel module rpm!";
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ if(!-d "$repopath/nvidia/modules/")
+ {
+ mkdir("$repopath/nvidia/modules/");
+ }
+
+
+ # since kernel 2.6.25.20-0.1 there has to be a call to ld
+ # ld -r -m elf_i386 -o ../modules/nvidia.ko lib/modules/2.6.25.20-0.4-pae/updates/{nv-kernel,nv-linux}.o
+
+ my $nv_path = glob "$tmpdir/lib/modules/*-$ksuffix/updates/";
+ if ( -f "$nv_path/nv-kernel.o" ) {
+ # we have to link our kernel module here
+ system("ld -r -m elf_i386 -o $nv_path/nvidia.ko $nv_path/{nv-kernel,nv-linux}.o");
+ }
+
+ copyFile("$nv_path/nvidia.ko", "$repopath/nvidia/modules");
+
+
+ my @versions = split(/-/, $rpm[0]);
+ my @nv_versions = split('_',$versions[5]);
+ my $nv_version = $nv_versions[0];
+
+ system("wget -P $tmpdir -t2 -T2 $url/x11-video-nvidiaG01-$nv_version* >/dev/null 2>&1");
+
+ @rpm = glob "$tmpdir/x11-video-nvidiaG01-$nv_version*";
+ $rpm = @rpm;
+
+ if($rpm == 0)
+ {
+ print "Could not download x11-video-nvidiaG01-$nv_version*.rpm!\n";
+ print "Exiting nvidia driver installation!\n";
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ rmtree("$tmpdir/usr/share");
+ system("mv $tmpdir/usr $repopath/nvidia/");
+
+ rmtree($tmpdir);
+
+}
+
+# this function needs wget
+sub installAti
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $tmpdir = "$repopath/ati/temp";
+ if( !-d $tmpdir ) {
+ mkdir( $tmpdir );
+ }
+ else {
+ system("rm -rf $tmpdir/*");
+ }
+
+ my $mykernel = getKernelVersionForDistro("/boot");
+ my $kver = $mykernel->{'version'};
+ my $kver_ati = $kver;
+ $kver_ati =~ s/-/_/;
+
+ my $ksuffix = $mykernel->{'suffix'};
+
+ my $srinfo = `head -n1 /etc/SuSE-release`;
+ my @data = split (/ /, $srinfo);
+ chomp(@data);
+
+ my $version = $data[1];
+ my $chost = substr($data[2],1,-1);
+
+ my $url = "http://www2.ati.com/suse/$version/";
+
+ print " * Downloading ATI rpm from http://www2.ati.com/suse/$version\n";
+
+ system("wget -P $tmpdir -t2 -T2 $url/repodata/primary.xml.gz >/dev/null 2>&1");
+
+ my $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$kver_ati.*?$chost.rpm"`;
+ chomp($url2);
+
+ if($url2 eq '') {
+ # Taking more general kernel version (minus local suse version)
+ my $newkernvers = '';
+ if($kver_ati =~ /(.*)_(.*?)$/) {
+ # if we have a match here
+ $newkernvers = $1;
+ }
+ else {
+ # just try the old method
+ $newkernvers = substr $kver_ati, 0, -4;
+ }
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$newkernvers.*?$chost.rpm"`;
+ chomp($url2);
+ if(! $url2 eq '') {
+ $kver = $newkernvers;
+ }
+ else {
+ # Minus local Suse version number - hoping, there was no ABI change
+ if($newkernvers =~ /(.*).(.*?)$/) {
+ # here we try with yet another older kernel version
+ $newkernvers = $1;
+ }
+ else {
+ $newkernvers = substr $kver_ati, 0, -7;
+ }
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$newkernvers.*?$chost.rpm"`;
+ chomp($url2);
+ if(! $url2 eq '') {
+ $kver = $newkernvers;
+ }
+
+ }
+ }
+
+# print "KVER = $kver; CHOST = $chost; ksuffix=$ksuffix\n";
+# system("bash");
+
+ if($url2 eq '') {
+ print "No ATI module rpm for the chosen kernel version ($kver) found! Exiting!\n";
+ return;
+ }
+ system("wget -P $tmpdir -t2 -T2 $url/$url2 >/dev/null 2>&1");
+
+ my @rpm = glob "$tmpdir/ati-fglrxG01-kmp-$ksuffix*$chost.rpm";
+ my $rpm = @rpm;
+
+ if($rpm == 0) {
+ print "Could not download ATI kernel module rpm (for kernel $kver)!\n";
+ print "Consider downgrading your Kernel! \nTrying package-install!\n";
+ $self->installAtiOldStyle(@_);
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ if(!-d "$repopath/ati/modules/")
+ {
+ mkdir("$repopath/ati/modules/");
+ }
+ copyFile("$tmpdir/lib/modules/$kver*-$ksuffix/updates/fglrx.ko",
+ "$repopath/ati/modules");
+
+ my @versions = split(/-/, $rpm[0]);
+ my @ati_versions = split('_',$versions[5]);
+ my $ati_version = $ati_versions[0];
+
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/x11-video-fglrxG01-$ati_version-.*?.$chost.rpm"`;
+ chomp($url2);
+ system("wget -P $tmpdir -t2 -T2 $url/$url2 >/dev/null 2>&1");
+
+ @rpm = glob "$tmpdir/x11-video-fglrxG01-$ati_version*";
+ $rpm = @rpm;
+
+ if($rpm == 0)
+ {
+ print " Could not download x11-video-fglrxG01-$ati_version*.rpm!\n";
+ print " Exiting ATI driver installation!\n";
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ rmtree("$tmpdir/usr/share");
+ system("mv $tmpdir/usr $repopath/ati/");
+ system("mv $tmpdir/etc $repopath/ati/");
+ if( ! -d "/usr/X11R6/lib/modules/dri/" ) {
+ system("mkdir -p /usr/X11R6/lib/modules/dri/");
+ }
+ symlink("$repopath/ati/usr/lib/dri/fglrx_dri.so","/usr/X11R6/lib/modules/dri/fglrx_dri.so");
+
+ rmtree($tmpdir);
+}
+
+
+
+sub installAtiOldStyle
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+
+ my $ret = $self->SUPER::installAti(@_);
+
+ if($ret =~ /^error$/) {
+ print "Something went wrong installing ATI files!\n";
+ return;
+ }
+
+ $self->SUPER::getdkms();
+ my $mykernel = getKernelVersionForDistro("/boot");
+ my $kver = $mykernel->{'version'};
+ my $kver_ati = $kver;
+ $kver_ati =~ s/-/_/;
+
+ my $ksuffix = $mykernel->{'suffix'};
+
+ my $srinfo = `head -n1 /etc/SuSE-release`;
+ my @data = split (/ /, $srinfo);
+ chomp(@data);
+
+ my $version = $data[1];
+ my $chost = substr($data[2],1,-1);
+
+ # here we have to compile the kernel modules for all kernels
+ #
+ my $ati_version = `head $repopath/$pkgpath/ati-driver-installer-*.run | grep -P -o '[0-9]+\.[0-9]{3}' | tail -n1`;
+ chomp($ati_version);
+
+ system("mv $ret /usr/src/fglrx-$ati_version >/dev/null 2>&1");
+
+ open FH,">/usr/src/fglrx-$ati_version/dkms.conf";
+ print FH "DEST_MODULE_LOCATION=/updates\n";
+ print FH "PACKAGE_NAME=fglrx\n";
+ print FH "PACKAGE_VERSION=$ati_version\n";
+ close FH;
+
+ my $cmd = "#============= Executing following command =============\n".
+ "/sbin/dkms ".
+ " -m fglrx -v $ati_version ".
+ " -k $kver-$ksuffix ".
+ " --kernelsourcedir /usr/src/linux-$kver-obj/i586/$ksuffix ".
+ " --no-prepare-kernel ".
+ " --no-clean-kernel ".
+ " build >/dev/null 2>&1 \n".
+ "#==========================================================";
+
+#print $cmd;
+ if(!-f "/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko") {
+ system("/sbin/dkms add -m fglrx -v $ati_version >/dev/null 2>&1");
+ system($cmd);
+ #if ($? > 0) {
+ # print "\n\nCould not compile module! Exit with Ctrl-D\n";
+ # system("/bin/bash");
+ #}
+ }
+
+
+ if(!-d "$repopath/ati/modules/")
+ {
+ mkdir( "$repopath/ati/modules/" );
+ }
+
+ if( -e "/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko") {
+ copyFile("/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko",
+ "$repopath/ati/modules");
+ }
+ else {
+ print "Could not install ati driver via pkg-installer!\n";
+ rmtree($repopath."/ati");
+ return;
+ }
+ rmtree("$repopath/ati/temp");
+
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm
new file mode 100644
index 00000000..ab543549
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_1.pm
@@ -0,0 +1,361 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse_11_1.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse_11_1;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+use Data::Dumper;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # SuSE specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/X11R6/bin
+ testmkd /mnt/var/lib/xdm/authdir/authfiles 0700
+ ln -s /usr/bin/Xorg /mnt/var/X11R6/bin/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ End-of-Here
+
+ return $script;
+}
+
+# This function needs wget installed
+sub installNvidia
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $tmpdir = "$repopath/nvidia/temp";
+ if( !-d $tmpdir ) {
+ mkdir( $tmpdir );
+ }
+ else {
+ system("rm -rf $tmpdir/*");
+ }
+
+ my $mykernel = getKernelVersionForDistro("/boot");
+ my $kver = $mykernel->{'version'};
+ my $ksuffix = $mykernel->{'suffix'};
+
+ my $srinfo = `head -n1 /etc/SuSE-release`;
+ my @data = split (/ /, $srinfo);
+ chomp(@data);
+
+ my $version = $data[1];
+ my $chost = substr($data[2],1,-1);
+
+ my $url = "ftp://download.nvidia.com/opensuse/$version/$chost";
+
+ print " * Downloading NVIDIA rpm from ftp://download.nvidia.com/opensuse/$version\n";
+
+ system("wget -P $tmpdir -t2 -T2 $url/nvidia-gfxG01-kmp-$ksuffix* >/dev/null 2>&1");
+
+ if($? > 0) {
+ print "Could not download nvidia kernel module rpm!\n";
+ }
+
+ my @rpm = glob "$tmpdir/nvidia-gfxG01*.rpm";
+ my $rpm = @rpm;
+ $rpm[0] =~ /nvidia-gfxG01-kmp-$ksuffix-(.*?)_(.*?)-.*?\.$chost.rpm/;
+
+ my $nv_kver = $2;
+ $nv_kver =~ s/_/-/g;
+
+ if($rpm == 0) {
+ print "Could not download nvidia kernel module rpm!";
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ if(!-d "$repopath/nvidia/modules/")
+ {
+ mkdir("$repopath/nvidia/modules/");
+ }
+
+
+ # since kernel 2.6.25.20-0.1 there has to be a call to ld
+ # ld -r -m elf_i386 -o ../modules/nvidia.ko lib/modules/2.6.25.20-0.4-pae/updates/{nv-kernel,nv-linux}.o
+
+ my $nv_path = glob "$tmpdir/lib/modules/*-$ksuffix/updates/";
+ if ( -f "$nv_path/nv-kernel.o" ) {
+ # we have to link our kernel module here
+ system("ld -r -m elf_i386 -o $nv_path/nvidia.ko $nv_path/{nv-kernel,nv-linux}.o");
+ }
+
+ copyFile("$nv_path/nvidia.ko", "$repopath/nvidia/modules");
+
+
+ my @versions = split(/-/, $rpm[0]);
+ my @nv_versions = split('_',$versions[5]);
+ my $nv_version = $nv_versions[0];
+
+ system("wget -P $tmpdir -t2 -T2 $url/x11-video-nvidiaG01-$nv_version* >/dev/null 2>&1");
+
+ @rpm = glob "$tmpdir/x11-video-nvidiaG01-$nv_version*";
+ $rpm = @rpm;
+
+ if($rpm == 0)
+ {
+ print "Could not download x11-video-nvidiaG01-$nv_version*.rpm!\n";
+ print "Exiting nvidia driver installation!\n";
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ rmtree("$tmpdir/usr/share");
+ system("mv $tmpdir/usr $repopath/nvidia/");
+
+ rmtree($tmpdir);
+
+}
+
+
+# this function needs wget
+sub installAti
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $tmpdir = "$repopath/ati/temp";
+ if( !-d $tmpdir ) {
+ mkdir( $tmpdir );
+ }
+ else {
+ system("rm -rf $tmpdir/*");
+ }
+
+ my $mykernel = getKernelVersionForDistro("/boot");
+ my $kver = $mykernel->{'version'};
+ my $kver_ati = $kver;
+ $kver_ati =~ s/-/_/;
+
+ my $ksuffix = $mykernel->{'suffix'};
+
+ my $srinfo = `head -n1 /etc/SuSE-release`;
+ my @data = split (/ /, $srinfo);
+ chomp(@data);
+
+ my $version = $data[1];
+ my $chost = substr($data[2],1,-1);
+
+ my $url = "http://www2.ati.com/suse/$version/";
+
+ print " * Downloading ATI rpm from http://www2.ati.com/suse/$version\n";
+
+ system("wget -P $tmpdir -t2 -T2 $url/repodata/primary.xml.gz >/dev/null 2>&1");
+
+ my $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$kver_ati.*?$chost.rpm"`;
+ chomp($url2);
+
+ if($url2 eq '') {
+ # Taking more general kernel version (minus local suse version)
+ my $newkernvers = '';
+ if($kver_ati =~ /(.*)_(.*?)$/) {
+ # if we have a match here
+ $newkernvers = $1;
+ }
+ else {
+ # just try the old method
+ $newkernvers = substr $kver_ati, 0, -4;
+ }
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$newkernvers.*?$chost.rpm"`;
+ chomp($url2);
+ if(! $url2 eq '') {
+ $kver = $newkernvers;
+ }
+ else {
+ # Minus local Suse version number - hoping, there was no ABI change
+ if($newkernvers =~ /(.*).(.*?)$/) {
+ # here we try with yet another older kernel version
+ $newkernvers = $1;
+ }
+ else {
+ $newkernvers = substr $kver_ati, 0, -7;
+ }
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/ati-fglrxG01-kmp-$ksuffix.*?$newkernvers.*?$chost.rpm"`;
+ chomp($url2);
+ if(! $url2 eq '') {
+ $kver = $newkernvers;
+ }
+
+ }
+ }
+
+# print "KVER = $kver; CHOST = $chost; ksuffix=$ksuffix\n";
+# system("bash");
+
+ if($url2 eq '') {
+ print "No ATI module rpm for the chosen kernel version ($kver) found! Exiting!\n";
+ return;
+ }
+ system("wget -P $tmpdir -t2 -T2 $url/$url2 >/dev/null 2>&1");
+
+ my @rpm = glob "$tmpdir/ati-fglrxG01-kmp-$ksuffix*$chost.rpm";
+ my $rpm = @rpm;
+
+ if($rpm == 0) {
+ print "Could not download ATI kernel module rpm (for kernel $kver)!\n";
+ print "Consider downgrading your Kernel! \nTrying package-install!\n";
+ $self->installAtiOldStyle(@_);
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ if(!-d "$repopath/ati/modules/")
+ {
+ mkdir("$repopath/ati/modules/");
+ }
+ copyFile("$tmpdir/lib/modules/$kver*-$ksuffix/updates/fglrx.ko",
+ "$repopath/ati/modules");
+
+ my @versions = split(/-/, $rpm[0]);
+ my @ati_versions = split('_',$versions[5]);
+ my $ati_version = $ati_versions[0];
+
+ $url2 = `zcat $tmpdir/primary.xml.gz | grep -P -o "$chost/x11-video-fglrxG01-$ati_version-.*?.$chost.rpm"`;
+ chomp($url2);
+ system("wget -P $tmpdir -t2 -T2 $url/$url2 >/dev/null 2>&1");
+
+ @rpm = glob "$tmpdir/x11-video-fglrxG01-$ati_version*";
+ $rpm = @rpm;
+
+ if($rpm == 0)
+ {
+ print " Could not download x11-video-fglrxG01-$ati_version*.rpm!\n";
+ print " Exiting ATI driver installation!\n";
+ return;
+ }
+
+ system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1");
+
+ rmtree("$tmpdir/usr/share");
+ system("mv $tmpdir/usr $repopath/ati/");
+ system("mv $tmpdir/etc $repopath/ati/");
+ if( ! -d "/usr/X11R6/lib/modules/dri/" ) {
+ system("mkdir -p /usr/X11R6/lib/modules/dri/");
+ }
+ symlink("$repopath/ati/usr/lib/dri/fglrx_dri.so","/usr/X11R6/lib/modules/dri/fglrx_dri.so");
+
+ rmtree($tmpdir);
+}
+
+
+
+sub installAtiOldStyle
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+
+ my $ret = $self->SUPER::installAti(@_);
+
+ if($ret =~ /^error$/) {
+ print "Something went wrong installing ATI files!\n";
+ return;
+ }
+
+ $self->SUPER::getdkms();
+ my $mykernel = getKernelVersionForDistro("/boot");
+ my $kver = $mykernel->{'version'};
+ my $kver_ati = $kver;
+ $kver_ati =~ s/-/_/;
+
+ my $ksuffix = $mykernel->{'suffix'};
+
+ my $srinfo = `head -n1 /etc/SuSE-release`;
+ my @data = split (/ /, $srinfo);
+ chomp(@data);
+
+ my $version = $data[1];
+ my $chost = substr($data[2],1,-1);
+
+ # here we have to compile the kernel modules for all kernels
+ #
+ my $ati_version = `head $repopath/$pkgpath/ati-driver-installer-*.run | grep -P -o '[0-9]+\.[0-9]{3}' | tail -n1`;
+ chomp($ati_version);
+
+ system("mv $ret /usr/src/fglrx-$ati_version >/dev/null 2>&1");
+
+ open FH,">/usr/src/fglrx-$ati_version/dkms.conf";
+ print FH "DEST_MODULE_LOCATION=/updates\n";
+ print FH "PACKAGE_NAME=fglrx\n";
+ print FH "PACKAGE_VERSION=$ati_version\n";
+ close FH;
+
+ my $cmd = "#============= Executing following command =============\n".
+ "/sbin/dkms ".
+ " -m fglrx -v $ati_version ".
+ " -k $kver-$ksuffix ".
+ " --kernelsourcedir /usr/src/linux-$kver-obj/i586/$ksuffix ".
+ " --no-prepare-kernel ".
+ " --no-clean-kernel ".
+ " build >/dev/null 2>&1 \n".
+ "#==========================================================";
+
+#print $cmd;
+ if(!-f "/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko") {
+ system("/sbin/dkms add -m fglrx -v $ati_version >/dev/null 2>&1");
+ system($cmd);
+ #if ($? > 0) {
+ # print "\n\nCould not compile module! Exit with Ctrl-D\n";
+ # system("/bin/bash");
+ #}
+ }
+
+
+ if(!-d "$repopath/ati/modules/")
+ {
+ mkdir( "$repopath/ati/modules/" );
+ }
+
+ if( -e "/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko") {
+ copyFile("/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko",
+ "$repopath/ati/modules");
+ }
+ else {
+ print "Could not install ati driver via pkg-installer!\n";
+ rmtree($repopath."/ati");
+ return;
+ }
+ rmtree("$repopath/ati/temp");
+
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm
new file mode 100644
index 00000000..5cddcef0
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Suse_11_2.pm
@@ -0,0 +1,53 @@
+# Copyright (c) 2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Suse_11_2.pm
+# - provides SUSE-specific overrides of the Distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Suse_11_2;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use File::Path;
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
+
+use Data::Dumper;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # SuSE specific extension to stage3 xserver.sh
+ testmkd /mnt/var/lib/xkb/compiled
+ testmkd /mnt/var/lib/X11
+ testmkd /mnt/var/lib/xdm/authdir/authfiles 0700
+ ln -s /usr/bin/Xorg /mnt/var/lib/X11/X
+ rm /mnt/etc/X11/xdm/SuSEconfig.xdm
+ End-of-Here
+
+ return $script;
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm
new file mode 100644
index 00000000..057cf138
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm
@@ -0,0 +1,96 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Ubuntu.pm
+# - provides Ubuntu-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Ubuntu;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+# needs to be implemented ...
+sub XserverPathInfo
+{
+ my $self = shift;
+
+ my $pathInfo = {
+ config => '/etc/X11/xorg.openslx',
+ paths => [
+ '/usr/bin',
+ ],
+ };
+
+ return $pathInfo;
+}
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ # overwriting script part from Base.pm
+ $script = unshiftHereDoc(<<' End-of-Here');
+ # Ubuntu specific extension to stage3 xserver.sh
+ echo -e "# ${xfc#/mnt*}\n# autogenerated X hardware configuration by \
+ the xserver plugin in OpenSLX stage3\n# DO NOT EDIT THIS FILE BUT THE PLUGIN \
+ INSTEAD" >${xfc}
+ # using variables defined in XX_xserver.sh
+ echo -e "${x_modpath}\n${x_srvflags}\n${x_modules}" >>${xfc}
+ echo "${x_keyboard}" | sed "s/kbd/evdev/" >>${xfc}
+ echo -e "${x_mouse}\n${x_monitor}\n${x_screen}" >>${xfc}
+ echo "${x_srvlayout}" | sed "/ Screen /d" >>${xfc}
+ testmkd /mnt/etc/X11/xorg.conf.d
+ testmkd /mnt/var/run/xauth
+ testmkd /mnt/var/lib/xkb
+ ln -sf /usr/bin/Xorg /mnt/etc/X11/X
+ End-of-Here
+
+ return $script;
+}
+
+
+sub installNvidia
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $distroName = $self->{engine}->distroName();
+
+ system($repopath."/ubuntu-gfx-install.sh nvidia $distroName");
+
+}
+
+sub installAti
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $distroName = $self->{engine}->distroName();
+
+ system($repopath."/ubuntu-gfx-install.sh ati $distroName");
+
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm
new file mode 100644
index 00000000..1fa88446
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_8.pm
@@ -0,0 +1,73 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Ubuntu_8.pm
+# - provides Ubuntu-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Ubuntu_8;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+sub setupXserverScript
+{
+ my $self = shift;
+ my $repoPath = shift;
+
+ my $script = $self->SUPER::setupXserverScript($repoPath);
+
+ $script .= unshiftHereDoc(<<' End-of-Here');
+ # Ubuntu specific extension to stage3 xserver.sh
+ # use the old kbd keyboard driver instead of evdev
+ sed "s/\"evdev\"/,/\"kbd\"/" -i ${xfc}
+ testmkd /mnt/var/run/xauth
+ testmkd /mnt/var/lib/xkb
+ ln -sf /usr/bin/Xorg /mnt/etc/X11/X
+ End-of-Here
+
+ return $script;
+}
+
+
+sub installNvidia
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $distroName = $self->{engine}->distroName();
+
+ system($repopath."/ubuntu-gfx-install.sh nvidia $distroName");
+
+}
+
+sub installAti
+{
+ my $self = shift;
+ my $repopath = shift || "/opt/openslx/plugin-repo/xserver/";
+ my $pkgpath = shift || "packages";
+
+ my $distroName = $self->{engine}->distroName();
+
+ system($repopath."/ubuntu-gfx-install.sh ati $distroName");
+
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm
new file mode 100644
index 00000000..80dccbc9
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu_9.pm
@@ -0,0 +1,30 @@
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver/OpenSLX/Distro/Ubuntu_9.pm
+# - provides Ubuntu-specific overrides of the distro API for the xserver
+# plugin.
+# -----------------------------------------------------------------------------
+package xserver::OpenSLX::Distro::Ubuntu_9;
+
+use strict;
+use warnings;
+
+use base qw(xserver::OpenSLX::Distro::Ubuntu_8);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+################################################################################
+### interface methods
+################################################################################
+
+
+1;
diff --git a/src/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm b/src/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm
new file mode 100644
index 00000000..b172dc22
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm
@@ -0,0 +1,396 @@
+# Copyright (c) 2008 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# xserver.pm
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::xserver;
+
+use strict;
+use warnings;
+
+use base qw(OpenSLX::OSPlugin::Base);
+
+use OpenSLX::Basics;
+use OpenSLX::Utils;
+
+use File::Basename;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+sub new
+{
+ my $class = shift;
+
+ my $self = {
+ name => 'xserver',
+ };
+
+ return bless $self, $class;
+}
+
+sub getInfo
+{
+ my $self = shift;
+
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ This plugin tries to configure the local Xorg-Server and
+ integrates binary graphics drivers (closed sourced) into the system.
+ Notice that you need to have kernel-headers installed to work properly.
+ in some cases. You need to download the driver packages yourself and
+ supply the download folder into the pkgpath option.
+ End-of-Here
+ precedence => 80,
+ };
+}
+
+sub getAttrInfo
+{ # returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system by means
+ # of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'xserver::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'xserver'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ 'xserver::ddcinfo' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'xserver'-plugin use the ddcinfo (if available) for
+ the monitor/tft setup? Might help in scenarios with resolutions
+ configured much lower than physically possible. (0 ignore, 1 use)
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '0 ignore ddcinfo, 1 use ddcinfo if available',
+ default => '0',
+ },
+ 'xserver::driver' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ force to use defined driver
+ End-of-Here
+ content_regex => undef,
+ content_descr => 'force to use defined driver',
+ default => undef,
+ },
+ 'xserver::prefnongpl' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'xserver'-plugin use the non-gpl drivers for some graphic
+ adaptors if available (0 prefer gpl, 1 use the nongpl)
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '0 prefer gpl, 1 use the nongpl',
+ default => '0',
+ },
+ 'xserver::multihead' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'xserver'-plugin configure multi-head setups of Xorg
+ for different scenarios and dynamically added displays
+ (not implemented yet)
+ End-of-Here
+ content_regex => undef,
+ content_descr => '',
+ default => '1',
+ },
+
+ # plugin specific attributes start here ...
+
+ # stage1
+ # Currently not needed in scenarios where distro specific packages are
+ # available, but for example in SUSE 10.2 we use this method
+ # -> provide downloaded packages here.
+ 'xserver::pkgpath' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Path to downloaded ATI or Nvidia package
+ End-of-Here
+ content_regex => qr{^.+$}, # not empty
+ content_descr => 'Path to Nvidia or ATI packages',
+ default => '/root/xserver-pkgs',
+ },
+ 'xserver::ati' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the non-gpl ATI drivers be available (installed in vendor-OS - not implemented yet)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1"',
+ default => '0',
+ },
+ 'xserver::nvidia' => {
+ applies_to_vendor_os => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the non-gpl NVidia drivers be available (installed in vendor-OS - not implemented yet)?
+ End-of-Here
+ content_regex => qr{^0|1$},
+ content_descr => '"0", "1"',
+ default => '0',
+ },
+ #'xserver::matrox' => {
+ # applies_to_vendor_os => 1,
+ # description => unshiftHereDoc(<<' End-of-Here'),
+ # should the non-gpl Matrox drivers (e.g. for the Parhelia) be
+ # available (installed in vendor-OS)?
+ # End-of-Here
+ # content_regex => qr{^0|1$},
+ # content_descr => '"0", "1"',
+ # default => '0',
+ #},
+ };
+}
+
+
+sub preInstallationPhase()
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{pluginTempPath} = $info->{'plugin-temp-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+ $self->{openslxConfigPath} = $info->{'openslx-config-path'};
+ $self->{attrs} = $info->{'plugin-attrs'};
+ $self->{vendorOsPath} = $info->{'vendor-os-path'};
+
+
+ my $pkgpath = $self->{attrs}->{'xserver::pkgpath'};
+ $pkgpath ||= "";
+ my $installAti = $self->{attrs}->{'xserver::ati'};
+ my $installNvidia = $self->{attrs}->{'xserver::nvidia'};
+
+ if (! -d $pkgpath && ($installAti == 1 || $installNvidia == 1)) {
+ print "\n\n * xserver::pkgpath: no such directory!\n";
+ print " * xserver plugin can only install ATI or Nvidia driver\n";
+ print " via operating system packaging (e.g. != SuSE-10.2)!\n";
+ # exit 1 => xserver plugin is not getting installed because ati
+ # or nvidia where selected but are not installable!
+ # exit 1;
+ }
+
+ if (-d $pkgpath && ($installNvidia == 1 || $installAti == 1)) {
+ system("cp -r $pkgpath $self->{pluginRepositoryPath}/packages");
+ }
+
+}
+
+
+sub installationPhase
+{ # called while chrooted to the vendor-OS root in order to give the plugin
+ # a chance to install required files into the vendor-OS.
+ my $self = shift;
+ my $info = shift;
+
+ # ehh... every plugin has it's own different installationPhase
+ # variable definition?
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ # The folder where the stage1-plugin should store all files
+ # required by the corresponding stage3 runlevel script.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ # A temporary playground that will be cleaned up automatically.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $openslxBasePath = $info->{'openslx-base-path'};
+ # the openslx base path (/opt/openslx) bind-mounted into the chroot
+ my $openslxConfigPath = $info->{'openslx-config-path'};
+ # the openslx config path (/etc/opt/openlsx) bind-mounted into the
+ # chroot
+ my $attrs = $info->{'plugin-attrs'};
+ # attributes in effect for this installation
+ my $vendorOSName = $self->{'os-plugin-engine'}->{'vendor-os-name'};
+
+ # write the distro specific extension (inclusion) of XX_xserver.sh
+ my $script = $self->{distro}->setupXserverScript($pluginRepoPath);
+ spitFile("$pluginRepoPath/xserver.sh", $script);
+
+ # if defined: build nvidia or ati binarys
+ my $pluginFilesPath =
+ "$openslxBasePath/lib/plugins/$self->{'name'}/files";
+ my $installationPath = "$pluginRepoPath/";
+ my $binDrivers = 0;
+ my $engine = $self->{'os-plugin-engine'};
+
+ # removeLinks is to remove Links to the files
+ # TODO: In future versions this call can be removed - deprecated version
+ $self->removeLinks();
+
+ if ($attrs->{'xserver::nvidia'} == 1 || $attrs->{'xserver::ati'} == 1 ) {
+ if($vendorOSName =~ /.*?ubuntu.*?/i)
+ {
+ if($vendorOSName =~ /.*?8.10|9.04|9.10.*?/i)
+ {
+ copyFile("$pluginFilesPath/ubuntu-ng-gfx-install.sh",
+ "$installationPath");
+ rename("$installationPath/ubuntu-ng-gfx-install.sh",
+ "$installationPath/ubuntu-gfx-install.sh");
+ }
+ else
+ {
+ copyFile("$pluginFilesPath/ubuntu-gfx-install.sh", "$installationPath");
+ }
+ }
+ $binDrivers = 1;
+ }
+ if ($attrs->{'xserver::ati'} == 1 ) {
+ $self->{distro}->installAti($pluginRepoPath,"packages");
+ }
+ if ($attrs->{'xserver::nvidia'} == 1 ) {
+ $self->{distro}->installNvidia($pluginRepoPath,"packages");
+ }
+
+ if ($binDrivers == 1) {
+ $self->ldconf($info);
+ system("chmod -R 755 $installationPath");
+ }
+
+ return;
+}
+
+sub removalPhase
+{ # called while chrooted to the vendor-OS root in order to give the plugin
+ # a chance to uninstall no longer required files from the vendor-OS.
+ my $self = shift;
+ my $info = shift;
+
+ my $pluginRepoPath = $info->{'plugin-repo-path'};
+ # The folder where the stage1-plugin should store all files
+ # required by the corresponding stage3 runlevel script.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+ my $pluginTempPath = $info->{'plugin-temp-path'};
+ # A temporary playground that will be cleaned up automatically.
+ # As this method is being executed while chrooted into the vendor-OS,
+ # this path is relative to that root (i.e. directly usable).
+
+
+ # TODO (in far future): Remove - linking is deprecated
+ # Make sure nobody has installed the old plugin version
+ $self->removeLinks();
+
+ return;
+}
+
+
+
+# Create ld.so.conf for the binary drivers
+sub ldconf
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $attrs = $info->{'plugin-attrs'};
+ my $ldincl = $info->{'plugin-repo-path'}.'/';
+ my $ldpl = "/etc/ld.conf.preload";
+ my $ldconf = "/etc/ld.so.conf";
+ my $ldcache = "";
+
+ if( -d $ldincl.'nvidia/') {
+
+ ## WRITE ld.so.conf ##
+
+ open(IN,'>'.$ldincl.'nvidia/ld.so.conf');
+ print IN $ldincl."nvidia/usr/lib\n".$ldincl.'nvidia/usr/X11R6/lib';
+ close(IN);
+
+ ## CREATE DIFFERENT 'ld.so.cache' ##
+
+ $ldcache = $ldincl.'/nvidia/ld.so.cache';
+ system('sed -e "1s,^,include '.$ldincl.'nvidia/ld.so.conf\n,g" -i '.$ldconf);
+ #print "Calling ldconfig to create $ldcache ... Please Wait\n";
+ system('ldconfig -C '.$ldcache);
+ system('sed -e "1d" -i '.$ldconf);
+ }
+
+
+ if( -d $ldincl.'ati/') {
+ open(IN,'>'.$ldincl.'ati/ld.so.conf');
+ print IN $ldincl."ati/usr/lib\n".$ldincl.'ati/usr/X11R6/lib';
+ close(IN);
+
+ $ldcache = $ldincl.'/ati/ld.so.cache';
+ system('sed -e "1s,^,include '.$ldincl.'ati/ld.so.conf\n,g" -i '.$ldconf);
+ #print "Calling ldconfig to create $ldcache ... Please Wait\n";
+ system('ldconfig -C '.$ldcache);
+ system('sed -e "1d" -i '.$ldconf);
+ }
+}
+
+
+# deprecated
+# removes linked libraries from /usr/lib/
+sub removeLinks
+{
+ my $instFolders = "/usr/lib";
+ if(-d "/usr/X11R6/lib") {
+ $instFolders .= " /usr/X11R6/lib";
+ }
+ my $divertFolder = "/var/X11R6/lib";
+ my $pluginFolder = "/opt/openslx/plugin-repo/xserver";
+
+ # get all previously installed links
+ my @linkedFiles =
+ `find $instFolders -lname "$divertFolder*" -o -lname "$pluginFolder*" `;
+
+
+ # also remove _MESA backup files
+ my @backupFiles =
+ `find $instFolders -name "*_MESA.so*"`;
+ my $origfile = '';
+ for my $file (@backupFiles) {
+ $origfile = $file;
+ $file =~ s/_MESA//;
+ rename($origfile,$file);
+ }
+ unlink "/usr/lib/libGL.so", "/usr/lib/libGL.so.1";
+ symlink "/usr/lib/libGL.so.1.2", "/usr/lib/libGL.so.1";
+ symlink "/usr/lib/libGL.so.1.2", "/usr/lib/libGL.so";
+
+
+ foreach my $file (@linkedFiles) {
+ chomp($file);
+ unlink $file;
+ }
+
+ # this should not print any file at all ;-(
+ my @files = `find $instFolders -lname "$divertFolder*" -o -lname "$pluginFolder*" `;
+ if ( $#files > 0 ) {
+ print "Links were not removed properly! Exiting!\n";
+ my $bla;
+ foreach (@files) {
+ chomp($bla = $_);
+ print $bla;
+ }
+ exit(1);
+ }
+ return;
+}
+
+1;
diff --git a/src/os-plugins/plugins/xserver/XX_xserver.sh b/src/os-plugins/plugins/xserver/XX_xserver.sh
new file mode 100644
index 00000000..1b757901
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/XX_xserver.sh
@@ -0,0 +1,351 @@
+# Copyright (c) 2008 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'xserver' plugin - the runlevel script setting up the Xorg
+# configuration and checking for 3D capabilities and non-gpl drivers
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# defining a set of stanard configuration blocks
+x_modpath='Section "Files"
+# ModulePath "/usr/lib/xorg/modules/,/usr/lib64/xorg/modules/"
+EndSection'
+x_srvflags='Section "ServerFlags"
+ Option "AllowMouseOpenFail"
+ Option "AllowEmptyInput" "false"
+ Option "blank time" "5"
+ Option "standby time" "10"
+ Option "suspend time" "15"
+ Option "off time" "20"
+EndSection'
+x_modules='Section "Module"
+ Load "i2c"
+ Load "bitmap"
+ Load "ddc"
+ Load "extmod"
+ Load "freetype"
+ Load "int10"
+ Load "vbe"
+ Load "glx"
+ Load "dri"
+EndSection'
+x_mouse='Section "InputDevice"
+ Identifier "Generic Mouse"
+ Driver "mouse"
+# Option "Device" "/dev/input/mice"
+# Option "Protocol" "ImPS/2"
+# Option "ZAxisMapping" "4 5"
+# Option "Emulate3Buttons" "true"
+ Option "CorePointer"
+EndSection'
+x_keyboard='Section "InputDevice"
+ Identifier "Generic Keyboard"
+ Driver "evdev"
+ Option "CoreKeyboard"
+ Option "XkbRules" "xorg"
+ Option "XkbModel" "pc105"
+ Option "XkbLayout" "us"
+EndSection'
+x_videocard='Section "Device"
+ Identifier "Generic Video Card"
+ Driver "vesa"
+# BusID "PCI:xx" #especially needed for fglrx
+EndSection'
+x_monitor='Section "Monitor"
+ Identifier "Generic Display"
+ Option "DPMS"
+# Modelname "could be enabled via xserver::ddcinfo attribute"
+# Vertrefresh ...
+# Horizsync ...
+# DisplaySize ...
+EndSection'
+x_screen='Section "Screen"
+ Identifier "Default Screen"
+ Device "Generic Video Card"
+ Monitor "Generic Display"
+ DefaultDepth 24
+# SubSection "Display"
+# Depth 24
+# Modes "1024x768" "800x600"
+# EndSubSection
+EndSection'
+x_srvlayout='Section "ServerLayout"
+ Identifier "Default Layout"
+ Screen "Default Screen"
+ InputDevice "Generic Keyboard"
+ InputDevice "Generic Mouse"
+EndSection'
+x_dri='Section "DRI"
+ Mode 0666
+EndSection'
+# Xorg configuration file location
+xfc="/mnt/etc/X11/xorg.conf"
+
+# read the central configuration file (fixme: should the keyboard layout
+# defined within the xserver plugin settings - probably not, dvs)
+if [ -e /initramfs/machine-setup ] ; then
+ . /initramfs/machine-setup
+else
+ error " The central configuration file 'machine-setup' (produced by the \
+slxconfig-demuxer\n and transported via fileget) is not present" nonfatal
+fi
+
+if [ -e /etc/slxsystem.conf ]; then
+ . /etc/slxsystem.conf
+fi
+
+# directory for libGL, DRI library links to point to proper library set
+# depending on the hardware environment
+glliblinks="/mnt/var/X11R6/lib/"
+testmkd ${glliblinks}
+
+# check for the existance of plugin configuration and non-existance of an
+# admin provided config file in ConfTGZ
+if [ -e /initramfs/plugin-conf/xserver.conf -a \
+ ! -f /rootfs/etc/X11/xorg.conf ]; then
+ . /initramfs/plugin-conf/xserver.conf
+ # check if driver set via xserver_driver
+ # if so check for xserver_prefnongpl and xserver_driver because you want to
+ # force driver even if xserver_prefnongpl=0
+ # eg: [ -n "$xserver_driver" -o "$xserver_prefnongpl" -eq 1 ]
+ if [ -n "$xserver_driver" ]; then
+ if `grep -qi "Server Module" /etc/hwinfo.gfxcard`; then
+ sed -i "s,XFree86.*,FORCED XFree86 v4 Server Module: ${xserver_driver}," \
+ /etc/hwinfo.gfxcard
+ echo -e "\n# File modified by $1" >> /etc/hwinfo.gfxcard
+ echo "# Reason: attribute server_driver set to ${xserver_driver}" \
+ >> /etc/hwinfo.gfxcard
+ else
+ echo -e "\n# File modified by $1" >> /etc/hwinfo.gfxcard
+ echo "# Reason: attribute server_driver set to ${xserver_driver}" \
+ >> /etc/hwinfo.gfxcard
+ echo "FORCED XFree86 v4 Server Module: ${xserver_driver}" >> /etc/hwinfo.gfxcard
+ fi
+ fi
+ # do not start any configuration if the admin provided a preconfigured
+ # xorg.conf in /rootfs/etc/X11/xorg.conf
+ if [ $xserver_active -ne 0 -a ! -f /rootfs/${xfc#/mnt} ]; then
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'xserver' os-plugin ...";
+ xmodule=$(grep -i -m 1 "XFree86 v4 Server Module" /etc/hwinfo.gfxcard | \
+ sed "s/.*v4 Server Module: //")
+ # proprietary ATI/NVidia modules listed a different way with hwinfo
+ [ -z "$xmodule" ] || error "${hcfg_hwsetup}" nonfatal
+
+ ######################################################################
+ # begin proprietary drivers section (xorg.conf part)
+ ######################################################################
+
+ if $(grep -iq -m 1 'Module: fglrx' /etc/hwinfo.gfxcard) && \
+ [ -n "$xserver_driver" -o "$xserver_prefnongpl" -eq 1 ]
+ then
+ # we have an ati card here
+ PLUGIN_ROOTFS="/opt/openslx/plugin-repo/xserver/ati"
+ if [ -f /mnt${PLUGIN_ROOTFS}/usr/X11R6/lib/dri/fglrx_dri.so -o \
+ -f /mnt${PLUGIN_ROOTFS}/usr/lib/dri/fglrx_dri.so ]; then
+
+ # this will be written before standard module path into xorg.conf
+ MODULE_PATH="${PLUGIN_ROOTFS}/usr/lib/xorg/modules/\,\
+${PLUGIN_ROOTFS}/usr/X11R6/lib/modules/\,"
+ xmodule="fglrx"
+ PLUGIN_PATH="/mnt/${PLUGIN_ROOTFS}"
+
+ # impossible to load it directly via stage3 insmod - yes, somehow this is too big
+ chroot /mnt /sbin/insmod ${PLUGIN_ROOTFS}/modules/fglrx.ko
+
+ # workaround for bug #453 (for some ati graphics cards)
+ if [ $? -gt 0 -a "${slxconf_distro_name}" = "ubuntu" ]; then
+ xmodule="radeon"
+ MODULE_PATH="/usr/lib/xorg/modules/,/usr/X11R6/lib/xorg/modules/"
+ else
+
+ # we need some database for driver initialization
+ cp -r "${PLUGIN_PATH}/etc/ati" /mnt/etc
+
+ if [ "${slxconf_distro_name}" = "ubuntu" ]; then
+ echo "${PLUGIN_ROOTFS}/usr/lib/libGL.so.1" >> /mnt/etc/ld.so.preload
+ fi
+
+ # if fglrx_dri.so is linked wrong -> we have to link it here
+ if [ "1" -eq "$( ls -l /mnt/usr/lib/dri/fglrx_dri.so \
+ | grep -o "/var/X11R6.*so$" | wc -l )" ]; then
+ ln -s ${PLUGIN_ROOTFS}/usr/lib/dri/fglrx_dri.so \
+ ${glliblinks}dri/fglrx_dri.so
+ fi
+ BUSID=$(grep -m1 -i " SysFS BusID: .*" /etc/hwinfo.gfxcard | \
+ awk -F':' '{print "PCI:"$3":"$4}' | sed -e 's,\.,:,g')
+ echo -e "\t${PLUGIN_ROOTFS}/usr/bin/aticonfig --initial &>/dev/null"\
+ >> /mnt/etc/init.d/boot.slx
+ ATI=1
+ fi # if kernel module not loaded properly
+ fi
+ elif $(grep -iq -m 1 'Module: nvidia' /etc/hwinfo.gfxcard) && \
+ [ -n "$xserver_driver" -o "$xserver_prefnongpl" -eq 1 ]
+ then
+ # we have an nvidia card here
+ NVIDIA=1
+ PLUGIN_ROOTFS="/opt/openslx/plugin-repo/xserver/nvidia"
+ MODULE_PATH="${PLUGIN_ROOTFS}/usr/lib/xorg/modules/\,\
+${PLUGIN_ROOTFS}/usr/X11R6/lib/modules/\,"
+ xmodule="nvidia"
+ PLUGIN_PATH="/mnt${PLUGIN_ROOTFS}"
+
+ # if we can't find the nongpl kernel module, use gpl xorg
+ # nvidia driver
+ if [ -e ${PLUGIN_PATH}/modules/nvidia.ko ]; then
+ # sometimes the kernel module needs agpgart
+ modprobe agpgart
+ # insert kernel driver
+ chroot /mnt /sbin/insmod ${PLUGIN_ROOTFS}/modules/nvidia.ko
+
+
+ # workaround for bug #453 (Xorg does not start with ld.so.preload)
+ if [ "${slxconf_distro_name}" = "ubuntu" -a "${xmodule}" != "nvidia" ]; then
+ echo "${PLUGIN_ROOTFS}/usr/lib/libGL.so.1" >> /mnt/etc/ld.so.preload
+ fi
+
+ else
+ xmodule="nv"
+ fi
+
+ fi
+
+ ######################################################################
+ # end proprietary drivers xorg.conf section
+ ######################################################################
+
+ # write the xorg.conf completely or in files needed (depending on
+ # distro version)
+ # determine keyboard setup (fill XKEYBOARD)
+ localization "${country}"
+
+ # run distro specific generated stage3 script which uses variables
+ # defined in the beginning of this script like ${x_*}, ${xfc}
+ [ -e /mnt/opt/openslx/plugin-repo/xserver/xserver.sh ] && \
+ . /mnt/opt/openslx/plugin-repo/xserver/xserver.sh
+
+ # set nodeadkeys for special layouts
+ if [ ${XKEYBOARD} = "de" ]; then
+ sed -e '/\"XkbLayout\"/a\\ \ Option "XkbVariant" "nodeadkeys"' \
+ -i ${xfc}
+ fi
+ # if a synaptic touchpad is present, add it to the device list
+ if grep -q -E "ynaptics" /etc/hwinfo.mouse || \
+ dmesg | grep -q -E "ynaptics" ; then
+ sed -e '/\"CorePointer\"/ {
+a\
+EndSection\
+Section "InputDevice"\
+ Identifier "Synaptics TP"\
+ Driver "synaptics"\
+ Option "Device" "/dev/input/mice"\
+ Option "SendCoreEvents" "true"
+}' -e '/Device "Generic Mouse"/ {
+a\ \ InputDevice\ \ "Synaptics TP"\ \ \ \ \ \ "SendCoreEvents"
+}' -i ${xfc}
+ fi
+
+ # ModulePath for proprietary drivers (otherwise disabled)
+ if [ -n "$xserver_driver" -o "$xserver_prefnongpl" -eq "1" ]; then
+ sed -e "s,# ModulePath \", ModulePath \"${MODULE_PATH},g" \
+ -i ${xfc}
+ fi
+
+ ############################################
+ # Copy the appropriate ld.so.cache file
+ ############################################
+ if [ "${xmodule}" = "fglrx" -o "${xmodule}" = "nvidia" ]; then
+ cp ${PLUGIN_PATH}/ld.so.cache /mnt/etc/ld.so.cache
+
+ # just in case somebody needs to run ldconfig - insert GL-Libs at the beginning
+ sed -e "1s,^,include ${PLUGIN_ROOTFS}/ld.so.conf\n,g" -i /mnt/etc/ld.so.conf
+
+ if [ "${xmodule}" = "nvidia" ]; then
+ sed -i "s,\(Driver.*\"nvidia\"\),\1\n Option \"NoLogo\" \"True\"," ${xfc}
+ fi
+ fi
+
+ # check if tablet hardware available, read device information from file
+ if [ -e /etc/tablet.conf ]; then
+ . /etc/tablet.conf
+ echo -e 'Section "InputDevice"
+ Driver "wacom"
+ Identifier "Stylus"
+ Option "Device" "/dev/input/wacom"
+ Option "Type" "stylus"
+ Option "ForceDevice" "ISDV4" # Tablet PC ONLY
+EndSection
+Section "InputDevice"
+ Driver "wacom"
+ Identifier "Pad"
+ Option "Device" "/dev/input/wacom"
+ Option "Type" "pad"
+ Option "ForceDevice" "ISDV4" # Tablet PC ONLY
+EndSection
+Section "InputDevice"
+ Driver "wacom"
+ Identifier "Eraser"
+ Option "Device" "/dev/input/wacom"
+ Option "Type" "eraser"
+ Option "ForceDevice" "ISDV4" # Tablet PC ONLY
+EndSection
+Section "InputDevice"
+ Driver "wacom"
+ Identifier "Cursor"
+ Option "Device" "/dev/input/wacom"
+ Option "Type" "cursor"
+ Option "ForceDevice" "ISDV4" # Tablet PC ONLY
+EndSection' >> ${xfc}
+ sed -e "s,/dev/input/wacom,/dev/${wacomdev}," \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "Stylus" "SendCoreEvents"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "Pad" "SendCoreEvents"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "Cursor" "SendCoreEvents"' \
+ -e '/e \"Generic Mouse\"/a\\ \ InputDevice "Eraser" "SendCoreEvents"' \
+ -i ${xfc}
+ fi
+
+ # some configurations produce no proper screen resolution without
+ # Horizsync and Vertrefresh set (more enhancements might be needed for
+ # really old displays like CRTs)
+ if [ $xserver_ddcinfo -ne 0 ] ; then
+ # read /etc/hwinfo.display started at "runinithook '00-started'"
+ vert=$(grep -m 1 "Vert.*Range:" /etc/hwinfo.display | \
+ sed 's|.*Range:\ ||;s|\ Hz||')
+ horz=$(grep -m 1 "Hor.*Range:" /etc/hwinfo.display | \
+ sed 's|.*Range:\ ||;s|\ kHz||')
+ modl=$(grep -m 1 " Model: " /etc/hwinfo.display | \
+ sed 's|.*Model:\ ||;s|"||g')
+ size="$(grep -m 1 " Size: " /etc/hwinfo.display | \
+ sed 's|.*ize:\ ||;s|\ mm||;s|x|\ |')"
+ modes=$(grep -i "Resolution: .*@" /etc/hwinfo.display | \
+ awk '{print $2}'| sort -unr| awk -F '@' '{print "\"" $1 "\""}'|\
+ tr "\n" " ")
+ [ -n "$vert" -a -n "$horz" ] && \
+ sed -e "s|# Horizsync.*| Horizsync $horz|;\
+ s|# Vertrefre.*| Vertrefresh $vert|;\
+ s|# Modelname.*| Modelname \"$modl\"|" -i ${xfc}
+ [ -n "$size" ] && \
+ sed -e "s|# DisplaySi.*| DisplaySize $size|" -i ${xfc}
+ [ -n "$modes" ] && \
+ sed -e "s|# SubSection.*| SubSection \"Display\"|;\
+ s|# Depth 24.*| Depth 24|;\
+ s|# Modes.*| Modes $modes|;\
+ s|# EndSubSection.*| EndSubSection|;" -i ${xfc}
+
+ fi
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "done with 'xserver' os-plugin ..."
+
+ fi
+elif [ ! -e /initramfs/plugin-conf/xserver.conf ]; then
+ [ $DEBUGLEVEL -gt 2 ] && \
+ echo "No configuration file found for xserver plugin."
+fi
diff --git a/src/os-plugins/plugins/xserver/files/README b/src/os-plugins/plugins/xserver/files/README
new file mode 100644
index 00000000..c13d9570
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/README
@@ -0,0 +1,77 @@
+Some development notes
+======================
+
+
+Infos about ati-packages:
+Most are identical, even when 64bit packages have a different name
+Only a couple of cards have its own special package. We need to
+investigate, if they are different or one package works for all.
+
+It seems - only for the FireMV 2200 PCI graphics card, they offer an older
+version (8.25) of the unified fglrx-driver. For the FirMV PCIE-Card they
+offer a more recent Version (8.5).
+By the time of writing the drivers were at version 8.7
+
+From the ATI-FAQ:
+
+Q2: Which ATI graphics cards can use this driver?
+A2: The ATI Proprietary Linux driver currently supports Radeon 8500 and
+later AGP or PCI Express graphics products, as well as ATI FireGL 8700
+and later products. We do not currently plan to include support for any
+products earlier than this.
+
+Support for earlier graphics card can be achieved by "radeon" or "ati" drivers!
+
+===============================================================================
+
+Infos about nvidia packages:
+they seem to differ much more as ati if you search directly for a
+specific graphic card. But if you take a look on
+http://www.nvidia.com/object/unix.html there seem to be just 3 different
+ersions - all for different architectures (ia32, ia64, amd64)
+
+
+
+Supported graphics cards can be read from the nvidia-documentation
+
+For the 173.14.12-NVIDIA-Driver go to
+http://www.nvidia.com/object/linux_display_ia32_173.14.12.html
+and click on "Supported Products List" on the right side
+
+(below each unified driver a line to symbolize the evolution of
+ drivers - correct me if I'm wrong)
+
+173.14.12 driver: GeForce FX 5100 & all newer supported
+ |---------------------------------->
+ 71.86.06 driver: Riva TNT - GeForce 6800 Ultra
+|---------------|
+ 96.43.07 driver: some GeForce3 - GeForce 7900 ??
+ |---------------|
+
+The Question is, wether we need to support older graphics cards.
+Probably we don't need to bother because the user can download right
+driver package for his needs - almost the same interfaces for the installer...
+
+
+
+===============================================================================
+Taken from the readme on
+http://us.download.nvidia.com/XFree86/Linux-x86/96.43.07/README/README.txt
+
+since 96.43.07 no longer supported in the unified driver:
+
+ NVIDIA chip name Device PCI ID
+ ---------------------------------- ----------------------------------
+ RIVA TNT 0x0020
+ RIVA TNT2/TNT2 Pro 0x0028
+ RIVA TNT2 Ultra 0x0029
+ Vanta/Vanta LT 0x002C
+ RIVA TNT2 Model 64/Model 64 Pro 0x002D
+ Aladdin TNT2 0x00A0
+ GeForce 256 0x0100
+ GeForce DDR 0x0101
+ Quadro 0x0103
+ GeForce2 GTS/GeForce2 Pro 0x0150
+ GeForce2 Ti 0x0151
+ GeForce2 Ultra 0x0152
+ Quadro2 Pro 0x0153
diff --git a/src/os-plugins/plugins/xserver/files/ati-install.sh b/src/os-plugins/plugins/xserver/files/ati-install.sh
new file mode 100755
index 00000000..662b96bf
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/ati-install.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+cd /opt/openslx/plugin-repo/xserver
+
+DISTRO=$1
+case $DISTRO in
+
+ ubuntu-9.10*)
+ ./ubuntu-ng-gfx-install.sh ati ${DISTRO}
+ ;;
+ ubuntu-9.04*)
+ ./ubuntu-ng-gfx-install.sh ati ${DISTRO}
+ ;;
+ ubuntu-8.10*)
+ ./ubuntu-ng-gfx-install.sh ati ${DISTRO}
+ ;;
+ ubuntu-*)
+ ./ubuntu-gfx-install.sh ati ${DISTRO}
+ ;;
+
+ suse-*)
+ ./suse-gfx-install.sh ati ${DISTRO}
+ ;;
+esac
diff --git a/src/os-plugins/plugins/xserver/files/nvidia-install.sh b/src/os-plugins/plugins/xserver/files/nvidia-install.sh
new file mode 100755
index 00000000..aa2b2269
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/nvidia-install.sh
@@ -0,0 +1,138 @@
+#!/bin/bash
+
+##########################################################
+# Installs NVIDIA binary drivers into openslx plugin-repo
+##########################################################
+PLUGIN_PATH="/opt/openslx/plugin-repo/xserver"
+
+# we could easily pass this information via calling stage1 script and do not
+# need to find it our here ...
+DISTRO=$1
+
+
+# for development we take the only kernel version from normal systems
+if [ -L /boot/vmlinuz ]; then
+ KVERS=$(ls -l /boot/vmlinuz | awk -F "->" '{print $2}'| grep -P -o "2.6.*")
+else
+ KVERS=$(ls /boot/vmlinuz-* | head -n1 | awk -F "->" '{print $2}' | grep -P -o "2.6.*" )
+fi
+
+
+#change to plugin path
+cd ${PLUGIN_PATH}
+
+case ${DISTRO} in
+ ubuntu-9.10*)
+ ./ubuntu-ng-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ ubuntu-9.04*)
+ ./ubuntu-ng-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ ubuntu-8.10*)
+ ./ubuntu-ng-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ ubuntu*)
+ ./ubuntu-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ suse-1*)
+ ./suse-gfx-install.sh nvidia ${DISTRO}
+ ;;
+ # general purpose nvidia installer script
+ *)
+ echo "* Running general NVidia installer (expected in xserver::pkgpath)"
+ # unpack the nvidia installer; quickhack - expects just one package
+ echo " * Unpacking installer"
+ sh packages/NVIDIA-Linux-*.run -a -x >>nvidia-inst.log 2>&1
+ # prefix and paths should be matched more closely to each distro
+ # just demo at the moment ... but working at the moment
+ # without the kernel module
+ stdprfx=/opt/openslx/plugin-repo/xserver/nvidia
+
+ # backing up libglx.so and libGLcore.so
+ BACKUP_PATH=${stdprfx}/../mesa/usr/lib/xorg/modules/extensions
+ mkdir -p ${BACKUP_PATH}
+ if [ -f /usr/lib/xorg/modules/extensions/libglx.so ]; then
+ cp /usr/lib/xorg/modules/extensions/libGLcore.so ${BACKUP_PATH}
+ cp /usr/lib/xorg/modules/extensions/libglx.so ${BACKUP_PATH}
+ elif [ -f /usr/X11R6/lib/xorg/modules/extensions/libglx.so ]; then
+ cp /usr/X11R6/lib/xorg/modules/extensions/libglx.so ${BACKUP_PATH}
+ cp /usr/X11R6/lib/xorg/modules/extensions/libGLcore.so ${BACKUP_PATH}
+ touch ${BACKUP_PATH}/X11R6
+ fi
+ if [ -f /usr/lib/libGL.so.1.2 ]; then
+ cp /usr/lib/libGL.so.1.2 ${BACKUP_PATH}/../../..
+ elif [ -f /usr/X11R6/lib/libGL.so.1.2 ]; then
+ cp /usr/X11R6/lib/libGL.so.1.2 ${BACKUP_PATH}/../../..
+ touch ${BACKUP_PATH}/../../../X11R6
+ fi
+
+
+ # run the lib installer
+ echo " * Starting the library installer"
+ echo "Starting the lib installer" >>nvidia-inst.log
+ $(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N --no-abi-note \
+ --x-prefix=${stdprfx}/usr --x-library-path=${stdprfx}/usr/lib \
+ --x-module-path=${stdprfx}/usr/lib/xorg/modules \
+ --opengl-prefix=${stdprfx}/usr --utility-prefix=${stdprfx}/usr \
+ --documentation-prefix=${stdprfx}/usr --no-runlevel-check \
+ --no-rpms --no-x-check --no-kernel-module \
+ --log-file-name=nvidia-lib.log >>nvidia-inst.log 2>&1
+ # how to get an idea of the installed kernel?
+ # run the kernel module creator (should be done for every kernel!?)
+ kernel=${KVERS}
+ echo " * Trying to compile a kernel module for $kernel"
+ echo "Starting the kernel $kernel installer" >>nvidia-inst.log
+ # we need the .config file in /usr/src/linux or where ever!
+ # we need scripts/genksyms/genksyms compiled via make scripts in /usr/src/linux
+ # option available in newer nvidia packages
+ cd /usr/src/linux-${kernel%-*}
+ # in suse we have the config file lying there
+ cp /boot/config-${kernel} .config
+ ARCH=$(cat .config| grep -o CONFIG_M.86=y |tail -n1|grep -o "[0-9]86")
+ SUFFIX=${kernel##*-}
+ #cp -r /usr/src/linux-${kernel%-*}-obj/i${ARCH}/${SUFFIX}/ \
+ # /usr/src/linux-${kernel%-*}
+ make oldconfig >/dev/null 2>&1
+ make prepare >/dev/null 2>&1
+ cd - >/dev/null 2>&1
+ #/usr/src/linux-${kernel%-*}
+ addopts="--no-cc-version-check"
+ $(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N -K --no-abi-note \
+ --kernel-source-path=/usr/src/linux-${kernel%-*} \
+ --kernel-include-path=/usr/src/linux-${kernel%-*}-obj/i${ARCH}/${SUFFIX}/include \
+ -k ${kernel} \
+ --kernel-install-path=/opt/openslx/plugin-repo/xserver/nvidia/modules \
+ --no-runlevel-check --no-abi-note --no-rpms ${addopts} \
+ --log-file-name=nvidia-kernel.log >>nvidia-inst.log 2>&1
+ if [ $? -gt 0 ];then
+ echo "* kernel module built failed!"
+ fi
+ echo " * Have a look into the several *.log files in "
+ echo " stage1/${DISTRO}/plugin-repo/xserver"
+
+
+ # redo some unwanted changes of nvidia-installer
+ if [ -f ${BACKUP_PATH}/libglx.so ]; then
+ cp ${BACKUP_PATH}/libGLcore.so /usr/lib/xorg/modules/extensions
+ cp ${BACKUP_PATH}/libglx.so /usr/lib/xorg/modules/extensions
+ if [ -f ${BACKUP_PATH}/X11R6 ]; then
+ cp ${BACKUP_PATH}/libGLcore.so /usr/X11R6/lib/xorg/modules/extensions
+ cp ${BACKUP_PATH}/libglx.so /usr/X11R6/lib/xorg/modules/extensions
+ fi
+ fi
+ if [ -f ${BACKUP_PATH}/../../../libGL.so.1.2 ]; then
+ cp ${BACKUP_PATH}/../../../libGL.so.1.2 /usr/lib
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so
+ elif [ -f ${BACKUP_PATH}/../../../X11R6 ]; then
+ cp ${BACKUP_PATH}/../../../libGL.so.1.2 /usr/X11R6/lib/
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so
+ fi
+
+
+ ;;
+esac
+
+# set a proper return value to evaluate it in the calling script
+exit 0
diff --git a/src/os-plugins/plugins/xserver/files/suse-gfx-install.sh b/src/os-plugins/plugins/xserver/files/suse-gfx-install.sh
new file mode 100755
index 00000000..ac6713fb
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/suse-gfx-install.sh
@@ -0,0 +1,330 @@
+#!/bin/bash
+
+#
+# supported:
+# nvidia:
+# * 10.2 (pkg-installer)
+# * 11.0 (zypper rpm packages)
+# * 11.1 (zypper rpm packages)
+#
+# ati:
+# * 10.2 (pkg-installer)
+# * 11.0 (zypper rpm packages)
+# * 11.1 (zypper rpm packages)
+#
+
+# not right any more - removed from script
+# is there any busybox in this environment
+#BUSYBOX="/mnt/opt/openslx//busybox/busybox"
+
+BASE=/opt/openslx/plugin-repo/xserver
+DISTRO=$2
+cd ${BASE}
+
+if [ -L /boot/vmlinuz ]; then
+ KSUFFIX=$(ls -l /boot/vmlinuz | grep -P -o -e "-[a-z]*$" )
+ KVERS=$(ls -l /boot/vmlinuz | awk -F "->" '{print $2}'| grep -P -o "2.6.*")
+else
+ KSUFFIX=$(ls /boot/vmlinuz-* | head -n1 | grep -P -o -e "-[a-z]*$" )
+ KVERS=$(ls /boot/vmlinuz-* | head -n1 | awk -F "->" '{print $2}' | grep -P -o "2.6.*" )
+
+fi
+
+if [ -z "${KSUFFIX}" ]; then
+ echo "Could not determine proper local kernel suffix!"
+ echo "This is needed to install kernel modules for graphics drivers!"
+ exit 1
+fi
+
+
+buildfglrx() {
+ # build ATI kernel module
+ cd ${BASE}/ati/usr/src/kernel-modules/fglrx
+ rm -rf fglrx.ko >/dev/null 2>&1
+ make KVER=${1} >/dev/null 2>&1
+ if [ "$?" -eq "0" ]; then
+ cp fglrx.ko ../../../../modules
+ else
+ echo -e "Kernel module for kernel ${1} could not be built!"
+ fi
+ cd - >/dev/null 2>&1
+}
+
+
+##########################################################################
+# NVidia section
+##########################################################################
+if [ "$1" = "nvidia" ]; then
+ if [ -e nvidia/usr/lib/libGL.so.1 ]; then
+ exit
+ fi
+ if [ ! -d nvidia ]; then
+ mkdir -p nvidia/{modules,usr,temp}
+ fi
+ cd nvidia/temp
+
+ case ${DISTRO} in
+ suse-10.2*)
+ echo "* Running general NVidia installer (expected in xserver::pkgpath)"
+ # unpack the nvidia installer; quickhack - expects just one package
+ echo " * Unpacking installer"
+ sh ../../packages/NVIDIA-Linux-*.run -a -x >>nvidia-inst.log 2>&1
+ # prefix and paths should be matched more closely to each distro
+ # just demo at the moment ... but working at the moment
+ # without the kernel module
+ stdprfx=/opt/openslx/plugin-repo/xserver/nvidia
+
+ # backing up libglx.so and libGLcore.so
+ bkpprfx=${stdprfx}/../mesa/lib/xorg/modules/extensions
+ mkdir -p ${bkpprfx}
+ if [ -f /usr/lib/xorg/modules/extensions/libglx.so ]; then
+ cp /usr/lib/xorg/modules/extensions/libGLcore.so ${bkpprfx}
+ cp /usr/lib/xorg/modules/extensions/libglx.so ${bkpprfx}
+ elif [ -f /usr/X11R6/lib/xorg/modules/extensions/libglx.so ]; then
+ cp /usr/X11R6/lib/xorg/modules/extensions/libglx.so ${bkpprfx}
+ cp /usr/X11R6/lib/xorg/modules/extensions/libGLcore.so ${bkpprfx}
+ touch ${bkpprfx}/../../../../X11R6
+ fi
+ if [ -f /usr/lib/libGL.so.1.2 ]; then
+ cp /usr/lib/libGL.so.1.2 ${bkpprfx}/../../..
+ elif [ -f /usr/X11R6/lib/libGL.so.1.2 ]; then
+ cp /usr/X11R6/lib/libGL.so.1.2 ${bkpprfx}/../../..
+ touch ${bkpprfx}/../../../X11R6
+ fi
+
+
+ # run the lib installer
+ echo " * Starting the library installer"
+ echo "Starting the lib installer" >>nvidia-inst.log
+ $(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N --no-abi-note \
+ --x-prefix=${stdprfx}/usr --x-library-path=${stdprfx}/usr/lib \
+ --x-module-path=${stdprfx}/usr/lib/xorg/modules \
+ --opengl-prefix=${stdprfx}/usr --utility-prefix=${stdprfx}/usr \
+ --documentation-prefix=${stdprfx}/usr --no-runlevel-check \
+ --no-rpms --no-x-check --no-kernel-module \
+ --log-file-name=nvidia-lib.log >>nvidia-inst.log 2>&1
+ # how to get an idea of the installed kernel?
+ # run the kernel module creator (should be done for every kernel!?)
+ kernel=${KVERS}
+ echo " * Trying to compile a kernel module for $kernel"
+ echo "Starting the kernel module installer for $kernel" >>nvidia-inst.log
+ # we need the .config file in /usr/src/linux or where ever!
+ # we need scripts/genksyms/genksyms compiled via make scripts in /usr/src/linux
+ # option available in newer nvidia packages
+ cd /usr/src/linux-${kernel%-*}
+ # in suse we have the config file lying there
+ cp /boot/config-${kernel} .config
+ ARCH=$(cat .config| grep -o CONFIG_M.86=y |tail -n1|grep -o "[0-9]86")
+ SUFFIX=${kernel##*-}
+ cp -r /usr/src/linux-${kernel%-*}-obj/i${ARCH}/${SUFFIX}/ \
+ /usr/src/linux-${kernel%-*}
+ make scripts >/dev/null 2>&1
+ make prepare >/dev/null 2>&1
+ cd - >/dev/null 2>&1
+ #/usr/src/linux-${kernel%-*}
+ addopts="--no-cc-version-check"
+ $(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N -K --no-abi-note \
+ --kernel-source-path=/usr/src/linux-${kernel%-*} \
+ -k ${kernel} \
+ --kernel-install-path=/opt/openslx/plugin-repo/xserver/nvidia/modules \
+ --no-runlevel-check --no-abi-note --no-rpms ${addopts} \
+ --log-file-name=nvidia-kernel.log >>nvidia-inst.log 2>&1
+ if [ $? -gt 0 ];then
+ echo "* kernel module built failed!"
+ echo "* Have a look into the several log files in "
+ echo " stage1/${DISTRO}/plugin-repo/xserver"
+ fi
+
+
+ # redo some unwanted changes of nvidia-installer
+ if [ -f ${bkpprfx}/libglx.so ]; then
+ cp ${bkpprfx}/libGLcore.so /usr/lib/xorg/modules/extensions
+ cp ${bkpprfx}/libglx.so /usr/lib/xorg/modules/extensions
+ if [ -f ${bkpprfx}/X11R6 ]; then
+ cp ${bkpprfx}/libGLcore.so /usr/X11R6/lib/xorg/modules/extensions
+ cp ${bkpprfx}/libglx.so /usr/X11R6/lib/xorg/modules/extensions
+ fi
+ fi
+ if [ -f ${bkpprfx}/../../../libGL.so.1.2 ]; then
+ cp ${bkpprfx}/../../../libGL.so.1.2 /usr/lib
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1
+ ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so
+ fi
+ ;;
+ suse-11.*)
+ echo "* Downloading nvidia rpm packages... this could take some time..."
+ # add repository for nvidia drivers
+ case ${DISTRO} in
+ suse-11.0*)
+ REPO=http://download.nvidia.com/opensuse/11.0/
+ ;;
+ suse-11.1*)
+ REPO=http://download.nvidia.com/opensuse/11.1/
+ ;;
+ esac
+ zypper --no-gpg-checks addrepo ${REPO} NVIDIA > /dev/null 2>&1
+ # get URLs by virtually installing nvidia-OpenGL driver
+ zypper --no-gpg-checks -n -vv install -D \
+ nvidia-gfxG01-kmp${KSUFFIX} > logfile 2>&1
+
+ # zypper refresh is requested if something is not found
+ if [ "1" -le "$(cat logfile | grep -o "zypper refresh"| wc -l)" ]; then
+ zypper --no-gpg-checks refresh >/dev/null 2>&1
+ fi
+
+ # take unique urls from logfile
+ URLS=$(cat logfile | grep -P -o "http://.*?rpm " | sort -u | xargs)
+ for RPM in $URLS; do
+ RNAME=$(echo ${RPM} | sed -e 's,^.*/\(.*\)$,\1,g')
+ if [ ! -e ${RNAME} ]; then
+ wget ${RPM} > /dev/null 2>&1
+ fi
+ # We use rpm2cpio from suse to extract
+ if [ -f ${RNAME} ]; then
+ rpm2cpio ${RNAME} | cpio -id > /dev/null 2>&1
+ fi
+ done
+ if [ -d ./usr/X11R6/lib ]; then
+ mv ./usr/X11R6/lib/* ./usr/lib/
+ fi
+ if [ $(find ./usr/ -name *.so* 2>/dev/null | wc -l ) -eq 0 ]; then
+ echo " NVIDIA files failed to install via zypper!!"
+ exit
+ fi
+
+ rm -rf ../usr
+ if [ -d ./usr ]; then
+ mv ./usr ..
+ fi
+ find lib/ -name "*.ko" -exec mv '{}' ../modules \; > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo " Could not find kernel module nvidia.ko!";
+ fi
+
+ cd ..
+ ;;
+ esac
+
+ rm -rf temp/
+ cd ..
+
+fi
+
+
+############################################################################
+# ATI section
+############################################################################
+if [ "$1" = "ati" ]; then
+ if [ -e ati/usr/lib/libGL.so.1.2 ]; then
+ exit
+ fi
+
+ mkdir -p ati/modules ati/temp
+
+ case ${DISTRO} in
+ suse-10.2*)
+ ### SUSE 10.2 section ###
+ echo "* Extracting ATI package (expected in xserver::pkgpath) ... this could take some time..."
+
+ PKG=`find packages/ -name ati-driver*\.run | tail -n1`
+ PKG_VERSION=`head ${PKG} | grep -P -o "[0-9]\.[0-9]{3}"`
+
+ chmod +x ${PKG}
+
+ ${PKG} --extract ati/temp >/dev/null 2>&1
+
+ cd ati/temp/
+ RPM=`./ati-installer.sh ${PKG_VERSION} --buildpkg SuSE/SUSE102-IA32 2>&1 | grep Package | awk '{print $2}' | tail -n1`
+
+ cd ..
+ rpm2cpio ${RPM} 2>/dev/null | cpio -id >/dev/null 2>&1
+
+
+ if [ -d ./usr/X11R6/lib ]; then
+ mv ./usr/X11R6/lib/* ./usr/lib/
+ fi
+ if [ -d etc ]; then
+ cp -r etc/* /etc/
+ fi
+
+ # cleanup
+ rm -rf ${RPM}
+ cd ..
+ rm -rf ${PKG}
+
+
+ buildfglrx ${KVERS}
+
+ ;;
+ suse-11.*)
+ ### SUSE 11.0 Section ###
+
+ echo "* Downloading ati rpm packages... this could take some time..."
+ cd ati/temp
+
+ # add repository for ATI drivers
+ case ${DISTRO} in
+ suse-11.0*)
+ zypper --no-gpg-checks addrepo http://www2.ati.com/suse/11.0/ ATI > /dev/null 2>&1
+ ;;
+ suse-11.1*)
+ zypper --no-gpg-checks addrepo http://www2.ati.com/suse/11.1/ ATI > /dev/null 2>&1
+ ;;
+ esac
+ # get URLs by virtually installing fglrx-OpenGL driver
+ zypper --no-gpg-checks -n -vv install -D ati-fglrxG01-kmp${KSUFFIX} \
+ x11-video-fglrxG01 > logfile 2>&1
+
+ # zypper refresh is requested if something is not found
+ if [ "1" -le "$(cat logfile | grep -o "zypper refresh" | wc -l)" ]; then
+ zypper --no-gpg-check refresh >/dev/null 2>&1
+ fi
+
+ # take unique urls from logfile
+ URLS=$(cat logfile | grep -P -o "http://.*?rpm " | grep fglrx | sort -u | xargs)
+ for RPM in $URLS; do
+ RNAME=$(echo ${RPM} | sed -e 's,^.*/\(.*\)$,\1,g')
+ if [ ! -e ${RNAME} ]; then
+ wget ${RPM} > /dev/null 2>&1
+ fi
+ # We use rpm2cpio from suse to extract -> propably new rpm version
+ if [ -f ${RNAME} ]; then
+ rpm2cpio ${RNAME} | cpio -id > /dev/null 2>&1
+ fi
+ done
+
+ if [ -d ./usr/X11R6/lib ]; then
+ mv ./usr/X11R6/lib/* ./usr/lib/ > /dev/null 2>&1
+ fi
+ if [ $(find ./usr/ -name *.so* 2>/dev/null | wc -l ) -eq 0 ]; then
+ echo " ATI files failed to install via zypper!!"
+ exit
+ fi
+
+ mv ./usr ..
+ mv ./etc ..
+
+ find lib/ -name "*.ko" -exec mv {} ../modules \; >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo " Could not find kernel module fglrx.ko!";
+ fi
+
+ ;;
+ esac
+ cd ..
+
+ # OpenGl implementation (libGL?) expect fglrx_dri.so in /usr/X11R6/lib/dri/
+ if [ ! -f /usr/X11R6/lib/modules/dri/fglrx_dri.so -a \
+ ! -f usr/X11R6/lib/modules/dri/fglrx_dri.so ]; then
+ if [ ! -d /usr/X11R6/lib/modules/dri ]; then
+ mkdir -p /usr/X11R6/lib/modules/dri
+ fi
+ if [ -f usr/lib/dri/fglrx_dri.so ]; then
+ ln -s ${BASE}/ati/usr/lib/dri/fglrx_dri.so \
+ /usr/X11R6/lib/modules/dri/fglrx_dri.so
+ fi
+ fi
+
+ rm -rf temp/
+fi
+
diff --git a/src/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh b/src/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh
new file mode 100755
index 00000000..c6ac17c9
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/ubuntu-gfx-install.sh
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+# gets needed packages for ubuntu nvidia/ati drivers
+# $1 = nvidia | ati
+PLUGIN_FOLDER="/opt/openslx/plugin-repo/xserver"
+TMP_FOLDER="/tmp/slx-plugin/xserver"
+TARGET="$1"
+DISTRO="$2"
+
+if [ ! -d "${PLUGIN_FOLDER}" ]; then
+ mkdir -p "${PLUGIN_FOLDER}/modules"
+fi
+
+# change into temp
+cd ${TMP_FOLDER} > /dev/null
+
+if [ -e "/boot/vmlinuz" ]; then
+ KVER=$(ls -ahl '/boot/vmlinuz' | sed -e 's,^.*vmlinuz-,,g')
+else
+ KVER=$(find /lib/modules/2.6* -maxdepth 0|sed 's,/lib/modules/,,g'|sort|tail -n1)
+fi
+
+
+echo " * downloading restricted modules... this may take a while"
+# TODO: remove commented out "> /dev/null ..." later... multiple times
+# in this script! check all comments!
+aptitude download linux-restricted-modules-${KVER} #> /dev/null 2&>1
+if [ $? -eq 1 ]; then
+ echo " * Didn't get restricted modules. Exit now!"
+ #TODO: remove sh when development is finished
+ sh
+ exit
+fi
+MODULE_DEB=$(ls linux-restricted-modules-*.deb | tail -n1)
+dpkg-deb -x ${MODULE_DEB} ${TMP_FOLDER}/modules
+
+case ${TARGET} in
+ ati)
+ mkdir -p ${PLUGIN_FOLDER}/ati
+ mkdir -p ${PLUGIN_FOLDER}/ati/modules
+
+ echo " * downloading fglrx xorg package... this may take a while"
+ aptitude download xorg-driver-fglrx #> /dev/null 2&>1
+ if [ $? -eq 1 ]; then
+ echo " * Didn't get package xorg-driver-fglrx! Exit now!"
+ #TODO: remove sh when development is finished
+ sh
+ exit
+ fi
+ FGLRX_DEB=$(ls xorg-driver-fglrx_*.deb | tail -n1)
+ # extract $DEB
+ dpkg-deb -x ${FGLRX_DEB} ${PLUGIN_FOLDER}/ati
+
+ # assemble module
+ cd modules/lib/linux-restricted-modules/${KVER}/
+ ld_static -d -r -o ${PLUGIN_FOLDER}/ati/modules/fglrx.ko fglrx/*
+
+ if [ -f /usr/lib/dri/fglrx_dri.so ]; then
+ mv /usr/lib/dri/fglrx_dri.so /usr/lib/dri/fglrx_dri.so.slx
+ else
+ # remove link
+ rm -rf /usr/lib/dri/fglrx_dri.so
+ fi
+ ln -s ${PLUGIN_FOLDER}/ati/usr/lib/dri/fglrx_dri.so \
+ /usr/lib/dri/fglrx_dri.so
+
+ # Recent ATI drivers expect the driver link in /xyz
+ if [ ! -d /usr/X11R6/lib/modules/dri ]; then
+ mkdir -p /usr/X11R6/lib/modules/dri
+ fi
+ ln -s ${PLUGIN_FOLDER}/ati/usr/lib/dri/fglrx_dri.so \
+ /usr/X11R6/lib/modules/dri/fglrx_dri.so
+
+ # cleanup
+ cd ${PLUGIN_FOLDER}/ati
+
+ #@Volker: We need /etc-files - there is a database
+ # file for the fglrx-driver in stage3 !!!
+ #rm -rf ./etc
+ #TODO: check for more cleanups when the main part works!
+
+ ;;
+
+
+ nvidia)
+ mkdir -p ${PLUGIN_FOLDER}/nvidia
+ mkdir -p ${PLUGIN_FOLDER}/nvidia/modules
+
+ echo " * downloading fglrx xorg package... this may take a while"
+ aptitude download nvidia-glx-new #> /dev/null 2&>1
+ if [ $? -eq 1 ]; then
+ echo " * Didn't get package nvidia-glx-new!"
+ #TODO: remove sh when development is finished
+ sh
+ exit
+ fi
+ #Bastian: what is this? please explain
+ #aptitude download nvidia-glx
+ NVIDIA_DEB=$(ls nvidia-glx*.deb | tail -n1)
+ # extract $DEB
+ dpkg-deb -x ${NVIDIA_DEB} ${PLUGIN_FOLDER}/nvidia
+
+ # assemble module - we just need the new one here
+ # TODO: modules for older graphics hardware can be found here
+ cd modules/lib/linux-restricted-modules/${KVER}/
+ ld_static -d -r -o ${PLUGIN_FOLDER}/nvidia/modules/nvidia.ko nvidia_new/*
+
+ #TODO: if we use this part, we need to copy the check from ati, too!
+ #if [ -f /usr/lib/dri/fglrx_dri.so ]; then
+ # mv /usr/lib/dri/fglrx_dri.so /usr/lib/dri/fglrx_dri.so.slx
+ #else
+ # # remove link
+ # rm -rf /usr/lib/dri/fglrx_dri.so
+ #fi
+ #ln -s ${PLUGIN_FOLDER}/nvidia/nvroot/usr/lib/dri/nvidia_dri.so \
+ # /usr/lib/dri/fglrx_dri.so
+
+ # cleanup
+ cd ${PLUGIN_FOLDER}/nvidia
+ rm -rf ./etc
+ #TODO: check for more cleanups when the main part works!
+ ;;
+esac
+
diff --git a/src/os-plugins/plugins/xserver/files/ubuntu-ng-gfx-install.sh b/src/os-plugins/plugins/xserver/files/ubuntu-ng-gfx-install.sh
new file mode 100755
index 00000000..259f2650
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/files/ubuntu-ng-gfx-install.sh
@@ -0,0 +1,236 @@
+#!/bin/sh
+
+# gets needed packages for ubuntu nvidia/ati drivers
+# $1 = nvidia | ati
+PLUGIN_FOLDER="/opt/openslx/plugin-repo/xserver"
+TMP_FOLDER="/tmp/slx-plugin/xserver"
+TARGET="$1"
+
+if [ ! -d "${PLUGIN_FOLDER}" ]; then
+ mkdir -p "${PLUGIN_FOLDER}/modules"
+fi
+
+# change into temp
+cd ${TMP_FOLDER} > /dev/null
+
+if [ -e "/boot/vmlinuz" ]; then
+ KVER=$(ls -ahl '/boot/vmlinuz' | sed -e 's,^.*vmlinuz-,,g')
+else
+ KVER=$(find /lib/modules/2.6* -maxdepth 0|sed 's,/lib/modules/,,g'|sort|tail -n1)
+fi
+
+# TODO: check for build-essential !!
+
+if [ ! -e "/usr/sbin/dkms" ]; then
+ echo -n " * DKMS not found: installing .."
+ aptitude -y install dkms > /dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package dkms! Exit now!"
+ exit 1
+ else
+ echo "ok"
+ fi
+fi
+
+# TODO: find a more clean way for this workaround
+# the current dkms script included in ubuntu is trying to compile
+# kernel modules under the user nobody using "su" which is not
+# working in the installation phase of the plugin.
+
+if [ $(grep -c "getent passwd nobody" /usr/sbin/dkms) -ne 0 ]; then
+ echo -n " * Patch DKMS not to run under user nobody .."
+ sed -i "s/getent passwd nobody/getent passwd N0/" \
+ /usr/sbin/dkms
+ echo "ok"
+fi
+
+case ${TARGET} in
+ ati)
+ mkdir -p ${PLUGIN_FOLDER}/ati/modules
+
+ echo -n " * downloading fglrx xorg package... "
+ aptitude download xorg-driver-fglrx > /dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package xorg-driver-fglrx! Exit now!"
+ exit 1
+ else
+ echo "ok"
+ fi
+ FGLRX_DEB=$(ls xorg-driver-fglrx_*.deb | tail -n1)
+ # extract $DEB
+ dpkg-deb -x ${FGLRX_DEB} ${PLUGIN_FOLDER}/ati
+
+ echo -n " * downloading fglrx kernel package... "
+ aptitude download fglrx-kernel-source >/dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package fglrx-kernel-source!"
+ exit 1
+ else
+ echo "ok"
+ fi
+
+ FGLRX_KERNEL_DEB=$(ls fglrx-kernel-source*.deb | tail -n1)
+ dpkg-deb -x ${FGLRX_KERNEL_DEB} /
+
+ FGLRX_SOURCE_DIR=$(find /usr/src/fglrx-${FGLRX_DRIVER_VERSION}* \
+ -maxdepth 0 -type d)
+ FGLRX_FULL_VERSION=$(echo ${FGLRX_SOURCE_DIR} | \
+ sed -e 's/\/usr\/src\/fglrx-//')
+
+ FGLRX_DKMS_DIR="/var/lib/dkms/fglrx/${FGLRX_FULL_VERSION}"
+
+ if [ -d /var/lib/dkms/fglrx/${FGLRX_FULL_VERSION} ]; then
+ if [ ! -L ${FGLRX_DKMS_DIR}/source ]; then
+ ln -sf ${FGLRX_SOURCE_DIR} ${FGLRX_DKMS_DIR}/source
+ fi
+ else
+ echo -n " * Add fglrx kernel module to dkms tree... "
+ dkms add -m fglrx -v ${FGLRX_FULL_VERSION} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "ok"
+ else
+ echo "fail"
+ exit 1
+ fi
+ fi
+
+ ###### build kernel module ######
+ echo -n " * Building fglrx kernel module for kernel ${KVER}... "
+ dkms -m fglrx -v ${FGLRX_FULL_VERSION} \
+ -k ${KVER} \
+ --kernelsourcedir /usr/src/linux-headers-${KVER}/ \
+ --no-prepare-kernel \
+ --no-clean-kernel \
+ build \
+ > /tmp/dkms.log 2>&1
+ if [ $? -eq 0 ]; then
+ echo "ok"
+ else
+ if $(cat /tmp/dkms.log | grep -q "has already"); then
+ echo "--- fglrx module already built ---"
+ else
+ echo "fail"
+ echo "------ dkms.log -----"
+ cat /tmp/dkms.log
+ echo "---------------------"
+ rm /tmp/dkms.log
+ exit 1
+ fi
+ fi
+
+ FGLRX_MODULE_PATH=$(find ${FGLRX_DKMS_DIR}/${KVER}/ -name fglrx.ko \
+ | tail -n1 )
+
+ cp ${FGLRX_MODULE_PATH} ${PLUGIN_FOLDER}/ati/modules/fglrx.ko
+
+ # cleanup
+ if [ -f /usr/lib/dri/fglrx_dri.so ]; then
+ mv /usr/lib/dri/fglrx_dri.so /usr/lib/dri/fglrx_dri.so.slx
+ else
+ # remove link
+ rm -rf /usr/lib/dri/fglrx_dri.so
+ fi
+ ln -s ${PLUGIN_FOLDER}/ati/usr/lib/dri/fglrx_dri.so \
+ /usr/lib/dri/fglrx_dri.so
+
+ # cleanup
+ rm /tmp/dkms.log
+ cd ${PLUGIN_FOLDER}/ati
+
+ ;;
+
+
+ nvidia)
+ mkdir -p ${PLUGIN_FOLDER}/nvidia/modules
+
+ NVIDIA_DRIVER_VERSION=173
+
+ echo -n " * downloading nvidia xorg package... "
+ aptitude download nvidia-glx-${NVIDIA_DRIVER_VERSION} > /dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package nvidia-glx-${NVIDIA_DRIVER_VERSION}!"
+ exit 1
+ else
+ echo "ok"
+ fi
+
+ echo -n " * downloading nvidia kernel package... "
+ aptitude download nvidia-${NVIDIA_DRIVER_VERSION}-kernel-source >/dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "fail"
+ echo " * Didn't get package nvidia-${NVIDIA_DRIVER_VERSION}-kernel-source!"
+ exit 1
+ else
+ echo "ok"
+ fi
+
+ NVIDIA_DEB=$(ls -1 nvidia-glx*.deb | tail -n1)
+ NVIDIA_KERNEL_DEB=$(ls -1 nvidia-${NVIDIA_DRIVER_VERSION}-kernel-source*.deb | tail -n1)
+ # extract $DEB
+ dpkg-deb -x ${NVIDIA_DEB} ${PLUGIN_FOLDER}/nvidia
+ # extract the sources deb to root
+ dpkg-deb -x ${NVIDIA_KERNEL_DEB} /
+
+ NVIDIA_SOURCE_DIR=$(find /usr/src/nvidia-${NVIDIA_DRIVER_VERSION}* \
+ -maxdepth 0 -type d)
+ NVIDIA_FULL_VERSION=$(echo ${NVIDIA_SOURCE_DIR} | \
+ sed -e 's/\/usr\/src\/nvidia-//')
+
+ NVIDIA_DKMS_DIR="/var/lib/dkms/nvidia/${NVIDIA_FULL_VERSION}"
+
+ if [ -d /var/lib/dkms/nvidia/${NVIDIA_FULL_VERSION} ]; then
+ if [ ! -L ${NVIDIA_DKMS_DIR}/source ]; then
+ ln -sf ${NVIDIA_SOURCE_DIR} ${NVIDIA_DKMS_DIR}/source
+ fi
+ else
+ echo -n " * Add nvidia kernel module to dkms tree... "
+ dkms add -m nvidia -v ${NVIDIA_FULL_VERSION} >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ echo "ok"
+ else
+ echo "fail"
+ exit 1
+ fi
+ fi
+
+ ###### build kernel module ######
+ echo -n " * Building nvidia kernel module for kernel ${KVER}... "
+ dkms -m nvidia -v ${NVIDIA_FULL_VERSION} \
+ -k ${KVER} \
+ --kernelsourcedir /usr/src/linux-headers-${KVER}/ \
+ --no-prepare-kernel \
+ --no-clean-kernel \
+ build \
+ > /tmp/dkms.log 2>&1
+ if [ $? -eq 0 ]; then
+ echo "ok"
+ else
+ if $(cat /tmp/dkms.log | grep -q "has already"); then
+ echo "--- nvidia module already built ---"
+ else
+ echo "fail"
+ echo "------ dkms.log -----"
+ cat /tmp/dkms.log
+ echo "---------------------"
+ rm /tmp/dkms.log
+ exit 1
+ fi
+ fi
+
+ NVIDIA_MODULE_PATH=$(find ${NVIDIA_DKMS_DIR}/${KVER}/ -name \
+ nvidia.ko | tail -n 1)
+
+ cp ${NVIDIA_MODULE_PATH} ${PLUGIN_FOLDER}/nvidia/modules/nvidia.ko
+
+ # cleanup
+ rm /tmp/dkms.log
+ cd ${PLUGIN_FOLDER}/nvidia
+ rm -rf ./etc
+ #TODO: check for more cleanups when the main part works!
+ ;;
+esac
+
diff --git a/src/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh b/src/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh
new file mode 100644
index 00000000..0b08ec13
--- /dev/null
+++ b/src/os-plugins/plugins/xserver/init-hooks/00-started/xserver.sh
@@ -0,0 +1,53 @@
+# Copyright (c) 2008 - RZ Uni Freiburg
+# Copyright (c) 2008..2010 - OpenSLX GmbH
+#
+# This program/file is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your feedback to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org
+#
+# stage3 part of 'xserver' plugin - the runlevel script setting up the Xorg
+# configuration and checking for 3D capabilities and non-gpl drivers
+#
+# script is included from init via the "." load function - thus it has all
+# variables and functions available
+
+# get an idea of the installed graphics hardware - might be needed if the
+# automatic Xorg configation fails in this field. If no useable info was
+# detected just delete the file.
+
+# tablet detection function
+tabletdetect () {
+ sleep 1; waitfor /etc/hwinfo.bios 20000
+ # quickhack for IBM X61/ACER tablet detection (some kind of positive list
+ # or external admin configurable file needed)
+ if grep -qiE "tablet|TravelMate C200" /etc/hwinfo.bios ; then
+ echo 'wacomdev="ttyS0"' >/etc/tablet.conf
+ fi
+ # wacom device attached to usb - code to be tested
+ if [ ! -e /etc/tablet.conf ]; then
+ if hwinfo --usb | grep -qiE "wacom|tablet" ; then
+ echo 'wacomdev="input/wacom"' >/etc/tablet.conf
+ fi
+ fi
+}
+
+# hardware detection not really needed for Xorg => 1.7 used in newer versions
+# distro distinguishing here not 100% conform to the OpenSLX ideas. Hardware
+# detection might be needed for proprietary Xorg drivers ...
+# (clean up expected with rewritten stage3)
+case ${slxconf_distro_ver} in
+ "10.04"|"11.3")
+ ;;
+ *)
+ # hwinfo --gfxcard moved to general hardware detection as needed for two
+ # different plugins (bootsplash, xserver)
+ #( hwinfo --gfxcard >/etc/hwinfo.gfxcard ) &
+ ( hwinfo --monitor >/etc/hwinfo.display; grep "Generic Monitor" \
+ /etc/hwinfo.display >/dev/null 2>&1 && rm /etc/hwinfo.display ) &
+ ;;
+esac
+( tabletdetect ) &