forked from ungleich-public/cdist
Merge branch 'pkgng_freebsd-bootstrap' into 'master'
[__package_pkgng_freebsd] Bootstrap pkg if necessary See merge request ungleich-public/cdist!940
This commit is contained in:
commit
34a7d8c280
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
|
# 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
|
if [ -f "$__object/parameter/name" ]; then
|
||||||
name="$(cat "$__object/parameter/name")"
|
name="$(cat "$__object/parameter/name")"
|
||||||
else
|
else
|
||||||
|
|
|
@ -43,6 +43,7 @@ fi
|
||||||
repo="$(cat "$__object/parameter/repo")"
|
repo="$(cat "$__object/parameter/repo")"
|
||||||
state="$(cat "$__object/parameter/state")"
|
state="$(cat "$__object/parameter/state")"
|
||||||
curr_version="$(cat "$__object/explorer/pkg_version")"
|
curr_version="$(cat "$__object/explorer/pkg_version")"
|
||||||
|
pkg_bootstrapped="$(cat "$__object/explorer/pkg_bootstrapped")"
|
||||||
add_cmd="pkg install -y"
|
add_cmd="pkg install -y"
|
||||||
rm_cmd="pkg delete -y"
|
rm_cmd="pkg delete -y"
|
||||||
upg_cmd="pkg upgrade -y"
|
upg_cmd="pkg upgrade -y"
|
||||||
|
@ -73,6 +74,10 @@ execcmd(){
|
||||||
;;
|
;;
|
||||||
esac
|
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 "$_cmd >/dev/null 2>&1" # Silence the output of the command
|
||||||
echo "status=\$?"
|
echo "status=\$?"
|
||||||
echo "if [ \"\$status\" -ne \"0\" ]; then"
|
echo "if [ \"\$status\" -ne \"0\" ]; then"
|
||||||
|
|
Loading…
Reference in a new issue