90-update-alternatives: do not set alternative for vim if we just have vim.tiny.
[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   $ROOTCMD update-alternatives --set view   /usr/bin/vim.gtk
18 elif $ROOTCMD update-alternatives --list editor 2>/dev/null | grep -q vim.basic ; then
19   echo "Setting vim.basic as editor using update-alternatives."
20   $ROOTCMD update-alternatives --set editor /usr/bin/vim.basic
21   $ROOTCMD update-alternatives --set vi     /usr/bin/vim.basic
22   $ROOTCMD update-alternatives --set vim    /usr/bin/vim.basic
23   $ROOTCMD update-alternatives --set view   /usr/bin/vim.basic
24 elif $ROOTCMD update-alternatives --list editor 2>/dev/null | grep -q vim.tiny ; then
25   echo "Setting vim.tiny as editor using update-alternatives."
26   $ROOTCMD update-alternatives --set editor /usr/bin/vim.tiny
27   $ROOTCMD update-alternatives --set vi     /usr/bin/vim.tiny
28   $ROOTCMD update-alternatives --set view   /usr/bin/vim.tiny
29 else
30   echo "Warning: No vim binary suitable for update-alternatives found."
31 fi
32
33 if $ROOTCMD update-alternatives --list x-terminal-emulator 2>/dev/null | grep -q '/uxterm' ; then
34   echo "Setting uxterm as x-terminal-emulator using update-alternatives."
35   $ROOTCMD update-alternatives --set x-terminal-emulator /usr/bin/uxterm
36 elif $ROOTCMD update-alternatives --list x-terminal-emulator 2>/dev/null | grep -q '/xterm' ; then
37   echo "Setting xterm as x-terminal-emulator using update-alternatives."
38   $ROOTCMD update-alternatives --set x-terminal-emulator /usr/bin/xterm
39 fi
40
41 if $ROOTCMD update-alternatives --list x-cursor-theme 2>/dev/null | grep -q '/whiteglass.theme' ; then
42   echo "Setting whiteglass.theme as x-cursor-theme using update-alternatives."
43   $ROOTCMD update-alternatives --set x-cursor-theme /etc/X11/cursors/whiteglass.theme
44 fi
45
46 if $ROOTCMD update-alternatives --list x-www-browser 2>/dev/null | grep -q '/iceweasel' ; then
47   echo "Setting iceweasel as x-www-browser using update-alternatives."
48   $ROOTCMD update-alternatives --set x-www-browser /usr/bin/iceweasel
49 fi
50
51 if $ROOTCMD update-alternatives --list www-browser 2>/dev/null | grep -q '/w3m' ; then
52   echo "Setting w3m as www-browser using update-alternatives."
53   $ROOTCMD update-alternatives --set www-browser /usr/bin/w3m
54 fi
55
56 if $ROOTCMD update-alternatives --list x-window-manager 2>/dev/null | grep -q '/wm-ng' ; then
57   echo "Setting wm-ng as x-window-manager using update-alternatives."
58   $ROOTCMD update-alternatives --set x-window-manager /usr/bin/wm-ng
59 fi
60
61 # sadly isn't available via update-alternates, anyway - use
62 # ntfs-3g (if available) as default for ntfs
63 if [ -r $target/sbin/mount.ntfs-3g ] || [ -L $target/sbin/mount.ntfs-3g ] ; then
64   $ROOTCMD ln -sf /sbin/mount.ntfs-3g /sbin/mount.ntfs
65 fi
66
67 ## END OF FILE #################################################################
68 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2