Compare commits
No commits in common. "0482efc7de5a9c997103b1d7cbabf772ef5653a5" and "df1ffcbedf6ad2cc27005bf32b0a31cb5f89c6ae" have entirely different histories.
0482efc7de
...
df1ffcbedf
7 changed files with 31 additions and 75 deletions
|
@ -1,9 +0,0 @@
|
|||
tori determines what is the running operating system through the output of `uname -s`. If it cannot get a descriptive enough, it will look for the `/etc/os-release` file.
|
||||
|
||||
If a `/etc/os-release` file is present, it takes precedence over the output of `uname`. Both the `NAME` and `ID` values will be looked at. This is aimed at helping to disambiguate between different variants of the same operating system.
|
||||
|
||||
The `NAME` value may be the only queried value if for the given supported operating system it is enough to disambiguate between the variants tori needs to be aware of.
|
||||
|
||||
In case there is no `/etc/os-release` file found, the output of `uname` is the next value considered.
|
||||
|
||||
If a supported operating system is not detected on neither of these, tori will exit with an error.
|
|
@ -1,6 +1,4 @@
|
|||
. "$TORI_ROOT/src/check.sh"
|
||||
. "$TORI_ROOT/src/configuration.sh"
|
||||
. "$TORI_ROOT/src/package/package.sh"
|
||||
. "$TORI_ROOT/src/package/package_resolution.sh"
|
||||
. "$TORI_ROOT/src/package.sh"
|
||||
. "$TORI_ROOT/src/utility.sh"
|
||||
. "$TORI_ROOT/src/system.sh"
|
||||
|
|
|
@ -1,3 +1,31 @@
|
|||
# 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=
|
||||
|
||||
|
@ -11,7 +39,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"
|
||||
|
@ -22,8 +50,6 @@ resolve_packages() {
|
|||
|
||||
if [ "$strategy" = 1 ]; then
|
||||
: # TODO
|
||||
elif [ $strategy -eq 6 ]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -42,8 +68,6 @@ resolve_packages() {
|
|||
|
||||
if [ $strategy -eq 1 ]; then
|
||||
: # TODO
|
||||
elif [ $strategy -eq 6 ]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
# 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,19 +0,0 @@
|
|||
get_operating_system() {
|
||||
local uname_output="$(uname -s)"
|
||||
local os_release_name="$(cat \
|
||||
/etc/os-release | grep '^NAME=' | sed 's/NAME=//')"
|
||||
local os_release_id="$(cat \
|
||||
/etc/os-release | grep '^ID=' | sed 's/ID=//')"
|
||||
|
||||
log debug "uname OS: $uname_output"
|
||||
log debug "os-release OS name: $os_release_name"
|
||||
log debug "os-release OS ID: $os_release_id"
|
||||
|
||||
if [ "$os_release_name" = FreeBSD ]; then
|
||||
echo "FreeBSD"
|
||||
return 0
|
||||
else
|
||||
log fatal "Unsupported operating system"
|
||||
return 1
|
||||
fi
|
||||
}
|
5
src/tori
5
src/tori
|
@ -1,6 +1,5 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
# paths
|
||||
VERSION="0.0.4 2024-06-30"
|
||||
TORI_ROOT="$HOME/tori"
|
||||
CONFIG_ROOT="$HOME/.config/tori"
|
||||
|
@ -14,10 +13,8 @@ TMP_DIR="/tmp/tori"
|
|||
argument="$1"
|
||||
parameter="$2"
|
||||
|
||||
set_opts -
|
||||
|
||||
## global constants
|
||||
OS="$(get_operating_system)"
|
||||
OS="$(uname -s)"
|
||||
|
||||
## global state
|
||||
base_files=
|
||||
|
|
|
@ -13,14 +13,6 @@ log() {
|
|||
fi
|
||||
}
|
||||
|
||||
set_opts() {
|
||||
sign="$1"
|
||||
|
||||
set "${sign}o" errexit
|
||||
set "${sign}o" nounset
|
||||
set "${sign}o" pipefail
|
||||
}
|
||||
|
||||
prepare_directories() {
|
||||
if ! [ -d "$TMP_DIR" ]; then
|
||||
mkdir "$TMP_DIR"
|
||||
|
|
Loading…
Reference in a new issue