Revamp debugging
This commit is contained in:
parent
eb5075aab5
commit
340cf9848f
1 changed files with 24 additions and 24 deletions
48
lib-core.sh
48
lib-core.sh
|
@ -260,6 +260,29 @@ operation_aborted() {
|
||||||
rm -rf "${WHITESUR_TMP_DIR}"; exit 1
|
rm -rf "${WHITESUR_TMP_DIR}"; exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rootify() {
|
||||||
|
trap true SIGINT
|
||||||
|
prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root"
|
||||||
|
|
||||||
|
if ! sudo "${@}"; then
|
||||||
|
error_snippet="${*}"
|
||||||
|
operation_aborted
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap signal_exit SIGINT
|
||||||
|
}
|
||||||
|
|
||||||
|
userify() {
|
||||||
|
trap true SIGINT
|
||||||
|
|
||||||
|
if ! sudo -u "${MY_USERNAME}" "${@}"; then
|
||||||
|
error_snippet="${*}"
|
||||||
|
operation_aborted
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap signal_exit SIGINT
|
||||||
|
}
|
||||||
|
|
||||||
trap 'operation_aborted' ERR
|
trap 'operation_aborted' ERR
|
||||||
trap 'signal_exit' INT EXIT TERM
|
trap 'signal_exit' INT EXIT TERM
|
||||||
|
|
||||||
|
@ -558,21 +581,9 @@ remind_relative_path() {
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# SYSTEMS #
|
# MISC #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
rootify() {
|
|
||||||
trap true SIGINT
|
|
||||||
prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root"
|
|
||||||
|
|
||||||
if ! sudo "${@}"; then
|
|
||||||
error_snippet="${*}"
|
|
||||||
operation_aborted
|
|
||||||
fi
|
|
||||||
|
|
||||||
trap signal_exit SIGINT
|
|
||||||
}
|
|
||||||
|
|
||||||
full_rootify() {
|
full_rootify() {
|
||||||
if [[ ! -w "/" ]]; then
|
if [[ ! -w "/" ]]; then
|
||||||
prompt -e "ERROR: '${1}' needs a root priviledge. Please run this '${0}' as root"
|
prompt -e "ERROR: '${1}' needs a root priviledge. Please run this '${0}' as root"
|
||||||
|
@ -580,17 +591,6 @@ full_rootify() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
userify() {
|
|
||||||
trap true SIGINT
|
|
||||||
|
|
||||||
if ! sudo -u "${MY_USERNAME}" "${@}"; then
|
|
||||||
error_snippet="${*}"
|
|
||||||
operation_aborted
|
|
||||||
fi
|
|
||||||
|
|
||||||
trap signal_exit SIGINT
|
|
||||||
}
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
prompt -e "Usage function is not implemented"; exit 1
|
prompt -e "Usage function is not implemented"; exit 1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue