1
0
mirror of https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git synced 2023-10-10 13:37:40 +02:00
raspberrymatic-addon-rmupdate/rmupdate
2017-03-24 19:51:51 +01:00

45 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
ADDON_NAME=rmupdate
CONFIG_DIR=/usr/local/etc/config
ADDON_DIR=/usr/local/addons/${ADDON_NAME}
RCD_DIR=${CONFIG_DIR}/rc.d
case "$1" in
""|start|stop|restart)
echo "Nothing to do."
;;
info)
version=$(cat ${ADDON_DIR}/VERSION)
echo "Info: <b>${ADDON_NAME} addon</b><br>"
echo "Info: <a href='https://github.com/j-a-n/raspberrymatic-addon-rmupdate'>https://github.com/j-a-n/raspberrymatic-addon-rmupdate</a>"
echo "Name: RaspberryMatic update"
echo "Version: ${version}"
echo "Operations: uninstall"
echo "Config-Url: /addons/${ADDON_NAME}"
echo "Update: /addons/${ADDON_NAME}/update.cgi"
;;
uninstall)
logger -t homematic -p user.info "removing addon ${ADDON_NAME}"
"/usr/local/addons/cuxd/update_addon" ${ADDON_NAME} || true
[ -e "${ADDON_DIR}" ] && rm -rf "${ADDON_DIR}"
[ -L "${CONFIG_DIR}/addons/www/${ADDON_NAME}" ] && rm "${CONFIG_DIR}/addons/www/${ADDON_NAME}"
if [ -e "${RCD_DIR}/${ADDON_NAME}" ]; then
mount -o remount,rw /
rm -f ${RCD_DIR}/${ADDON_NAME}
mount -o remount,ro /
fi
[ -e "/usr/local/addons/${ADDON_NAME}-install.log" ] && rm -rf "/usr/local/addons/${ADDON_NAME}-install.log"
;;
*)
echo "Usage: $0 {start|stop|restart|uninstall}" >&2
exit 1
;;
esac
exit 0