forked from mirrors/openup
Add printf(1) functions.
This commit is contained in:
parent
954e05ae4f
commit
66c83d3b34
1 changed files with 19 additions and 15 deletions
34
openup
34
openup
|
|
@ -67,10 +67,14 @@ error() {
|
||||||
echo -n "*** ERROR: $@"
|
echo -n "*** ERROR: $@"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_action() {
|
print3() {
|
||||||
echo "===> ${@}${DRYRUN}"
|
echo "===> ${@}${DRYRUN}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print2() {
|
||||||
|
echo "==> ${@}"
|
||||||
|
}
|
||||||
|
|
||||||
get_cert() {
|
get_cert() {
|
||||||
local _CMD
|
local _CMD
|
||||||
|
|
||||||
|
|
@ -82,16 +86,16 @@ get_cert() {
|
||||||
grep -q "${PKG_CERT_FPRINT}" && return
|
grep -q "${PKG_CERT_FPRINT}" && return
|
||||||
done
|
done
|
||||||
|
|
||||||
print_action "Downloading certificate"
|
print3 "Downloading certificate"
|
||||||
_CMD="ftp -Vo ${TMPCERT} ${PKG_CERT_URL}"
|
_CMD="ftp -Vo ${TMPCERT} ${PKG_CERT_URL}"
|
||||||
echo "==> ${_CMD}"
|
print2 "${_CMD}"
|
||||||
if [ -z "${DRYRUN}" ]; then
|
if [ -z "${DRYRUN}" ]; then
|
||||||
eval ${_CMD} || exit 1
|
eval ${_CMD} || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_action "Installing certificate"
|
print3 "Installing certificate"
|
||||||
_CMD="cat ${TMPCERT} >>/etc/ssl/pkgca.pem"
|
_CMD="cat ${TMPCERT} >>/etc/ssl/pkgca.pem"
|
||||||
echo "==> ${_CMD}"
|
print2 "${_CMD}"
|
||||||
if [ -z "${DRYRUN}" ]; then
|
if [ -z "${DRYRUN}" ]; then
|
||||||
eval ${_CMD} || exit 1
|
eval ${_CMD} || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -100,9 +104,9 @@ get_cert() {
|
||||||
update_self() {
|
update_self() {
|
||||||
local _CMD _N
|
local _CMD _N
|
||||||
|
|
||||||
print_action "Checking for openup(8) update"
|
print3 "Checking for openup(8) update"
|
||||||
_CMD="ftp -Vo ${TMPUPD} ${OPENUP_URL}"
|
_CMD="ftp -Vo ${TMPUPD} ${OPENUP_URL}"
|
||||||
echo "==> ${_CMD}"
|
print2 "${_CMD}"
|
||||||
if [ -z "${DRYRUN}" ]; then
|
if [ -z "${DRYRUN}" ]; then
|
||||||
eval ${_CMD} # non-fatal
|
eval ${_CMD} # non-fatal
|
||||||
fi
|
fi
|
||||||
|
|
@ -110,9 +114,9 @@ update_self() {
|
||||||
_N=$(grep -Eo '^OPENUP_VERSION=.*' ${TMPUPD} | awk -F '=' '{ print $2 }')
|
_N=$(grep -Eo '^OPENUP_VERSION=.*' ${TMPUPD} | awk -F '=' '{ print $2 }')
|
||||||
[[ -n "${_N}" ]] && \
|
[[ -n "${_N}" ]] && \
|
||||||
if [ "${OPENUP_VERSION}" -lt "${_N}" ]; then
|
if [ "${OPENUP_VERSION}" -lt "${_N}" ]; then
|
||||||
print_action "Updating openup(8) from version ${OPENUP_VERSION} to version ${_N}"
|
print3 "Updating openup(8) from version ${OPENUP_VERSION} to version ${_N}"
|
||||||
_CMD="cat ${TMPUPD} >${MEESA}"
|
_CMD="cat ${TMPUPD} >${MEESA}"
|
||||||
echo "==> ${_CMD}"
|
print2 "${_CMD}"
|
||||||
eval ${_CMD} # non-fatal
|
eval ${_CMD} # non-fatal
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
# XXX
|
# XXX
|
||||||
|
|
@ -129,9 +133,9 @@ update_binpatches() {
|
||||||
_BP=$(pkg_info -Q binpatch${REL_INT}-$(arch -s) | sed 's/.[^-]*$//' | sort -u | tr '\n' ' ')
|
_BP=$(pkg_info -Q binpatch${REL_INT}-$(arch -s) | sed 's/.[^-]*$//' | sort -u | tr '\n' ' ')
|
||||||
|
|
||||||
if [ -n "$_BP" ]; then
|
if [ -n "$_BP" ]; then
|
||||||
print_action "Updating binpatch(es)"
|
print3 "Updating binpatch(es)"
|
||||||
_CMD="pkg_add ${pkg_opt} ${_BP}"
|
_CMD="pkg_add ${pkg_opt} ${_BP}"
|
||||||
echo "==> ${_CMD}"
|
print2 "${_CMD}"
|
||||||
eval ${_CMD}
|
eval ${_CMD}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -139,18 +143,18 @@ update_binpatches() {
|
||||||
update_pkg() {
|
update_pkg() {
|
||||||
local _CMD
|
local _CMD
|
||||||
|
|
||||||
print_action "Updating package(s)"
|
print3 "Updating package(s)"
|
||||||
_CMD="pkg_add -u ${pkg_opt}"
|
_CMD="pkg_add -u ${pkg_opt}"
|
||||||
echo "==> ${_CMD}"
|
print2 "${_CMD}"
|
||||||
eval ${_CMD}
|
eval ${_CMD}
|
||||||
}
|
}
|
||||||
|
|
||||||
update_fw() {
|
update_fw() {
|
||||||
local _CMD
|
local _CMD
|
||||||
|
|
||||||
print_action "Updating firmware(s)"
|
print3 "Updating firmware(s)"
|
||||||
_CMD="fw_update ${fw_opt}"
|
_CMD="fw_update ${fw_opt}"
|
||||||
echo "==> ${_CMD}"
|
print2 "${_CMD}"
|
||||||
eval ${_CMD}
|
eval ${_CMD}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue