Refactor directory variable names for uniformity

This commit is contained in:
Juno Takano 2024-09-01 22:23:28 -03:00
parent 005638bef4
commit 7b2f1494b9
4 changed files with 18 additions and 13 deletions

View file

@ -1,8 +1,8 @@
package_conflict_input_parser() { package_conflict_input_parser() {
local packages="$1" local packages="$1"
local conflict_type="$2" local conflict_type="$2"
local input="$TMP_DIR/package_conflict_input" local input="$TMP_ROOT/package_conflict_input"
local input_choices="$TMP_DIR/package_conflict_input_choices" local input_choices="$TMP_ROOT/package_conflict_input_choices"
local choices= local choices=
local packages_to_install= local packages_to_install=
local packages_to_uninstall= local packages_to_uninstall=

View file

@ -3,18 +3,18 @@ resolve_packages() {
local input_packages= local input_packages=
# shellcheck disable=SC2154 # shellcheck disable=SC2154
( echo "$system_packages" > "$TMP_DIR/system_packages" ( echo "$system_packages" > "$TMP_ROOT/system_packages"
echo "$user_packages" > "$TMP_DIR/user_packages" ) echo "$user_packages" > "$TMP_ROOT/user_packages" )
local packages_not_on_configuration="$(grep -v -x -f \ local packages_not_on_configuration="$(grep -v -x -f \
"$TMP_DIR/user_packages" "$TMP_DIR/system_packages" | xargs)" "$TMP_ROOT/user_packages" "$TMP_ROOT/system_packages" | xargs)"
if [ -n "$packages_not_on_configuration" ]; then if [ -n "$packages_not_on_configuration" ]; then
not_on_configuration_dialog "$packages_not_on_configuration" not_on_configuration_dialog "$packages_not_on_configuration"
fi fi
local packages_not_installed=$(grep -v -x -f \ local packages_not_installed=$(grep -v -x -f \
"$TMP_DIR/system_packages" "$TMP_DIR/user_packages" | xargs) "$TMP_ROOT/system_packages" "$TMP_ROOT/user_packages" | xargs)
if [ -n "$packages_not_installed" ]; then if [ -n "$packages_not_installed" ]; then
not_installed_dialog "$packages_not_installed" not_installed_dialog "$packages_not_installed"

View file

@ -124,12 +124,16 @@ set_opts() {
} }
prepare_directories() { prepare_directories() {
if ! [ -d "$TMP_DIR" ]; then if ! [ -d "$TMP_ROOT" ]; then
mkdir "$TMP_DIR" mkdir "$TMP_ROOT"
fi fi
if ! [ -d "$CACHE_DIR" ]; then if ! [ -d "$CACHE_ROOT" ]; then
mkdir -p "$CACHE_DIR" mkdir -p "$CACHE_ROOT"
fi
if ! [ -d "$BACKUP_ROOT" ]; then
mkdir -p "$BACKUP_ROOT"
fi fi
if ! [ -d "$CONFIG_ROOT" ]; then if ! [ -d "$CONFIG_ROOT" ]; then

7
tori
View file

@ -5,8 +5,9 @@ main() {
VERSION="0.5.0 2024-07-18" VERSION="0.5.0 2024-07-18"
TORI_ROOT="$HOME/.local/share/tori" TORI_ROOT="$HOME/.local/share/tori"
CONFIG_ROOT="$HOME/.config/tori" CONFIG_ROOT="$HOME/.config/tori"
TMP_DIR="/tmp/tori" BACKUP_ROOT="$HOME/.local/state/tori/backup"
CACHE_DIR="$HOME/.cache/tori" TMP_ROOT="/tmp/tori"
CACHE_ROOT="$HOME/.cache/tori"
# os-independent state # os-independent state
@ -25,7 +26,7 @@ main() {
## os-dependent state ## os-dependent state
OS="$(get_operating_system)" OS="$(get_operating_system)"
PACKAGE_CACHE="$CACHE_DIR/${OS}_packages.cache" PACKAGE_CACHE="$CACHE_ROOT/${OS}_packages.cache"
base_files= base_files=
bkp_files= bkp_files=