source: livedvd/gisvm/trunk/bin/install_desktop.sh

Last change on this file was 12115, checked in by kalxas, 3 years ago

reverting [11696] since background is dark again, but keeping mount=1

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:mime-type set to text/x-sh
File size: 13.6 KB
Line 
1#!/bin/sh
2# Copyright (c) 2009-2013 The Open Source Geospatial Foundation.
3# Licensed under the GNU LGPL.
4#
5# This library is free software; you can redistribute it and/or modify it
6# under the terms of the GNU Lesser General Public License as published
7# by the Free Software Foundation, either version 2.1 of the License,
8# or any later version.  This library is distributed in the hope that
9# it will be useful, but WITHOUT ANY WARRANTY, without even the implied
10# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11# See the GNU Lesser General Public License for more details, either
12# in the "LICENSE.LGPL.txt" file distributed with this software or at
13# web page "http://www.fsf.org/licenses/lgpl.html".
14
15# About:
16# =====
17# This script will install a desktop background image, password file,
18# taskbar,and generally clean up the user desktop-interface experience.
19# The menu creation and icon sorting has moved to install_icons_and_menus.sh
20#
21
22./diskspace_probe.sh "`basename $0`" begin
23BUILD_DIR=`pwd`
24####
25
26if [ -z "$USER_NAME" ] ; then
27   USER_NAME="user"
28fi
29USER_HOME="/home/$USER_NAME"
30
31
32# Default password list on the desktop to be replaced by html help in the future.
33cp ../doc/passwords.txt "$USER_HOME/Desktop/"
34chown "$USER_NAME"."$USER_NAME" "$USER_HOME/Desktop/passwords.txt"
35
36
37# Setup the desktop background image
38cp ../desktop-conf/osgeo-desktop.png \
39   /usr/share/lubuntu/wallpapers/
40
41cp ../desktop-conf/osgeo-desktop-transparent.png \
42   /usr/share/lubuntu/wallpapers/
43
44# copy in placeholder background image
45#cd /usr/share/lubuntu/wallpapers/
46#wget -N --progress=dot:mega \
47#   "http://upload.wikimedia.org/wikipedia/commons/e/e2/OrteliusWorldMap1570.jpg"
48#cd -
49
50### set the desktop background, turn on keyboard layout select control
51sed -i -e 's|^bg=.*|bg=/usr/share/lubuntu/wallpapers/osgeo-desktop.png|' \
52       -e 's|^keyboard=0$|keyboard=1|' \
53    /etc/xdg/lubuntu/lxdm/lxdm.conf
54
55# Actually, I think this is the one which really does it:
56sed -i -e 's|^wallpaper=.*|wallpaper=/usr/share/lubuntu/wallpapers/osgeo-desktop.png|' \
57       -e 's|^desktop_shadow=.*|desktop_shadow=.*\nshow_mounts=1|' \
58   /etc/xdg/pcmanfm/lubuntu/pcmanfm.conf
59
60echo "desktop_folder_new_win=1" >> /etc/xdg/pcmanfm/lubuntu/pcmanfm.conf
61
62
63# New way to set login screen background as of 12.04 that uses lightdm instead of gdm
64#  (awaiting graphic with text overlay explaining what the user name and password is)
65sed -i -e 's|^background=.*|background=/usr/share/lubuntu/wallpapers/osgeo-desktop.png|' \
66   /etc/lightdm/lightdm-gtk-greeter.conf
67
68#Done:support for headless installs with or without user existing, preference for png
69#Only works if user is not logged into XFCE session
70# Puts the desktop background into the spot where it would be used for new user creation
71#mkdir -p /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/
72#cp ../desktop-conf/xfce/xfce4-desktop.xml \
73#     /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
74
75# edit it in the skel dirs too, for the chroot method
76#sed -i -e 's/xubuntu-.*.png/osgeo-desktop.png/' \
77#  /etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml
78#cp -f ../desktop-conf/xfce/xfce4-desktop.xml \
79#     /etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/
80
81#Copy it to the existing user
82#mkdir -p "$USER_HOME"/.config/xfce4/xfconf/xfce-perchannel-xml/
83#cp /etc/skel/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml \
84#     "$USER_HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml"
85
86#chown "$USER_NAME"."$USER_NAME" \
87#     "$USER_HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml"
88
89#Old version in case we need to revert, or if you're logged into the current XFCE session
90#Has to been run as the regular user
91#sudo -u $USER_NAME xfconf-query -c xfce4-desktop \
92#     -p /backdrop/screen0/monitor0/image-path \
93#     -s /usr/share/lubuntu/wallpapers/osgeo-desktop.png
94# set to stretch style background
95#sudo -u $USER_NAME xfconf-query -c xfce4-desktop --create \
96#     -p /backdrop/screen0/monitor0/image-style  -s 3  -t int
97
98
99# if you want panel transparency turned off edit Apps->Settings->WM Tweaks or
100#  /etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml
101#         ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml
102#    <property name="use_compositing" type="bool" value="true"/>
103##sed -i -e 's|\(use_compositing" type="bool" value\)="true"|\1="false"|' \
104##   /etc/xdg/xdg-xubuntu/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml
105
106
107
108#Add the launchhelp script which allows other apps to provide sudo
109#    launching with the password already embedded
110#[Geonetwork and] deegree need this right now
111mkdir -p "$USER_HOME/bin/"
112chown "$USER_NAME.$USER_NAME" "$USER_HOME/bin/"
113mkdir -p /etc/skel/bin
114
115cp "launchassist.sh" "$USER_HOME/bin/"
116chmod 700 "$USER_HOME/bin/launchassist.sh"
117chown "$USER_NAME.$USER_NAME" \
118   "$USER_HOME/bin/launchassist.sh" "$USER_HOME/bin"
119# no good to copy it to /etc/skel as the pw will differ for each account
120#cp "launchassist.sh" /etc/skel/bin/
121#chmod 700 "/etc/skel/bin/launchassist.sh"
122
123
124
125##### Setup Automatic or Timed Login #####
126echo "TODO: update autologin preferences for lightdm."
127#cp "$BUILD_DIR"/../desktop-conf/custom.conf /etc/gdm/custom.conf
128
129
130##### Setup timed welcome message
131apt-get --assume-yes install gxmessage
132
133mkdir -p /usr/local/share/osgeo-desktop
134
135cat << EOF > "/usr/local/share/osgeo-desktop/welcome_message.desktop"
136[Desktop Entry]
137Type=Application
138Encoding=UTF-8
139Name=Welcome message
140Comment=Live Demo welcome message
141Exec=/usr/local/share/osgeo-desktop/welcome_message.sh
142Terminal=false
143StartupNotify=false
144Hidden=false
145EOF
146
147mkdir -p "$USER_HOME"/.config/autostart
148cp /usr/local/share/osgeo-desktop/welcome_message.desktop \
149   "$USER_HOME"/.config/autostart/
150mkdir -p /etc/skel/.config/autostart
151cp /usr/local/share/osgeo-desktop/welcome_message.desktop \
152   /etc/skel/.config/autostart/
153
154cp "$BUILD_DIR/../desktop-conf/welcome_message.sh" \
155   /usr/local/share/osgeo-desktop/
156
157#
158# LANG_CODE is defined in main.sh
159#
160#cp "$BUILD_DIR/../doc/$LANG_CODE"/welcome_message.* \
161#   /usr/local/share/osgeo-desktop/
162
163if [ -e "$BUILD_DIR/../doc/$LANG_CODE"/welcome_message.txt ] ; then
164  cp "$BUILD_DIR/../doc/$LANG_CODE"/welcome_message.txt \
165    /usr/local/share/osgeo-desktop/
166else
167  cp "$BUILD_DIR/../doc/en"/welcome_message.txt \
168    /usr/local/share/osgeo-desktop/
169fi
170
171cp /usr/local/share/osgeo-desktop/welcome_message.txt "$USER_HOME"/
172chown "$USER_NAME"."$USER_NAME" "$USER_HOME"/welcome_message.txt
173cp /usr/local/share/osgeo-desktop/welcome_message.txt /etc/skel/
174
175
176# xdg nm-applet not loading by default, re-add it to user autostart
177cp /etc/xdg/autostart/nm-applet.desktop  /etc/skel/.config/autostart/
178
179#alternate: have it launch a script in /usr/local/restart_dns.sh
180# if [ `ifconfig -s | grep -cw ^eth0` -eq 1 ] ; then
181#   dhclient eth0   # sudo needed?
182# fi
183cat << EOF > "/etc/skel/.config/autostart/force_dns.desktop"
184[Desktop Entry]
185Type=Application
186Encoding=UTF-8
187Name=Manually trigger DNS setting from DHCP
188Comment=Work around for missing resolv.conf bug
189Exec=sudo --non-interactive dhclient eth0
190Terminal=false
191StartupNotify=false
192Hidden=false
193EOF
194
195#### replace the Software Center on the Apps menu with the more useful Synaptic
196# .. TODO   (right click the Apps menu, properties, edit, add synaptic-pkexec,
197#       name it package manager to keep the width narrow; then create a patch)
198# --> see bin/setup.sh line 116 where it is replaced with sed
199
200
201# Tweak (non-default) theme so that window borders are wider so easier to grab.
202sed -i -e 's|^border.width: 1|border.width: 2|' \
203   /usr/share/themes/Mikachu/openbox-3/themerc
204
205
206# Long live the classic X11 keybindings
207cat << EOF > /etc/skel/.xinitrc
208setxkbmap -option keypad:pointerkeys
209setxkbmap -option terminate:ctrl_alt_bksp
210EOF
211
212
213# work around for launchpad bug #975152 (opens empty lxterminal; trac #1363)
214#   and make the icons not so huge
215sed -i -e 's|lxsession-default-terminal %s|x-terminal-emulator -e %s|' \
216       -e 's|big_icon_size=48|big_icon_size=36|' \
217   /etc/xdg/lubuntu/libfm/libfm.conf
218
219sed -i -e 's|lxsession-default terminal|x-terminal-emulator|' \
220   /usr/share/lxpanel/profile/Lubuntu/config
221
222
223# add some file types to the master mime.types file
224#  ("users can create their own by creating a .mime.types
225#   files in their home directory")
226
227# set default TIFF viewer to QGIS
228sed -i -e 's|^image/tiff=.*|image/tiff=qgis.desktop|' \
229   /etc/xdg/lubuntu/applications/defaults.list
230
231# associate shapefiles and .qgs with QGIS
232echo "application/x-qgis=qgis.desktop" >> \
233   /etc/xdg/lubuntu/applications/defaults.list
234
235echo >> /etc/mime.types
236echo "application/x-sqlite3\t\t\t\tsqlite" >> \
237   /etc/mime.types
238echo "application/x-sqlite3=spatialite-gui.desktop" >> \
239   /etc/xdg/lubuntu/applications/defaults.list
240
241echo "application/x-openstreetmap+xml\t\t\tosm osc" >> \
242   /etc/mime.types
243echo "application/x-openstreetmap+xml=josm.desktop" >> \
244   /etc/xdg/lubuntu/applications/defaults.list
245
246# mmph, should be a drag-and-drop viewer
247echo "application/x-netcdf=ncWMS-start.desktop" >> \
248   /etc/xdg/lubuntu/applications/defaults.list
249
250# ipython notebooks
251echo "application/x-ipynb+json\t\t\tipynb" >> \
252   /etc/mime.types
253# erhm..
254echo "application/x-ipynb+json=osgeo-ipython-notebook.desktop" >> \
255   /etc/xdg/lubuntu/applications/defaults.list
256
257echo "application/x-mbtiles+sql\t\t\tmbtiles" >> \
258   /etc/mime.types
259echo "application/x-mbtiles+sql=qgis.desktop" >> \
260   /etc/xdg/lubuntu/applications/defaults.list
261
262echo "application/gpx+xml\t\t\t\tgpx" >> \
263   /etc/mime.types
264echo "application/gpx+xml=gpsprune.desktop" >> \
265   /etc/xdg/lubuntu/applications/defaults.list
266
267
268#### Make Unity Usable (Muu..)
269# we are using xubuntu so it's a bit academic, but in case anyone wants to
270#  use OSGeo on stock Ubuntu these changes can make it a lot less annoying.
271if [ "$DESKTOP_SESSION" = "Unity" ] ; then
272  apt-get install --yes gconf-editor dconf-tools
273
274  # The hardest part is finding where the heck the gnome people hid the option.
275  # To locate what you are looking for (e.g. setting the icon_size) search through:
276  #gconftool --dump /apps | grep -w -B5 -A5 icon_size
277  # more options can be found here:
278  #dconf dump / | less
279  # See also:
280  # http://www.tuxgarage.com/2011/07/customizing-gnome-lock-screen.html
281  # http://www.tuxgarage.com/2011/05/customize-gdm-plymouth-grub2.html
282  # http://library.gnome.org/admin/system-admin-guide/stable/dconf-profiles.html.en
283
284  # set the web browser homepage:
285  gconftool-2 --direct \
286    --config-source xml:readwrite:/etc/opt/gnome/gconf/gconf.xml.mandatory \
287    --type string --set /apps/firefox/general/homepage_url live.osgeo.org
288
289  # make the launcher icons smaller, this isn't a touchscreen
290  gconftool-2 --direct \
291    --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
292    --type int --set /apps/compiz-1/plugins/unityshell/screen0/options/icon_size 38
293  #also you might check the setting here: (same goes for other options too)
294  #  --type int --set /apps/compizconfig-1/profiles/Default/plugins/unityshell/screen0/options/icon_size 38
295
296  # only put a launcher bar on one monitor (maybe nice for laptop+monitor but bad for dual headed setups)
297  gconftool-2 --direct \
298    --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
299    --type int --set /apps/compiz-1/plugins/unityshell/screen0/options/num_launchers 1
300 
301  # don't be sticky at the edge of the monitor (another huge frustration for dual-headed monitors)
302  gconftool-2 --direct \
303    --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
304    --type bool --set /apps/compiz-1/plugins/unityshell/screen0/options/launcher_capture_mouse false
305 
306  # keep windows stacked as you left them,
307  gconftool-2 --direct \
308    --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
309    --type bool --set /apps/metacity/general/auto_raise false
310 
311  # don't maximize if the window happens to brush the top of the screen while moving it
312  gconftool-2 --direct \
313    --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
314    --type int --set /apps/compiz-1/plugins/grid/screen0/options/top_edge_action 0
315 
316  # right mouse button exists for the context menu, no need to waste the screen real estate
317  gconftool-2 --direct \
318    --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
319      --type bool --set /apps/gnome-terminal/profiles/Default/default_show_menubar false
320
321
322  # dconf weirdness:
323  mkdir -p /etc/dconf/db/local.d
324  mkdir -p /etc/dconf/profile
325  # basic setup for local mods:
326  cat << EOF > /etc/dconf/profile/user
327user-db:user
328system-db:local
329EOF
330  cat << EOF > /etc/dconf/profile/gdm
331user
332gdm
333EOF
334
335  # set the default desktop background:
336  cat << EOF > /etc/dconf/db/local.d/00_default-wallpaper
337[org/gnome/desktop/background]
338#picture-options='zoom'
339picture-uri='file:///usr/share/backgrounds/Precise_Pangolin_by_Vlad_Gerasimov.jpg'
340EOF
341
342  # set the default login background image when Unity-greeter is used by lightdm:
343  cat << EOF > /usr/share/glib-2.0/schemas/com.canonical.unity-greeter.gschema.override
344[com.canonical.unity-greeter]
345draw-user-backgrounds=false
346background='/usr/share/lubuntu/wallpapers/osgeo-desktop.png'
347EOF
348  glib-compile-schemas /usr/share/glib-2.0/schemas/
349
350  # set what icons will be on the taskbar (launcher) by default for new users
351  cat << EOF > /etc/dconf/db/local.d/01_unity_favorites
352[desktop/unity/launcher]
353favorites=['nautilus-home.desktop', 'firefox.desktop', 'libreoffice-writer.desktop', 'libreoffice-calc.desktop', 'gnome-control-center.desktop', 'gnome-terminal.desktop', 'nedit.desktop']
354EOF
355
356  # blank screen after 5 minutes
357  cat << EOF > /etc/dconf/db/local.d/02_5min_timeout
358[org/gnome/desktop/session]
359idle-delay=uint32 300
360
361[org/gnome/settings-daemon/plugins/power]
362sleep-display-ac=300
363sleep-display-battery=300
364EOF
365
366  # apply the changes to the dconf DB
367  dconf update
368fi
369
370
371####
372"$BUILD_DIR"/diskspace_probe.sh "`basename $0`" end
Note: See TracBrowser for help on using the repository browser.