File: cmdline.sh

package info (click to toggle)
kickseed 0.64
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 304 kB
  • sloc: sh: 1,709; makefile: 2
file content (70 lines) | stat: -rw-r--r-- 1,314 bytes parent folder | download | duplicates (4)
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
#! /bin/sh

if [ -z "$SPOOL" ]; then
	SPOOL=/var/spool/kickseed
fi

# Find the parameter named by $2 in /proc/cmdline (or the test file of your choice).
kickseed_cmdline () {
	for item in $(cat "$1"); do
		var="${item%%=*}"

		if [ "$var" = "$2" ]; then
			echo "${item#*=}"
			break
		fi
	done
}

# Work out the filename corresponding to a ks parameter.
kickseed_file () {
	if [ -z "$1" ]; then
		return
	fi
	case $1 in
		cdrom:/*)
			echo "/cdrom${1#cdrom:}"
			;;
		file:/*)
			echo "${1#file:}"
			;;
		floppy)
			echo /floppy/ks.cfg
			;;
		floppy:/*)
			echo "/floppy${1#floppy:}"
			;;
		ftp://*/*)
			spoolpath="$SPOOL/fetch/ftp/${1#ftp://}"
			mkdir -p "${spoolpath%/*}"
			echo "$spoolpath"
			;;
		hd:*:/*)
			file="${1#hd:}"
			device="${file%%:*}"
			file="${file#*:}"
			echo "/media/$device$file"
			;;
		http://*/*)
			spoolpath="$SPOOL/fetch/http/${1#http://}"
			mkdir -p "${spoolpath%/*}"
			echo "$spoolpath"
			;;
		https://*/*)
			spoolpath="$SPOOL/fetch/https/${1#https://}"
			mkdir -p "${spoolpath%/*}"
			echo "$spoolpath"
			;;
		nfs:*:/*)
			file="${1#nfs:}"
			server="${file%%:*}"
			file="${file#*:}"
			spoolpath="$SPOOL/fetch/nfs/$server/$file"
			mkdir -p "${spoolpath%/*}"
			echo "$spoolpath"
			;;
		*)
			logger -t kickseed "Kickstart location $1 not supported"
			;;
	esac
}