mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
move parameters to cpio.sh
This commit is contained in:
parent
255461510e
commit
753e19e031
2 changed files with 26 additions and 22 deletions
|
@ -12,28 +12,7 @@ if [[ -z "${1}" ]]; then
|
|||
_usage
|
||||
fi
|
||||
_root_check
|
||||
while [ $# -gt 0 ]; do
|
||||
case "${1}" in
|
||||
-c) shift
|
||||
_CONFIG="${1}"
|
||||
;;
|
||||
-k) shift
|
||||
_KERNEL="${1}"
|
||||
;;
|
||||
-d) shift
|
||||
_TARGET_DIR="${1}"
|
||||
;;
|
||||
-g) shift
|
||||
[[ -d "${1}" ]] && _abort "Invalid image path -- ${1} is a directory!"
|
||||
if ! _GENERATE_IMAGE="$(readlink -f "${1}")" || [[ ! -e "${_GENERATE_IMAGE%/*}" ]]; then
|
||||
_abort "Unable to write to path!" "${1}"
|
||||
fi
|
||||
;;
|
||||
-h) _usage
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
_parameters
|
||||
#shellcheck disable="SC1090"
|
||||
. "${_CONFIG}" 2>"${_NO_LOG}" || _abort "Failed to read ${_CONFIG} configuration file"
|
||||
if [[ -z "${_KERNEL}" ]]; then
|
||||
|
|
|
@ -28,6 +28,31 @@ EOF
|
|||
exit 0
|
||||
}
|
||||
|
||||
_parameters() {
|
||||
while [ $# -gt 0 ]; do
|
||||
case "${1}" in
|
||||
-c) shift
|
||||
_CONFIG="${1}"
|
||||
;;
|
||||
-k) shift
|
||||
_KERNEL="${1}"
|
||||
;;
|
||||
-d) shift
|
||||
_TARGET_DIR="${1}"
|
||||
;;
|
||||
-g) shift
|
||||
[[ -d "${1}" ]] && _abort "Invalid image path -- ${1} is a directory!"
|
||||
if ! _GENERATE_IMAGE="$(readlink -f "${1}")" || [[ ! -e "${_GENERATE_IMAGE%/*}" ]]; then
|
||||
_abort "Unable to write to path!" "${1}"
|
||||
fi
|
||||
;;
|
||||
-h) _usage
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
_abort() {
|
||||
echo "ERROR:" "$@"
|
||||
exit 1
|
||||
|
|
Loading…
Reference in a new issue