# $Id$ provide basic-version help_version_os() { mecho "get version.os" mecho " Prints the current os version." } help_version_tools() { mecho "get version.tools" mecho " Prints the current mcore-tools version." } help_version_netboot() { mecho "get version.netboot" mecho " Prints the current netboot state." } help_version_deactivated() { mecho "get version.deactivated" mecho " Shows the current state of the system." mecho mecho "set version.deactivated [0|1]" mecho " Sets the state of the system." } get_version_os() { local version if [ -f /etc/os-release ] then version="$(source /etc/os-release; echo ${Version_ID})" fi if [[ -z ${version} ]] then version="UNKNOWN" fi rvecho "${version}" } get_version_tools() { local version if [ -f ${MCORE_LIBDIR}/VERSION ] then version="$(<${MCORE_LIBDIR}/VERSION)" fi if [[ -z ${version} ]] then version="UNKNOWN" fi rvecho "${version}" } get_version_netboot() { local netboot local i # default no netboot netboot=0 if [ -f /proc/cmdline ] then for i in $(< /proc/cmdline) do case ${i} in rd.netboot) netboot=1 ;; esac done fi rvecho "${netboot}" } get_version_deactivated() { local deactivated=0 [[ -e ${MCORE_CONFIG_PATH}/client-deactivated ]] && deactivated=1 rvecho "${deactivated}" } set_version_deactivated() { local deactivated="${CLASS_ARGV[0]}" case "${deactivated}" in 0) if [[ -e ${MCORE_CONFIG_PATH}/client-deactivated ]] then rm ${MCORE_CONFIG_PATH}/client-deactivated fi rvecho "Client activated" ;; 1) if [[ ! -e ${MCORE_CONFIG_PATH}/client-deactivated ]] then touch ${MCORE_CONFIG_PATH}/client-deactivated fi rvecho "Client deactivated" ;; *) decho "Unknown state '${deactivated}'" help_version_deactivated ;; esac }