forked from ungleich-public/cdist
[__package_pkgng_freebsd] Bootstrap pkg if necessary
In a pristine FreeBSD base installation, pkg is really a bootstrapper utility, in such cases the type used to fail instead of automatically bootstrapping pkg.
This commit is contained in:
parent
652c891858
commit
f994226d0e
3 changed files with 14 additions and 0 deletions
4
cdist/conf/type/__package_pkgng_freebsd/explorer/pkg_bootstrapped
Executable file
4
cdist/conf/type/__package_pkgng_freebsd/explorer/pkg_bootstrapped
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh -e
|
||||
if pkg -N >/dev/null 2>&1; then
|
||||
echo "YES"
|
||||
fi
|
|
@ -21,6 +21,11 @@
|
|||
# Retrieve the status of a package - parsed dpkg output
|
||||
#
|
||||
|
||||
if ! pkg -N >/dev/null 2>&1; then
|
||||
# Nothing to do if pkg is not bootstrapped
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -f "$__object/parameter/name" ]; then
|
||||
name="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
|
|
|
@ -43,6 +43,7 @@ fi
|
|||
repo="$(cat "$__object/parameter/repo")"
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
curr_version="$(cat "$__object/explorer/pkg_version")"
|
||||
pkg_bootstrapped="$(cat "$__object/explorer/pkg_bootstrapped")"
|
||||
add_cmd="pkg install -y"
|
||||
rm_cmd="pkg delete -y"
|
||||
upg_cmd="pkg upgrade -y"
|
||||
|
@ -73,6 +74,10 @@ execcmd(){
|
|||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${pkg_bootstrapped}" ]; then
|
||||
echo "pkg bootstrap -y >/dev/null 2>&1"
|
||||
fi
|
||||
|
||||
echo "$_cmd >/dev/null 2>&1" # Silence the output of the command
|
||||
echo "status=\$?"
|
||||
echo "if [ \"\$status\" -ne \"0\" ]; then"
|
||||
|
|
Loading…
Reference in a new issue