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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#!/bin/bash
#!/bin/bash
fetch_source() {
:
}
build() {
local FILELIST="list_binaries_and_files"
rm -f "${FILELIST}"
# Get ldconfig
mkdir -p "$MODULE_BUILD_DIR/sbin"
local LOC=$(which ldconfig.real)
[ -z "$LOC" ] && LOC=$(which ldconfig)
[ -z "$LOC" ] && perror "Cannot find ldconfig"
pdebug "Picking ldconfig from $LOC"
cp "$LOC" "$MODULE_BUILD_DIR/sbin/ldconfig"
pinfo "Searching binaries from config file in system..."
for BIN in ${REQUIRED_BINARIES}
do
[ -n "$(find "$MODULE_BUILD_DIR" -name "$BIN")" ] && continue
BIN_LOCATION="$(which "$BIN")"
if [ ! -z "$BIN_LOCATION" -a -e "$BIN_LOCATION" ]; then
get_link_chain "$BIN_LOCATION" >> "$FILELIST"
else
perror "${BIN} not found on the system! Please install it."
fi
done
pinfo "Searching libraries from config file in system... (could take some time)"
for LIB in ${REQUIRED_LIBRARIES}
do
# lib + lib64: Ugly hack, will be replaced by a better solution
for LIB_LOCATION in $(find /lib/ /lib64/ -name "${LIB}.so*")
do
get_link_chain "${LIB_LOCATION}" >> "${FILELIST}"
done
done
for FILE in /etc/ssl/certs
do
[ ! -d ${FILE} ] && perror "Missing required directory $FILE"
echo ${FILE} >> "${FILELIST}"
(
IFS=$'\n'
for file in $(find "${FILE}" -type l); do
get_link_chain "${file}" >> "${FILELIST}"
done
)
done
for FILE in ${REQUIRED_FILES}
do
[ ! -f ${FILE} ] && perror "Missing required file $FILE"
echo ${FILE} >> "${FILELIST}"
done
# Grab gconv .so files, required by vmware, mtools and maybe some more tools
find /usr/lib/ /usr/lib64 -name gconv -type d | grep -v debug >> "${FILELIST}"
local NUMFILES=$(cat "${FILELIST}" | wc -l)
if [ "x$NUMFILES" != "x" -a "x$NUMFILES" != "x0" ]; then
pinfo "File list generated at ${MODULE_BUILD_DIR}/${FILELIST} ($NUMFILES entries)"
pinfo "If something fails here, try to clean this module first."
tarcopy "$(cat "${FILELIST}")" "${MODULE_BUILD_DIR}"
fi
}
post_copy() {
# symlink for more
if [ ! -e "$TARGET_BUILD_DIR/bin/more" ]; then
[ -e "$TARGET_BUILD_DIR/bin/less" ] && ln -s /bin/less "$TARGET_BUILD_DIR/bin/more"
[ -e "$TARGET_BUILD_DIR/usr/bin/less" ] && ln -s /usr/bin/less "$TARGET_BUILD_DIR/bin/more"
fi
# same hack for mount
[ ! -e "$TARGET_BUILD_DIR/bin/mount" ] && ln -s /usr/bin/mount "$TARGET_BUILD_DIR/bin/mount"
# make basic directory structure
mkdir -p "$TARGET_BUILD_DIR"/{bin,dev,proc,lib,etc,mnt,run,sys,var,opt/openslx/mnt}
ln -s -n -f -t "$TARGET_BUILD_DIR/var" "../run/lock" "../run"
# set /etc/environment to include /opt/openslx/bin and /opt/openslx/sbin
#add_env PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin"
add_env PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin"
# set terminal to linux as it defaults to xterm which messes up ssh sessions
add_env TERM "linux"
# quick fix for /etc/fstab
[ ! -e "${TARGET_BUILD_DIR}/etc/fstab" ] && echo "# no configuration" > "${TARGET_BUILD_DIR}/etc/fstab"
# link /etc/mtab, needed for systemd
[ ! -e "${TARGET_BUILD_DIR}/etc/mtab" ] && ln -s "/proc/self/mounts" "${TARGET_BUILD_DIR}/etc/mtab"
# quick fix for missing group in /etc/group
groupadd "lock"
groupadd --gid 65534 "nogroup"
useradd --uid 65534 --gid 65534 "nobody"
# setup root account
useradd --password "" --uid 0 --gid 0 root
mkdir -p "${TARGET_BUILD_DIR}/root"
sed -i -r 's/^blacklist.*pcspkr/#&/g' "$TARGET_BUILD_DIR/etc/modprobe.d/blacklist.conf"
echo "minilinux-$(hostname)" > "${TARGET_BUILD_DIR}/etc/hostname"
# copy kernel, modules and firmware
copy_kernel_modules
copy_kernel
}
|