summaryrefslogtreecommitdiffstats
path: root/satellit_installer/includes/20-prerequisites.inc
blob: e0dc9e0033fffa8b44f1ced6ce12a19deeeb2372 (plain) (blame)
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
prerequisites() {
	mkdir -p -m 700 "$BASEDIR"/config	# No point in testing.
	mkdir -p -m 700 "$BASEDIR"/temp

	# Old debugging config file there?
	[ -f "$CONFIGDIR/config" ] && cp -p "$CONFIGDIR/config" "$CONFIGDIR/config.prerun" 2>/dev/null

	# Let's look whether an english locale is alread active (we choose en_US.UTF-8)
	if [[ $(grep "en_US.UTF-8" /etc/locale.gen|cut -f 1 -d " ") == "#" ]]; then
		echo -n "# Generating an english UTF-8 based locale (this may take some time)..."
		# Backing up never hurts:
		cp -p /etc/locale.gen /etc/locale.gen.orig
		# Now patch the localization file:
		sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen
		dpkg-reconfigure locales 2>/dev/null 1>&2
		if [ "$ERR" -ne 0 ]; then
			echo
			echo "# WARNING: Could not reconfigure locales. This is annoying, as"
			echo "#          it will yield some mixed languages, perhaps."
			echo "#          Please make sure thy system has an UTF-8 based"
			echo "#          character set."
		else
			echo " ok."
		fi

	else
		echo "# English locale detected; all is well."
	fi
}