Compare commits

..

No commits in common. "7b2f1494b944b89660122f78bd18a183e2a46094" and "a0fdbe014937adce0dad19b99a278723afe6455c" have entirely different histories.

5 changed files with 17 additions and 27 deletions

View file

@ -47,7 +47,8 @@ file_merge_tree() {
local prompt_verb="In configuration only"
local prompt_options="Copy to system"
fi
strategy="$(ask "$prompt_verb: $(tildify "$absolute_path")" "$prompt_options")"
strategy="$(ask "$prompt_verb: $(tildify "$absolute_path")" "$prompt_options")" ||
file_merge_tree "$base_files"
log debug "[merge_tree] Chosen strategy: $strategy"
if [ "$strategy" -eq 0 ]; then
@ -64,7 +65,6 @@ file_merge_tree() {
return 1
else
log user 'Invalid choice'
return 1
fi
fi
done

View file

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

View file

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

View file

@ -76,15 +76,10 @@ ask() {
read -r read_answer
answer="$(echo "$read_answer" | xargs)"
if [ -z "$answer" ]; then
log info "[ask] Invalid choice"
echo -1
return 1
elif [ "$answer" -ge 0 ] 2> /dev/null && [ "$answer" -le $options_count ]; then
if [ "$answer" -ge 0 ] 2> /dev/null && [ "$answer" -le $options_count ]; then
echo "$answer"
else
log info "[ask] Invalid choice"
echo -1
log debug "[ask] Invalid choice"
return 1
fi
}
@ -124,16 +119,12 @@ set_opts() {
}
prepare_directories() {
if ! [ -d "$TMP_ROOT" ]; then
mkdir "$TMP_ROOT"
if ! [ -d "$TMP_DIR" ]; then
mkdir "$TMP_DIR"
fi
if ! [ -d "$CACHE_ROOT" ]; then
mkdir -p "$CACHE_ROOT"
fi
if ! [ -d "$BACKUP_ROOT" ]; then
mkdir -p "$BACKUP_ROOT"
if ! [ -d "$CACHE_DIR" ]; then
mkdir -p "$CACHE_DIR"
fi
if ! [ -d "$CONFIG_ROOT" ]; then

7
tori
View file

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