From: hayao Date: Sat, 14 Nov 2020 05:36:36 +0000 (+0900) Subject: [update] : Unified aur script X-Git-Tag: rc3-alpha1~13^2~16^2~1 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0f14fd859742e17cf9569e6638e18eab0ea94185;p=alterlinux%2Falterlinux.git [update] : Unified aur script --- diff --git a/build.sh b/build.sh index 6cad3d5b..d52443cf 100755 --- a/build.sh +++ b/build.sh @@ -666,36 +666,23 @@ make_packages_file() { make_packages_aur() { local _pkg pkglist_aur - pkglist_aur=($("${script_path}/tools/pkglist.sh" --aur -a "x86_64" -k "${kernel}" -c "${channel_dir}" -l "${locale_name}")) # Create a list of packages to be finally installed as packages.list directly under the working directory. echo -e "\n\n# AUR packages.\n#\n\n" >> "${work_dir}/packages.list" for _pkg in ${pkglist_aur[@]}; do echo ${_pkg} >> "${work_dir}/packages.list"; done - # Build aur packages on airootfs - for _file in "aur_prepare" "aur_remove"; do - cp -r "${script_path}/system/aur_scripts/${_file}.sh" "${airootfs_dir}/root/${_file}.sh" - chmod 755 "${airootfs_dir}/root/${_file}.sh" - done - - local _aur_packages_ls_str="" - for _pkg in ${_pkglist[@]}; do - _aur_packages_ls_str="${_aur_packages_ls_str} ${_pkg}" - done + # prepare for yay + cp -r "${script_path}/system//aur_prepare.sh" "${airootfs_dir}/root/aur_prepare.sh" + chmod 755 "${airootfs_dir}/root/aur_prepare.sh" cp -rf "/etc/pacman.d/gnupg/" "${airootfs_dir}/etc/pacman.d/gnupg/" - #cp -f "/etc/resolv.conf" "${airootfs_dir}/etc/resolv.conf" - cp -f "${work_dir}/pacman-${arch}.conf" "${airootfs_dir}/etc/pacman.conf" - # Create user to build AUR + cp -f "${work_dir}/pacman-${arch}.conf" "${airootfs_dir}/etc/alteriso-pacman.conf" + + # Run aur script ${mkalteriso} ${mkalteriso_option} -w "${work_dir}/${arch}" -D "${install_dir}" -r "/root/aur_prepare.sh ${pkglist_aur[*]}" run - rm -rf "${airootfs_dir}/etc/pacman.d/gnupg/" - #rm -rf "${airootfs_dir}/etc/resolv.conf" - rm -rf "${airootfs_dir}/etc/pacman.conf" - # Remove the user created for the build. - ${mkalteriso} ${mkalteriso_option} -w "${work_dir}/${arch}" -D "${install_dir}" -r "/root/aur_remove.sh" run - - # Remove scripts - remove "${airootfs_dir}/root/"{"aur_prepare","aur_remove"}".sh" + + # Remove script + remove "${airootfs_dir}/root/aur_prepare.sh" } # Customize installation (airootfs) diff --git a/system/aur_scripts/aur_prepare.sh b/system/aur.sh similarity index 83% rename from system/aur_scripts/aur_prepare.sh rename to system/aur.sh index dc1bf9a6..739e9f9a 100755 --- a/system/aur_scripts/aur_prepare.sh +++ b/system/aur.sh @@ -48,4 +48,12 @@ echo "aurbuild ALL=(ALL) NOPASSWD:ALL" > "/etc/sudoers.d/aurbuild" # Build and install chmod +s /usr/bin/sudo -sudo -u aurbuild yay -Sy --nocleanmenu --nodiffmenu --noeditmenu --noupgrademenu --noprovides ${*} \ No newline at end of file +sudo -u aurbuild yay -Sy --nocleanmenu --nodiffmenu --noeditmenu --noupgrademenu --noprovides --config "/etc/alteriso-pacman.conf" ${*} + + +# remove user and file +userdel aurbuild +remove /aurbuild_temp +remove /etc/sudoers.d/aurbuild +remove "/etc/pacman.d/gnupg/" +remove "/etc/alteriso-pacman.conf" diff --git a/system/aur_scripts/aur_remove.sh b/system/aur_scripts/aur_remove.sh deleted file mode 100755 index 946603fa..00000000 --- a/system/aur_scripts/aur_remove.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -# -# Yamada Hayao -# Twitter: @Hayao0819 -# Email : hayao@fascode.net -# -# (c) 2019-2020 Fascode Network. -# -set -e -u - -# Delete file only if file exists -# remove ... -function remove () { - local _list - local _file - _list=($(echo "$@")) - for _file in "${_list[@]}"; do - if [[ -f ${_file} ]]; then - rm -f "${_file}" - elif [[ -d ${_file} ]]; then - rm -rf "${_file}" - fi - echo "${_file} was deleted." - done -} - - - -# remove user and file -userdel aurbuild -remove /aurbuild_temp -remove /etc/sudoers.d/aurbuild