SHA-1:d91fae337f77367399a10841b1903b615f388955, from <http://d-i.alioth.debian.org/pub/lenny/babelbox/babelbox.tgz>
		
			
				
	
	
		
			52 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
| #! /bin/bash
 | |
| 
 | |
| # Script to prepare babelbox for the next install: switch language to the
 | |
| # next in the list. Normally run from installed system, but can also be run
 | |
| # from the base system that controls the babelbox runs.
 | |
| # It takes the top line from langlist as the next language and moves that
 | |
| # line to the bottom of the list.
 | |
| 
 | |
| set -e
 | |
| 
 | |
| ROOT=""
 | |
| 
 | |
| if [ -f /BABELBOX ] ; then
 | |
| 	ROOT="/mnt"
 | |
| 	sleep 30
 | |
| 
 | |
| 	mount /dev/sda1 $ROOT
 | |
| fi
 | |
| 
 | |
| cd $ROOT/srv/babelbox
 | |
| 
 | |
| LANGSEL="$(egrep -v "^[[:space:]]*(#.*)?$" langlist | grep -A1 ":x:")"
 | |
| if [ -z "$LANGSEL" ]; then
 | |
| 	LANGSEL="$(head -n2 langlist)"
 | |
| fi
 | |
| if [ $(echo "$LANGSEL" | wc -l) -eq 2 ]; then
 | |
| 	LANG="$(echo "$LANGSEL" | head -n1)"
 | |
| 	NEXTLANG="$(echo "$LANGSEL" | tail -n1)"
 | |
| else
 | |
| 	# Selected language is the last in the file
 | |
| 	LANG="$LANGSEL"
 | |
| 	NEXTLANG="$(egrep -v "^[[:space:]]*(#.*)?$" langlist | head -n1)"
 | |
| fi
 | |
| 
 | |
| LOCALE=$(echo "$LANG" | cut -d: -f1)
 | |
| LANGNAME=$(echo "$LANG" | cut -d: -f3)
 | |
| GRUBLINE=$(echo "$LANG" | cut -d: -f4)
 | |
| 
 | |
| sed -i "s/LANGNAME \".*\"/LANGNAME \"$LANGNAME\"/" preseed_early
 | |
| 
 | |
| sed -i "s/locale=.*$/locale=$LOCALE $GRUBLINE/
 | |
|         s/^default[[:space:]].*$/default\t\t2/" $ROOT/boot/grub/menu.lst
 | |
| 
 | |
| # Comment out the next three lines if you don't want the language to change
 | |
| N_LOCALE=$(echo "$NEXTLANG" | cut -d: -f1)
 | |
| sed -i "s/:x:/::/;s/^$N_LOCALE::/$N_LOCALE:x:/" langlist
 | |
| 
 | |
| if [ -z "$ROOT" ]; then
 | |
| 	echo "Next language: $LANGNAME"
 | |
| fi
 | |
| 
 | |
| exit 0
 |