1
0
Fork 0
forked from mirrors/openup

Clearer output.

This commit is contained in:
Antoine Jacoutot 2013-08-13 09:39:02 +02:00
commit 331b94ef66

26
openup
View file

@ -64,8 +64,8 @@ print3() {
echo "===> ${@}${DRYRUN}" echo "===> ${@}${DRYRUN}"
} }
print2() { print_arrow() {
echo "==> ${@}" echo "-> ${@}"
} }
get_cert() { get_cert() {
@ -81,14 +81,14 @@ get_cert() {
print3 "Downloading certificate" print3 "Downloading certificate"
_CMD="ftp -Vo ${TMPCERT} ${PKG_CERT_URL}" _CMD="ftp -Vo ${TMPCERT} ${PKG_CERT_URL}"
print2 "${_CMD}" print_arrow "${_CMD}"
if [ -z "${DRYRUN}" ]; then if [ -z "${DRYRUN}" ]; then
eval ${_CMD} || exit 1 eval ${_CMD} || exit 1
fi fi
print3 "Installing certificate" print3 "Installing certificate"
_CMD="cat ${TMPCERT} >>/etc/ssl/pkgca.pem" _CMD="cat ${TMPCERT} >>/etc/ssl/pkgca.pem"
print2 "${_CMD}" print_arrow "${_CMD}"
if [ -z "${DRYRUN}" ]; then if [ -z "${DRYRUN}" ]; then
eval ${_CMD} || exit 1 eval ${_CMD} || exit 1
fi fi
@ -97,9 +97,9 @@ get_cert() {
update_self() { update_self() {
local _CMD _N local _CMD _N
print3 "Checking for openup(8) update" print3 "Checking for openup update"
_CMD="ftp -Vo ${TMPUPD} ${OPENUP_URL}" _CMD="ftp -Vo ${TMPUPD} ${OPENUP_URL}"
print2 "${_CMD}" print_arrow "${_CMD}"
if [ -z "${DRYRUN}" ]; then if [ -z "${DRYRUN}" ]; then
eval ${_CMD} || exit 1 eval ${_CMD} || exit 1
fi fi
@ -107,14 +107,14 @@ update_self() {
_N=$(grep -Eo '^OPENUP_VERSION=.*' ${TMPUPD} | awk -F '=' '{ print $2 }') _N=$(grep -Eo '^OPENUP_VERSION=.*' ${TMPUPD} | awk -F '=' '{ print $2 }')
if [ -z "${DRYRUN}" -a -n "${_N}" ]; then if [ -z "${DRYRUN}" -a -n "${_N}" ]; then
if [ "${OPENUP_VERSION}" -lt "${_N}" ]; then if [ "${OPENUP_VERSION}" -lt "${_N}" ]; then
print3 "Updating openup(8) from version ${OPENUP_VERSION} to version ${_N}" print3 "Updating openup from version ${OPENUP_VERSION} to version ${_N}"
_CMD="cat ${TMPUPD} >${MEESA}" _CMD="cat ${TMPUPD} >${MEESA}"
print2 "${_CMD}" print_arrow "${_CMD}"
eval ${_CMD} || exit 1 eval ${_CMD} || exit 1
rtn=$? rtn=$?
print3 "openup(8) updated to version ${_N}, restarting" print3 "openup updated to version ${_N}, restarting"
_CMD="${MEESA} -U $@" _CMD="${MEESA} -U $@"
print2 "${_CMD}" print_arrow "${_CMD}"
eval ${_CMD} eval ${_CMD}
exit $rtn exit $rtn
fi fi
@ -129,7 +129,7 @@ update_binpatches() {
if [ -n "$_BP" ]; then if [ -n "$_BP" ]; then
print3 "Updating binpatch(es)" print3 "Updating binpatch(es)"
_CMD="pkg_add ${pkg_opt} ${_BP}" _CMD="pkg_add ${pkg_opt} ${_BP}"
print2 "${_CMD}" print_arrow "${_CMD}"
eval ${_CMD} eval ${_CMD}
fi fi
} }
@ -139,7 +139,7 @@ update_pkg() {
print3 "Updating package(s)" print3 "Updating package(s)"
_CMD="pkg_add -u ${pkg_opt}" _CMD="pkg_add -u ${pkg_opt}"
print2 "${_CMD}" print_arrow "${_CMD}"
eval ${_CMD} eval ${_CMD}
} }
@ -148,7 +148,7 @@ update_fw() {
print3 "Updating firmware(s)" print3 "Updating firmware(s)"
_CMD="fw_update ${fw_opt}" _CMD="fw_update ${fw_opt}"
print2 "${_CMD}" print_arrow "${_CMD}"
eval ${_CMD} eval ${_CMD}
} }