From: Michael Hanke <michael.hanke@gmail.com>
Date: Wed, 3 Nov 2010 18:08:09 +0000 (-0400)
Subject: First draft of a welcome wizard for the VM.
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=054bf30d4c677bd858626d523922bf4bacb55961;p=neurodebian.git

First draft of a welcome wizard for the VM.
---

diff --git a/debian/changelog b/debian/changelog
index 6d4e290..203ad28 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,5 @@
-neurodebian (0.3) squeeze; urgency=low
+neurodebian (0.4) squeeze; urgency=low
 
   * Initial release.
 
- -- Michael Hanke <michael.hanke@gmail.com>  Fri, 29 Oct 2010 10:31:03 -0400
+ -- Michael Hanke <michael.hanke@gmail.com>  Wed, 03 Nov 2010 14:08:27 -0400
diff --git a/debian/neurodebian-guest-additions.install b/debian/neurodebian-guest-additions.install
index 20d2d81..ec6c292 100644
--- a/debian/neurodebian-guest-additions.install
+++ b/debian/neurodebian-guest-additions.install
@@ -1,3 +1,4 @@
 etc/sudoers.d/nopasswd etc/sudoers.d/
 etc/xdg/autostart/* etc/xdg/autostart/
 etc/gconf/* usr/share/gconf/defaults/
+tools/nd-vmsetupwizard usr/bin
diff --git a/etc/xdg/autostart/vmsetupwizard.desktop b/etc/xdg/autostart/vmsetupwizard.desktop
new file mode 100644
index 0000000..c6ccdd5
--- /dev/null
+++ b/etc/xdg/autostart/vmsetupwizard.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=NeuroDebian VirtualMachine setup wizard
+Comment=Runs once to perform final configuration steps
+Exec=[ ! -e /etc/neurodebian/guest/setupwizard_done ] && nd-vmsetupwizard
+Terminal=false
+Type=Application
diff --git a/tools/nd-vmsetupwizard b/tools/nd-vmsetupwizard
new file mode 100755
index 0000000..03900ee
--- /dev/null
+++ b/tools/nd-vmsetupwizard
@@ -0,0 +1,65 @@
+#!/bin/bash
+#emacs: -*- mode: shell-script; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
+#ex: set sts=4 ts=4 sw=4 et:
+
+# play save
+set -e
+set -u
+
+success_flag=/etc/neurodebian/guest/setupwizard_done
+nd_icon=/usr/share/pixmaps/neurodebian.svg
+icon_opt="--window-icon=$nd_icon"
+
+first_run=0
+if [ ! -e $success_flag ]; then
+	first_run=1
+fi
+
+if [ $first_run -eq 1 ]; then
+zenity --info $icon_opt --title="NeuroDebian Setup Wizard" \
+       --text="Welcome to the NeuroDebian virtual machine!
+
+This is the first time you have started this virtual machine. We will now perform a few simple steps to finalize its configuration. This includes upgrading the system to the latest available versions and installing additional software packages upon your request."
+fi
+
+if ! zenity --question $icon_opt --title="NeuroDebian Setup Wizard" \
+--text="The setup procedure requires network access to download packages from the Debian archive. If you do not have network access right now, you can re-start this wizzard at any time from the NeuroDebian menu.
+
+Do you want to proceed with updating the system?
+"; then
+	exit 0
+fi
+
+# initialize apt
+#update-manager -c
+
+if [ ! -e /etc/popularity-contest.conf ]; then
+	zenity --info $icon_opt --title="NeuroDebian Setup Wizard" \
+		--text="You will now be given the choice to participate in the package survey. If enabled, a list of installed packages will be anonymously sent to Debian (http://popcon.debian.org). Your participation is important for two reasons:
+
+1) Popular packages receive more attention from developers, bugs are fixed faster and updates are provided quicker.
+2) User statistics can help research software developers to acquire funding for continued development."
+
+	# install, but do not fail if something goes wrong
+	nd-autoinstall popularity-contest /etc/popularity-contest.conf || true
+fi
+
+# essential things are done -- let's mark sucess
+if [ $first_run -eq 1 ]; then
+	sudo touch $success_flag
+fi
+
+packages=$(zenity --list --checklist --column="Install" --column="Description" \
+	   --column="Package Name" --print-column=3 --hide-column=3 --hide-header \
+	   --separator=' ' --text="This is the manual
+" \
+FALSE "one" "ipython" \
+FALSE "two" "vim" \
+FALSE "three" "bc dc")
+
+if [ -n "$packages" ]; then
+	nd-autoinstall -f -p "$packages" true
+fi
+
+# and start greeter
+x-www-browser http://neuro.debian.net/vm_welcome.html &
diff --git a/xdg/desktop/neurodebian-vmsetupwizard.desktop b/xdg/desktop/neurodebian-vmsetupwizard.desktop
new file mode 100644
index 0000000..5e98ab8
--- /dev/null
+++ b/xdg/desktop/neurodebian-vmsetupwizard.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=VirtualMachine Setup Wizard
+Exec=nd-vmsetupwizard
+Type=Application
+Terminal=false
+Icon=system-run
+Categories=X-NeuroDebian