3d958e563b5d8d10c54d1e60663e471ec4c08129
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 90-update-alternatives
1 #!/bin/bash
2 # Filename:      ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/90-update-alternatives
3 # Purpose:       set up /etc/alternatives/* according to grml preferences
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 ################################################################################
8
9 set -u
10 set -e
11
12 if $ROOTCMD update-alternatives --list editor 2>/dev/null | grep -q vim.gtk ; then
13   echo "Setting vim.gtk as editor using update-alternatives."
14   $ROOTCMD update-alternatives --set editor /usr/bin/vim.gtk
15   $ROOTCMD update-alternatives --set vi     /usr/bin/vim.gtk
16   $ROOTCMD update-alternatives --set vim    /usr/bin/vim.gtk
17 elif $ROOTCMD update-alternatives --list editor 2>/dev/null | grep -q vim.basic ; then
18   echo "Setting vim.basic as editor using update-alternatives."
19   $ROOTCMD update-alternatives --set editor /usr/bin/vim.basic
20   $ROOTCMD update-alternatives --set vi     /usr/bin/vim.basic
21   $ROOTCMD update-alternatives --set vim    /usr/bin/vim.basic
22 elif $ROOTCMD update-alternatives --list editor 2>/dev/null | grep -q vim.tiny ; then
23   echo "Setting vim.tiny as editor using update-alternatives."
24   $ROOTCMD update-alternatives --set editor /usr/bin/vim.tiny
25   $ROOTCMD update-alternatives --set vi     /usr/bin/vim.tiny
26 else
27   echo "Warning: No vim binary suitable for update-alternatives found."
28 fi
29
30 if $ROOTCMD update-alternatives --list x-terminal-emulator 2>/dev/null | grep -q '/uxterm' ; then
31   echo "Setting uxterm as x-terminal-emulator using update-alternatives."
32   $ROOTCMD update-alternatives --set x-terminal-emulator /usr/bin/uxterm
33 elif $ROOTCMD update-alternatives --list x-terminal-emulator 2>/dev/null | grep -q '/xterm' ; then
34   echo "Setting xterm as x-terminal-emulator using update-alternatives."
35   $ROOTCMD update-alternatives --set x-terminal-emulator /usr/bin/xterm
36 fi
37
38 if $ROOTCMD update-alternatives --list x-cursor-theme 2>/dev/null | grep -q '/whiteglass.theme' ; then
39   echo "Setting whiteglass.theme as x-cursor-theme using update-alternatives."
40   $ROOTCMD update-alternatives --set x-cursor-theme /etc/X11/cursors/whiteglass.theme
41 fi
42
43 if $ROOTCMD update-alternatives --list x-www-browser 2>/dev/null | grep -q '/iceweasel' ; then
44   echo "Setting iceweasel as x-www-browser using update-alternatives."
45   $ROOTCMD update-alternatives --set x-www-browser /usr/bin/iceweasel
46 fi
47
48 if $ROOTCMD update-alternatives --list www-browser 2>/dev/null | grep -q '/w3m' ; then
49   echo "Setting w3m as www-browser using update-alternatives."
50   $ROOTCMD update-alternatives --set www-browser /usr/bin/w3m
51 fi
52
53 if $ROOTCMD update-alternatives --list x-window-manager 2>/dev/null | grep -q '/wm-ng' ; then
54   echo "Setting wm-ng as x-window-manager using update-alternatives."
55   $ROOTCMD update-alternatives --set x-window-manager /usr/bin/wm-ng
56 fi
57
58 # sadly isn't available via update-alternates, anyway - use
59 # ntfs-3g (if available) as default for ntfs
60 if [ -r $target/sbin/mount.ntfs-3g ] || [ -L $target/sbin/mount.ntfs-3g ] ; then
61   $ROOTCMD ln -sf /sbin/mount.ntfs-3g /sbin/mount.ntfs
62 fi
63
64 ## END OF FILE #################################################################
65 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2