Compare commits

...

2 Commits

Author SHA1 Message Date
0fc45bc85f added function: create_base_pfx 2025-06-27 16:56:08 +03:00
62497c94c4 unpack: added --skip-xattr for get_base_pfx 2025-06-27 15:30:39 +03:00

View File

@ -239,6 +239,12 @@ create_new_dir () {
} }
unpack () { unpack () {
if [[ $1 == "--skip-xattr" ]] ; then
local skip_xattr="1"
shift
else
unset skip_xattr
fi
print_info "Запуск распаковки архива $1" print_info "Запуск распаковки архива $1"
local command outarg local command outarg
case $1 in case $1 in
@ -249,12 +255,14 @@ unpack () {
*.zip|*.exe|*.rar) command="7z x -y -bso0" ; outarg="-o" ;; *.zip|*.exe|*.rar) command="7z x -y -bso0" ; outarg="-o" ;;
esac esac
create_new_dir "$2" create_new_dir "$2"
if $command "$1" ${outarg}"$2" ; then if [[ $skip_xattr == "1" ]] \
print_ok "Файл $1 распакован." && $command "$1" ${outarg}"$2" 2>&1 | grep -v "xattr"
return 0 then print_ok "Файл $1 распакован."
else elif $command "$1" ${outarg}"$2"
fatal "Распаковать файл $1 не удалось!" then print_ok "Файл $1 распакован."
else fatal "Распаковать файл $1 не удалось!"
fi fi
return 0
} }
try_get_page () { try_get_page () {
@ -870,11 +878,11 @@ get_base_pfx () {
if [[ ! -f "$PFX_TMP/$FILE_NAME_PFX.tar.xz" ]] ; then if [[ ! -f "$PFX_TMP/$FILE_NAME_PFX.tar.xz" ]] ; then
print_info "Загрузка базового префикса: ${FILE_NAME_PFX}" print_info "Загрузка базового префикса: ${FILE_NAME_PFX}"
if try_download "$PFX_URL" "$PFX_TMP/$FILE_NAME_PFX.tar.xz" check256sum if try_download "$PFX_URL" "$PFX_TMP/$FILE_NAME_PFX.tar.xz" check256sum
then unpack "$PFX_TMP/$FILE_NAME_PFX.tar.xz" "$WINEPREFIX/" then unpack --skip-xattr "$PFX_TMP/$FILE_NAME_PFX.tar.xz" "$WINEPREFIX/"
else try_remove_file "$PFX_TMP/$FILE_NAME_PFX.tar.xz" else try_remove_file "$PFX_TMP/$FILE_NAME_PFX.tar.xz"
fi fi
else else
if ! unpack "$PFX_TMP/$FILE_NAME_PFX.tar.xz" "$WINEPREFIX/" ; then if ! unpack --skip-xattr "$PFX_TMP/$FILE_NAME_PFX.tar.xz" "$WINEPREFIX/" ; then
try_remove_file "${PFX_TMP}/${FILE_NAME_PFX}.tar.xz" try_remove_file "${PFX_TMP}/${FILE_NAME_PFX}.tar.xz"
get_base_pfx "$FILE_NAME_PFX" get_base_pfx "$FILE_NAME_PFX"
fi fi
@ -1370,6 +1378,55 @@ remove_winehelper () {
fi fi
} }
create_base_pfx () {
export WINEPREFIX="$1"
check_prefix_var
local prefix_dir="$WINEPREFIX"
local drive_c_dir="$prefix_dir/drive_c"
local users_dir="$drive_c_dir/users"
local archive_path="$WH_TMP_DIR/pfx/new_${PREFIX_NAME}.tar.xz"
try_copy_dir "$prefix_dir" "${prefix_dir}_bak"
for wtlog in workaround isolate internal winxp win2 win7 win10
do sed -i "/$wtlog/d" "$prefix_dir/winetricks.log"
done
if [[ -d "$users_dir/$USER" ]] \
&& [[ ! -L "$users_dir/$USER" ]]
then
if [[ -L "$users_dir/xuser" ]]
then try_remove_dir "$users_dir/xuser/"
fi
create_new_dir "$users_dir/xuser/"
cp -fr "$users_dir/$USER"/* "$users_dir/xuser/"
fi
try_remove_file "$prefix_dir/.update-timestamp"
try_remove_file "$prefix_dir/.firstboot"
try_remove_file "$prefix_dir/last.conf"
try_remove_dir "$prefix_dir/dosdevices/"
try_remove_dir "$users_dir/$USER"
try_remove_dir "$users_dir/xuser/AppData/Local/Temp/"
try_remove_dir "$drive_c_dir/ProgramData/Package Cache/"
try_remove_dir "$drive_c_dir/windows/temp/"
try_remove_dir "$drive_c_dir/windows/Installer/"
rm -fr "$drive_c_dir/windows/Microsoft.NET"/*/*/SetupCache/
cd "$prefix_dir"
if tar --no-xattrs -c -I 'xz --memlimit=8000MiB -9 -T0' -f "$archive_path" ./* ; then
print_ok "Архив создан по пути: $archive_path"
xdg-open "$(dirname "$archive_path")" &
cd -
else
try_remove_file "$archive_path"
cd -
fatal "Не удалось создать архив."
fi
}
backup_prefix() { backup_prefix() {
export WINEPREFIX="$1" export WINEPREFIX="$1"
check_prefix_var check_prefix_var
@ -1586,6 +1643,7 @@ case "$arg1" in
restore-prefix) restore_prefix "$@" ;; restore-prefix) restore_prefix "$@" ;;
remove-all) remove_winehelper "$@" ;; remove-all) remove_winehelper "$@" ;;
remove-prefix) remove_prefix "$@" ;; remove-prefix) remove_prefix "$@" ;;
create-base-pfx) create_base_pfx "$@" ;;
*) *)
if [[ -f "$arg1" ]] ; then if [[ -f "$arg1" ]] ; then
WIN_FILE_EXEC="$(readlink -f "$arg1")" WIN_FILE_EXEC="$(readlink -f "$arg1")"