mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Add undocumented 'portsnap alfred' command, which runs (fetch|cron)
based on whether fd 0 is a terminal, and then runs (extract|update)
based on whether ${PORTSDIR} exists.
Requested by: alfred
MFC after: 1 month
This commit is contained in:
parent
8c78c2959a
commit
07759af5eb
1 changed files with 17 additions and 1 deletions
|
|
@ -140,7 +140,7 @@ parse_cmdline() {
|
|||
if [ ! -z "${SERVERNAME}" ]; then usage; fi
|
||||
shift; SERVERNAME="$1"
|
||||
;;
|
||||
cron | extract | fetch | update)
|
||||
cron | extract | fetch | update | alfred)
|
||||
COMMANDS="${COMMANDS} $1"
|
||||
;;
|
||||
*)
|
||||
|
|
@ -1040,6 +1040,22 @@ cmd_update() {
|
|||
update_run || exit 1
|
||||
}
|
||||
|
||||
# Alfred command. Run 'fetch' or 'cron' depending on
|
||||
# whether stdin is a terminal; then run 'update' or
|
||||
# 'extract' depending on whether ${PORTSDIR} exists.
|
||||
cmd_alfred() {
|
||||
if [ -t 0 ]; then
|
||||
cmd_fetch
|
||||
else
|
||||
cmd_cron
|
||||
fi
|
||||
if [ -d ${PORTSDIR} ]; then
|
||||
cmd_update
|
||||
else
|
||||
cmd_extract
|
||||
fi
|
||||
}
|
||||
|
||||
#### Entry point
|
||||
|
||||
# Make sure we find utilities from the base system
|
||||
|
|
|
|||
Loading…
Reference in a new issue