Skip to content

Commit 7a4eb4b

Browse files
committed
[fix] : pkgbuild.sh does not install depends with yay
1 parent 4e3fcd5 commit 7a4eb4b

1 file changed

Lines changed: 3 additions & 68 deletions

File tree

system/pkgbuild.sh

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,6 @@ function user_check () {
3838
fi
3939
}
4040

41-
# Usage: get_srcinfo_data <path> <var>
42-
# 参考: https://qiita.com/withelmo/items/b0e1ffba639dd3ae18c0
43-
function get_srcinfo_data() {
44-
local _srcinfo="${1}" _ver="${2}"
45-
local _srcinfo_json=$(python << EOF
46-
from srcinfo.parse import parse_srcinfo; import json
47-
text = """
48-
$(cat ${1})
49-
"""
50-
parsed, errors = parse_srcinfo(text)
51-
print(json.dumps(parsed))
52-
EOF
53-
)
54-
echo "${_srcinfo_json}" | jq -rc "${2}" | tr '\n' ' '
55-
}
56-
5741
# 一般ユーザーで実行します
5842
function run_user () {
5943
sudo -u "${build_username}" ${@}
@@ -87,60 +71,11 @@ ls "/usr/share/pacman/keyrings/"*".gpg" | sed "s|.gpg||g" | xargs | pacman-key -
8771

8872
# Parse SRCINFO
8973
cd "${pkgbuild_dir}"
90-
makedepends=() depends=() pkgbuild_dirs=($(ls "${pkgbuild_dir}" 2> /dev/null))
74+
pkgbuild_dirs=($(ls "${pkgbuild_dir}" 2> /dev/null))
9175
if (( "${#pkgbuild_dirs[@]}" != 0 )); then
92-
# Install yay
93-
if ! pacman -Qq yay 1> /dev/null 2>&1; then
94-
(
95-
_oldpwd="$(pwd)"
96-
pacman -Syy --noconfirm --config "/etc/alteriso-pacman.conf"
97-
pacman --noconfirm -S --asdeps --needed go --config "/etc/alteriso-pacman.conf"
98-
sudo -u "${build_username}" git clone "https://aur.archlinux.org/yay.git" "/tmp/yay"
99-
cd "/tmp/yay"
100-
sudo -u "${build_username}" makepkg --ignorearch --clean --cleanbuild --force --skippgpcheck --noconfirm
101-
pacman --noconfirm --config "/etc/alteriso-pacman.conf" -U $(sudo -u "${build_username}" makepkg --packagelist)
102-
cd ..
103-
rm -rf "/tmp/yay"
104-
cd "${_oldpwd}"
105-
)
106-
fi
107-
108-
if ! type -p yay > /dev/null; then
109-
echo "Failed to install yay"
110-
exit 1
111-
fi
112-
113-
for _dir in ${pkgbuild_dirs[@]}; do
114-
cd "${_dir}"
115-
run_user bash -c "makepkg --printsrcinfo > .SRCINFO"
116-
makedepends+=($(get_srcinfo_data ".SRCINFO" ".makedepends[]?"))
117-
depends+=($(get_srcinfo_data ">SRCINFO" ".depends[]?"))
118-
cd - >/dev/null
119-
done
120-
121-
# Build and install
122-
chmod +s /usr/bin/sudo
123-
echo "Install depends: ${makedepends[*]} ${depends[*]}"
124-
yes | run_user \
125-
yay -Sy \
126-
--mflags "-AcC" \
127-
--asdeps \
128-
--noconfirm \
129-
--nocleanmenu \
130-
--nodiffmenu \
131-
--noeditmenu \
132-
--noupgrademenu \
133-
--noprovides \
134-
--removemake \
135-
--useask \
136-
--color always \
137-
--config "/etc/alteriso-pacman.conf" \
138-
--cachedir "/var/cache/pacman/pkg/" \
139-
${makedepends[*]} ${depends[*]}
140-
14176
for _dir in ${pkgbuild_dirs[@]}; do
14277
cd "${_dir}"
143-
run_user makepkg -iAcC --noconfirm
78+
run_user makepkg -iAcCs --noconfirm
14479
cd - >/dev/null
14580
done
14681
fi
@@ -149,7 +84,7 @@ if deletepkg=($(pacman -Qtdq)) && (( "${#deletepkg[@]}" != 0 )); then
14984
pacman -Rsnc --noconfirm "${deletepkg[@]}" --config "/etc/alteriso-pacman.conf"
15085
fi
15186

152-
run_user yay -Sccc --noconfirm --config "/etc/alteriso-pacman.conf"
87+
pacman -Sccc --noconfirm --config "/etc/alteriso-pacman.conf"
15388

15489
# remove user and file
15590
userdel "${build_username}"

0 commit comments

Comments
 (0)