summaryrefslogtreecommitdiffstats
path: root/init.d/alpinecfg.sh
blob: 180b6e84f595484eac1e01b2e95d174c6234b183 (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
#!/bin/busybox sh

# the purpose of this script is to find and import the alpine config.
# load it or set default values.

#depracated
echo "remeber to remove this $0 file..."
exit 

get_boot_var () {
	# Look for CFG_MEDIA in cmdline
	for i in `cat /proc/cmdline` ; do
#		if echo $i | grep $ > /dev/null ; then
#			echo $i | sed 's/'$1'=//'
#		fi
		case $i in
			$1=*) echo $i | sed 's|'$1'=||' ;;
		esac
	done
}


import_config() {
	if mount $1 ; then
		echo "Using Alpine config from $1"
		cp $1/$2 /etc/alpine.conf
		sleep 1
		umount $1
	fi
}

CFG="alpine.conf"
CFG_MEDIA=`get_boot_var cfg_media`
#if [ -z "$CFG_MEDIA" ] ; then
	# cfg_media was not set in cmdline. We use the defaults...
	echo "looking for alpine.conf on default locations"
	for i in /media/* ; do
		import_config $i $CFG
	done
#else
	# Only import for specified location
#	import_config "/media/$CFG_MEDIA" $CFG 
#fi