Extract package resolution from package.sh
This commit is contained in:
parent
df1ffcbedf
commit
e81f8f0227
3 changed files with 34 additions and 30 deletions
|
@ -1,4 +1,5 @@
|
||||||
. "$TORI_ROOT/src/check.sh"
|
. "$TORI_ROOT/src/check.sh"
|
||||||
. "$TORI_ROOT/src/configuration.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"
|
. "$TORI_ROOT/src/utility.sh"
|
||||||
|
|
27
src/package/package.sh
Normal file
27
src/package/package.sh
Normal file
|
@ -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"
|
||||||
|
}
|
|
@ -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() {
|
resolve_packages() {
|
||||||
local strategy=
|
local strategy=
|
||||||
|
|
||||||
|
@ -50,6 +22,8 @@ resolve_packages() {
|
||||||
|
|
||||||
if [ "$strategy" = 1 ]; then
|
if [ "$strategy" = 1 ]; then
|
||||||
: # TODO
|
: # TODO
|
||||||
|
elif [ $strategy -eq 6 ]; then
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -68,6 +42,8 @@ resolve_packages() {
|
||||||
|
|
||||||
if [ $strategy -eq 1 ]; then
|
if [ $strategy -eq 1 ]; then
|
||||||
: # TODO
|
: # TODO
|
||||||
|
elif [ $strategy -eq 6 ]; then
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
Loading…
Reference in a new issue