From 59e040d59789dcf75a78ff4da9e2c0ec3fdd254b Mon Sep 17 00:00:00 2001 From: jutty Date: Tue, 3 Sep 2024 08:57:55 -0300 Subject: [PATCH] Extract authorization command to top level --- src/package/package_manager.sh | 7 +++---- tori | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/package/package_manager.sh b/src/package/package_manager.sh index f96f132..4303ce8 100644 --- a/src/package/package_manager.sh +++ b/src/package/package_manager.sh @@ -2,7 +2,6 @@ package_manager() { local command="$1" local manager - local authorizer="sudo" local args__install local args__uninstall local args__get_manually_installed @@ -25,11 +24,11 @@ package_manager() { if [ "$command" = 'get_manually_installed' ]; then eval $manager "$args__get_manually_installed" elif [ "$command" = 'install' ]; then - $authorizer $manager $args__install $args__user_args + $AUTHORIZE_COMMAND $manager $args__install $args__user_args elif [ "$command" = 'uninstall' ]; then - $authorizer $manager $args__uninstall $args__user_args + $AUTHORIZE_COMMAND $manager $args__uninstall $args__user_args elif [ "$command" = 'update' ]; then - $authorizer $manager $args__update + $AUTHORIZE_COMMAND $manager $args__update elif [ "$command" = 'get_available' ]; then eval $manager "$args__get_available" else diff --git a/tori b/tori index e2e92e7..3c15354 100755 --- a/tori +++ b/tori @@ -19,14 +19,14 @@ main() { parameter="$2" # import source - check_core_paths . "$TORI_ROOT/src/index.sh" - set_opts on ## os-dependent state + set_opts on OS="$(get_operating_system)" PACKAGE_CACHE="$CACHE_ROOT/${OS}_packages.cache" + AUTHORIZE_COMMAND="sudo" base_files= bkp_files=