Skip to content
Snippets Groups Projects
Commit 26dda297 authored by Bensong Liu's avatar Bensong Liu
Browse files

working

parent 51cebcef
No related branches found
No related tags found
No related merge requests found
......@@ -22,16 +22,16 @@ my_path=`where_am_i`
source "$my_path/config.sh"
####################### prepare ##########################
function do_install () {
function _aurpar_do_install () {
# do_install $package_name
# NO input, outputs to stderr.
PATH="$my_path:$PATH" yaourt -S --noconfirm "$1" 1>&2
sudo -u "$aurpar_aur_user" yaourt -S --noconfirm "$1" 1>&2
return $?
}
function get_package_list () {
# NO input, NO arg. Result outputs to stdout, seprated by '\n'
pacman -Sy || return $?
pacman -Sy 1>&2 || return $?
if [[ "$aurpar_config_aur_manager" == "yaourt" ]]; then
echo n | "$aurpar_config_aur_manager_path" -Su --aur 2>/dev/null | sed 's/\r/\n/g' | grep '^aur/'
return $?
......@@ -45,10 +45,12 @@ function get_package_list () {
}
pkgs=`get_package_list` || { echo "Failed to get package list. Exiting..." 1>&2; exit $?; }
echo "============ Packages to UPGRADE: "
echo "$pkgs"
echo "$pkgs" | parallel --max-procs "$aurpar_config_threads" do_install '{}' || echo "Done. But there is some failure. " 1>&2
export -f _aurpar_do_install
export aurpar_aur_user
echo "$pkgs" | SHELL=$(type -p bash) PATH="$my_path:$PATH" parallel --max-procs "$aurpar_config_threads" _aurpar_do_install '{}' || echo "Done. But some package failed to upgrade. " 1>&2
exit 0
############ notes
......
......@@ -6,6 +6,9 @@ aurpar_config_threads=6
aurpar_config_aur_manager='yaourt'
# aurpar_config_aur_manager='pakku'
# Username to run aur_manager. It should have password-less sudo, and CAN NOT be root.
aurpar_aur_user='recolic'
########################################################################
# Path of your AUR package manager
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment