mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-24 11:46:30 +00:00
Merge remote-tracking branch 'thingos/dev' into dev
This commit is contained in:
commit
698a22f3c9
@ -16,7 +16,9 @@ mount_overlay() {
|
||||
grep -qw overlay /proc/filesystems || return
|
||||
|
||||
msg_begin "Mounting overlay filesystems"
|
||||
grep -oE '/data/.overlay-[^ ]+' /etc/fstab.overlay | xargs mkdir -p
|
||||
grep -oE 'lowerdir=[^,]+' /etc/fstab.overlay | cut -d '=' -f 2 | xargs -r mkdir -p
|
||||
grep -oE 'upperdir=[^,]+' /etc/fstab.overlay | cut -d '=' -f 2 | xargs -r mkdir -p
|
||||
grep -oE 'workdir=[^ ]+' /etc/fstab.overlay | cut -d '=' -f 2 | xargs -r mkdir -p
|
||||
/bin/mount -T /etc/fstab.overlay -a
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ SYS_VERSION_FILE="/etc/version"
|
||||
VERSION_FILE="/data/etc/version"
|
||||
POST_UPGRADE_DIR="/usr/share/post-upgrade"
|
||||
|
||||
LOG="/var/log/post-upgrade.log"
|
||||
|
||||
|
||||
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||
|
||||
@ -15,7 +17,7 @@ test "${hash}" == "${sys_hash}" && exit 0
|
||||
test -d ${POST_UPGRADE_DIR} || exit 0
|
||||
|
||||
function version_gt() {
|
||||
if [[ "$1" != "$2" ]] && [[ $(echo -e "$2\n$1" | sort -t . | head -n 1) == "$2" ]]; then
|
||||
if [[ "$1" != "$2" ]] && [[ $(echo -e "$2\n$1" | semver-sort | head -n 1) == "$2" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@ -29,15 +31,26 @@ function run_post_upgrade() {
|
||||
|
||||
sys_version="$(source ${SYS_VERSION_FILE} 2>/dev/null && echo ${OS_VERSION})"
|
||||
|
||||
echo "---- post-upgrade from ${version} to ${sys_version} ----" >> ${LOG}
|
||||
|
||||
versions=$(ls -1 ${POST_UPGRADE_DIR} | cut -d '.' -f 1)
|
||||
for v in ${versions}; do
|
||||
if [[ ${v} == "post-upgrade" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [[ -z "${version}" ]] || version_gt ${v} ${version}; then
|
||||
msg_begin "Post-upgrading to version ${v}"
|
||||
out=$(${POST_UPGRADE_DIR}/${v}.sh 2>&1)
|
||||
${POST_UPGRADE_DIR}/${v}.sh >> ${LOG} 2>&1
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
echo "${out}" | logger -t post-upgrade
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -x "${POST_UPGRADE_DIR}/post-upgrade.sh" ]]; then
|
||||
msg_begin "Running common post-upgrade script"
|
||||
${POST_UPGRADE_DIR}/post-upgrade.sh >> ${LOG} 2>&1
|
||||
test $? == 0 && msg_done || msg_fail
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
24
board/common/overlay/sbin/service
Executable file
24
board/common/overlay/sbin/service
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
function show_usage() {
|
||||
echo "Usage: service <service_name> [command]"
|
||||
echo "Usual commands include: start, stop, restart"
|
||||
echo "Type 'service <service_name>' without command for service-specific usage"
|
||||
}
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
show_usage 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVICE=$1
|
||||
|
||||
shift # Remove $1
|
||||
SCRIPT=(/etc/init.d/S*${SERVICE})
|
||||
|
||||
if ! [[ -x "${SCRIPT}" ]]; then
|
||||
echo "No such service: ${SERVICE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source ${SCRIPT} "$@"
|
Loading…
x
Reference in New Issue
Block a user