added check users for backup and recovery pfx

This commit is contained in:
Mikhail Tergoev
2025-06-18 16:46:38 +03:00
parent 8ba7c99b45
commit b46728e2e2

View File

@ -889,6 +889,11 @@ init_wineprefix () {
export DRIVE_C="$WINEPREFIX/drive_c"
create_new_dir "$WINEPREFIX/dosdevices/"
if [[ ! -L "$WINEPREFIX/dosdevices/h:" ]]
then try_force_link_dir "$HOME" "$WINEPREFIX/dosdevices/h:"
fi
if [[ ! -f "$WINEPREFIX/.firstboot" ]] ; then
create_new_dir "$WINEPREFIX"
if [[ "$CLEAR_PREFIX" == "1" ]]
@ -923,8 +928,9 @@ init_wineprefix () {
then try_force_link_dir "$DRIVE_C/users/$USER" "$DRIVE_C/users/xuser"
fi
if [[ ! -L "$WINEPREFIX/dosdevices/h:" ]]
then try_force_link_dir "$HOME" "$WINEPREFIX/dosdevices/h:"
if [[ ! -f "$WINEPREFIX/.update-timestamp" ]] ; then
"$WINELOADER" wineboot -u
wait_wineserver
fi
try_remove_file "$DRIVE_C/windows/system32/winemenubuilder.exe"
@ -1324,6 +1330,8 @@ backup_prefix() {
local backup_archive_name="backup_${PREFIX_NAME}_$(date +%Y.%m.%d).whpack"
local backup_dest_path="$backup_base_dir/$backup_archive_name"
local temp_backup_dir="$WH_TMP_DIR/backup_${PREFIX_NAME}_$(date +%Y.%m.%d)"
local temp_prefix_dir="$temp_backup_dir/prefixes/$PREFIX_NAME"
local temp_users_dir="$temp_prefix_dir/drive_c/users"
print_info "Начало резервного копирования префикса: $PREFIX_NAME"
create_new_dir "$temp_backup_dir"
@ -1331,7 +1339,19 @@ backup_prefix() {
create_new_dir "$temp_backup_dir/dist/"
print_info "Подготовка префикса к упаковке..."
if cp -a "$WINEPREFIX" "$temp_backup_dir/prefixes/$PREFIX_NAME" ; then
if cp -a "$WINEPREFIX" "$temp_prefix_dir" ; then
try_remove_dir "$temp_prefix_dir/dosdevices"
try_remove_file "$temp_prefix_dir/.update-timestamp"
if [[ -d "$temp_users_dir/$USER" ]] \
&& [[ ! -L "$temp_users_dir/$USER" ]]
then
if [[ -L "$temp_users_dir/xuser" ]]
then try_remove_dir "$temp_users_dir/xuser"
fi
create_new_dir "$temp_users_dir/xuser"
cp -fr "$temp_users_dir/$USER"/* "$temp_users_dir/xuser/"
fi
try_remove_dir "$temp_users_dir/$USER"
print_ok "Директория префикса подготовлена."
else
print_error "Не удалось подготовить директорию префикса."