OSDN Git Service

[update] : Unified aur script
authorhayao <shun819.mail@gmail.com>
Sat, 14 Nov 2020 05:36:36 +0000 (14:36 +0900)
committerhayao <shun819.mail@gmail.com>
Sat, 14 Nov 2020 05:36:36 +0000 (14:36 +0900)
build.sh
system/aur.sh [moved from system/aur_scripts/aur_prepare.sh with 83% similarity]
system/aur_scripts/aur_remove.sh [deleted file]

index 6cad3d5..d52443c 100755 (executable)
--- 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)
similarity index 83%
rename from system/aur_scripts/aur_prepare.sh
rename to system/aur.sh
index dc1bf9a..739e9f9 100755 (executable)
@@ -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 (executable)
index 946603f..0000000
+++ /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 <file1> <file2> ...
-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