Skip to content

Commit 98a1840

Browse files
committed
Merge branch 'dev' into dev-stable
2 parents 713d2c3 + a6f1db1 commit 98a1840

File tree

35 files changed

+518
-592
lines changed

35 files changed

+518
-592
lines changed

allarch.sh

Lines changed: 48 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -38,157 +38,46 @@ fi
3838

3939
umask 0022
4040

41-
# Color echo
42-
# usage: echo_color -b <backcolor> -t <textcolor> -d <decoration> [Text]
43-
#
44-
# Text Color
45-
# 30 => Black
46-
# 31 => Red
47-
# 32 => Green
48-
# 33 => Yellow
49-
# 34 => Blue
50-
# 35 => Magenta
51-
# 36 => Cyan
52-
# 37 => White
53-
#
54-
# Background color
55-
# 40 => Black
56-
# 41 => Red
57-
# 42 => Green
58-
# 43 => Yellow
59-
# 44 => Blue
60-
# 45 => Magenta
61-
# 46 => Cyan
62-
# 47 => White
63-
#
64-
# Text decoration
65-
# You can specify multiple decorations with ;.
66-
# 0 => All attributs off (ノーマル)
67-
# 1 => Bold on (太字)
68-
# 4 => Underscore (下線)
69-
# 5 => Blink on (点滅)
70-
# 7 => Reverse video on (色反転)
71-
# 8 => Concealed on
72-
73-
echo_color() {
74-
local backcolor textcolor decotypes echo_opts arg OPTIND OPT
75-
echo_opts="-e"
76-
while getopts 'b:t:d:n' arg; do
77-
case "${arg}" in
78-
b) backcolor="${OPTARG}" ;;
79-
t) textcolor="${OPTARG}" ;;
80-
d) decotypes="${OPTARG}" ;;
81-
n) echo_opts="-n -e" ;;
82-
esac
83-
done
84-
shift $((OPTIND - 1))
85-
if [[ "${nocolor}" = false ]]; then
86-
echo ${echo_opts} "\e[$([[ -v backcolor ]] && echo -n "${backcolor}"; [[ -v textcolor ]] && echo -n ";${textcolor}"; [[ -v decotypes ]] && echo -n ";${decotypes}")m${*}\e[m"
87-
else
88-
echo ${echo_opts} "${@}"
89-
fi
90-
}
91-
92-
9341
# Show an INFO message
9442
# $1: message string
9543
msg_info() {
96-
if [[ "${msgdebug}" = false ]]; then
97-
set +xv
98-
else
99-
set -xv
100-
fi
101-
local echo_opts="-e" arg OPTIND OPT
102-
while getopts 'n' arg; do
103-
case "${arg}" in
104-
n) echo_opts="${echo_opts} -n" ;;
105-
esac
106-
done
107-
shift $((OPTIND - 1))
108-
echo ${echo_opts} "$( echo_color -t '36' '[allarch.sh]') $( echo_color -t '32' 'Info') ${*}"
109-
if [[ "${bash_debug}" = true ]]; then
110-
set -xv
111-
else
112-
set +xv
113-
fi
44+
local _msg_opts="-a build.sh"
45+
[[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
46+
[[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
47+
"${script_path}/tools/msg.sh" ${_msg_opts} info "${@}"
11448
}
11549

116-
11750
# Show an Warning message
11851
# $1: message string
11952
msg_warn() {
120-
if [[ "${msgdebug}" = false ]]; then
121-
set +xv
122-
else
123-
set -xv
124-
fi
125-
local echo_opts="-e" arg OPTIND OPT
126-
while getopts 'n' arg; do
127-
case "${arg}" in
128-
n) echo_opts="${echo_opts} -n" ;;
129-
esac
130-
done
131-
shift $((OPTIND - 1))
132-
echo ${echo_opts} "$( echo_color -t '36' '[allarch.sh]') $( echo_color -t '33' 'Warning') ${*}" >&2
133-
if [[ "${bash_debug}" = true ]]; then
134-
set -xv
135-
else
136-
set +xv
137-
fi
53+
local _msg_opts="-a build.sh"
54+
[[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
55+
[[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
56+
"${script_path}/tools/msg.sh" ${_msg_opts} warn "${@}"
13857
}
13958

140-
14159
# Show an debug message
14260
# $1: message string
14361
msg_debug() {
144-
if [[ "${msgdebug}" = false ]]; then
145-
set +xv
146-
else
147-
set -xv
148-
fi
149-
local echo_opts="-e" arg OPTIND OPT
150-
while getopts 'n' arg; do
151-
case "${arg}" in
152-
n) echo_opts="${echo_opts} -n" ;;
153-
esac
154-
done
155-
shift $((OPTIND - 1))
156-
if [[ ${debug} = true ]]; then
157-
echo ${echo_opts} "$( echo_color -t '36' '[allarch.sh]') $( echo_color -t '35' 'Debug') ${*}"
158-
fi
159-
if [[ "${bash_debug}" = true ]]; then
160-
set -xv
161-
else
162-
set +xv
62+
if [[ "${debug}" = true ]]; then
63+
local _msg_opts="-a build.sh"
64+
[[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
65+
[[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
66+
"${script_path}/tools/msg.sh" ${_msg_opts} info "${@}"
16367
fi
16468
}
16569

166-
16770
# Show an ERROR message then exit with status
16871
# $1: message string
16972
# $2: exit code number (with 0 does not exit)
17073
msg_error() {
171-
if [[ "${msgdebug}" = false ]]; then
172-
set +xv
173-
else
174-
set -xv
175-
fi
176-
local echo_opts="-e" arg OPTIND OPT
177-
while getopts 'n' arg; do
178-
case "${arg}" in
179-
n) echo_opts="${echo_opts} -n" ;;
180-
esac
181-
done
182-
shift $((OPTIND - 1))
183-
echo ${echo_opts} "$( echo_color -t '36' '[allarch.sh]') $( echo_color -t '31' 'Error') ${1}" >&2
74+
local _msg_opts="-a build.sh"
75+
[[ "${msgdebug}" = true ]] && _msg_opts="${_msg_opts} -x"
76+
[[ "${nocolor}" = true ]] && _msg_opts="${_msg_opts} -n"
77+
"${script_path}/tools/msg.sh" ${_msg_opts} error "${1}"
18478
if [[ -n "${2:-}" ]]; then
18579
exit ${2}
18680
fi
187-
if [[ "${bash_debug}" = true ]]; then
188-
set -xv
189-
else
190-
set +xv
191-
fi
19281
}
19382

19483

@@ -225,7 +114,7 @@ _usage () {
225114
echo " Default: ${out_dir}"
226115
echo " -p | --password <password> Set a live user password"
227116
echo " Default: ${password}"
228-
echo " -t | --comp-opts <options> Set compressor-specific options"
117+
echo " -t | --comp-opts <options> Set compressor-specific options."
229118
echo " Default: empty"
230119
echo " -u | --user <username> Set user name"
231120
echo " Default: ${username}"
@@ -261,7 +150,6 @@ _usage () {
261150

262151
echo
263152
echo " Channel:"
264-
#for _dirname in $(if [[ "${nochkver}" = true ]]; then bash "${script_path}/tools/channel.sh" -d -b -n show; else bash "${script_path}/tools/channel.sh" -d -b show; fi); do
265153
for _dirname in $(bash "${script_path}/tools/channel.sh" -d -b -n show); do
266154
if [[ $(echo "${_dirname}" | sed 's/^.*\.\([^\.]*\)$/\1/') = "add" ]]; then
267155
_channel="$(echo ${_dirname} | sed 's/\.[^\.]*$//')"
@@ -427,7 +315,6 @@ prepare_env() {
427315
for __pkg in $(seq 0 $(( ${#_installed_pkg[@]} - 1 ))); do
428316
# パッケージがインストールされているかどうか
429317
if [[ "${_installed_pkg[${__pkg}]}" = ${1} ]]; then
430-
#__ver="$(pacman -Sp --print-format '%v' --config ${build_pacman_conf} ${1} 2> /dev/null; :)"
431318
__ver="$(pacman -Sp --print-format '%v' ${1} 2> /dev/null; :)"
432319
if [[ "${_installed_ver[${__pkg}]}" = "${__ver}" ]]; then
433320
# パッケージが最新の場合
@@ -774,23 +661,23 @@ make_packages_aur() {
774661
"${script_path}/channels/share/packages_aur.${arch}/lang/${locale_name}.${arch}"
775662

776663
# channel packages
777-
$(ls ${channel_path}/packages_aur.${arch}/*.${arch} 2> /dev/null)
778-
"${channel_path}/packages_aur.${arch}/lang/${locale_name}.${arch}"
664+
$(ls ${channel_dir}/packages_aur.${arch}/*.${arch} 2> /dev/null)
665+
"${channel_dir}/packages_aur.${arch}/lang/${locale_name}.${arch}"
779666

780667
# kernel packages
781668
"${script_path}/channels/share/packages_aur.${arch}/kernel/${kernel}.${arch}"
782-
"${channel_path}/packages_aur.${arch}/kernel/${kernel}.${arch}"
669+
"${channel_dir}/packages_aur.${arch}/kernel/${kernel}.${arch}"
783670
)
784671

785672
# Plymouth package list
786673
if [[ "${boot_splash}" = true ]]; then
787674
_loadfilelist+=(
788675
$(ls "${script_path}"/channels/share/packages_aur.${arch}/plymouth/*.${arch} 2> /dev/null)
789-
$(ls ${channel_path}/packages_aur.${arch}/plymouth/*.${arch} 2> /dev/null)
676+
$(ls ${channel_dir}/packages_aur.${arch}/plymouth/*.${arch} 2> /dev/null)
790677
)
791678
fi
792679

793-
if [[ ! -d "${channel_path}/packages_aur.${arch}/" ]] && [[ ! -d "${script_path}/channels/share/packages_aur.${arch}/" ]]; then
680+
if [[ ! -d "${channel_dir}/packages_aur.${arch}/" ]] && [[ ! -d "${script_path}/channels/share/packages_aur.${arch}/" ]]; then
794681
return
795682
fi
796683

@@ -807,7 +694,7 @@ make_packages_aur() {
807694
# Exclude packages from the share exclusion list
808695
_excludefile=(
809696
"${script_path}/channels/share/packages_aur.${arch}/exclude"
810-
"${channel_path}/packages_aur.${arch}/exclude"
697+
"${channel_dir}/packages_aur.${arch}/exclude"
811698
)
812699

813700
for _file in ${_excludefile[@]}; do
@@ -859,17 +746,20 @@ make_packages_aur() {
859746
fi
860747
done
861748

749+
750+
# Install dependent packages.
751+
local dependent_packages=""
752+
for _aur_pkg in ${pkglist_aur[@]}; do dependent_packages="${dependent_packages} $("${script_path}/system/aur_scripts/PKGBUILD_DEPENDS_SANDBOX.sh" "${script_path}/system/arch-pkgbuild-parser" "$(realpath "${work_dir}/${arch}/airootfs/aurbuild_temp/${_aur_pkg}/PKGBUILD")")"; done
753+
[[ -n "${dependent_packages}" ]] && ${mkalteriso} ${mkalteriso_option} -w "${work_dir}/${arch}" -C "${work_dir}/pacman-${arch}.conf" -D "${install_dir}" -p "${dependent_packages}" install
754+
862755
# Dump packages
863756
${mkalteriso} ${mkalteriso_option} -w "${work_dir}/${arch}" -D "${install_dir}" -r "/root/pacls_gen_old.sh" run
864757

865-
# Install dependent packages.
866-
local dependent_packages
867-
for _aur_pkg in ${pkglist_aur[@]}; do
868-
dependent_packages="$("${script_path}/system/aur_scripts/PKGBUILD_DEPENDS_SANDBOX.sh" "${script_path}/system/arch-pkgbuild-parser" "$(realpath "${work_dir}/${arch}/airootfs/aurbuild_temp/${_aur_pkg}/PKGBUILD")")"
869-
if [[ -n "${dependent_packages}" ]]; then
870-
${mkalteriso} ${mkalteriso_option} -w "${work_dir}/${arch}" -C "${work_dir}/pacman-${arch}.conf" -D "${install_dir}" -p "${dependent_packages}" install
871-
fi
872-
done
758+
# Install makedependent packages.
759+
local makedependent_packages=""
760+
for _aur_pkg in ${pkglist_aur[@]}; do makedependent_packages="${makedependent_packages} $("${script_path}/system/aur_scripts/PKGBUILD_MAKEDEPENDS_SANDBOX.sh" "${script_path}/system/arch-pkgbuild-parser" "$(realpath "${work_dir}/${arch}/airootfs/aurbuild_temp/${_aur_pkg}/PKGBUILD")")"; done
761+
[[ -n "${makedependent_packages}" ]] && ${mkalteriso} ${mkalteriso_option} -w "${work_dir}/${arch}" -C "${work_dir}/pacman-${arch}.conf" -D "${install_dir}" -p "${makedependent_packages}" install
762+
873763

874764
# Dump packages
875765
${mkalteriso} ${mkalteriso_option} -w "${work_dir}/${arch}" -D "${install_dir}" -r "/root/pacls_gen_new.sh" run
@@ -1328,6 +1218,7 @@ OPT=$(getopt -o ${_opt_short} -l ${_opt_long} -- ${DEFAULT_ARGUMENT} ${ARGUMENT}
13281218
[[ ${?} != 0 ]] && exit 1
13291219

13301220
eval set -- "${OPT}"
1221+
msg_debug "Argument: ${OPT}"
13311222
unset OPT _opt_short _opt_long
13321223

13331224
while :; do
@@ -1384,7 +1275,11 @@ while :; do
13841275
shift 1
13851276
;;
13861277
-t | --comp-opts)
1387-
sfs_comp_opt="${2}"
1278+
if [[ "${2}" = "reset" ]]; then
1279+
sfs_comp_opt=""
1280+
else
1281+
sfs_comp_opt="${2}"
1282+
fi
13881283
shift 2
13891284
;;
13901285
-u | --user)
@@ -1520,7 +1415,13 @@ fi
15201415
# Check channel version
15211416
msg_debug "channel path is ${channel_path}"
15221417
if [[ ! "$(cat "${channel_path}/alteriso" 2> /dev/null)" = "alteriso=${alteriso_version}" ]] && [[ "${nochkver}" = false ]]; then
1523-
msg_error "This channel does not support AlterISO 3." "1"
1418+
msg_error "This channel does not support Alter ISO 3."
1419+
if [[ -d "${script_path}/.git" ]]; then
1420+
msg_error "Please run \"git checkout alteriso-2\"" "1"
1421+
else
1422+
msg_error "Please download Alter ISO 2 here."
1423+
msg_error "https://github.com/FascodeNet/alterlinux/archive/alteriso-2.zip" "1"
1424+
fi
15241425
fi
15251426

15261427
check_bool debug

0 commit comments

Comments
 (0)