• R/O
  • HTTP
  • SSH
  • HTTPS

alterlinux: 提交

GitHubのミラーです
https://github.com/FascodeNet/alterlinux


Commit MetaInfo

修订版be87a5204cfa0552c631c31f22e63803bce58a75 (tree)
时间2021-05-22 23:32:35
作者hayao <hayao@fasc...>
Commiterhayao

Log Message

Merge branch 'dev' into dev-stable

更改概述

差异

--- a/.github/workflows/codeql-analysis.yml
+++ /dev/null
@@ -1,71 +0,0 @@
1-# For most projects, this workflow file will not need changing; you simply need
2-# to commit it to your repository.
3-#
4-# You may wish to alter this file to override the set of languages analyzed,
5-# or to provide custom queries or build logic.
6-name: "CodeQL"
7-
8-on:
9- push:
10- branches: [dev, dev-stable, master]
11- pull_request:
12- # The branches below must be a subset of the branches above
13- branches: [dev]
14- schedule:
15- - cron: '0 17 * * 2'
16-
17-jobs:
18- analyze:
19- name: Analyze
20- runs-on: ubuntu-latest
21-
22- strategy:
23- fail-fast: false
24- matrix:
25- # Override automatic language detection by changing the below list
26- # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
27- language: ['cpp', 'python']
28- # Learn more...
29- # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
30-
31- steps:
32- - name: Checkout repository
33- uses: actions/checkout@v2
34- with:
35- # We must fetch at least the immediate parents so that if this is
36- # a pull request then we can checkout the head.
37- fetch-depth: 2
38-
39- # If this run was triggered by a pull request event, then checkout
40- # the head of the pull request instead of the merge commit.
41- - run: git checkout HEAD^2
42- if: ${{ github.event_name == 'pull_request' }}
43-
44- # Initializes the CodeQL tools for scanning.
45- - name: Initialize CodeQL
46- uses: github/codeql-action/init@v1
47- with:
48- languages: ${{ matrix.language }}
49- # If you wish to specify custom queries, you can do so here or in a config file.
50- # By default, queries listed here will override any specified in a config file.
51- # Prefix the list here with "+" to use these queries and those in the config file.
52- # queries: ./path/to/local/query, your-org/your-repo/queries@main
53-
54- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55- # If this step fails, then you should remove it and run the build manually (see below)
56- - name: Autobuild
57- uses: github/codeql-action/autobuild@v1
58-
59- # ℹ️ Command-line programs to run using the OS shell.
60- # 📚 https://git.io/JvXDl
61-
62- # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63- # and modify them (or add more) to build your code if your project
64- # uses a compiled language
65-
66- #- run: |
67- # make bootstrap
68- # make release
69-
70- - name: Perform CodeQL Analysis
71- uses: github/codeql-action/analyze@v1
--- a/.github/workflows/codescan-analysis.yml
+++ /dev/null
@@ -1,35 +0,0 @@
1-# This workflow requires that you have an existing account with codescan.io
2-# For more information about configuring your workflow,
3-# read our documentation at https://github.com/codescan-io/codescan-scanner-action
4-name: CodeScan
5-
6-on:
7- push:
8- branches: [master, main]
9- pull_request:
10- # The branches below must be a subset of the branches above
11- branches: [master, main]
12-
13-jobs:
14- CodeScan:
15- runs-on: ubuntu-latest
16- steps:
17- - name: Checkout repository
18- uses: actions/checkout@v2
19- - name: Cache files
20- uses: actions/cache@v2
21- with:
22- path: |
23- ~/.sonar
24- key: ${{ runner.os }}-sonar
25- restore-keys: ${{ runner.os }}-sonar
26- - name: Run Analysis
27- uses: codescan-io/codescan-scanner-action@master
28- with:
29- login: ${{ secrets.CODESCAN_AUTH_TOKEN }}
30- organization: ${{ secrets.CODESCAN_ORGANIZATION_KEY }}
31- projectKey: ${{ secrets.CODESCAN_PROJECT_KEY }}
32- - name: Upload SARIF file
33- uses: github/codeql-action/upload-sarif@v1
34- with:
35- sarif_file: codescan.sarif
--- /dev/null
+++ b/.github/workflows/shellcheck.yml
@@ -0,0 +1,34 @@
1+# This is a basic workflow to help you get started with Actions
2+
3+name: ShellCheck CL
4+
5+# Controls when the action will run.
6+on:
7+ # Triggers the workflow on push or pull request events but only for the dev branch
8+ push:
9+ branches: [ dev ]
10+ pull_request:
11+ branches: [ dev ]
12+
13+ # Allows you to run this workflow manually from the Actions tab
14+ workflow_dispatch:
15+
16+# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+jobs:
18+ # This workflow contains a single job called "build"
19+ build:
20+ # The type of runner that the job will run on
21+ runs-on: ubuntu-latest
22+
23+ # Steps represent a sequence of tasks that will be executed as part of the job
24+ steps:
25+ # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
26+ - uses: actions/checkout@v2
27+
28+ # Runs a single command using the runners shell
29+ - name: Run ShellCheck
30+ uses: ludeeus/action-shellcheck@master
31+ with:
32+ severity: error
33+ env:
34+ SHELLCHECK_OPTS: --shell=bash
--- a/.travis.yml
+++ /dev/null
@@ -1,15 +0,0 @@
1-language: shell
2-sudo: required
3-addons:
4- apt:
5- packages:
6- - ninja
7- - cmake
8- - clang
9- - qtbase5-dev
10-script:
11- - bash -c 'shopt -s globstar nullglob; shellcheck -s bash --exclude=SC2068 -S error **/*.{sh,ksh,bash}'
12- - bash -c 'shopt -s globstar nullglob; shellcheck -s bash --exclude=SC2068 -S error tools/*.{sh,ksh,bash}'
13-git:
14- submodules: false
15- language: bash
--- a/build.sh
+++ b/build.sh
@@ -32,7 +32,7 @@ alteriso_version="3.1"
3232 # Load config file
3333 [[ ! -f "${defaultconfig}" ]] && "${tools_dir}/msg.sh" -a 'build.sh' error "${defaultconfig} was not found." && exit 1
3434 for config in "${defaultconfig}" "${script_path}/custom.conf"; do
35- [[ -f "${script_path}/${config}.conf" ]] && source "${script_path}/${config}.conf"
35+ [[ -f "${config}" ]] && source "${config}"
3636 done
3737
3838 umask 0022
@@ -424,7 +424,7 @@ prepare_build() {
424424 local module_check
425425 module_check(){
426426 msg_debug "Checking ${1} module ..."
427- ! bash "${tools_dir}/module.sh" check "${1}" && msg_error "Module ${1} is not available." "1";
427+ bash "${tools_dir}/module.sh" check "${1}" || msg_error "Module ${1} is not available." "1";
428428 }
429429 modules=($(printf "%s\n" "${modules[@]}" | awk '!a[$0]++'))
430430 for_module "module_check {}"
@@ -600,10 +600,10 @@ make_pkgbuild() {
600600 # Customize installation (airootfs)
601601 make_customize_airootfs() {
602602 # Overwrite airootfs with customize_airootfs.
603- local _airootfs _airootfs_script_options _script _script_list _airootfs_list _main_script
603+ local _airootfs _airootfs_script_options _script _script_list _airootfs_list=() _main_script
604604
605- _airootfs_list=("${channel_dir}/airootfs.any" "${channel_dir}/airootfs.${arch}")
606- for_module '_airootfs_list=("${_airootfs_list[@]}" "${module_dir}/{}/airootfs.any" "${module_dir}/{}/airootfs.${arch}")'
605+ for_module '_airootfs_list+=("${module_dir}/{}/airootfs.any" "${module_dir}/{}/airootfs.${arch}")'
606+ _airootfs_list+=("${channel_dir}/airootfs.any" "${channel_dir}/airootfs.${arch}")
607607
608608 for _airootfs in "${_airootfs_list[@]}";do
609609 if [[ -d "${_airootfs}" ]]; then
--- /dev/null
+++ b/channels/cinnamon/airootfs.any/etc/lightdm/lightdm.conf.d/02-autologin-session.conf
@@ -0,0 +1,2 @@
1+[Seat:*]
2+autologin-session=cinnamon2d
--- /dev/null
+++ b/channels/i3/airootfs.any/etc/lightdm/lightdm.conf.d/02-autologin-session.conf
@@ -0,0 +1,2 @@
1+[Seat:*]
2+autologin-session=i3
--- a/channels/i3/airootfs.any/etc/skel/.config/rofi/power.sh
+++ b/channels/i3/airootfs.any/etc/skel/.config/rofi/power.sh
@@ -22,7 +22,7 @@ declare -A menu_list=(
2222
2323 function main() {
2424 local -r IFS=$'\n'
25- [[ $# -ne 0 ]] && eval "${menu_list[$1]}" || echo "${!menu_list[*]}"
25+ [[ "${#}" -ne 0 ]] && eval "${menu_list[$1]}" || echo "${!menu_list[*]}"
2626 }
2727
28-main $@
28+main "${@}"
--- a/modules/lightdm/airootfs.any/root/customize_airootfs_lightdm.sh
+++ b/modules/lightdm/airootfs.any/root/customize_airootfs_lightdm.sh
@@ -20,7 +20,7 @@ sed -i "s|%USERNAME%|${username}|g" "/etc/lightdm/lightdm.conf.d/02-autologin.co
2020
2121
2222 # Session list
23-if cat "/etc/lightdm/lightdm.conf.d/02-autologin-session.conf" | grep "%SESSION%" 1> /dev/null 2>&1; then
23+if [[ -f "/etc/lightdm/lightdm.conf.d/02-autologin-session.conf" ]] && cat "/etc/lightdm/lightdm.conf.d/02-autologin-session.conf" | grep "%SESSION%" 1> /dev/null 2>&1; then
2424 session_list=()
2525 while read -r session; do
2626 session_list+=("${session}")
@@ -32,6 +32,10 @@ if cat "/etc/lightdm/lightdm.conf.d/02-autologin-session.conf" | grep "%SESSION%
3232 elif (( "${#session_list[@]}" == 0)); then
3333 echo "Warining: Auto login session was not found"
3434 else
35- remove "/etc/lightdm/lightdm.conf.d/02-autologin-session.conf"
35+ echo "Failed to set the session.Multiple sessions were found." >&2
36+ echo "Please set the session of automatic login in /etc/lightdm/lightdm.conf.d/02-autologin-session.conf"
37+ echo "Found session: $(printf "%s " "${session_list[@]}")"
38+ sleep 0.5
39+ exit 1
3640 fi
3741 fi
--- a/system/aur.sh
+++ b/system/aur.sh
@@ -9,7 +9,7 @@
99 set -e -u
1010
1111 aur_username="aurbuild"
12-pacman_debug=true
12+pacman_debug=false
1313 pacman_args=()
1414
1515 trap 'exit 1' 1 2 3 15
--- a/system/pkgbuild.sh
+++ b/system/pkgbuild.sh
@@ -9,7 +9,7 @@
99 set -e
1010
1111 build_username="pkgbuild"
12-pacman_debug=true
12+pacman_debug=false
1313 pacman_args=()
1414
1515 _help() {
@@ -66,7 +66,7 @@ function user_check () {
6666
6767 # 一般ユーザーで実行します
6868 function run_user () {
69- sudo -u "${build_username}" ${@}
69+ sudo -u "${build_username}" "${@}"
7070 }
7171
7272 # 引数を確認
@@ -106,12 +106,12 @@ pacman -Syy "${pacman_args[@]}"
106106 cd "${pkgbuild_dir}"
107107 pkgbuild_dirs=($(ls "${pkgbuild_dir}" 2> /dev/null))
108108 if (( "${#pkgbuild_dirs[@]}" != 0 )); then
109- for _dir in ${pkgbuild_dirs[@]}; do
109+ for _dir in "${pkgbuild_dirs[@]}"; do
110110 cd "${_dir}"
111111 depends=($(source "${pkgbuild_dir}/${_dir}/PKGBUILD"; echo "${depends[@]}"))
112112 makedepends=($(source "${pkgbuild_dir}/${_dir}/PKGBUILD"; echo "${makedepends[@]}"))
113113 if (( ${#depends[@]} + ${#makedepends[@]} != 0 )); then
114- for _pkg in ${depends[@]} ${makedepends[@]}; do
114+ for _pkg in "${depends[@]}" "${makedepends[@]}"; do
115115 if pacman -Ssq "${_pkg}" | grep -x "${_pkg}" 1> /dev/null; then
116116 pacman -S --asdeps --needed "${pacman_args[@]}" "${_pkg}"
117117 fi
--- a/tools/README.md
+++ b/tools/README.md
@@ -7,6 +7,9 @@ Alter Linuxのビルドに使用する処理をコマンド化したものです
77 全てのチャンネルのパッケージの一覧を表示します。
88 `channel.sh`でチャンネルの一覧を取得後、`pkglist.sh`でパッケージ一覧を取得します。
99
10+## alteriso-info.sh
11+ビルド情報を書いたテキストファイルを出力します。詳細は`alteiso-info.sh`を実行してください。
12+
1013 ## build_helper.py
1114 GUIのビルドヘルパーです。PyGobjectが必要です。
1215
@@ -43,6 +46,10 @@ menuconfigで使用されるスクリプトです。
4346 ## menuconf-to-alterconf.sh
4447 menuconfigで使用されるスクリプトです。
4548
49+## module.sh
50+使用可能なモジュールの一覧や確認を行います。
51+詳細は`module.sh -h`を実行してください。
52+
4653 ## msg.sh
4754 ラベルと色がついたメッセージを出力します。このスクリプトは様々な場所から呼び出されます。
4855 詳細は`msg.sh -h`を実行してください。
@@ -52,7 +59,7 @@ menuconfigで使用されるスクリプトです。
5259 `build.sh`の依存関係チェックに使用されています。
5360 詳細は`package.py -h`を実行してください。
5461
55-## pkglist.py
62+## pkglist.sh
5663 指定されたチャンネルのパッケージ一覧を取得します。
5764 詳細は`pkglist.sh`を実行してください。
5865
@@ -60,6 +67,11 @@ menuconfigで使用されるスクリプトです。
6067 `allpkglist.sh`で全てのパッケージ一覧を取得後、そのパッケージが公式リポジトリから利用可能かどうかを調べます。
6168 詳細は`testpkg.sh`を実行してください。
6269
70+## umount.sh
71+指定されたディレクトリ以下のマウントポイントを検索してアンマウントします。
72+`build.sh`や`clean.sh`から呼び出されます。
73+詳細は`umount.sh`を実行してください。
74+
6375 ## wizard.sh
6476 CLIの対話型のビルド設定ツールです。英語と日本語に対応しています。
6577 依存パッケージの自動インストールやキーリングの自動インストールを行います。
--- a/tools/allpkglist.sh
+++ b/tools/allpkglist.sh
@@ -4,7 +4,7 @@ set -e
44
55 load_config() {
66 local _file
7- for _file in ${@}; do
7+ for _file in "${@}"; do
88 if [[ -f "${_file}" ]]; then
99 source "${_file}"
1010 fi
@@ -79,7 +79,7 @@ fi
7979
8080 load_config() {
8181 local _file
82- for _file in ${@}; do
82+ for _file in "${@}"; do
8383 if [[ -f "${_file}" ]]; then
8484 source "${_file}"
8585 fi
@@ -88,12 +88,12 @@ load_config() {
8888
8989 for_module(){
9090 local module
91- for module in ${modules[@]}; do
92- eval $(echo ${@} | sed "s|{}|${module}|g")
91+ for module in "${modules[@]}"; do
92+ eval $(echo "${@}" | sed "s|{}|${module}|g")
9393 done
9494 }
9595
96-for arch in ${archs[@]}; do
96+for arch in "${archs[@]}"; do
9797 for channel in $("${tools_dir}/channel.sh" show -a "${arch}" -b -d -k zen -f); do
9898 modules=($(
9999 load_config "${script_path}/default.conf" "${script_path}/custom.conf"
@@ -105,7 +105,7 @@ for arch in ${archs[@]}; do
105105 modules=("share")
106106 fi
107107 fi
108- for module in ${modules[@]}; do
108+ for module in "${modules[@]}"; do
109109 dependent="${module_dir}/${module}/dependent"
110110 if [[ -f "${dependent}" ]]; then
111111 modules+=($(grep -h -v ^'#' "${dependent}" | tr -d "\n" ))
--- a/tools/alteriso-info.sh
+++ b/tools/alteriso-info.sh
@@ -97,7 +97,7 @@ variable_list=(
9797 "iso_version"
9898 )
9999
100-for var in ${variable_list[@]}; do
100+for var in "${variable_list[@]}"; do
101101 if [[ -z "$(eval echo '$'${var})" ]]; then
102102 echo "${var} is empty" >&2
103103 exit 1
--- a/tools/channel.sh
+++ b/tools/channel.sh
@@ -237,10 +237,10 @@ else
237237 fi
238238
239239 case "${mode}" in
240- "check" ) check ${@} ;;
240+ "check" ) check "${@}" ;;
241241 "show" ) show ;;
242- "desc" ) desc ${@} ;;
243- "ver" ) get_alteriso_version ${@} ;;
242+ "desc" ) desc "${@}" ;;
243+ "ver" ) get_alteriso_version "${@}" ;;
244244 "help" ) _help; exit 0 ;;
245245 * ) _help; exit 1 ;;
246246 esac
--- a/tools/clean.sh
+++ b/tools/clean.sh
@@ -4,6 +4,7 @@ set -eu
44
55 script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && cd .. && pwd )"
66 work_dir="${script_path}/work"
7+tools_dir="${script_path}/tools"
78 debug=false
89 only_work=false
910 noconfirm=false
@@ -13,7 +14,7 @@ noconfirm=false
1314 # load_config [file1] [file2] ...
1415 load_config() {
1516 local _file
16- for _file in ${@}; do
17+ for _file in "${@}"; do
1718 if [[ -f "${_file}" ]]; then
1819 source "${_file}"
1920 fi
@@ -90,22 +91,7 @@ _umount() { if mountpoint -q "${1}"; then umount -lf "${1}"; fi; }
9091
9192 # Unmount chroot dir
9293 umount_chroot () {
93- local _mount
94- if [[ ! -v "work_dir" ]] || [[ "${work_dir}" = "" ]]; then
95- msg_error "Exception error about working directory" 1
96- fi
97- if [[ ! -d "${work_dir}" ]]; then
98- return 0
99- fi
100- for _mount in $(find "${work_dir}" -mindepth 1 -type d -printf "%p\0" | xargs -0 -I{} bash -c "mountpoint -q {} && echo {}" | tac); do
101- if echo "${_mount}" | grep "${work_dir}" > /dev/null 2>&1 || echo "${_mount}" | grep "${script_path}" > /dev/null 2>&1 || echo "${_mount}" | grep "${out_dir}" > /dev/null 2>&1; then
102- msg_info "Unmounting ${_mount}"
103- _umount "${_mount}" 2> /dev/null
104- else
105- msg_error "It is dangerous to unmount a directory that is not managed by the script."
106- msg_error "Path: ${_mount}"
107- fi
108- done
94+ "${tools_dir}/umount.sh" "${work_dir}"
10995 }
11096
11197 # Usage: getclm <number>
@@ -168,9 +154,7 @@ fi
168154 umount_chroot
169155 if [[ "${only_work}" = false ]]; then
170156 remove "${script_path}/menuconfig/build/"**
171- remove "${script_path}/system/cpp-src/mkalteriso/build"/**
172157 remove "${script_path}/menuconfig-script/kernel_choice"
173- remove "${script_path}/system/mkalteriso"
174158 fi
175159
176160 remove "${work_dir%/}"/**
--- a/tools/fullbuild.sh
+++ b/tools/fullbuild.sh
@@ -15,6 +15,8 @@ architectures=("x86_64" "i686")
1515 locale_list=("ja" "en")
1616 share_options=()
1717 default_options=("--boot-splash" "--cleanup" "--user" "alter" "--password" "alter")
18+failed=()
19+abort=false
1820
1921 work_dir="${script_path}/work"
2022 simulation=false
@@ -25,62 +27,39 @@ all_channel=false
2527 customized_work=false
2628 noconfirm=false
2729
28-# Show an INFO message
29-# $1: message string
30-msg_info() {
31- local _msg_opts="-a fullbuilid -s 5"
32- if [[ "${1}" = "-n" ]]; then
33- _msg_opts="${_msg_opts} -o -n"
34- shift 1
35- fi
36- "${script_path}/tools/msg.sh" ${_msg_opts} info "${1}"
30+# Message common function
31+# msg_common [type] [-n] [string]
32+msg_common(){
33+ local _msg_opts=("-a" "fullbuild" "-s" "5") _type="${1}"
34+ shift 1
35+ [[ "${1}" = "-n" ]] && _msg_opts+=("-o" "-n") && shift 1
36+ [[ "${nocolor}" = true ]] && _msg_opts+=("-n")
37+ _msg_opts+=("${_type}" "${@}")
38+ "${script_path}/tools/msg.sh" "${_msg_opts[@]}"
3739 }
3840
39-# Show an Warning message
40-# $1: message string
41-msg_warn() {
42- local _msg_opts="-a fullbuilid -s 5"
43- if [[ "${1}" = "-n" ]]; then
44- _msg_opts="${_msg_opts} -o -n"
45- shift 1
46- fi
47- "${script_path}/tools/msg.sh" ${_msg_opts} warn "${1}"
48-}
41+# Show an INFO message
42+# ${1}: message string
43+msg_info() { msg_common info "${@}"; }
4944
50-# Show an debug message
51-# $1: message string
52-msg_debug() {
53- if [[ "${debug}" = true ]]; then
54- local _msg_opts="-a fullbuilid -s 5"
55- if [[ "${1}" = "-n" ]]; then
56- _msg_opts="${_msg_opts} -o -n"
57- shift 1
58- fi
59- "${script_path}/tools/msg.sh" ${_msg_opts} debug "${1}"
60- fi
61-}
45+# Show an Warning message
46+# ${1}: message string
47+msg_warn() { msg_common warn "${@}"; }
6248
6349 # Show an ERROR message then exit with status
64-# $1: message string
65-# $2: exit code number (with 0 does not exit)
50+# ${1}: message string
51+# ${2}: exit code number (with 0 does not exit)
6652 msg_error() {
67- local _msg_opts="-a fullbuilid -s 5"
68- if [[ "${1}" = "-n" ]]; then
69- _msg_opts="${_msg_opts} -o -n"
70- shift 1
71- fi
72- "${script_path}/tools/msg.sh" ${_msg_opts} error "${1}"
73- if [[ -n "${2:-}" ]]; then
74- exit ${2}
75- fi
53+ msg_common error "${1}"
54+ [[ -n "${2:-}" ]] && exit "${2}"
7655 }
7756
7857
7958 trap_exit() {
80- local status=${?}
59+ local status="${?}"
8160 echo
8261 msg_error "fullbuild.sh has been killed by the user."
83- exit ${status}
62+ exit "${status}"
8463 }
8564
8665
@@ -90,7 +69,8 @@ build() {
9069 _options+=("--arch" "${arch}" "--lang" "${lang}" "${cha}")
9170
9271 if [[ "${simulation}" = false ]] && [[ "${remove_cache}" = true ]]; then
93- sudo pacman -Sccc --noconfirm
72+ msg_info "Removing package cache for ${arch}"
73+ sudo rm -rf "${work_dir}/cache/${arch}"
9474 fi
9575
9676 if [[ ! -e "${fullbuild_dir}/fullbuild.${cha}_${arch}_${lang}" ]]; then
@@ -105,7 +85,11 @@ build() {
10585 touch "${fullbuild_dir}/fullbuild.${cha}_${arch}_${lang}"
10686 elif (( "${retry_count}" == "${retry}" )); then
10787 msg_error "Failed to build (Exit code: ${_exit_code})"
108- exit "${_exit_code}"
88+ if [[ "${abort}" = true ]]; then
89+ exit "${_exit_code}"
90+ else
91+ failed+=("${cha}-${arch}-${lang}")
92+ fi
10993 else
11094 msg_error "build.sh finished with exit code ${_exit_code}. Will try again."
11195 fi
@@ -121,6 +105,7 @@ _help() {
121105 echo " -a <options> Set other options in build.sh"
122106 echo " -c Build all channel (DO NOT specify the channel !!)"
123107 echo " -d Use the default build.sh arguments. (${default_options[*]})"
108+ echo " -e Exit the script when the build fails"
124109 echo " -g Use gitversion"
125110 echo " -h | --help This help message"
126111 echo " -l <locale> Set the locale to build"
@@ -148,7 +133,7 @@ share_options+=("--noconfirm")
148133
149134 # Parse options
150135 ARGUMENT=("${@}")
151-OPTS="a:dghr:sctm:l:w:"
136+OPTS="a:deghr:sctm:l:w:"
152137 OPTL="help,remove-cache,noconfirm"
153138 if ! OPT=$(getopt -o ${OPTS} -l ${OPTL} -- "${ARGUMENT[@]}"); then
154139 exit 1
@@ -157,7 +142,7 @@ eval set -- "${OPT}"
157142 unset OPT OPTS OPTL ARGUMENT
158143
159144 while true; do
160- case ${1} in
145+ case "${1}" in
161146 -a)
162147 share_options+=(${2})
163148 shift 2
@@ -170,6 +155,10 @@ while true; do
170155 share_options+=("${default_options[@]}")
171156 shift 1
172157 ;;
158+ -e)
159+ abort=true
160+ shift 1
161+ ;;
173162 -m)
174163 architectures=(${2})
175164 shift 2
@@ -236,7 +225,7 @@ if [[ "${all_channel}" = true ]]; then
236225 channnels=($("${script_path}/tools/channel.sh" -b show))
237226 fi
238227 elif [[ -n "${*}" ]]; then
239- channnels=(${@})
228+ channnels=("${@}")
240229 fi
241230
242231 if [[ "${simulation}" = true ]]; then
@@ -271,16 +260,11 @@ fi
271260
272261 trap 'trap_exit' 1 2 3 15
273262
274-if [[ "${simulation}" = false ]]; then
275- msg_info "Update the package database."
276- sudo pacman -Syy
277-fi
278-
279-for arch in ${architectures[@]}; do
280- for cha in ${channnels[@]}; do
281- for lang in ${locale_list[@]}; do
282- for retry_count in $(seq 1 ${retry}); do
283- if [[ -n $(cat "${script_path}/channels/${cha}/architecture" | grep -h -v ^'#' | grep -x "${arch}") ]]; then
263+for arch in "${architectures[@]}"; do
264+ for cha in "${channnels[@]}"; do
265+ for lang in "${locale_list[@]}"; do
266+ for retry_count in $(seq 1 "${retry}"); do
267+ if [[ -n "$(cat "${script_path}/channels/${cha}/architecture" | grep -h -v ^'#' | grep -x "${arch}")" ]]; then
284268 build
285269 fi
286270 done
@@ -290,5 +274,10 @@ done
290274
291275
292276 if [[ "${simulation}" = false ]]; then
293- msg_info "All editions have been built"
277+ if (( "${#failed[@]}" == 0 )); then
278+ msg_info "All editions have been built"
279+ else
280+ msg_error "Build of the following settings failed"
281+ printf " - %s\n" "${failed[@]}"
282+ fi
294283 fi
--- a/tools/kernel-choice-conf-gen.sh
+++ b/tools/kernel-choice-conf-gen.sh
@@ -6,25 +6,9 @@ arch_list=(
66 "i686"
77 )
88
9-# rm helper
10-# Delete the file if it exists.
11-# For directories, rm -rf is used.
12-# If the file does not exist, skip it.
13-# remove <file> <file> ...
14-remove() {
15- local _list=($(echo "$@")) _file
16- for _file in "${_list[@]}"; do
17- if [[ -f "${_file}" ]]; then
18- rm -f "${_file}"
19- elif [[ -d "${_file}" ]]; then
20- rm -rf "${_file}"
21- fi
22- done
23-}
24-
259 #cd "${script_path}"
26-for arch in ${arch_list[@]}; do
27- remove "${script_path}/menuconfig-script/kernel_choice_${arch}"
10+for arch in "${arch_list[@]}"; do
11+ rm -rf "${script_path}/menuconfig-script/kernel_choice_${arch}"
2812 for kernel in $(bash "${script_path}/tools/kernel.sh" -a "${arch}" show ); do
2913 echo "config KERNEL_N_A_M_E_${kernel}" >> "${script_path}/menuconfig-script/kernel_choice_${arch}"
3014 echo -e "\tbool ${kernel}" >> "${script_path}/menuconfig-script/kernel_choice_${arch}"
--- a/tools/kernel.sh
+++ b/tools/kernel.sh
@@ -101,7 +101,7 @@ get() {
101101 _kernel_name_list=($(cat "${_kernel_config_file}" | grep -h -v ^'#' | getclm 1))
102102 _get_kernel_line() {
103103 local _kernel _count=0
104- for _kernel in ${_kernel_name_list[@]}; do
104+ for _kernel in "${_kernel_name_list[@]}"; do
105105 _count=$(( _count + 1 ))
106106 if [[ "${_kernel}" = "${1}" ]]; then echo "${_count}"; return 0; fi
107107 done
@@ -175,9 +175,9 @@ else
175175 fi
176176
177177 case "${mode}" in
178- "check" ) check ${@} ;;
178+ "check" ) check "${@}" ;;
179179 "show" ) show ;;
180- "get" ) get ${@} ;;
180+ "get" ) get "${@}" ;;
181181 "help" ) _help; exit 0 ;;
182182 * ) _help; exit 1 ;;
183183 esac
--- a/tools/keyring.sh
+++ b/tools/keyring.sh
@@ -171,7 +171,7 @@ checkpkg() {
171171
172172 run() {
173173 msg_info "Running ${*}"
174- ${@}
174+ eval "${@}"
175175 }
176176
177177
--- a/tools/locale.sh
+++ b/tools/locale.sh
@@ -90,13 +90,13 @@ get() {
9090 _locale_name_list=($(cat "${_locale_config_file}" | grep -h -v ^'#' | awk '{print $1}'))
9191 _get_locale_line_number() {
9292 local _lang _count=0
93- for _lang in ${_locale_name_list[@]}; do
93+ for _lang in "${_locale_name_list[@]}"; do
9494 _count=$(( _count + 1 ))
9595 if [[ "${_lang}" = "${1}" ]]; then echo "${_count}"; return 0; fi
9696 done
9797 echo -n "failed"
9898 }
99- _locale_line_number="$(_get_locale_line_number ${@})"
99+ _locale_line_number="$(_get_locale_line_number "${@}")"
100100
101101 # 不正なロケール名なら終了する
102102 if [[ "${_locale_line_number}" = "failed" ]]; then
@@ -131,7 +131,7 @@ eval set -- "${OPT}"
131131 unset OPTS OPTL
132132
133133 while true; do
134- case ${1} in
134+ case "${1}" in
135135 -a | --arch)
136136 arch="${2}"
137137 shift 2
@@ -165,9 +165,9 @@ else
165165 fi
166166
167167 case "${mode}" in
168- "check" ) check ${@} ;;
168+ "check" ) check "${@}" ;;
169169 "show" ) show ;;
170- "get" ) get ${@} ;;
170+ "get" ) get "${@}" ;;
171171 "help" ) _help; exit 0 ;;
172172 * ) _help; exit 1 ;;
173173 esac
--- a/tools/pkglist.sh
+++ b/tools/pkglist.sh
@@ -44,8 +44,8 @@ _help() {
4444 # for_module <command>
4545 for_module(){
4646 local module
47- for module in ${modules[@]}; do
48- eval $(echo ${@} | sed "s|{}|${module}|g")
47+ for module in "${modules[@]}"; do
48+ eval $(echo "${@}" | sed "s|{}|${module}|g")
4949 done
5050 }
5151
@@ -183,7 +183,7 @@ fi
183183
184184 #-- Read package list --#
185185 # Read the file and remove comments starting with # and add it to the list of packages to install.
186-for _file in ${_loadfilelist[@]}; do
186+for _file in "${_loadfilelist[@]}"; do
187187 if [[ -f "${_file}" ]]; then
188188 msg_debug "Loaded package file ${_file}"
189189 _pkglist=( ${_pkglist[@]} "$(grep -h -v ^'#' ${_file})" )
@@ -197,7 +197,7 @@ done
197197 _excludefile=("${channel_dir}/packages.${arch}/exclude" "${channel_dir}/packages_aur.${arch}/exclude")
198198 for_module '_excludefile+=("${module_dir}/{}/packages.${arch}/exclude" "${module_dir}/{}/packages_aur.${arch}/exclude")'
199199
200-for _file in ${_excludefile[@]}; do
200+for _file in "${_excludefile[@]}"; do
201201 if [[ -f "${_file}" ]]; then
202202 _excludelist+=($(grep -h -v ^'#' "${_file}") )
203203 fi
--- a/tools/testpkg.sh
+++ b/tools/testpkg.sh
@@ -89,7 +89,7 @@ done
8989
9090 # パッケージ一覧
9191 msg_debug "Getting package list ..."
92-for arch in ${archs[@]}; do
92+for arch in "${archs[@]}"; do
9393 packages+=($("${script_path}/tools/allpkglist.sh" -s -a "${arch}"))
9494 done
9595
@@ -98,7 +98,7 @@ msg_debug "Getting group list ..."
9898 group_list=($(curl -s https://archlinux.org/groups/ | grep "/groups/x86_64" | cut -d "/" -f 4))
9999
100100 # 実行開始
101-for pkg in ${packages[@]}; do
101+for pkg in "${packages[@]}"; do
102102 msg_debug "Searching ${pkg} ..."
103103 if ! searchpkg "${pkg}"; then
104104 echo "${pkg} is not in the official repository." >&2
--- a/tools/umount.sh
+++ b/tools/umount.sh
@@ -19,6 +19,7 @@ tools_dir="${script_path}/tools/"
1919 debug=false
2020 nocolor=false
2121 force=false
22+maxdepth="2"
2223
2324 _help() {
2425 echo "usage ${0} [options] [dir]"
@@ -28,6 +29,7 @@ _help() {
2829 echo " General options:"
2930 echo " -f | --force Force umount (No warning)"
3031 echo " -d | --debug Enable debug message"
32+ echo " -m | --maxdepth Specify the maximum hierarchy (set 0 to no limit)"
3133 echo " -h | --help This help message"
3234 }
3335
@@ -76,7 +78,8 @@ umount_work () {
7678 fi
7779 [[ ! -d "${target_dir}" ]] && return 0
7880 while read -r _mount; do
79- if echo "${_mount}" | grep "${target_dir}" > /dev/null 2>&1 || [[ "${force}" = true ]]; then
81+ if [[ "${force}" = true ]] || [[ "${_mount}" = "${target_dir}"* ]] > /dev/null 2>&1; then
82+ msg_debug "Checking ${_mount}"
8083 if mountpoint -q "${_mount}"; then
8184 msg_info "Unmounting ${_mount}"
8285 _umount "${_mount}" 2> /dev/null
@@ -84,7 +87,13 @@ umount_work () {
8487 else
8588 msg_error "It is dangerous to unmount a directory that is not managed by the script."
8689 fi
87- done < <(find "${target_dir}" -mindepth 1 -type d -printf "%p\n" | tac)
90+ done < <(
91+ if (( maxdepth == 0 )); then
92+ find "${target_dir}" -mindepth 1 -type d -printf "%p\n" | tac
93+ else
94+ find "${target_dir}" -mindepth 1 -maxdepth "${maxdepth}" -type d -printf "%p\n" | tac
95+ fi
96+ )
8897 }
8998
9099
@@ -94,8 +103,8 @@ if (( ! "${EUID}" == 0 )); then
94103 fi
95104
96105 # Parse options
97-OPTS=("dfh")
98-OPTL=("debug" "force" "help:")
106+OPTS=("d" "f" "h" "m:")
107+OPTL=("debug" "force" "help" "maxdepth:")
99108 if ! OPT=$(getopt -o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${@}"); then
100109 exit 1
101110 fi
@@ -114,6 +123,10 @@ while true; do
114123 force=true
115124 shift 1
116125 ;;
126+ -m | --maxdepth)
127+ maxdepth="${2}"
128+ shift 2
129+ ;;
117130 -h | --help)
118131 _usage
119132 exit 0
@@ -133,7 +146,7 @@ done
133146 if [[ -z "${1+SET}" ]]; then
134147 msg_error "Please specify the target directory." "1"
135148 else
136- target_dir="${1}"
149+ target_dir="$(realpath "${1}")"
137150 fi
138151
139152 umount_work
--- a/tools/wizard.sh
+++ b/tools/wizard.sh
@@ -166,7 +166,7 @@ Function_Global_Main_check_required_files () {
166166 "default.conf"
167167 )
168168
169- for Var_Local_file in ${Var_Local_file_list[@]}; do
169+ for Var_Local_file in "${Var_Local_file_list[@]}"; do
170170 if [[ ! -f "${Var_Global_Wizard_Env_script_path}/${Var_Local_file}" ]]; then
171171 msg_error "${Var_Local_file}が見つかりませんでした。" "${Var_Local_file} was not found."
172172 Var_Local_error=true
@@ -199,9 +199,9 @@ Function_Global_Main_install_dependent_packages () {
199199 local Var_Local_package Var_Local_installed_package Var_Local_installed_version
200200 Var_Local_installed_package=($(pacman -Q | getclm 1))
201201 Var_Local_installed_version=($(pacman -Q | getclm 2))
202- for Var_Local_package in $(seq 0 $(( ${#Var_Local_installed_package[@]} - 1 ))); do
203- if [[ ${Var_Local_installed_package[${Var_Local_package}]} = ${1} ]]; then
204- if [[ ${Var_Local_installed_version[${Var_Local_package}]} = $(pacman -Sp --print-format '%v' --config "${Var_Global_Wizard_Env_pacman_conf}" ${1}) ]]; then
202+ for Var_Local_package in $(seq 0 $(( "${#Var_Local_installed_package[@]}" - 1 ))); do
203+ if [[ "${Var_Local_installed_package[${Var_Local_package}]}" = "${1}" ]]; then
204+ if [[ "${Var_Local_installed_version[${Var_Local_package}]}" = $(pacman -Sp --print-format '%v' --config "${Var_Global_Wizard_Env_pacman_conf}" ${1}) ]]; then
205205 echo -n "true"
206206 return 0
207207 else
@@ -214,14 +214,14 @@ Function_Global_Main_install_dependent_packages () {
214214 return 0
215215 }
216216 echo
217- for Var_Local_package in ${dependence[@]}; do
217+ for Var_Local_package in "${dependence[@]}"; do
218218 msg "依存パッケージ ${Var_Local_package} を確認しています..." "Checking dependency package ${Var_Local_package} ..."
219219 if [[ $(Function_Local_checkpkg ${Var_Local_package}) = false ]]; then
220220 Var_Global_missing_packages+=(${Var_Local_package})
221221 fi
222222 done
223223 if [[ -n "${Var_Global_missing_packages[*]}" ]]; then
224- yay -S --needed --config "${Var_Global_Wizard_Env_pacman_conf}" ${Var_Global_missing_packages[@]}
224+ yay -S --needed --config "${Var_Global_Wizard_Env_pacman_conf}" "${Var_Global_missing_packages[@]}"
225225 fi
226226 echo
227227 }
@@ -255,7 +255,7 @@ Function_Global_Main_run_keyring.sh () {
255255
256256 Function_Global_Main_remove_dependent_packages () {
257257 if [[ -n "${Var_Global_missing_packages[*]}" ]]; then
258- sudo pacman -Rsn --config "${Var_Global_Wizard_Env_pacman_conf}" ${Var_Global_missing_packages[@]}
258+ sudo pacman -Rsn --config "${Var_Global_Wizard_Env_pacman_conf}" "${Var_Global_missing_packages[@]}"
259259 fi
260260 }
261261
@@ -313,7 +313,7 @@ Function_Global_Ask_locale() {
313313
314314 local Var_Local_locale_list Var_Local_locale Var_Local_count=1 Var_Local_input_locale
315315 Var_Local_locale_list=($("${Var_Global_Wizard_Env_script_path}/tools/locale.sh" -a "${Var_Global_Wizard_Option_build_arch}" show))
316- for Var_Local_locale in ${Var_Local_locale_list[@]}; do
316+ for Var_Local_locale in "${Var_Local_locale_list[@]}"; do
317317 (
318318 local locale_name locale_gen_name locale_version locale_time locale_fullname
319319 eval $("${Var_Global_Wizard_Env_script_path}/tools/locale.sh" -a "${Var_Global_Wizard_Option_build_arch}" get "${Var_Local_locale}" )
@@ -328,7 +328,7 @@ Function_Global_Ask_locale() {
328328
329329 set +e
330330 expr "${Var_Local_input_locale}" + 1 >/dev/null 2>&1
331- if [[ ${?} -lt 2 ]]; then
331+ if [[ "${?}" -lt 2 ]]; then
332332 set -e
333333 # 数字である
334334 Var_Local_input_locale=$(( Var_Local_input_locale - 1 ))
@@ -562,7 +562,7 @@ Function_Global_Ask_kernel () {
562562
563563 #選択肢の生成
564564 local Var_Local_kernel Var_Local_count=1 Var_Local_int
565- for Var_Local_kernel in ${Var_Local_kernel_list[@]}; do
565+ for Var_Local_kernel in "${Var_Local_kernel_list[@]}"; do
566566 (
567567 local kernel kernel_filename kernel_mkinitcpio_profile
568568 eval $("${Var_Global_Wizard_Env_script_path}/tools/kernel.sh" -a "${Var_Global_Wizard_Option_build_arch}" get "${Var_Local_kernel}" )
@@ -616,7 +616,7 @@ Function_Global_Ask_channel () {
616616
617617 msg "チャンネルを以下の番号から選択してください。" "Select a channel from the numbers below."
618618 # 選択肢を生成
619- for Var_Local_channel in ${Var_Local_channel_list[@]}; do
619+ for Var_Local_channel in "${Var_Local_channel_list[@]}"; do
620620 if [[ -f "${Var_Global_Wizard_Env_script_path}/channels/${Var_Local_channel_dir[$(( Var_Local_count - 1 ))]}/description.txt" ]]; then
621621 Var_Local_description=$(cat "${Var_Global_Wizard_Env_script_path}/channels/${Var_Local_channel_dir[$(( Var_Local_count - 1 ))]}/description.txt")
622622 else
Show on old repository browser