Extract authorization command to top level

This commit is contained in:
Juno Takano 2024-09-03 08:57:55 -03:00
parent 4b6a956995
commit 59e040d597
2 changed files with 5 additions and 6 deletions

View file

@ -2,7 +2,6 @@ package_manager() {
local command="$1" local command="$1"
local manager local manager
local authorizer="sudo"
local args__install local args__install
local args__uninstall local args__uninstall
local args__get_manually_installed local args__get_manually_installed
@ -25,11 +24,11 @@ package_manager() {
if [ "$command" = 'get_manually_installed' ]; then if [ "$command" = 'get_manually_installed' ]; then
eval $manager "$args__get_manually_installed" eval $manager "$args__get_manually_installed"
elif [ "$command" = 'install' ]; then elif [ "$command" = 'install' ]; then
$authorizer $manager $args__install $args__user_args $AUTHORIZE_COMMAND $manager $args__install $args__user_args
elif [ "$command" = 'uninstall' ]; then elif [ "$command" = 'uninstall' ]; then
$authorizer $manager $args__uninstall $args__user_args $AUTHORIZE_COMMAND $manager $args__uninstall $args__user_args
elif [ "$command" = 'update' ]; then elif [ "$command" = 'update' ]; then
$authorizer $manager $args__update $AUTHORIZE_COMMAND $manager $args__update
elif [ "$command" = 'get_available' ]; then elif [ "$command" = 'get_available' ]; then
eval $manager "$args__get_available" eval $manager "$args__get_available"
else else

4
tori
View file

@ -19,14 +19,14 @@ main() {
parameter="$2" parameter="$2"
# import source # import source
check_core_paths check_core_paths
. "$TORI_ROOT/src/index.sh" . "$TORI_ROOT/src/index.sh"
set_opts on
## os-dependent state ## os-dependent state
set_opts on
OS="$(get_operating_system)" OS="$(get_operating_system)"
PACKAGE_CACHE="$CACHE_ROOT/${OS}_packages.cache" PACKAGE_CACHE="$CACHE_ROOT/${OS}_packages.cache"
AUTHORIZE_COMMAND="sudo"
base_files= base_files=
bkp_files= bkp_files=