# vim: ft=sh set -e export MC_LOCAL_DIR="" while [ $# -gt 0 ]; do case "$1" in -h|--help) echo "Usage: $0 [OPTION]..." echo "Multiconfig system script." echo "$MC_DESCRIPTION" echo echo "Options:" echo " --description" echo " Print description of this module and exit." echo " --local [DIR]" echo " Instead of accessing remote files storage use local directory." echo " If no directory is provided or is empty then current working directory is used." echo " -h, --help" echo " Print this help text and exit." exit 0 ;; --description) echo "$MC_DESCRIPTION" exit 0 ;; --local) shift MC_LOCAL_DIR="${1:-$PWD}" ;; *) echo "Unknown option: $1" >&2 exit 1 ;; esac shift done if [ "$(id -u)" != "0" ]; then die "Please run this script only as root" fi # Add path to our own libraries export PATH="$PATH:$(dirname "$(readlink -f "$0")")/lib" # Include utils . utils # Verify if distribution is supported [ "$(distribution)" != "unknown" ] || die "Running on unsupported distribution!" # Export some utility paths export MC_STATUS_DIR="/var/multiconfig/status" export MC_TRASH_DIR="/var/multiconfig/trash" case "$(distribution)" in openwrt) MC_STATUS_DIR="/usr/share/multiconfig/status" MC_TRASH_DIR="/usr/share/multiconfig/trash" ;; esac # Make sure that status directoruy mkdir -p "$MC_STATUS_DIR"