forked from kiss-community/kiss
kiss: move as_root out of git
This commit is contained in:
parent
f09f0d6ec1
commit
cb54b59f98
@ -193,7 +193,7 @@ features or conditionally do things on a per-package basis.
|
|||||||
| pre-install | Type | Package | Extracted package | |
|
| pre-install | Type | Package | Extracted package | |
|
||||||
| pre-remove | Type | Package | Installed database | |
|
| pre-remove | Type | Package | Installed database | |
|
||||||
| pre-source | Type | Package | Verbatim source | Resolved source |
|
| pre-source | Type | Package | Verbatim source | Resolved source |
|
||||||
| pre-update | Type | [7] | | |
|
| pre-update | Type | [8] | | |
|
||||||
| queue-status | Type | Package | Number in queue | Total in queue |
|
| queue-status | Type | Package | Number in queue | Total in queue |
|
||||||
| | | | | |
|
| | | | | |
|
||||||
+---------------+--------+----------+--------------------+-----------------+
|
+---------------+--------+----------+--------------------+-----------------+
|
||||||
@ -201,6 +201,10 @@ features or conditionally do things on a per-package basis.
|
|||||||
[7] The -update hooks start in the current repository. In other words, you
|
[7] The -update hooks start in the current repository. In other words, you
|
||||||
can operate on the repository directly or grab the value from '$PWD'.
|
can operate on the repository directly or grab the value from '$PWD'.
|
||||||
|
|
||||||
|
[8] The second argument of pre-update is '0' if the current user owns the
|
||||||
|
repository and '1' if they do not. In the latter case, privilege
|
||||||
|
escalation is required to preserve ownership.
|
||||||
|
|
||||||
|
|
||||||
[5.0] Package Manager Extensions
|
[5.0] Package Manager Extensions
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
29
kiss
29
kiss
@ -1548,9 +1548,6 @@ pkg_update() {
|
|||||||
if git -C "$repo" remote >/dev/null 2>&1; then
|
if git -C "$repo" remote >/dev/null 2>&1; then
|
||||||
repo_type=git
|
repo_type=git
|
||||||
|
|
||||||
# Display whether or not signature verification is enabled.
|
|
||||||
repo_sig=$(git -C "$repo" config --get merge.verifySignatures) || :
|
|
||||||
|
|
||||||
# Get the Git repository root directory.
|
# Get the Git repository root directory.
|
||||||
subm=$(git -C "$repo" rev-parse --show-superproject-working-tree)
|
subm=$(git -C "$repo" rev-parse --show-superproject-working-tree)
|
||||||
repo=$(git -C "${subm:-"$repo"}" rev-parse --show-toplevel)
|
repo=$(git -C "${subm:-"$repo"}" rev-parse --show-toplevel)
|
||||||
@ -1559,28 +1556,34 @@ pkg_update() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pkg_update_repo "$repo" "$repo_type" "${repo_sig:-false}"
|
pkg_update_repo
|
||||||
done
|
done
|
||||||
|
|
||||||
pkg_upgrade
|
pkg_upgrade
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_update_repo() {
|
pkg_update_repo() {
|
||||||
cd "$1" || die "Repository '$1' inaccessible"
|
cd "$repo" || die "Repository '$repo' inaccessible"
|
||||||
|
|
||||||
# NULL function for unsupported repository types.
|
# NULL function for unsupported repository types.
|
||||||
pkg_update_null() { log "$PWD" "Repository has no remote"; }
|
pkg_update_null() { printf 'Repository has no remote\n'; }
|
||||||
|
|
||||||
contains "$repos" "$PWD" || {
|
contains "$repos" "$PWD" || {
|
||||||
repos="$repos $PWD"
|
repos="$repos $PWD"
|
||||||
|
|
||||||
log "$PWD" "[verify: $3]"
|
log "Updating" "$PWD"
|
||||||
|
|
||||||
|
am_owner "$PWD" || {
|
||||||
|
printf 'Need "%s" to update\n' "$user"
|
||||||
|
set -- as_user
|
||||||
|
}
|
||||||
|
|
||||||
# arg1: pre-update
|
# arg1: pre-update
|
||||||
|
# arg2: need su?
|
||||||
# env: PWD is path to repository
|
# env: PWD is path to repository
|
||||||
run_hook pre-update
|
run_hook pre-update "$#"
|
||||||
|
|
||||||
"pkg_update_$2"
|
"pkg_update_$repo_type" "$@"
|
||||||
|
|
||||||
# arg1: post-update
|
# arg1: post-update
|
||||||
# env: PWD is path to repository
|
# env: PWD is path to repository
|
||||||
@ -1589,10 +1592,10 @@ pkg_update_repo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pkg_update_git() {
|
pkg_update_git() {
|
||||||
am_owner "$PWD" || {
|
# Display whether or not signature verification is enabled.
|
||||||
log "$PWD" "Need '$user' to update"
|
case $(git config --get merge.verifySignatures) in true)
|
||||||
set -- as_user
|
printf 'Signature verification enabled.\n'
|
||||||
}
|
esac
|
||||||
|
|
||||||
"$@" git pull
|
"$@" git pull
|
||||||
"$@" git submodule update --remote --init -f
|
"$@" git submodule update --remote --init -f
|
||||||
|
Loading…
Reference in New Issue
Block a user