}
+ # Display channel list
+ show_channel_list() {
+ local i
+ for i in $(ls -l "${script_path}"/channels/ | awk '$1 ~ /d/ {print $9 }'); do
+ if [[ -n $(ls "${script_path}"/channels/${i}) ]]; then
+ if [[ ! ${i} = "share" ]]; then
+ if [[ ! $(echo "${i}" | sed 's/^.*\.\([^\.]*\)$/\1/') = "add" ]]; then
+ if [[ ! -d "${script_path}/channels/${i}.add" ]]; then
+ echo -n "${i} "
+ fi
+ else
+ echo -n "${i} "
+ fi
+ fi
+ fi
+ done
+ echo
+ exit 0
+ }
+
+
# Preparation for build
prepare_build() {
- # Build mkalteriso
- if [[ "${shmkalteriso}" = false ]]; then
- mkalteriso="${script_path}/system/mkalteriso"
- cd "${script_path}"
- _msg_info "Building mkalteriso..."
- if [[ "${debug}" = true ]]; then
- make mkalteriso
- echo
- else
- make mkalteriso > /dev/null 2>&1
- fi
- cd - > /dev/null 2>&1
- else
- mkalteriso="${script_path}/system/mkalteriso.sh"
- fi
-
# Create a working directory.
[[ ! -d "${work_dir}" ]] && mkdir -p "${work_dir}"
noloopmod=true
shift 1
;;
- --tarball)
- tarball=true
- shift 1
- ;;
- --noiso)
- noiso=true
- shift 1
- ;;
- --noaur)
- noaur=true
- shift 1
- ;;
- --nochkver)
- nochkver=true
- --channellist)
- show_channel_list
-- shift 1
-- ;;
--)
shift
break
fi
fi
-
- # Parse languages
- locale_config_file="${script_path}/system/locale-${arch}"
- locale_name_list=($(cat "${locale_config_file}" | grep -h -v ^'#' | awk '{print $1}'))
- get_locale_line() {
- local _lang
- local count
- count=0
- for _lang in ${locale_name_list[@]}; do
- count=$(( count + 1 ))
- if [[ "${_lang}" == "${language}" ]]; then
- echo "${count}"
- return 0
- fi
- done
- echo -n "failed"
- return 0
- }
- locale_line="$(get_locale_line)"
- if [[ "${locale_line}" == "failed" ]]; then
- _msg_error "${language} is not a valid language." "1"
+ # Run clean
+ if [[ "${channel_name}" = "clean" ]]; then
+ umount_chroot
+ remove "${script_path}/menuconfig/build"
+ remove "${script_path}/system/cpp-src/mkalteriso/build"
+ remove "${script_path}/menuconfig-script/kernel_choice"
+ remove_work
+ remove "${rebuildfile}"
- remove "${script_path}/temp"
+ exit 0
fi
+locale_config_line="$(cat "${locale_config_file}" | grep -h -v ^'#' | grep -v ^$ | head -n "${locale_line}" | tail -n 1)"
+
+localegen=$(echo ${locale_config_line} | awk '{print $2}')
+mirror_country=$(echo ${locale_config_line} | awk '{print $3}')
+locale_name=$(echo ${locale_config_line} | awk '{print $4}')
+timezone=$(echo ${locale_config_line} | awk '{print $5}')
+lang_fullname=$(echo ${locale_config_line} | awk '{print $6}')
+
+
+# Parse kernel
+kernel_config_file="${script_path}/system/kernel-${arch}"
+kernel_name_list=($(cat "${kernel_config_file}" | grep -h -v ^'#' | awk '{print $1}'))
+get_kernel_line() {
+ local _kernel
+ local count
+ count=0
+ for _kernel in ${kernel_name_list[@]}; do
+ count=$(( count + 1 ))
+ if [[ "${_kernel}" == "${kernel}" ]]; then
+ echo "${count}"
+ return 0
+ fi
+ done
+ echo -n "failed"
+ return 0
+}
+kernel_line="$(get_kernel_line)"
+if [[ "${kernel_line}" == "failed" ]]; then
+ _msg_error "Invalid kernel ${kernel}" "1"
+fi
+
+kernel_config_line="$(cat "${kernel_config_file}" | grep -h -v ^'#' | grep -v ^$ | head -n "${kernel_line}" | tail -n 1)"
+
+kernel_package=$(echo ${kernel_config_line} | awk '{print $2}')
+kernel_headers_packages=$(echo ${kernel_config_line} | awk '{print $3}')
+kernel_filename=$(echo ${kernel_config_line} | awk '{print $4}')
+kernel_mkinitcpio_profile=$(echo ${kernel_config_line} | awk '{print $5}')
+
+kernel_config_line="${kernel} ${kernel_package} ${kernel_headers_packages} ${kernel_filename} ${kernel_mkinitcpio_profile}"
+
+
# Check the value of a variable that can only be set to true or false.
check_bool() {
local _value
echo " -r Set the number of retries."
echo " Defalut: ${retry}"
echo " -s Enable simulation mode."
+ echo " -t Build the tarball as well."
echo
- echo "!! WARNING !!"
- echo "Do not set channel or architecture with -a."
- echo "Be sure to enclose the build.sh argument with '' to avoid mixing it with the fullbuild.sh argument."
- echo "Example: ${0} -a '-b -k zen'"
+ echo " !! WARNING !!"
+ echo " Do not set channel or architecture with -a."
+ echo " Be sure to enclose the build.sh argument with '' to avoid mixing it with the fullbuild.sh argument."
+ echo " Example: ${0} -a '-b -k zen'"
+ echo
+ echo "Run \"build.sh -h\" for channel details."
+ echo -n " Channel: "
+ "${script_path}/build.sh" --channellist
}