2 script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && cd .. && pwd )"
6 machine_arch="$(uname -m)"
7 cd "${script_path}" || exit 1
9 if [ "${#}" -ne 1 ]; then
11 echo "You must set one arg!" 1>&2
15 #build.shのオプションに使う変数を設定
16 buf=$(grep CONFIG_I686_BUILD .config)
18 if [[ "${CONFIG_I686_BUILD}" = "y" ]]; then
21 buf=`grep CONFIG_KERNEL_N_A_M_E_ .config | sed -e 's/=y//g' | sed -e 's/CONFIG_KERNEL_N_A_M_E_/kernel=/g'`
23 buf=`grep CONFIG_ENABLE_PLYMOUTH .config | sed -e 's/y/true/g' | sed -e 's/CONFIG_ENABLE_PLYMOUTH/plymouth/g'`
25 buf=`grep CONFIG_USE_CUSTOM_LANG .config | sed -e 's/y/true/g' | sed -e 's/CONFIG_USE_CUSTOM_LANG/USE_CUSTOM_LANG/g'`
27 buf=`grep CONFIG_SFS_CMP_ .config | sed -e 's/=y//g' | sed -e 's/CONFIG_SFS_CMP_/comp_type=/g'`
29 buf=`grep CONFIG_USE_SFS_OPTION .config | sed -e 's/y/true/g'`
31 if [[ "${CONFIG_USE_SFS_OPTION}" ]]; then
32 if [[ $comp_type = "zstd" ]]; then
33 buf=`grep CONFIG_ZSTD_COMP_LVL .config`
35 comp_option="-Xcompression-level '${CONFIG_ZSTD_COMP_LVL}'"
37 if [[ $comp_type = "gzip" ]]; then
38 buf=`grep CONFIG_GZIP_SFS_ .config`
40 comp_option="-Xcompression-level '${CONFIG_GZIP_SFS_COMP_LVL}' -Xwindow-size '${CONFIG_GZIP_SFS_WIN_SIZE}'"
42 if [[ "${comp_type}" = "lz4" ]]; then
43 buf=`grep CONFIG_LZ4_HIGH_COMP .config`
45 if [[ "${CONFIG_LZ4_HIGH_COMP}" = "y" ]]; then
50 buf=`grep CONFIG_USE_CUSTOM_USERNAME .config`
52 if [[ "${CONFIG_USE_CUSTOM_USERNAME}" = "y" ]]; then
53 buf=`grep CONFIG_CUSTOM_USERNAME .config | sed -e 's/CONFIG_CUSTOM_USERNAME/username/g' `
56 buf=`grep CONFIG_USE_CUSTOM_PASSWD .config`
58 if [[ "${CONFIG_USE_CUSTOM_PASSWD}" = "y" ]]; then
59 buf=`grep CONFIG_CUSTOM_PASSWD .config | sed -e 's/CONFIG_CUSTOM_PASSWD/password/g' `
62 buf=`grep CONFIG_USE_CUSTOM_WORK .config`
64 if [[ "${CONFIG_USE_CUSTOM_WORK}" = "y" ]]; then
65 buf=`grep CONFIG_CUSTOM_WORKDIR .config | sed -e 's/CONFIG_CUSTOM_WORKDIR/workdir/g' `
68 buf=`grep CONFIG_CHANNEL_N_A_M_E_ .config | sed -e 's/=y//g' | sed -e 's/CONFIG_CHANNEL_N_A_M_E_/channel=/g'`
70 if [[ $USE_CUSTOM_LANG = "true" ]]; then
71 buf=`grep CONFIG_CUSTOM_LANGUAGE .config | sed -e 's/CONFIG_CUSTOM_LANGUAGE/language/g' `
76 [[ -n "${language}" ]] && echo " Language : ${language}"
77 [[ -n "${plymouth}" ]] && echo " Plymouth : ${plymouth}"
78 [[ -n "${kernel}" ]] && echo " kernel : ${kernel}"
79 [[ -n "${comp_type}" ]] && echo " Compression method : ${comp_type}"
80 [[ -n "${comp_option}" ]] && echo "Compression options : ${comp_option}"
81 [[ -n "${username}" ]] && echo " Username : ${username}"
82 [[ -n "${password}" ]] && echo " Password : ${password}"
83 [[ -n "${channel}" ]] && echo " Channel : ${channel}"
84 [[ -n "${workdir}" ]] && echo " Work : ${workdir}"
86 if [[ "${USE_CUSTOM_LANG}" = "true" ]]; then
87 argument="${argument} -l ${language}"
89 if [[ "${plymouth}" = true ]]; then
90 argument="${argument} -b"
92 if [[ -n "${comp_type}" ]]; then
93 argument="${argument} -c ${comp_type}"
95 if [[ -n "${kernel}" ]]; then
96 argument="${argument} -k ${kernel}"
98 if [[ -n "${username}" ]]; then
99 argument="${argument} -u '${username}'"
101 if [[ -n "${password}" ]]; then
102 argument="${argument} -p '${password}'"
104 if [[ -n "${out_dir}" ]]; then
105 argument="${argument} -o '${out_dir}'"
107 if [[ -n "${workdir}" ]]; then
108 argument="${argument} -w '${workdir}'"
110 argument="-a ${build_arch} --noconfirm ${argument} ${channel}"
111 echo "${argument}" > "${1}"