Skip to content

Commit 2d94cc3

Browse files
authored
Merge pull request #102 from Araputa/main
add zypper support for SUSE
2 parents 3750157 + e97302b commit 2d94cc3

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

install.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ warn() {
3434
# root
3535
[[ $EUID != 0 ]] && err "当前非 ${yellow}ROOT用户.${none}"
3636

37-
# yum or apt-get, ubuntu/debian/centos
38-
cmd=$(type -P apt-get || type -P yum)
39-
[[ ! $cmd ]] && err "此脚本仅支持 ${yellow}(Ubuntu or Debian or CentOS)${none}."
37+
# apt-get, yum or zypper, ubuntu/debian/centos/suse
38+
cmd=$(type -P apt-get || type -P yum || type -P zypper)
39+
[[ ! $cmd ]] && err "此脚本仅支持 ${yellow}(Ubuntu or Debian or CentOS or SUSE)${none}."
4040

4141
# systemd
4242
[[ ! $(type -P systemctl) ]] && {
@@ -144,7 +144,11 @@ install_pkg() {
144144
$cmd install -y $pkg &>/dev/null
145145
if [[ $? != 0 ]]; then
146146
[[ $cmd =~ yum ]] && yum install epel-release -y &>/dev/null
147-
$cmd update -y &>/dev/null
147+
if [[ $cmd =~ zypper ]]; then
148+
$cmd --non-interactive refresh &>/dev/null
149+
else
150+
$cmd update -y &>/dev/null
151+
fi
148152
$cmd install -y $pkg &>/dev/null
149153
[[ $? == 0 ]] && >$is_pkg_ok
150154
else

src/init.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ _wget() {
5858
wget --no-check-certificate "$@"
5959
}
6060

61-
# yum or apt-get
62-
cmd=$(type -P apt-get || type -P yum)
61+
# apt-get, yum or zypper
62+
cmd=$(type -P apt-get || type -P yum || type -P zypper)
6363

6464
# x64
6565
case $(arch) in

0 commit comments

Comments
 (0)