#!/bin/sh
# This script must be compatible with POSIX shell to run on all systems, do not use bash-specific code
# Use shellcheck to check for POSIX compatibility

# Author: mikhailnov
# License: GPLv3

# Most of functions used in system-autoupdate and system-autoupdate-runner are in common-funcs.sh
# Scripts work from ./usr/sbin/ in the development directory
# Script may be called from ./ or ./usr/sbin/
for common_funcs_file in "/usr/share/system-autoupdate/common-funcs.sh" "../share/system-autoupdate/common-funcs.sh" "./usr/share/system-autoupdate/common-funcs.sh"
do
	if [ -f "$common_funcs_file" ]; then
		. "$common_funcs_file"
	fi
done

##################################################################
detect_distro

case "$1" in
	"run_hooks")
		run_hooks "$2"
	;;
	"detect_distro")
		echo "$platform"
	;;
	*)
		update
	;;
esac

