summaryrefslogtreecommitdiff
path: root/debian/etcskel-kanotix.postinst
blob: e2c801109f42673a0449ade30faab5697686a7f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/sh
set -e

# override tool behaviour through distro-defaults
FLL_DISTRO_MODE="installed"
if [ -r /etc/default/distro ]; then
	. /etc/default/distro
fi

[ ! "$FLL_DISTRO_MODE" = "live" ] && exit 0

install_from_default()
{
	if [ ! -f "$2" ]; then
		cp -p "$1" "$2"
	fi
}

case "$1" in
	configure)
		if dpkg --compare-versions "$2" lt 0.7.6; then
			rm -f	/etc/inputrc \
				/etc/bash.bashrc \
				/root/.bashrc \
				/root/.profile
			
			# revert /etc/bash.bashrc
			cat > /etc/bash.bashrc << EOF
# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "\$PS1" ] && return

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "\$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=\$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='\${debian_chroot:+(\$debian_chroot)}\u@\h:\w\\$ '

# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user@host:dir
#case "\$TERM" in
#xterm*|rxvt*)
#    PROMPT_COMMAND='echo -ne "\033]0;\${USER}@\${HOSTNAME}: \${PWD}\007"'
#    ;;
#*)
#    ;;
#esac

# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ]; then
#    . /etc/bash_completion
#fi
EOF
			chmod 644 /etc/bash.bashrc

			# revert /etc/inputrc
			install_from_default /usr/share/readline/inputrc /etc/inputrc
		fi
		
		# /etc/profile, update versions modified by us under all circumstances
		grep -q '^\# changed by KANOTIX' /etc/profile 2> /dev/null &&	rm -f /etc/profile
		grep -q '/etc/sysconfig/i18n' /etc/profile 2> /dev/null &&	rm -f /etc/profile
		install_from_default /usr/share/base-files/profile /etc/profile
		
		cat >> /etc/profile << EOF
# changed by KANOTIX
# Set LOCALE
if [ -f /etc/sysconfig/i18n ]; then
	. /etc/sysconfig/i18n
	[ -n "\$LANG" ] || LANG="de_DE@euro"
	export LANG
	[ -n "\$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
	[ -n "\$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
	[ -n "\$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
	[ -n "\$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
	[ -n "\$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
	[ -n "\$LC_TIME" ] && export LC_TIME || unset LC_TIME
	[ -n "\$LC_ALL" ] && export LC_ALL || unset LC_ALL
	[ -n "\$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
	[ -n "\$LINGUAS" ] && export LINGUAS || unset LINGUAS
	[ -n "\$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET

	if [ -n "\$SYSFONTACM" ]; then
		case \$SYSFONTACM in
			iso01*|iso02*|iso15*|koi*|latin2-ucw*)
				if [ "\$TERM" = "linux" ]; then
					if ls -l /proc/\$\$/fd/0 2>/dev/null | grep -- '-> /dev/tty[0-9]*\$' >/dev/null 2>&1; then
						echo -n -e '\033(K' > /proc/\$\$/fd/0
					fi
				fi
				;;
		esac
	fi
	unset SYSFONTACM
fi
# END LOCALE

# alias definitions 
alias ..="cd .."
alias ll="ls -l --color=auto"
alias l="ls -a --color=auto"
alias rm="rm -i"
alias mv="mv -i"
alias cp="cp -i"
alias la="ls -la --color=auto"
alias ls="ls --color=auto"

# This is very KANOTIX/live-specific
alias su="sudo su"
alias sux="sudo sux"
EOF
		
		# populate /root/.profile and /root/.bashrc
		install_from_default /usr/share/base-files/dot.profile   /root/.profile
		install_from_default /usr/share/base-files/dot.bashrc    /root/.bashrc

		if ! grep -q bash_completion /root/.bashrc; then
			cat >> /root/.bashrc << EOF
# changed by KANOTIX
# enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
	. /etc/bash_completion
fi
EOF
		fi

		;;
	abort-upgrade|abort-remove|abort-deconfigure)
		;;
	*)
		echo "postinst called with unknown argument \`$1'" >&2
		exit 0
		;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0