]> git.donarmstrong.com Git - neurodebian.git/blob - tools/nd-vmsetupwizard
handle popcon -- it is installed but disabled by default
[neurodebian.git] / tools / nd-vmsetupwizard
1 #!/bin/bash
2 #emacs: -*- mode: shell-script; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
3 #ex: set sts=4 ts=4 sw=4 et:
4
5 # play save
6 set -e
7 set -u
8
9 cfg_dir=/etc/neurodebian/guest/setupwizard_done
10 success_flag=$cfg_dir/setupwizard_done
11 nd_icon=/usr/share/pixmaps/neurodebian.svg
12 icon_opt="--window-icon=$nd_icon"
13
14 first_run=0
15 if [ ! -e $success_flag ]; then
16         first_run=1
17 fi
18
19 if [ $first_run -eq 1 ]; then
20 zenity --info $icon_opt --title="NeuroDebian Setup Wizard" \
21        --text="Welcome to the NeuroDebian virtual machine!
22
23 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."
24 fi
25
26 if ! zenity --question $icon_opt --title="NeuroDebian Setup Wizard" \
27 --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 wizard at any time from the NeuroDebian menu. If you proceed you may have to enter the superuser password with is by default 'neurodebian'.
28
29 Do you want to proceed with updating the system?
30 "; then
31         exit 0
32 fi
33
34 # initialize apt
35 update-manager -c
36
37 popconf=/etc/popularity-contest.conf
38 if [ ! -e "$popconf" ] || grep -q -e '^PARTICIPATE.*no' "$popconf" ;
39 then
40         zenity --info $icon_opt --title="NeuroDebian Setup Wizard" \
41                 --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:
42
43 1) Popular packages receive more attention from developers, bugs are fixed faster and updates are provided quicker.
44 2) User statistics can help research software developers to acquire funding for continued development."
45
46         if [ -e "$popconf" ] ; then
47         # just reconfigure so user could get a chance to participate
48                 sudo DEBIAN_FRONTEND=gnome dpkg-reconfigure popularity-contest  
49         else
50         # install, but do not fail if something goes wrong
51                 nd-autoinstall popularity-contest /etc/popularity-contest.conf || true
52         fi
53 fi
54
55 # install custom filter for synaptics
56 if [ $first_run -eq 1 ]; then
57         sudo mkdir -p /root/.synaptic
58         sudo bash -c 'cat << EOT >> /root/.synaptic/filters
59 filter "NeuroDebian" {
60   section {
61     inclusive false;
62     sections {
63     };
64   };
65   status {
66     flags 0x1ffff;
67   };
68   pattern {
69     andMode 0;
70     patterns {
71       Origin; "neuro.debian.net"; false;
72       Maintainer; "team@neuro.debian.net"; false;
73     };
74   };
75   priority {
76   };
77   reducedview {
78     enabled false;
79   };
80 };
81 EOT
82 '
83         # essential things are done -- let's mark sucess
84         sudo bash -c "mkdir -p $cfg_dir && touch $success_flag"
85 fi
86
87 # create symlink to shared folder into homedir
88 [ ! -e $HOME/host ] && ln -s /mnt/host $HOME/host
89
90 packages=$(zenity --list $icon_opt --checklist --column="Install" --column="Description" \
91            --column="Package Name" --print-column=3 --hide-column=3 --hide-header \
92            --separator=' ' --text="Please select any additional component that shall be installed.
93
94 Please note that this selection will not affect packages already installed
95 on the system. No installed packages will be reinstalled or removed, only
96 additional components will be installed." \
97 FALSE "Emacs" "emacs" \
98 FALSE "GNU Image Manipulation Program (Gimp)" "gimp" \
99 FALSE "OpenOffice.org" "openoffice.org" \
100 FALSE "Scientific Python" "ipython,python-numpy,python-matplotlib" \
101 FALSE "TeX Live" "texlive" \
102 FALSE "Adobe Flash browser plugin" "flashplugin-nonfree" \
103 FALSE "Sun Java browser plugin" "sun-java6-plugin" \
104 || true)
105
106 if [ -n "$packages" ]; then
107         for pkgs in $packages; do
108                 nd-autoinstall -f -p "${pkgs//,/ }" true
109         done
110 fi
111
112 # some sane ending
113 zenity --info $icon_opt --text="Wizard has finished."
114
115 # and start greeter
116 x-www-browser http://neuro.debian.net/vm_welcome.html &