Skip to content

Commit 9ea3ab3

Browse files
committed
[add] : Added alteriso-info.sh
1 parent ab62b7d commit 9ea3ab3

File tree

2 files changed

+128
-20
lines changed

2 files changed

+128
-20
lines changed

build.sh

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,29 +1001,12 @@ make_prepare() {
10011001

10021002
# iso version info
10031003
if [[ "${include_info}" = true ]]; then
1004-
local _write_info_file _info_file="${isofs_dir}/alteriso-info"
1005-
_write_info_file () {
1006-
echo "${@}" >> "${_info_file}"
1007-
}
1004+
local _info_file="${isofs_dir}/alteriso-info" _version="${iso_version}"
10081005
remove "${_info_file}"; touch "${_info_file}"
1009-
1010-
_write_info_file "Developer : ${iso_publisher}"
1011-
_write_info_file "OS Name : ${iso_application}"
1012-
_write_info_file "Architecture : ${arch}"
10131006
if [[ -d "${script_path}/.git" ]] && [[ "${gitversion}" = false ]]; then
1014-
_write_info_file "Version : ${iso_version}-$(git rev-parse --short HEAD)"
1015-
else
1016-
_write_info_file "Version : ${iso_version}"
1017-
fi
1018-
_write_info_file "Channel name : ${channel_name}"
1019-
_write_info_file "Live user name : ${username}"
1020-
_write_info_file "Live user pass : ${password}"
1021-
_write_info_file "Kernel name : ${kernel}"
1022-
if [[ "${boot_splash}" = true ]]; then
1023-
_write_info_file "Plymouth : Yes"
1024-
else
1025-
_write_info_file "Plymouth : No"
1007+
_version="${iso_version}-$(git rev-parse --short HEAD)"
10261008
fi
1009+
"${tools_dir}/alteriso-info.sh" -a "${arch}" -b "${boot_splash}" -c "${channel_name%.add}" -d "${iso_publisher}" -k "${kernel}" -o "${os_name}" -p "${password}" -u "${username}" -v "${_version}"
10271010
fi
10281011
}
10291012

tools/alteriso-info.sh

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#!/usr/bin/env bash
2+
script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && cd .. && pwd )"
3+
tools_dir="${script_path}/tools"
4+
5+
_help() {
6+
echo "usage ${0} [options]"
7+
echo
8+
echo "Scripts that generate alteriso-info"
9+
echo
10+
echo " General options:"
11+
echo " -a | --arch [str] Specify the architecture"
12+
echo " -b | --boot-splash [bool] Set plymouth status (true or false)"
13+
echo " -c | --channel [str] Specify the channel"
14+
echo " -d | --developer [str] Specify the developer"
15+
echo " -k | --kernel [srt] Specify the kernel name"
16+
echo " -o | --os-name [str] Specify the application name"
17+
echo " -p | --password [str] Specify the user password for livecd"
18+
echo " -u | --username [str] Specify the user name for livecd"
19+
echo " -v | --version [str] Specity the iso version"
20+
echo " -h | --help This help message"
21+
}
22+
23+
# Parse options
24+
ARGUMENT="${@}"
25+
opt_short="a:b:c:d:k:o:p:u:v:h"
26+
opt_long="arch:,boot-splash:,channel:,developer:,kernel:,os-name:,password:,username:,version:,help"
27+
OPT=$(getopt -o ${opt_short} -l ${opt_long} -- ${ARGUMENT})
28+
[[ ${?} != 0 ]] && exit 1
29+
30+
eval set -- "${OPT}"
31+
unset OPT opt_short opt_long
32+
33+
while true; do
34+
case ${1} in
35+
-a | --arch)
36+
arch="${2}"
37+
shift 2
38+
;;
39+
-b | --boot-splash)
40+
if [[ "${2}" = true || "${2}" = false ]]; then
41+
boot_splash="${2}"
42+
shift 2
43+
else
44+
_help
45+
exit 1
46+
fi
47+
;;
48+
-c | --channel)
49+
channel_name="${2}"
50+
shift 2
51+
;;
52+
-d | --developer)
53+
iso_publisher="${2}"
54+
shift 2
55+
;;
56+
-k | --kernel)
57+
kernel="${2}"
58+
shift 2
59+
;;
60+
-o | --os-name)
61+
iso_application="${2}"
62+
shift 2
63+
;;
64+
-p | --password)
65+
password="${2}"
66+
shift 2
67+
;;
68+
-u | --username)
69+
username="${2}"
70+
shift 2
71+
;;
72+
-v | --version)
73+
iso_version="${2}"
74+
shift 2
75+
;;
76+
-h | --help)
77+
_help
78+
exit 0
79+
;;
80+
--)
81+
shift 1
82+
break
83+
;;
84+
85+
esac
86+
done
87+
88+
variable_list=(
89+
"arch"
90+
"boot_splash"
91+
"channel_name"
92+
"iso_publisher"
93+
"kernel"
94+
"iso_application"
95+
"password"
96+
"username"
97+
"iso_version"
98+
)
99+
100+
for var in ${variable_list[@]}; do
101+
if [[ -z "$(eval echo '$'${var})" ]]; then
102+
echo "${var} is empty" >&2
103+
exit 1
104+
fi
105+
done
106+
107+
108+
# Get kernel info
109+
eval $(bash "${tools_dir}/kernel.sh" -s -c "${channel_name}" -a "${arch}" get "${kernel}")
110+
111+
112+
echo "Developer : ${iso_publisher}"
113+
echo "OS Name : ${iso_application}"
114+
echo "Architecture : ${arch}"
115+
echo "Version : ${iso_version}"
116+
echo "Channel name : ${channel_name}"
117+
echo "Live user name : ${username}"
118+
echo "Live user pass : ${password}"
119+
echo "Kernel name : ${kernel}"
120+
echo "Kernel path : ${kernel_filename}"
121+
if [[ "${boot_splash}" = true ]]; then
122+
echo "Plymouth : Yes"
123+
else
124+
echo "Plymouth : No"
125+
fi

0 commit comments

Comments
 (0)