Implemented telmich's suggestions
Using $($__explorer/os), command -v directly Fix spacing Fix copyright year
This commit is contained in:
parent
37a8b4af2b
commit
6eff4bb898
4 changed files with 19 additions and 26 deletions
|
@ -21,13 +21,7 @@
|
||||||
# Retrieve the status of a package - parsed dpkg output
|
# Retrieve the status of a package - parsed dpkg output
|
||||||
#
|
#
|
||||||
|
|
||||||
# Can't access $__global/explorer/os from here, so recreate the functionality
|
if [ "$($__explorer/os)" = "freebsd" ]; then
|
||||||
# because there's no point in executing this explorer on non-FreeBSD targets.
|
command -v pkg
|
||||||
if [ $(uname) = "FreeBSD" ]; then
|
|
||||||
if command -v pkg >&-; then
|
|
||||||
printf "pkg-ng installed"
|
|
||||||
else
|
|
||||||
printf "pkg-ng not found"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,7 @@ else
|
||||||
archlinux) type="pacman" ;;
|
archlinux) type="pacman" ;;
|
||||||
debian|ubuntu) type="apt" ;;
|
debian|ubuntu) type="apt" ;;
|
||||||
freebsd)
|
freebsd)
|
||||||
exists="$(cat "$__object/explorer/pkgng_exists")"
|
if [ -n "$(cat "$__object/explorer/pkgng_exists")" ]; then
|
||||||
if [ "$exists" = "pkg-ng installed" ]; then
|
|
||||||
type="pkgng_freebsd"
|
type="pkgng_freebsd"
|
||||||
else
|
else
|
||||||
type="pkg_freebsd"
|
type="pkg_freebsd"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2012 Jake Guffey (jake.guffey at eprotex.com)
|
# 2014 Jake Guffey (jake.guffey at eprotex.com)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2012 Jake Guffey (jake.guffey at eprotex.com)
|
# 2014 Jake Guffey (jake.guffey at eprotex.com)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -26,27 +26,27 @@
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
if [ -f "$__object/parameter/name" ]; then
|
if [ -f "$__object/parameter/name" ]; then
|
||||||
name="$(cat "$__object/parameter/name")"
|
name="$(cat "$__object/parameter/name")"
|
||||||
else
|
else
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/flavor" ]; then
|
if [ -f "$__object/parameter/flavor" ]; then
|
||||||
flavor="$(cat "$__object/parameter/flavor")"
|
flavor="$(cat "$__object/parameter/flavor")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/version" ]; then
|
if [ -f "$__object/parameter/version" ]; then
|
||||||
version="$(cat "$__object/parameter/version")"
|
version="$(cat "$__object/parameter/version")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/upgrade" ]; then
|
if [ -f "$__object/parameter/upgrade" ]; then
|
||||||
upgrade="true"
|
upgrade="true"
|
||||||
else
|
else
|
||||||
upgrade="false"
|
upgrade="false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/repo" ]; then
|
if [ -f "$__object/parameter/repo" ]; then
|
||||||
repo="$(cat "$__object/parameter/repo")"
|
repo="$(cat "$__object/parameter/repo")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/state" ]; then
|
if [ -f "$__object/parameter/state" ]; then
|
||||||
|
@ -82,15 +82,15 @@ execcmd(){
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "$_cmd 2>&- >&-" # Silence the output of the command
|
echo "$_cmd 2>&- >&-" # Silence the output of the command
|
||||||
echo "status=\$?"
|
echo "status=\$?"
|
||||||
echo "if [ \"\$status\" -ne \"0\" ]; then"
|
echo "if [ \"\$status\" -ne \"0\" ]; then"
|
||||||
echo " echo \"Error: ${_cmd} exited nonzero with \$status\"'!' >&2"
|
echo " echo \"Error: ${_cmd} exited nonzero with \$status\"'!' >&2"
|
||||||
echo " exit 1"
|
echo " exit 1"
|
||||||
echo "fi"
|
echo "fi"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -n "$curr_version" ]; then # PKG *is* installed
|
if [ -n "$curr_version" ]; then # PKG *is* installed
|
||||||
if [ -n "$repo" ]; then
|
if [ -n "$repo" ]; then
|
||||||
cmd="-r ${repo} ${name}"
|
cmd="-r ${repo} ${name}"
|
||||||
else
|
else
|
||||||
|
@ -114,7 +114,7 @@ if [ -n "$curr_version" ]; then # PKG *is* installed
|
||||||
else
|
else
|
||||||
: # Do nothing.
|
: # Do nothing.
|
||||||
fi
|
fi
|
||||||
else # PKG *isn't* installed
|
else # PKG *isn't* installed
|
||||||
if [ "$state" = "absent" ]; then # Shouldn't be installed
|
if [ "$state" = "absent" ]; then # Shouldn't be installed
|
||||||
exit 0
|
exit 0
|
||||||
else # Should be installed
|
else # Should be installed
|
||||||
|
|
Loading…
Reference in a new issue