File: read-config

package info (click to toggle)
u-boot-menu 4.2.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 120 kB
  • sloc: sh: 283; makefile: 2
file content (80 lines) | stat: -rwxr-xr-x 2,000 bytes parent folder | download
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
#!/bin/sh

has_separate_boot() {
    [ "$(stat --printf %d /)" != "$(stat --printf %d /boot)" ]
}

# Reading the default file
if [ -e /etc/default/u-boot ]
then
	. /etc/default/u-boot
fi

# Reading config file fragments if they exist
for file in /usr/share/u-boot-menu/conf.d/*.conf /etc/u-boot-menu/conf.d/*.conf
do
	if [ -e "${file}" ]
	then
		. "${file}"
	fi
done

# Reading the os-release file
if [ -e /etc/os-release ]
then
	. /etc/os-release
elif [ -e /usr/lib/os-release ]
then
	. /usr/lib/os-release
fi


U_BOOT_UPDATE="${U_BOOT_UPDATE:-true}"
U_BOOT_SYNC_DTBS="${U_BOOT_SYNC_DTBS:-false}"

if [ "${U_BOOT_UPDATE}" != "true" ]
then
	echo "P: u-boot-update is disabled in /etc/default/u-boot."

	exit 0
fi

# Find boot directory as seen in u-boot, and path prefix while in linux
if has_separate_boot
then
	# / and /boot are on different filesystems
	_BOOT_DIRECTORY=""
	_BOOT_PATH="/boot"
	if [ "${U_BOOT_SYNC_DTBS}" = "true" ]
	then
		_FDT_DIR="/dtbs/"
	fi
else
	# / and /boot are on the same filesystem
	_BOOT_DIRECTORY="/boot"
	_BOOT_PATH=""
	_FDT_DIR="/usr/lib/linux-image-"
fi

# Setting defaults if /etc/default/u-boot is missing

U_BOOT_ALTERNATIVES="${U_BOOT_ALTERNATIVES:-default recovery}"
U_BOOT_DEFAULT="${U_BOOT_DEFAULT:-l0}"
U_BOOT_PROMPT="${U_BOOT_PROMPT:-1}"
U_BOOT_ENTRIES="${U_BOOT_ENTRIES:-all}"
U_BOOT_TIMEOUT="${U_BOOT_TIMEOUT:-50}"
U_BOOT_MENU_LABEL="${U_BOOT_MENU_LABEL:-${PRETTY_NAME:-Debian GNU/Linux kernel}}"
U_BOOT_FDT_DIR="${U_BOOT_FDT_DIR:-${_FDT_DIR}}"
U_BOOT_FDT_OVERLAYS="${U_BOOT_FDT_OVERLAYS:-}"
U_BOOT_FDT_OVERLAYS_DIR="${U_BOOT_FDT_OVERLAYS_DIR:-/boot/dtbo}"
U_BOOT_INITRD="${U_BOOT_INITRD:-initrd.img}"

if [ -z "${U_BOOT_PARAMETERS}" ] && [ -f /etc/kernel/cmdline ]
then
	U_BOOT_PARAMETERS="$(cat /etc/kernel/cmdline | sed -e 's/root=[^[:space:]]*//' -e 's/^[[:space:]]*//')"
	if [ -z "${U_BOOT_ROOT}" ]
	then
		U_BOOT_ROOT="$(cat /etc/kernel/cmdline | sed -re 's/.*(root=[^[:space:]]*).*/\1/')"
	fi
fi
U_BOOT_PARAMETERS="${U_BOOT_PARAMETERS:-ro quiet}"