Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
netctl
Commits
4fdddbd1
Commit
4fdddbd1
authored
Apr 10, 2012
by
Jouke Witteveen
Browse files
Output fixes
Add spaces where necessary.
parent
93fd21fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/globals
View file @
4fdddbd1
# /usr/lib/networks/globals
#
# any +x files in /usr/lib/network/hooks
# will be sourced when this file is.
# hook files can override any of the utility functions defined here for custom behavior
# (such as logging error messages to syslog)
# this lets us keep netcfg simple but gives it the flexibility for users
# to make modular use of it to do more complex things
# All +x files in /usr/lib/network/hooks will be sourced when this file is.
# Hook files can override any of the utility functions defined here for custom
# behavior (such as logging error messages to syslog). This lets us keep netcfg
# simple but gives it the flexibility for users to make modular use of it to do
# more complex things
### Globals
...
...
@@ -19,7 +18,6 @@ STATE_DIR="/run/network"
### Logging/Error reporting
#
function
report_err
{
echo
"
$*
"
...
...
@@ -38,34 +36,32 @@ function report_debug {
}
function
report_try
{
#
JP: t
his needs -n
option
echo
-n
"::
$*
"
#
T
his needs -n
and a trailing space.
echo
-n
"::
$*
"
REPORT_TRYING
=
1
}
function
report_fail
{
if
[[
-n
"
$*
"
]]
;
then
if
[[
-n
"
$REPORT_TRYING
"
]]
;
then
# JP: this needs -n option
echo
-n
"-
$*
"
if
((
REPORT_TRYING
))
;
then
echo
"-
$*
[fail]"
REPORT_TRYING
=
echo
"[fail]"
else
echo
"
$*
"
fi
elif
[[
-n
"
$REPORT_TRYING
"
]]
;
then
REPORT_TRYING
=
elif
((
REPORT_TRYING
))
;
then
echo
"[fail]"
REPORT_TRYING
=
fi
}
function
report_success
{
if
[[
-n
"
$*
"
]]
;
then
# JP: this needs -n option
echo
-n
"-
$*
"
REPORT_TRYING
=
# This needs -n and a trailing space.
echo
-n
"-
$*
"
fi
echo
"[done]"
REPORT_TRYING
=
}
### For calling scripts only; don't use in library functions
...
...
@@ -79,7 +75,7 @@ function exit_fail { report_fail "$*"; exit 1; }
# checkyesno var
# Test $1 variable, and warn if not set to YES or NO.
# Return 0 if it's "yes" (et al), nonzero otherwise.
#
t
o
make
default yes, do "checkyesno ${VAR:-yes}"
#
T
o default
to
yes, do
:
"checkyesno ${VAR:-yes}"
.
#
checkyesno
()
{
...
...
@@ -104,9 +100,8 @@ checkyesno()
}
### Load all +x files in $HOOKS_DIR
function
load_hooks
()
{
### Load any +x files in $HOOKS_DIR and $USERHOOKS_DIR
local
hook
for
hook
in
$(
find
-L
"
$HOOKS_DIR
/"
-maxdepth
1
-type
f
-executable
|
sort
-u
)
;
do
source
"
$hook
"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment