#!/bin/bash -ex CURDIR=$(pwd) PROGNAME=${0##*/} usage() { cat << EOF Usage: $PROGNAME [OPTION] -h, --help Display this help --force Update, even if the signature checks fail --dir DIR Update from DIR, instead of downloading EOF } TEMP=$( getopt -o '' \ --long dir: \ --long force \ --long nocheck \ --long help \ -- "$@" ) if (( $? != 0 )); then usage >&2 exit 1 fi eval set -- "$TEMP" unset TEMP while true; do case "$1" in '--dir') USE_DIR="$(readlink -e $2)" shift 2; continue ;; '--force') FORCE="y" shift 1; continue ;; '--nocheck') NO_CHECK="y" shift 1; continue ;; '--help') usage exit 0 ;; '--') shift break ;; *) echo 'Internal error!' >&2 exit 1 ;; esac done BASEURL="$1" . /etc/os-release CURRENT_ROOT_HASH=$(