function main() {
local -r IFS=$'\n'
- [[ $# -ne 0 ]] && eval "${menu_list[$1]}" || echo "${!menu_list[*]}"
+ [[ "${#}" -ne 0 ]] && eval "${menu_list[$1]}" || echo "${!menu_list[*]}"
}
-main $@
+main "${@}"
else
echo "Failed to set the session.Multiple sessions were found." >&2
echo "Please set the session of automatic login in /etc/lightdm/lightdm.conf.d/02-autologin-session.conf"
- echo "Found session: $(printf "%s " ${session_list[@]})"
+ echo "Found session: $(printf "%s " "${session_list[@]}")"
sleep 0.5
exit 1
fi
# 一般ユーザーで実行します
function run_user () {
- sudo -u "${build_username}" ${@}
+ sudo -u "${build_username}" "${@}"
}
# 引数を確認
cd "${pkgbuild_dir}"
pkgbuild_dirs=($(ls "${pkgbuild_dir}" 2> /dev/null))
if (( "${#pkgbuild_dirs[@]}" != 0 )); then
- for _dir in ${pkgbuild_dirs[@]}; do
+ for _dir in "${pkgbuild_dirs[@]}"; do
cd "${_dir}"
depends=($(source "${pkgbuild_dir}/${_dir}/PKGBUILD"; echo "${depends[@]}"))
makedepends=($(source "${pkgbuild_dir}/${_dir}/PKGBUILD"; echo "${makedepends[@]}"))
if (( ${#depends[@]} + ${#makedepends[@]} != 0 )); then
- for _pkg in ${depends[@]} ${makedepends[@]}; do
+ for _pkg in "${depends[@]}" "${makedepends[@]}"; do
if pacman -Ssq "${_pkg}" | grep -x "${_pkg}" 1> /dev/null; then
pacman -S --asdeps --needed "${pacman_args[@]}" "${_pkg}"
fi
load_config() {
local _file
- for _file in ${@}; do
+ for _file in "${@}"; do
if [[ -f "${_file}" ]]; then
source "${_file}"
fi
for_module(){
local module
for module in ${modules[@]}; do
- eval $(echo ${@} | sed "s|{}|${module}|g")
+ eval $(echo "${@}" | sed "s|{}|${module}|g")
done
}
modules=("share")
fi
fi
- for module in ${modules[@]}; do
+ for module in "${modules[@]}"; do
dependent="${module_dir}/${module}/dependent"
if [[ -f "${dependent}" ]]; then
modules+=($(grep -h -v ^'#' "${dependent}" | tr -d "\n" ))
"iso_version"
)
-for var in ${variable_list[@]}; do
+for var in "${variable_list[@]}"; do
if [[ -z "$(eval echo '$'${var})" ]]; then
echo "${var} is empty" >&2
exit 1
fi
case "${mode}" in
- "check" ) check ${@} ;;
+ "check" ) check "${@}" ;;
"show" ) show ;;
- "desc" ) desc ${@} ;;
- "ver" ) get_alteriso_version ${@} ;;
+ "desc" ) desc "${@}" ;;
+ "ver" ) get_alteriso_version "${@}" ;;
"help" ) _help; exit 0 ;;
* ) _help; exit 1 ;;
esac
# load_config [file1] [file2] ...
load_config() {
local _file
- for _file in ${@}; do
+ for _file in "${@}"; do
if [[ -f "${_file}" ]]; then
source "${_file}"
fi
"i686"
)
-# rm helper
-# Delete the file if it exists.
-# For directories, rm -rf is used.
-# If the file does not exist, skip it.
-# remove <file> <file> ...
-remove() {
- local _list=($(echo "$@")) _file
- for _file in "${_list[@]}"; do
- if [[ -f "${_file}" ]]; then
- rm -f "${_file}"
- elif [[ -d "${_file}" ]]; then
- rm -rf "${_file}"
- fi
- done
-}
-
#cd "${script_path}"
-for arch in ${arch_list[@]}; do
- remove "${script_path}/menuconfig-script/kernel_choice_${arch}"
+for arch in "${arch_list[@]}"; do
+ rm -rf "${script_path}/menuconfig-script/kernel_choice_${arch}"
for kernel in $(bash "${script_path}/tools/kernel.sh" -a "${arch}" show ); do
echo "config KERNEL_N_A_M_E_${kernel}" >> "${script_path}/menuconfig-script/kernel_choice_${arch}"
echo -e "\tbool ${kernel}" >> "${script_path}/menuconfig-script/kernel_choice_${arch}"
_kernel_name_list=($(cat "${_kernel_config_file}" | grep -h -v ^'#' | getclm 1))
_get_kernel_line() {
local _kernel _count=0
- for _kernel in ${_kernel_name_list[@]}; do
+ for _kernel in "${_kernel_name_list[@]}"; do
_count=$(( _count + 1 ))
if [[ "${_kernel}" = "${1}" ]]; then echo "${_count}"; return 0; fi
done
fi
case "${mode}" in
- "check" ) check ${@} ;;
+ "check" ) check "${@}" ;;
"show" ) show ;;
- "get" ) get ${@} ;;
+ "get" ) get "${@}" ;;
"help" ) _help; exit 0 ;;
* ) _help; exit 1 ;;
esac
run() {
msg_info "Running ${*}"
- ${@}
+ eval "${@}"
}
_locale_name_list=($(cat "${_locale_config_file}" | grep -h -v ^'#' | awk '{print $1}'))
_get_locale_line_number() {
local _lang _count=0
- for _lang in ${_locale_name_list[@]}; do
+ for _lang in "${_locale_name_list[@]}"; do
_count=$(( _count + 1 ))
if [[ "${_lang}" = "${1}" ]]; then echo "${_count}"; return 0; fi
done
echo -n "failed"
}
- _locale_line_number="$(_get_locale_line_number ${@})"
+ _locale_line_number="$(_get_locale_line_number "${@}")"
# 不正なロケール名なら終了する
if [[ "${_locale_line_number}" = "failed" ]]; then
unset OPTS OPTL
while true; do
- case ${1} in
+ case "${1}" in
-a | --arch)
arch="${2}"
shift 2
fi
case "${mode}" in
- "check" ) check ${@} ;;
+ "check" ) check "${@}" ;;
"show" ) show ;;
- "get" ) get ${@} ;;
+ "get" ) get "${@}" ;;
"help" ) _help; exit 0 ;;
* ) _help; exit 1 ;;
esac
# for_module <command>
for_module(){
local module
- for module in ${modules[@]}; do
- eval $(echo ${@} | sed "s|{}|${module}|g")
+ for module in "${modules[@]}"; do
+ eval $(echo "${@}" | sed "s|{}|${module}|g")
done
}
#-- Read package list --#
# Read the file and remove comments starting with # and add it to the list of packages to install.
-for _file in ${_loadfilelist[@]}; do
+for _file in "${_loadfilelist[@]}"; do
if [[ -f "${_file}" ]]; then
msg_debug "Loaded package file ${_file}"
_pkglist=( ${_pkglist[@]} "$(grep -h -v ^'#' ${_file})" )
_excludefile=("${channel_dir}/packages.${arch}/exclude" "${channel_dir}/packages_aur.${arch}/exclude")
for_module '_excludefile+=("${module_dir}/{}/packages.${arch}/exclude" "${module_dir}/{}/packages_aur.${arch}/exclude")'
-for _file in ${_excludefile[@]}; do
+for _file in "${_excludefile[@]}"; do
if [[ -f "${_file}" ]]; then
_excludelist+=($(grep -h -v ^'#' "${_file}") )
fi
# パッケージ一覧
msg_debug "Getting package list ..."
-for arch in ${archs[@]}; do
+for arch in "${archs[@]}"; do
packages+=($("${script_path}/tools/allpkglist.sh" -s -a "${arch}"))
done
group_list=($(curl -s https://archlinux.org/groups/ | grep "/groups/x86_64" | cut -d "/" -f 4))
# 実行開始
-for pkg in ${packages[@]}; do
+for pkg in "${packages[@]}"; do
msg_debug "Searching ${pkg} ..."
if ! searchpkg "${pkg}"; then
echo "${pkg} is not in the official repository." >&2
"default.conf"
)
- for Var_Local_file in ${Var_Local_file_list[@]}; do
+ for Var_Local_file in "${Var_Local_file_list[@]}"; do
if [[ ! -f "${Var_Global_Wizard_Env_script_path}/${Var_Local_file}" ]]; then
msg_error "${Var_Local_file}が見つかりませんでした。" "${Var_Local_file} was not found."
Var_Local_error=true
local Var_Local_package Var_Local_installed_package Var_Local_installed_version
Var_Local_installed_package=($(pacman -Q | getclm 1))
Var_Local_installed_version=($(pacman -Q | getclm 2))
- for Var_Local_package in $(seq 0 $(( ${#Var_Local_installed_package[@]} - 1 ))); do
- if [[ ${Var_Local_installed_package[${Var_Local_package}]} = ${1} ]]; then
- if [[ ${Var_Local_installed_version[${Var_Local_package}]} = $(pacman -Sp --print-format '%v' --config "${Var_Global_Wizard_Env_pacman_conf}" ${1}) ]]; then
+ for Var_Local_package in $(seq 0 $(( "${#Var_Local_installed_package[@]}" - 1 ))); do
+ if [[ "${Var_Local_installed_package[${Var_Local_package}]}" = "${1}" ]]; then
+ if [[ "${Var_Local_installed_version[${Var_Local_package}]}" = $(pacman -Sp --print-format '%v' --config "${Var_Global_Wizard_Env_pacman_conf}" ${1}) ]]; then
echo -n "true"
return 0
else
return 0
}
echo
- for Var_Local_package in ${dependence[@]}; do
+ for Var_Local_package in "${dependence[@]}"; do
msg "依存パッケージ ${Var_Local_package} を確認しています..." "Checking dependency package ${Var_Local_package} ..."
if [[ $(Function_Local_checkpkg ${Var_Local_package}) = false ]]; then
Var_Global_missing_packages+=(${Var_Local_package})
Function_Global_Main_remove_dependent_packages () {
if [[ -n "${Var_Global_missing_packages[*]}" ]]; then
- sudo pacman -Rsn --config "${Var_Global_Wizard_Env_pacman_conf}" ${Var_Global_missing_packages[@]}
+ sudo pacman -Rsn --config "${Var_Global_Wizard_Env_pacman_conf}" "${Var_Global_missing_packages[@]}"
fi
}
local Var_Local_locale_list Var_Local_locale Var_Local_count=1 Var_Local_input_locale
Var_Local_locale_list=($("${Var_Global_Wizard_Env_script_path}/tools/locale.sh" -a "${Var_Global_Wizard_Option_build_arch}" show))
- for Var_Local_locale in ${Var_Local_locale_list[@]}; do
+ for Var_Local_locale in "${Var_Local_locale_list[@]}"; do
(
local locale_name locale_gen_name locale_version locale_time locale_fullname
eval $("${Var_Global_Wizard_Env_script_path}/tools/locale.sh" -a "${Var_Global_Wizard_Option_build_arch}" get "${Var_Local_locale}" )
set +e
expr "${Var_Local_input_locale}" + 1 >/dev/null 2>&1
- if [[ ${?} -lt 2 ]]; then
+ if [[ "${?}" -lt 2 ]]; then
set -e
# 数字である
Var_Local_input_locale=$(( Var_Local_input_locale - 1 ))
#選択肢の生成
local Var_Local_kernel Var_Local_count=1 Var_Local_int
- for Var_Local_kernel in ${Var_Local_kernel_list[@]}; do
+ for Var_Local_kernel in "${Var_Local_kernel_list[@]}"; do
(
local kernel kernel_filename kernel_mkinitcpio_profile
eval $("${Var_Global_Wizard_Env_script_path}/tools/kernel.sh" -a "${Var_Global_Wizard_Option_build_arch}" get "${Var_Local_kernel}" )
msg "チャンネルを以下の番号から選択してください。" "Select a channel from the numbers below."
# 選択肢を生成
- for Var_Local_channel in ${Var_Local_channel_list[@]}; do
+ for Var_Local_channel in "${Var_Local_channel_list[@]}"; do
if [[ -f "${Var_Global_Wizard_Env_script_path}/channels/${Var_Local_channel_dir[$(( Var_Local_count - 1 ))]}/description.txt" ]]; then
Var_Local_description=$(cat "${Var_Global_Wizard_Env_script_path}/channels/${Var_Local_channel_dir[$(( Var_Local_count - 1 ))]}/description.txt")
else