1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
#!/bin/sh
fail() { echo "FAILED:" "$@" 1>&2; exit 1; }
PYTHON=${PYTHON:-python3}
if ! command -v ${PYTHON} >/dev/null 2>&1; then
echo "Please install python first."
exit 1
fi
# Check dependencies:
depschecked=/tmp/c-i.dependencieschecked
pkgs="
bash
dmidecode
py3-configobj
py3-jinja2
py3-jsonschema
py3-jsonpatch
py3-jsonpointer
py3-oauthlib
py3-requests
py3-setuptools
py3-serial
py3-yaml
sudo--
wget
"
[ -f $depschecked ] || echo "Installing the following packages: $pkgs"; output=$(pkg_add -zI $pkgs 2>&1)
if echo "$output" | grep -q -e "Can't find" -e "Ambiguous"; then
echo "Failed to find or install one or more packages"
echo "Failed Package(s):"
echo "$output"
exit 1
else
echo Successfully installed packages
touch $depschecked
python3 setup.py build
python3 setup.py install -O1 --distro openbsd --skip-build --init-system sysvinit_openbsd
echo "Installation completed."
rcctl enable cloudinitlocal
rcctl enable cloudinit
rcctl enable cloudconfig
rcctl enable cloudfinal
fi
|