Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -n flag to unset DISPLAY #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lpf.1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
lpf \- Build non-redistributable rpms

.SH SYNOPSIS
.B lpf <command> [options]
.B lpf [-n] <command> [options]

.SH DESCRIPTION
Builds and installs non-redistributable rpms by downloading binaries,
Expand All @@ -30,7 +30,7 @@ below.
.PP
If DISPLAY is defined in the environment, lpf uses GUI dialogs for user
interaction even when invoked from command line. To force CLI only
operation, unset DISPLAY.
operation, use the -n flag or unset DISPLAY.
.PP
lpf has a notification system for packages needing to be updated. See
NOTIFICATIONS below.
Expand Down Expand Up @@ -157,4 +157,3 @@ sudo(8)
.TP
pkexec(1)
Used to add user to pkg-build group at initial run.

17 changes: 14 additions & 3 deletions scripts/lpf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source $scriptdir/lpf-defs.bash
function usage()
{
cat << EOF
Usage: lpf <command> [args]
Usage: lpf [-n] <command> [args]

commands:
list List all packages.
Expand Down Expand Up @@ -41,8 +41,8 @@ commands:
Re-enable notification messages for a possibly muted package.


Unset \$DISPLAY to disable GUI dialogs. See the manpage for more commands
and other info.
Use the -n flag or unset \$DISPLAY to disable GUI dialogs. See the manpage for
more commands and other info.
EOF
}

Expand Down Expand Up @@ -230,6 +230,17 @@ export NO_AT_BRIDGE=0

export SUDO_ASKPASS=$scriptdir/sudo_askpass

# parse basic flags with getopts
while getopts "hn" opt; do
# shellcheck disable=2220
case $opt in
h) usage; exit;;
n) unset DISPLAY;;
esac
done
shift "$((OPTIND-1))"

# now fall through to command parsing
command=$1
shift
case $command in
Expand Down