diff --git a/src/index.sh b/src/index.sh index dfa6083..a2d03e6 100644 --- a/src/index.sh +++ b/src/index.sh @@ -1,4 +1,5 @@ . "$TORI_ROOT/src/check.sh" . "$TORI_ROOT/src/configuration.sh" -. "$TORI_ROOT/src/package.sh" +. "$TORI_ROOT/src/package/package.sh" +. "$TORI_ROOT/src/package/package_resolution.sh" . "$TORI_ROOT/src/utility.sh" diff --git a/src/package/package.sh b/src/package/package.sh new file mode 100644 index 0000000..96f9e97 --- /dev/null +++ b/src/package/package.sh @@ -0,0 +1,27 @@ +# package management functions + +get_user_packages() { + cat $CONFIG_ROOT/packages | sort | uniq +} + +package_manager() { + local command="$1" + local manager + local args__get_manually_installed + local output + + if [ $OS = "FreeBSD" ]; then + manager="pkg" + args__get_manually_installed='query -e "%a = 0" "%n"' + fi + + if [ "$command" = 'get_manually_installed' ]; then + output=$(eval $manager $args__get_manually_installed) + printf "$output" + fi +} + +get_system_packages() { + local packages=$(package_manager get_manually_installed) + printf "$packages" +} diff --git a/src/package.sh b/src/package/package_resolution.sh similarity index 68% rename from src/package.sh rename to src/package/package_resolution.sh index 7afc040..4ba510f 100644 --- a/src/package.sh +++ b/src/package/package_resolution.sh @@ -1,31 +1,3 @@ -# package management functions - -get_user_packages() { - cat $CONFIG_ROOT/packages | sort | uniq -} - -package_manager() { - local command="$1" - local manager - local args__get_manually_installed - local output - - if [ $OS = "FreeBSD" ]; then - manager="pkg" - args__get_manually_installed='query -e "%a = 0" "%n"' - fi - - if [ "$command" = 'get_manually_installed' ]; then - output=$(eval $manager $args__get_manually_installed) - printf "$output" - fi -} - -get_system_packages() { - local packages=$(package_manager get_manually_installed) - printf "$packages" -} - resolve_packages() { local strategy= @@ -39,7 +11,7 @@ resolve_packages() { printf "\nInstalled packages not on configuration: $not_on_configuration\n" echo " [1] Uninstall all" - echo " [2] Enter packages to uninstall" + echo " [2] Enter packages to uninstall" echo " [3] Add all to configuration" echo " [4] Enter packages to add to configuration" echo " [5] Decide on editor" @@ -50,6 +22,8 @@ resolve_packages() { if [ "$strategy" = 1 ]; then : # TODO + elif [ $strategy -eq 6 ]; then + return 0 fi fi @@ -68,6 +42,8 @@ resolve_packages() { if [ $strategy -eq 1 ]; then : # TODO + elif [ $strategy -eq 6 ]; then + return 0 fi fi }