Skip to content

Commit 5573d7b

Browse files
committed
Replace unzip with bsdtar
The later is much faster and capable of supporting hundreds of compression file formats.
1 parent 5518635 commit 5573d7b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

install-release.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,27 @@ identify_the_operating_system_and_architecture() {
104104
PACKAGE_MANAGEMENT_INSTALL='apt -y --no-install-recommends install'
105105
PACKAGE_MANAGEMENT_REMOVE='apt purge'
106106
package_provide_tput='ncurses-bin'
107+
package_provide_bsdtar='libarchive-tools'
107108
elif [[ "$(type -P dnf)" ]]; then
108109
PACKAGE_MANAGEMENT_INSTALL='dnf -y install'
109110
PACKAGE_MANAGEMENT_REMOVE='dnf remove'
110111
package_provide_tput='ncurses'
112+
package_provide_bsdtar='bsdtar'
111113
elif [[ "$(type -P yum)" ]]; then
112114
PACKAGE_MANAGEMENT_INSTALL='yum -y install'
113115
PACKAGE_MANAGEMENT_REMOVE='yum remove'
114116
package_provide_tput='ncurses'
117+
package_provide_bsdtar='bsdtar'
115118
elif [[ "$(type -P zypper)" ]]; then
116119
PACKAGE_MANAGEMENT_INSTALL='zypper install -y --no-recommends'
117120
PACKAGE_MANAGEMENT_REMOVE='zypper remove'
118121
package_provide_tput='ncurses-utils'
122+
package_provide_bsdtar='bsdtar'
119123
elif [[ "$(type -P pacman)" ]]; then
120124
PACKAGE_MANAGEMENT_INSTALL='pacman -Syu --noconfirm'
121125
PACKAGE_MANAGEMENT_REMOVE='pacman -Rsn'
122126
package_provide_tput='ncurses'
127+
package_provide_bsdtar='libarchive'
123128
else
124129
echo "error: The script does not support the package manager in this operating system."
125130
exit 1
@@ -291,7 +296,7 @@ download_v2ray() {
291296
}
292297

293298
decompression() {
294-
if ! unzip -q "$1" -d "$TMP_DIRECTORY"; then
299+
if ! bsdtar -C "$TMP_DIRECTORY" -xf "$1"; then
295300
echo 'error: V2Ray decompression failed.'
296301
"rm" -r "$TMP_DIRECTORY"
297302
echo "removed: $TMP_DIRECTORY"
@@ -511,7 +516,7 @@ main() {
511516
echo 'warn: Install V2Ray from a local file, but still need to make sure the network is available.'
512517
echo -n 'warn: Please make sure the file is valid because we cannot confirm it. (Press any key) ...'
513518
read
514-
install_software 'unzip' 'unzip'
519+
install_software "$package_provide_bsdtar" 'bsdtar'
515520
decompression "$LOCAL_FILE"
516521
else
517522
# Normal way
@@ -526,7 +531,7 @@ main() {
526531
echo "removed: $TMP_DIRECTORY"
527532
exit 0
528533
fi
529-
install_software 'unzip' 'unzip'
534+
install_software "$package_provide_bsdtar" 'bsdtar'
530535
decompression "$ZIP_FILE"
531536
elif [[ "$NUMBER" -eq '1' ]]; then
532537
echo "info: No new version. The current version of V2Ray is $CURRENT_VERSION ."

0 commit comments

Comments
 (0)