Skip to content

Commit

Permalink
Enable terminal progress by default. Add --noprogress and --notify fl…
Browse files Browse the repository at this point in the history
…ags. Display remaining packages in queue
  • Loading branch information
oshazard committed Sep 29, 2016
1 parent 710ba9c commit 58c2838
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 6 deletions.
17 changes: 14 additions & 3 deletions apacman
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash
######################################################################
# apacman - AUR wrapper forked from packer
version="2.7"
version="2.8"
# Copyright OS Hazard <[email protected]>
#
# New Features:
# * Enabled --progress by default
# * Fix CLI switch precedence over config file
# * Improved support for virtual packages
# * Improved -U handling
Expand All @@ -25,6 +26,8 @@ version="2.7"
# * --legacy backwards compatability for AUR3 (deprecated)
# * --progress transaction status in terminal titlebar
# * --nosource for security do not source PKGBUILDs (WIP)
# * --noprogress no transaction status in titlebar
# * --notify transaction status in notification
# * --buildonly create but do not install packages
# * --nofail do not continue if a package fails to build
# * --purgebuild remove unneeded build dependencies
Expand Down Expand Up @@ -155,7 +158,9 @@ usage() {
echo ' --noconfirm - do not prompt for any confirmation'
echo ' --noedit - do not prompt to edit files'
echo ' --nofail - do not continue if a package fails to build'
echo ' --noprogress - no transaction status in titlebar'
echo ' --nosource - do not source PKGBUILDs (WIP)'
echo ' --notify - transaction status in notification'
echo ' --preview - edit pkgbuild before sourcing'
echo ' --progress - transaction status in terminal titlebar'
echo ' --purgebuild - remove unneeded build dependencies'
Expand Down Expand Up @@ -595,6 +600,7 @@ buildstatus() {
echo -e "${COLOR5} ->${ENDCOLOR} ${COLOR1}Status${ENDCOLOR}"
[[ $success ]] && echo -e "\t${COLOR4}built (${#success[@]}):${ENDCOLOR} ${success[@]}"
[[ $failure ]] && echo -e "\t${COLOR7}failed (${#failure[@]}):${ENDCOLOR} ${failure[@]}"
[[ $remains ]] && echo -e "\t${COLOR6}remain (${#remains[@]}):${ENDCOLOR} ${remains[@]}"
echo ""

[[ $nofail = 1 && $1 != 0 ]] && exit 1
Expand Down Expand Up @@ -658,6 +664,7 @@ cacheinstall() {
fi

echo -e "${COLOR6}notice:$ENDCOLOR installing $pkgrelease from cache"
remains=(${remains[@]/$1/})
buildinstall $1 $2 $3
}

Expand Down Expand Up @@ -801,6 +808,7 @@ aurinstall() {
fi

# Build check
remains=(${remains[@]/$1/});
if [[ $buildcheck -ne 0 ]]; then
failure+=("$1")
buildstatus 1
Expand All @@ -813,8 +821,8 @@ aurinstall() {
pkgtar=$(ls $1-*$PKGEXT 2>/dev/null | tail -n 1)
if [[ $pkgtar ]]; then
[ -d $savedir ] || runasroot mkdir -p $savedir
runasroot cp ${pkgtar} $savedir/ &&
echo -e "${COLOR5} -> ${COLOR1}Saved package:${ENDCOLOR} ${pkgtar}";
echo -e "${COLOR5} -> ${COLOR1}Saving package:${ENDCOLOR} ${pkgtar}"
runasroot cp ${pkgtar} $savedir/
buildinstall $1 $2 ${savedir}/$pkgtar
fi
}
Expand Down Expand Up @@ -959,6 +967,7 @@ installhandling() {
# Sanity check
pkgnum="${#pacmandepends[@]}"
totalcount="$((${#aurdepends[@]}+${#aurtargets[@]}+${#pacmandepends[@]}))"
remains=($(printf "%s\n" "${aurdepends[@]}" "${aurtargets[@]}" | sort -u))
if [ "$totalcount" = "0" ]; then
[[ $localinstall ]] ||
echo -e "${COLOR5}==>$ENDCOLOR nothing to do"
Expand Down Expand Up @@ -1104,7 +1113,9 @@ while [[ $1 ]]; do
'--noconfirm') noconfirm='1' PACOPTS+=("--noconfirm") ; export noconfirm ;;
'--noedit') noedit='1' ;;
'--nofail') nofail='1' ;;
'--noprogress') unset progress ;;
'--nosource') nosource='1' ;;
'--notify') progress='2' ;;
'--preview') preview='1' ;;
'--progress') progress='1' ;;
'--purgebuild') purgebuild='1' ;;
Expand Down
15 changes: 15 additions & 0 deletions apacman.8
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,21 @@ Perform commands without asking if the user wants to edit any installation files
Immediately quit if any package does not build successfully\&.
.RE
.PP
\fB\-\-noprogress\fR
.RS 4
Do not replace terminal title with transaction status\&.
.RE
.PP
\fB\-\-nosource\fR
.RS 4
Do not source PKGBUILDs, for security reasons (WIP)\&.
.RE
.PP
\fB\-\-notify\fR
.RS 4
Notification via notify\-send with transaction status\&.
.RE
.PP
\fB\-\-preview\fR
.RS 4
Always offer to edit the pkgbuild before sourcing it\&.
Expand Down
2 changes: 1 addition & 1 deletion apacman.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#noedit=1
#nofail=1
#preview=1
#progress=1
progress=1
#purgebuild=1
#quiet=1
#skipcache=1
Expand Down
9 changes: 7 additions & 2 deletions apacman.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: apacman.conf
.\" Author: [see the "Authors" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\" Date: 09/07/2015
.\" Date: 09/29/2016
.\" Manual: apacman Manual
.\" Source: apacman
.\" Language: English
.\"
.TH "APACMAN\&.CONF" "5" "09/07/2015" "apacman" "apacman Manual"
.TH "APACMAN\&.CONF" "5" "09/29/2016" "apacman" "apacman Manual"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
Expand Down Expand Up @@ -118,6 +118,11 @@ Do not prompt to edit files with EDITOR\&.
Do not continue if a package fails to build\&.
.RE
.PP
\fBnosource =\fR 1
.RS 4
Do not source PKGBUILDs (WIP)\&.
.RE
.PP
\fBpreview =\fR 1
.RS 4
Prompt to edit PKGBUILD and .install before building\&.
Expand Down

0 comments on commit 58c2838

Please sign in to comment.