BG5 commited on
Commit
afec5c1
·
verified ·
1 Parent(s): 23dae13

Rename install.sh to webmininstall.sh

Browse files
Files changed (2) hide show
  1. install.sh +0 -759
  2. webmininstall.sh +197 -0
install.sh DELETED
@@ -1,759 +0,0 @@
1
- #!/bin/bash
2
- PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
3
- export PATH
4
- LANG=en_US.UTF-8
5
-
6
- STRIPE_LINE="----------------------------------------------------"
7
- DOUBLE_STRIPE_LINE="============================================"
8
-
9
- HTTP_STR="http"
10
-
11
- XP_VERSION="v1.1.12"
12
-
13
- API_HOST="https://api.xp.cn"
14
- DL_HOST="https://dl.xp.cn"
15
-
16
- current_dir=$(pwd)
17
- INSTALL_LOG_PATH="${current_dir}/xp-install.log"
18
-
19
- start_time=`date +%s`
20
-
21
- IDC_CODE=""
22
-
23
- if [ $(whoami) != "root" ];then
24
- echo "xp面板安装命令需要root权限执行"
25
- exit 1;
26
- fi
27
-
28
- is64bit=$(getconf LONG_BIT)
29
- if [ "${is64bit}" != '64' ];then
30
- echo "xp面板仅支持64位系统安装";
31
- fi
32
-
33
- arch_check=$(uname -m)
34
- if [ "${arch_check}" != "x86_64" ] && [ "${arch_check}" != "amd64" ]; then
35
- echo "xp面板仅支持x86_64或者amd64架构CPU的系统安装";
36
- fi
37
-
38
- # Centos6不支持安装
39
- centos6_check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')
40
- if [ "${centos6_check}" ];then
41
- echo "xp面板不支持Centos6,请更换Centos7/8或更高版本的系统"
42
- exit 1
43
- fi
44
-
45
- # ubuntu16以下不支持安装
46
- ubuntu_check=$(cat /etc/issue|grep Ubuntu|awk '{print $2}'|cut -f 1 -d '.')
47
- if [ "${ubuntu_check}" ] && [ "${ubuntu_check}" -lt "16" ];then
48
- echo "xp面板不支持Ubuntu ${ubuntu_check},请更换Ubuntu18/20或更高版本的系统"
49
- exit 1
50
- fi
51
-
52
- hostname_check=$(cat /etc/hostname)
53
- if [ -z "${hostname_check}" ];then
54
- echo "无法安装xp面板,因为当前主机名hostname为空,请设置hostname后重新安装"
55
- exit 1
56
- fi
57
-
58
- Get_LocalInfo(){
59
- if [ -s "/etc/redhat-release" ];then
60
- SYS_VERSION=$(cat /etc/redhat-release | sed 's/\\n//g' | sed 's/\\l//g')
61
- elif [ -s "/etc/issue" ]; then
62
- SYS_VERSION=$(cat /etc/issue | sed 's/\\n//g' | sed 's/\\l//g' | tr -d '\n' | tr -d '\n')
63
- fi
64
- SYS_INFO=$(uname -a)
65
- SYS_BIT=$(getconf LONG_BIT)
66
- MEM_TOTAL=$(free -m|grep Mem|awk '{print $2}')
67
- CPU_INFO=$(getconf _NPROCESSORS_ONLN)
68
- DISK_USE=$(df -h / | tail -n 1 | awk '{printf "size:%s;used:%s;avil:%s;percent:%s", $2, $3, $4, $5}')
69
- }
70
-
71
- cd ~
72
- SETUP_PATH="/xp"
73
-
74
- Get_Sysinfo(){
75
- Get_LocalInfo
76
-
77
- echo -e ${SYS_VERSION}
78
- echo -e Bit:${SYS_BIT} Mem:${MEM_TOTAL}M Core:${CPU_INFO}
79
- echo -e ${SYS_INFO}
80
- echo -e "${DOUBLE_STRIPE_LINE}"
81
- echo -e "请截图以上报错信息发给客服人员"
82
- echo -e "${DOUBLE_STRIPE_LINE}"
83
- if [ -f "/usr/bin/qrencode" ];then
84
- echo -e "微信扫码联系企业微信技术求助"
85
- echo -e "${DOUBLE_STRIPE_LINE}"
86
- qrencode -t ANSIUTF8 "https://work.weixin.qq.com/kfid/kfc8e99c5e9fb4761c6"
87
- echo -e "${DOUBLE_STRIPE_LINE}"
88
- else
89
- echo -e "手机访问以下链接、扫码联系企业微信技术求助"
90
- echo -e "${DOUBLE_STRIPE_LINE}"
91
- echo -e "联系链接:https://work.weixin.qq.com/kfid/kfc8e99c5e9fb4761c6"
92
- echo -e "${DOUBLE_STRIPE_LINE}"
93
- fi
94
- }
95
-
96
- Red_Err(){
97
- echo "${DOUBLE_STRIPE_LINE}";
98
- printf '\033[1;31;40m%b\033[0m\n' "$@";
99
- Get_Sysinfo
100
- Analysis_Log
101
- exit 1;
102
- }
103
-
104
- # 检测是否装了别的环境
105
- Env_Check(){
106
- mysqld_exists=$(ps -ef |grep mysqld|grep -v grep|grep -v /www/server/mysql)
107
- php_exists=$(ps -ef|grep php-fpm|grep master|grep -v /www/server/php)
108
- nginx_exists=$(ps -ef|grep nginx|grep master|grep -v /www/server/nginx)
109
- httpd_exists=$(ps -ef |grep -E 'httpd|apache'|grep -v /www/server/apache|grep -v grep)
110
- if [ "${php_exists}" ] || [ "${mysqld_exists}" ] || [ "${nginx_exists}" ] || [ "${httpd_exists}" ];then
111
- Force_Install_Confirm
112
- fi
113
- }
114
-
115
- # 强制安装确认
116
- Force_Install_Confirm(){
117
- if [ "${INSTALL_FORCE}" ];then
118
- return
119
- fi
120
- echo -e "${STRIPE_LINE}"
121
- echo -e "检查已有其他Web/mysql环境,继续安装可能影响现有站点及数据"
122
- echo -e "Web/mysql service is alreday installed,Can't install panel"
123
- echo -e "${STRIPE_LINE}"
124
- echo -e "已知风险/Enter yes to force installation"
125
- read -p "输入yes强制安装: " yes;
126
- if [ "$yes" != "yes" ];then
127
- echo -e "------------"
128
- echo "取消安装"
129
- exit;
130
- fi
131
- start_time=`date +%s`
132
- INSTALL_FORCE="true"
133
- }
134
-
135
- # 获取包管理器
136
- Get_PM(){
137
- if [ -f "/usr/bin/yum" ] && [ -d "/etc/yum.repos.d" ]; then
138
- PM="yum"
139
- elif [ -f "/usr/bin/apt-get" ] && [ -f "/usr/bin/dpkg" ]; then
140
- PM="apt-get"
141
- fi
142
- }
143
-
144
- # 自动挂载Swap
145
- Auto_Swap_Mem(){
146
- MEM_TOTAL=$(free -g|grep Mem|awk '{print $2}')
147
- if [ "${MEM_TOTAL}" -le "1" ];then
148
- swap=$(free |grep Swap|awk '{print $2}')
149
- if [ "${swap}" -gt 1 ];then
150
- echo "Swap total sizse: $swap";
151
- return;
152
- fi
153
- if [ ! -d /www ];then
154
- mkdir /www
155
- fi
156
- swap_file="/www/swap"
157
- dd if=/dev/zero of=$swap_file bs=1M count=1025
158
- mkswap -f $swap_file
159
- swapon $swap_file
160
- echo "$swap_file swap swap defaults 0 0" >> /etc/fstab
161
- swap=`free |grep Swap|awk '{print $2}'`
162
- if [ $swap -gt 1 ];then
163
- echo "Swap total sizse: $swap";
164
- return;
165
- fi
166
-
167
- sed -i "/\/www\/swap/d" /etc/fstab
168
- rm -f $swap_file
169
- fi
170
- }
171
-
172
- Add_Service(){
173
- if [ "${PM}" == "yum" ] || [ "${PM}" == "dnf" ]; then
174
- chkconfig --add xpd
175
- chkconfig --level 2345 xpd on
176
- sudo cp ${SETUP_PATH}/init/xpd.service /usr/lib/systemd/system/xpd.service
177
- sudo chmod +x /usr/lib/systemd/system/xpd.service
178
- sudo systemctl enable xpd
179
- elif [ "${PM}" == "apt-get" ]; then
180
- sudo update-rc.d xpd defaults
181
- fi
182
- }
183
-
184
- # 设置软件源
185
- Set_Centos_Repo(){
186
- huawei_check=$(cat /etc/motd |grep "Huawei Cloud")
187
- if [ "${huawei_check}" ] && [ "${is64bit}" == "64" ];then
188
- \cp -rpa /etc/yum.repos.d/ /etc/yumBak
189
- sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
190
- sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
191
- rm -f /etc/yum.repos.d/epel.repo
192
- rm -f /etc/yum.repos.d/epel-*
193
- fi
194
- aliyun_check=$(cat /etc/motd|grep "Alibaba Cloud ")
195
- if [ "${aliyun_check}" ] && [ "${is64bit}" == "64" ] && [ ! -f "/etc/yum.repos.d/Centos-vault-8.5.2111.repo" ];then
196
- rename '.repo' '.repo.bak' /etc/yum.repos.d/*.repo
197
- wget https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo -O /etc/yum.repos.d/Centos-vault-8.5.2111.repo
198
- wget https://mirrors.aliyun.com/repo/epel-archive-8.repo -O /etc/yum.repos.d/epel-archive-8.repo
199
- sed -i 's/mirrors.cloud.aliyuncs.com/url_tmp/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo && sed -i 's/url_tmp/mirrors.aliyun.com/g' /etc/yum.repos.d/Centos-vault-8.5.2111.repo
200
- sed -i 's/mirrors.aliyun.com/mirrors.cloud.aliyuncs.com/g' /etc/yum.repos.d/epel-archive-8.repo
201
- fi
202
- mirror_check=$(cat /etc/yum.repos.d/CentOS-Linux-AppStream.repo |grep "[^#]mirror.centos.org")
203
- if [ "${mirror_check}" ] && [ "${is64bit}" == "64" ];then
204
- \cp -rpa /etc/yum.repos.d/ /etc/yumBak
205
- sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
206
- sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
207
- fi
208
- }
209
-
210
- # 安装rpm的基础包
211
- Install_RPM_Base_Pkg(){
212
- yum_path=/etc/yum.conf
213
- centos8_check=$(cat /etc/redhat-release | grep ' 8.' | grep -iE 'centos|Red Hat')
214
- if [ "${centos8_check}" ];then
215
- Set_Centos_Repo
216
- fi
217
- is_exc=$(cat $yum_path|grep httpd)
218
- if [ "$is_exc" = "" ];then
219
- echo "exclude=httpd nginx php mysql mairadb python-psutil python2-psutil" >> $yum_path
220
- fi
221
-
222
- if [ -f "/etc/redhat-release" ] && [ $(cat /etc/os-release|grep PLATFORM_ID|grep -oE "el8") ];then
223
- yum config-manager --set-enabled powertools
224
- yum config-manager --set-enabled PowerTools
225
- fi
226
-
227
- if [ -f "/etc/redhat-release" ] && [ $(cat /etc/os-release|grep PLATFORM_ID|grep -oE "el9") ];then
228
- dnf config-manager --set-enabled crb -y
229
- fi
230
-
231
- # 同步服务器时间
232
- echo 'Synchronizing system time...'
233
- get_server_time=$(curl -sS --connect-timeout 3 -m 60 ${API_HOST}/api/getTime)
234
- if [ "${get_server_time}" ];then
235
- date -s "$(date -d @$get_server_time +"%Y-%m-%d %H:%M:%S")"
236
- fi
237
-
238
- if [ -z "${centos8_check}" ]; then
239
- yum install ntp -y
240
- rm -rf /etc/localtime
241
- ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
242
-
243
- # 尝试同步国际时间(从ntp服务器)
244
- ntpdate 0.asia.pool.ntp.org
245
- setenforce 0
246
- fi
247
-
248
- sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
249
- yum_packs="libcurl-devel wget tar gcc make zip unzip openssl openssl-devel libxml2 libxml2-devel libxslt* zlib zlib-devel libjpeg-devel libpng-devel libwebp libwebp-devel freetype freetype-devel lsof pcre pcre-devel vixie-cron crontabs icu libicu-devel c-ares libffi-devel bzip2-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel qrencode clang libaio ncurses-compat-libs"
250
- echo "下列软件将被安装:${yum_packs}"
251
- yum install -y --skip-broken ${yum_packs}
252
-
253
- for yum_pack in ${yum_packs}
254
- do
255
- rpm_pack=$(rpm -q ${yum_pack})
256
- pack_check=$(echo ${rpm_pack}|grep not)
257
- if [ "${pack_check}" ]; then
258
- yum install ${yum_pack} -y
259
- fi
260
- done
261
-
262
- echo "安装必备软件:iptables"
263
- yum install -y iptables
264
-
265
- if [ -f "/usr/bin/dnf" ]; then
266
- dnf install -y redhat-rpm-config
267
- fi
268
-
269
- ali_os=$(cat /etc/redhat-release |grep "Alibaba Cloud Linux release 3")
270
- if [ -z "${ali_os}" ];then
271
- yum install epel-release -y
272
- fi
273
- }
274
-
275
- # 安装deb基础包
276
- Install_Deb_Base_Pkg(){
277
- # 如果apt存在锁,则手动删除释放锁文件
278
- lf_pid=$(sudo lsof /var/lib/dpkg/lock-frontend | awk 'NR==2{print $2}')
279
- if [ -n "$lf_pid" ]; then
280
- sudo kill -9 $lf_pid
281
- fi
282
- l_pid=$(sudo lsof /var/lib/dpkg/lock | awk 'NR==2{print $2}')
283
- if [ -n "$l_pid" ]; then
284
- sudo kill -9 $l_pid
285
- fi
286
-
287
- ln -sf bash /bin/sh
288
- ubuntu_22=$(cat /etc/issue|grep "Ubuntu 22")
289
- if [ "${ubuntu_22}" ];then
290
- apt-get remove needrestart -y
291
- fi
292
- aliyun_check=$(cat /etc/motd|grep "Alibaba Cloud ")
293
- if [ "${aliyun_check}" ] && [ "${ubuntu_22}" ];then
294
- apt-get remove libicu70 -y
295
- fi
296
- apt-get update -y
297
- apt-get install bash -y
298
- if [ -f "/usr/bin/bash" ];then
299
- ln -sf /usr/bin/bash /bin/sh
300
- fi
301
- apt-get install ruby -y
302
- apt-get install lsb-release -y
303
-
304
- libcurl_ver=$(dpkg -l|grep libcurl4|awk '{print $3}')
305
- if [ "${libcurl_ver}" == "7.68.0-1ubuntu2.8" ];then
306
- apt-get remove libcurl4 -y
307
- apt-get install curl -y
308
- fi
309
-
310
- deb_packs="wget curl libcurl4-openssl-dev gcc make zip unzip tar openssl libssl-dev libxml2 libxml2-dev zlib1g zlib1g-dev libjpeg-dev libpng-dev lsof libpcre3 libpcre3-dev cron net-tools swig build-essential libffi-dev libbz2-dev libncurses-dev libsqlite3-dev iptables libreadline-dev tk-dev libgdbm-dev libdb-dev libdb++-dev libpcap-dev xz-utils git qrencode libwebp-dev libsodium-dev clang libaio1 libncurses5"
311
- echo "下列软件将被安装:${deb_packs}"
312
- apt-get install -y -m $deb_packs --force-yes
313
-
314
- for deb_pack in ${deb_packs}
315
- do
316
- pack_check=$(dpkg -l|grep ${deb_pack})
317
- if [ "$?" -ne "0" ] ;then
318
- apt-get install -y $deb_pack
319
- fi
320
- done
321
-
322
- echo "安装必备软件:iptables"
323
- apt-get install -y iptables
324
-
325
- if [ ! -d '/etc/letsencrypt' ];then
326
- mkdir -p /etc/letsencryp
327
- mkdir -p /var/spool/cron
328
- if [ ! -f '/var/spool/cron/crontabs/root' ];then
329
- echo '' > /var/spool/cron/crontabs/root
330
- chmod 600 /var/spool/cron/crontabs/root
331
- fi
332
- fi
333
- }
334
-
335
- Init_DB(){
336
- if [ ! -d "${SETUP_PATH}/db" ];then
337
- Red_Err "数据库文件缺失,请检查安装包"
338
- exit 1
339
- fi
340
- if [ ! -f "${SETUP_PATH}/init/init.sql" ];then
341
- Red_Err "初始化数据文件缺失,请检查安装包"
342
- exit 1
343
- fi
344
-
345
- chmod -R 0777 ${SETUP_PATH}/db
346
-
347
- time_now_str=$(date "+%Y-%m-%d %H:%M:%S")
348
- sed -i -e "s/{port}/${panel_port}/g" -e "s/{account}/${panel_user}/g" -e "s/{pwd}/${panel_pwd}/g" -e "s/{pwdMd5}/${panel_pwd_md5}/g" -e "s/{safeEntry}/${safe_entry}/g" -e "s/{time}/${time_now_str}/g" -e "s/{xpVersion}/${XP_VERSION}/g" -e "s/{idcCode}/${IDC_CODE}/g" ${SETUP_PATH}/init/init.sql
349
-
350
- msg=$(sqlite3 ${SETUP_PATH}/db/app.db < ${SETUP_PATH}/init/init.sql 2>&1)
351
- if [ $? -ne 0 ];then
352
- Red_Err "数据库初始化失败,错误信息:${msg}"
353
- exit 1
354
- fi
355
- }
356
-
357
- Down_Deps(){
358
- for pkg in $@
359
- do
360
- dl_url="${DL_HOST}/deps/${pkg}.tar.gz"
361
- cd ${SETUP_PATH}/download
362
- wget -O ./${pkg}.tar.gz "${dl_url}"
363
- mkdir -p ./${pkg}
364
- tar -zxvf ./${pkg}.tar.gz -C ./${pkg}
365
- sudo bash ./${pkg}/${pkg}_install.sh
366
- cd $current_dir
367
- done
368
- }
369
-
370
- Check_CMD(){
371
- for cmd in $@
372
- do
373
- if ! command -v "$cmd" &> /dev/null; then
374
- Red_Err "Error: Command '$cmd' not found."
375
- exit 1
376
- fi
377
- done
378
- }
379
-
380
- Down_XP(){
381
- mkdir -p $SETUP_PATH/download
382
- wget -O ${SETUP_PATH}/download/xp-panel.tar.gz "${DL_HOST}/dl/xp/xp-panel.tar.gz"
383
- }
384
-
385
- Init_Tools(){
386
- xp_tools_dir="/xp/tools"
387
-
388
- if [ -d "$xp_tools_dir" ]; then
389
- for tool in "$xp_tools_dir"/*.sh; do
390
- filename=$(basename "$tool" .sh)
391
- if [ -L "/usr/bin/$filename" ]; then
392
- rm "/usr/bin/$filename"
393
- fi
394
- ln -s "$tool" "/usr/bin/$filename"
395
- done
396
- fi
397
- }
398
-
399
- Init_XP(){
400
- Check_CMD sqlite3 iptables vsftpd
401
-
402
- mkdir -p $SETUP_PATH/server
403
- mkdir -p $SETUP_PATH/panel
404
- mkdir -p $SETUP_PATH/wwwlogs
405
- mkdir -p $SETUP_PATH/applogs
406
- mkdir -p $SETUP_PATH/www
407
- mkdir -p $SETUP_PATH/backup
408
- mkdir -p $SETUP_PATH/db
409
- mkdir -p $SETUP_PATH/init
410
-
411
- cd $SETUP_PATH
412
- sudo tar -zxvf $SETUP_PATH/download/xp-panel.tar.gz -C $SETUP_PATH > /dev/null 2>&1
413
-
414
- sudo chown -R root /xp/*
415
- sudo chmod -R 0777 /xp/*
416
-
417
- # 给程序执行权限
418
- sudo chmod +x /xp/panel/app
419
- sudo chmod +x /xp/tasks/xp-tasks
420
- sudo chmod +x /xp/*.sh
421
-
422
- if [ ! -d "/etc/init.d" ];then
423
- mkdir -p /etc/init.d
424
- fi
425
-
426
- if [ -f "/etc/init.d/xpd" ]; then
427
- /etc/init.d/xpd stop
428
- sleep 1
429
- fi
430
-
431
- # 添加一个www用户
432
- run_user="www"
433
- www_user=$(cat /etc/passwd|cut -d ":" -f 1|grep ^www$)
434
- if [ "${www_user}" != "www" ];then
435
- groupadd ${run_user}
436
- useradd -s /sbin/nologin -g ${run_user} ${run_user}
437
- fi
438
-
439
- # 设置面板端口
440
- panel_port="7860"
441
- # if [ "${PANEL_PORT}" ];then
442
- # # ��查端口是否被占用
443
- # result=$(netstat -tln | grep ":${PANEL_PORT}")
444
- # if [ -n "$result" ]; then
445
- # Red_Err "安装面板失败,指定的端口 ${PANEL_PORT} 已被占用"
446
- # fi
447
- # panel_port=$PANEL_PORT
448
- # else
449
- # # 随机生成端口号
450
- # panel_port=$(expr $RANDOM % 55535 + 10000)
451
- # # 检查端口是否被占用
452
- # result=$(netstat -tln | grep ":$panel_port")
453
- # while [ -n "$result" ]; do
454
- # panel_port=$(expr $RANDOM % 55535 + 10000)
455
- # result=$(netstat -tln | grep ":$panel_port")
456
- # done
457
- # fi
458
-
459
- # 设置面板用户名
460
- panel_user=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
461
- if [ "$PANEL_USER" ];then
462
- panel_user=$PANEL_USER
463
- fi
464
-
465
- # 生成面板默认密码
466
- panel_pwd=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
467
- if [ "$PANEL_PWD" ];then
468
- panel_pwd=$PANEL_PWD
469
- fi
470
- sleep 1
471
- panel_pwd_md5=$(echo -n $panel_pwd | md5sum | cut -d ' ' -f 1)
472
-
473
- # 生成安全入口
474
- if [ -z "$SAFE_ENTRY" ];then
475
- safe_entry=$(cat /dev/urandom | head -n 16 | md5sum | head -c 6)
476
- else
477
- safe_entry=$SAFE_ENTRY
478
- fi
479
-
480
- # 安装xp服务
481
- sudo cp ${SETUP_PATH}/init/xpd /etc/init.d/xpd
482
- sudo chmod +x /etc/init.d/xpd
483
-
484
- # 给xp脚本创建软连接
485
- sudo chmod 777 /xp/xp.sh
486
- if [ -f "/usr/bin/xp" ];then
487
- sudo rm -f /usr/bin/xp
488
- fi
489
- sudo ln -s /xp/xp.sh /usr/bin/xp
490
-
491
- # 给tools目录下的脚本创建软连接
492
- Init_Tools
493
-
494
- Init_DB
495
-
496
- # 配置vsftpd
497
- sudo touch /var/log/vsftpd.log
498
- sudo chmod 777 /var/log/vsftpd.log
499
- sudo touch /var/log/vsftpd_xfer.log
500
- sudo chmod 777 /var/log/vsftpd_xfer.log
501
- sudo setsid /usr/local/bin/vsftpd /etc/vsftpd.conf &
502
- }
503
-
504
- Get_IP_Info(){
505
- IP_ADDR=""
506
- IP_ADDR=$(curl -sS --connect-timeout 10 -m 60 ${API_HOST}/api/myIP)
507
-
508
- LOCAL_IP=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
509
- }
510
-
511
- Kill_Old_XP(){
512
- sudo pkill -f /xp/panel/app
513
- sudo pkill -f /xp/tasks/xp-task
514
- }
515
-
516
- End(){
517
- sudo bash $SETUP_PATH/run.sh
518
- echo -e "\033[32m小皮面板启动中\033[0m"
519
-
520
- Panel_Pid=$(ps -ef | grep /xp/panel/app | grep -v grep | awk '{print $2}')
521
- Panel_Status="面板状态:未知"
522
- if [ -n "${Panel_Pid}" ]; then
523
- Panel_Status="\033[32m面板状态:运行中\033[0m"
524
- else
525
- Panel_Status="\033[31m面板状态:未运行\033[0m"
526
- fi
527
-
528
- Task_Pid=$(sudo ps -ef | grep /xp/tasks/xp-tasks | grep -v grep | awk '{print $2}')
529
- Task_Status="面板状态:未知"
530
- if [ -n "${Task_Pid}" ]; then
531
- Task_Status="\033[32m队列状态:运行中\033[0m"
532
- else
533
- Task_Status="\033[31m队列状态:未运行\033[0m"
534
- fi
535
- echo -e "================================================================"
536
- echo -e " \033[32m小皮面板安装成功\033[0m"
537
- echo -e "=========================面板状态==============================="
538
- echo -e " ${Panel_Status}"
539
- echo -e " ${Task_Status}"
540
- echo -e "=========================面板账户信息==========================="
541
- echo -e ""
542
- echo -e " 面板版本: ${XP_VERSION}"
543
- echo -e " 外网面板地址: ${HTTP_STR}://${IP_ADDR}:${panel_port}/${safe_entry}"
544
- echo -e " 内网面板地址: ${HTTP_STR}://${LOCAL_IP}:${panel_port}/${safe_entry}"
545
- echo -e " username: ${panel_user}"
546
- echo -e " password: ${panel_pwd}"
547
- echo -e ""
548
- echo -e "=========================面板注意事项==========================="
549
- echo -e ""
550
- echo -e " 【云服务器】请在安全组放行 $panel_port 端口"
551
- echo -e " 面板工具命令: xp"
552
- echo -e ""
553
- echo -e "================================================================"
554
- end_time=`date +%s`
555
- ((out_time=($end_time-$start_time)))
556
- echo -e "安装花费时间:\033[32m $out_time \033[0m秒"
557
- echo -e "安装日志路径:\033[32m $INSTALL_LOG_PATH \033[0m"
558
-
559
- echo -e "安装花费时间:\033[32m $out_time \033[0m秒"
560
- }
561
-
562
- Install_Tip(){
563
- echo "+${STRIPE_LINE}${STRIPE_LINE}"
564
- echo "| xp-panel for CentOS/Ubuntu/Debian"
565
- echo "+${STRIPE_LINE}${STRIPE_LINE}"
566
- echo "| Copyright © 2015-2050 XP-SOFT(https://xp.cn) All rights reserved."
567
- echo "+${STRIPE_LINE}${STRIPE_LINE}"
568
- echo "| The WebPanel URL will be http://SERVER_IP:${PANEL_PORT} when installed."
569
- echo "+${STRIPE_LINE}${STRIPE_LINE}"
570
- echo "| 为了您的正常使用,请确保使用全新或纯净的系统安装小皮面板"
571
- echo "+${STRIPE_LINE}${STRIPE_LINE}"
572
- echo "| 安装后可能会影响您系统原有的防火墙、ftp、数据库、开发环境等"
573
- echo "+${STRIPE_LINE}${STRIPE_LINE}"
574
- echo "| 开始安装后将会停止系统正在运行的小皮面板,并覆盖之前面板的数据,请注意备份"
575
- echo "+${STRIPE_LINE}${STRIPE_LINE}"
576
- }
577
-
578
- Open_Log(){
579
- touch $INSTALL_LOG_PATH
580
- exec 4>$INSTALL_LOG_PATH
581
- exec > >(tee >(cat >&4)) 2>&1
582
- }
583
-
584
- Analysis_Log(){
585
- exec 4>&-
586
- err_end=$(grep -n "请截图以上报错信息发给客服人员" $INSTALL_LOG_PATH | cut -d: -f1 | tail -n 1)
587
- if [ -n "$err_end" ]; then
588
- err_start=$(($err_end - 50))
589
- if [ $err_start -lt 0 ]; then
590
- err_start=1
591
- fi
592
- err=$(sed 's/\x1B\[[0-9;]*[JKmsu]//g' $INSTALL_LOG_PATH | sed -n "${err_start},${err_end}p" | tr '\n' ';')
593
- d='{"ver": "'${XP_VERSION}'", "err": "'${err}'","sysInfo": "'${SYS_INFO}'", "ip":"", "idc":"'${IDC_CODE}'"}'
594
- curl -s -X POST -H "Content-Type: application/json" -d "${d}" "${API_HOST}/api/installErr" 2>&1 >/dev/null
595
- fi
596
-
597
- err_end=$(grep -n "状态:未运行" $INSTALL_LOG_PATH | cut -d: -f1 | tail -n 1)
598
- if [ -n "$err_end" ]; then
599
- err_start=$(($err_end - 50))
600
- if [ $err_start -lt 0 ]; then
601
- err_start=1
602
- fi
603
- err=$(sed 's/\x1B\[[0-9;]*[JKmsu]//g' $INSTALL_LOG_PATH | sed -n "${err_start},${err_end}p" | tr '\n' ';')
604
- d='{"ver": "'${XP_VERSION}'", "err": "'${err}'","sysInfo": "'${SYS_INFO}'"}'
605
- curl -s -X POST -H "Content-Type: application/json" -d "${d}" "${API_HOST}/api/installErr" 2>&1 >/dev/null
606
- fi
607
- }
608
-
609
- Disable_Sudo_TTY(){
610
- if [ -f "/etc/sudoers" ]; then
611
- tty_mode=$(grep '^Default.*requiretty' /etc/sudoers)
612
- if [ -n "$tty_mode" ]; then
613
- sed -i 's/^Default.*requiretty/#&/' /etc/sudoers
614
- fi
615
- fi
616
- }
617
-
618
- Select_DlNode(){
619
- echo "select download node..."
620
- json_str=$(curl -s "${API_HOST}/api/dlNodes")
621
- if ! echo $json_str | grep -q '"ip":'; then
622
- echo "get download nodes failed, use default node"
623
- return
624
- fi
625
- ips=$(echo $json_str | grep -oP '"ip"\s*:\s*"\K[^"]+')
626
- min_delay_sec=5.0
627
- fasted_ip=""
628
- for ip in $ips
629
- do
630
- delay_sec=$(timeout 5 curl -o /dev/null -s -w "%{time_total}" ${ip} || echo 999.0)
631
- comp_result=$(echo "${delay_sec} < ${min_delay_sec}" | awk '{print ($1 < $3) ? "1" : "0"}')
632
- if [ $comp_result -eq 1 ]; then
633
- min_delay_sec=$delay_sec
634
- fasted_ip=$ip
635
- fi
636
- done
637
- if [ -z "$fasted_ip" ]; then
638
- echo "test download nodes error, use default node"
639
- return
640
- fi
641
-
642
- if grep -q "dl.xp.cn" /etc/hosts; then
643
- sed -i "s/.*dl.xp.cn.*/${fasted_ip} dl.xp.cn/g" /etc/hosts
644
- else
645
- echo -e "\n${fasted_ip} dl.xp.cn\n" >> /etc/hosts
646
- fi
647
- echo "select fasted download node finish"
648
- }
649
-
650
- Set_Cent_Repo_Source() {
651
- distro=$(cat /etc/centos-release | awk '{print $1}')
652
- version=$(cat /etc/centos-release | awk '{print $4}' | cut -d '.' -f1)
653
- if [ "$distro" == "CentOS" ]; then
654
- echo "开始替换 CentOS 的源为阿里源..."
655
- if [ "$version" == "7" ]; then
656
- echo "正在替换为 CentOS 7 的阿里源..."
657
- sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
658
- sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
659
- sudo yum clean all && sudo yum makecache
660
- echo "替换完成!"
661
- elif [ "$version" == "8" ]; then
662
- echo "正在替换为 CentOS 8 的阿里源..."
663
- sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
664
- sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
665
- sudo yum clean all && sudo yum makecache
666
- echo "替换完成!"
667
- else
668
- echo "不支持替换阿里源的 CentOS 版本:$version"
669
- fi
670
- fi
671
- }
672
-
673
- Install_Main(){
674
- Kill_Old_XP
675
- Env_Check
676
- Get_PM
677
-
678
- Auto_Swap_Mem
679
-
680
- Set_Cent_Repo_Source
681
-
682
- if [ "${PM}" = "yum" ]; then
683
- Install_RPM_Base_Pkg
684
- elif [ "${PM}" = "apt-get" ]; then
685
- Install_Deb_Base_Pkg
686
- fi
687
-
688
- Get_IP_Info
689
-
690
- Select_DlNode
691
-
692
- Down_XP
693
- Down_Deps sqlite3 vsftpd
694
-
695
- Open_Log
696
-
697
- Disable_Sudo_TTY
698
-
699
- Init_XP
700
- Add_Service
701
- End
702
- exit 0
703
- Analysis_Log
704
- exit 0
705
- }
706
-
707
- Install_Tip
708
-
709
- # go="wait" # 确认安装的等待
710
- # while [ ${#} -gt 0 ]; do
711
- # case $1 in
712
- # -u|--user)
713
- # PANEL_USER=$2
714
- # shift 1
715
- # ;;
716
- # -p|--password)
717
- # PANEL_PWD=$2
718
- # shift 1
719
- # ;;
720
- # -P|--port)
721
- # PANEL_PORT=$2
722
- # shift 1
723
- # ;;
724
- # --safe-entry)
725
- # SAFE_ENTRY=$2
726
- # shift 1
727
- # ;;
728
- # --ssl-disable)
729
- # SSL_PL="disable"
730
- # ;;
731
- # -y)
732
- # go="y"
733
- # ;;
734
- # *)
735
- # IDC_CODE=$1
736
- # ;;
737
- # esac
738
- # shift 1
739
- # done
740
-
741
- # while [ "$go" != 'Y' ] && [ "$go" != 'y' ] && [ "$go" != 'n' ] && [ "$go" != '' ]
742
- # do
743
- # read -p "Do you want to install xp-panel to the $SETUP_PATH directory now?(Y/n): " go;
744
- # done
745
-
746
- # if [ "$go" == 'n' ];then
747
- # exit;
748
- # fi
749
-
750
- # Get_LocalInfo
751
-
752
- # d='{"hostname": "'${hostname_check}'", "cpu": "'${CPU_INFO}'", "memory": "'${MEM_TOTAL}'", "diskUsage": "'${DISK_USE}'", "sysInfo": "'${SYS_INFO}'", "os": "'${SYS_VERSION}'", "idc": "'${IDC_CODE}'"}'
753
- # curl -s -X POST -H "Content-Type: application/json" -d "${d}" "${API_HOST}/api/addInstallInfo" 2>&1 >/dev/null
754
-
755
- Install_Main
756
- echo -e "666666666666666666666666666666666666666666"
757
- exit 0
758
- # 安装完成删除安装包
759
- rm -f $SETUP_PATH/download/xp-panel.tar.gz
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
webmininstall.sh ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # shellcheck disable=SC1090 disable=SC2059 disable=SC2164 disable=SC2181
3
+ # setup-repos.sh
4
+ # Configures Webmin repository for RHEL and Debian systems (derivatives)
5
+
6
+ webmin_host="download.webmin.com"
7
+ webmin_download="https://$webmin_host"
8
+ webmin_key="developers-key.asc"
9
+ webmin_key_download="$webmin_download/$webmin_key"
10
+ webmin_key_suffix="webmin-developers"
11
+ debian_repo_file="/etc/apt/sources.list.d/webmin.list"
12
+ rhel_repo_file="/etc/yum.repos.d/webmin.repo"
13
+ download_wget="/usr/bin/wget"
14
+ download="$download_wget -nv"
15
+
16
+ # Temporary colors
17
+ NORMAL=''
18
+ GREEN=''
19
+ RED=''
20
+ ITALIC=''
21
+ BOLD=''
22
+ if tty -s; then
23
+ NORMAL="$(tput sgr0)"
24
+ GREEN=$(tput setaf 2)
25
+ RED="$(tput setaf 1)"
26
+ BOLD=$(tput bold)
27
+ ITALIC=$(tput sitm)
28
+ fi
29
+
30
+ # Check user permission
31
+ if [ "$(id -u)" -ne 0 ]; then
32
+ echo "${RED}Error:${NORMAL} \`setup-repos.sh\` script must be run as root!" >&2
33
+ exit 1
34
+ fi
35
+
36
+ # Go to temp
37
+ cd "/tmp" 1>/dev/null 2>&1
38
+ if [ "$?" != "0" ]; then
39
+ echo "${RED}Error:${NORMAL} Failed to switch to \`/tmp\` directory!"
40
+ exit 1
41
+ fi
42
+
43
+ # Check for OS release file
44
+ osrelease="/etc/os-release"
45
+ if [ ! -f "$osrelease" ]; then
46
+ echo "${RED}Error:${NORMAL} Cannot detect OS!"
47
+ exit 1
48
+ fi
49
+
50
+ # Detect OS and package manager and install command
51
+ . "$osrelease"
52
+ if [ -n "${ID_LIKE}" ]; then
53
+ osid="$ID_LIKE"
54
+ else
55
+ osid="$ID"
56
+ fi
57
+ if [ -z "$osid" ]; then
58
+ echo "${RED}Error:${NORMAL} Failed to detect OS!"
59
+ exit 1
60
+ fi
61
+
62
+ # Derivatives precise test
63
+ osid_debian_like=$(echo "$osid" | grep "debian\|ubuntu")
64
+ osid_rhel_like=$(echo "$osid" | grep "rhel\|fedora\|centos")
65
+
66
+ repoid_debian_like=debian
67
+ if [ -n "${ID}" ]; then
68
+ repoid_debian_like="${ID}"
69
+ fi
70
+
71
+ # Setup OS dependent
72
+ if [ -n "$osid_debian_like" ]; then
73
+ package_type=deb
74
+ install_cmd="apt-get install --install-recommends"
75
+ install="$install_cmd --quiet --assume-yes"
76
+ clean="apt-get clean"
77
+ update="apt-get update"
78
+ elif [ -n "$osid_rhel_like" ]; then
79
+ package_type=rpm
80
+ if command -pv dnf 1>/dev/null 2>&1; then
81
+ install_cmd="dnf install"
82
+ install="$install_cmd -y"
83
+ clean="dnf clean all"
84
+ else
85
+ install_cmd="yum install"
86
+ install="$install_cmd -y"
87
+ clean="yum clean all"
88
+ fi
89
+ else
90
+ echo "${RED}Error:${NORMAL} Unknown OS : $osid"
91
+ exit
92
+ fi
93
+
94
+ # Ask first
95
+ if [ "$1" != "-f" ] && [ "$1" != "--force" ]; then
96
+ printf "Setup Webmin repository? (y/N) "
97
+ read -r sslyn
98
+ if [ "$sslyn" != "y" ] && [ "$sslyn" != "Y" ]; then
99
+ exit
100
+ fi
101
+ fi
102
+
103
+ # Check for wget or curl or fetch
104
+ if [ ! -x "$download_wget" ]; then
105
+ if [ -x "/usr/bin/curl" ]; then
106
+ download="/usr/bin/curl -f -s -L -O"
107
+ elif [ -x "/usr/bin/fetch" ]; then
108
+ download="/usr/bin/fetch"
109
+ else
110
+ # Try installing wget
111
+ echo " Installing required ${ITALIC}wget${NORMAL} package from OS repository .."
112
+ $install wget 1>/dev/null 2>&1
113
+ if [ "$?" != "0" ]; then
114
+ echo " .. failed to install 'wget' package!"
115
+ exit 1
116
+ else
117
+ echo " .. done"
118
+ fi
119
+ fi
120
+ fi
121
+
122
+
123
+ # Check if GPG command is installed
124
+ if [ -n "$osid_debian_like" ]; then
125
+ if [ ! -x /usr/bin/gpg ]; then
126
+ $update 1>/dev/null 2>&1
127
+ $install gnupg 1>/dev/null 2>&1
128
+ fi
129
+ fi
130
+
131
+ # Clean files
132
+ rm -f "/tmp/$webmin_key"
133
+
134
+ # Download key
135
+ echo " Downloading Webmin key .."
136
+ download_out=$($download $webmin_key_download 2>/dev/null 2>&1)
137
+ if [ "$?" != "0" ]; then
138
+ download_out=$(echo "$download_out" | tr '\n' ' ')
139
+ echo " ..failed : $download_out"
140
+ exit
141
+ fi
142
+ echo " .. done"
143
+
144
+ # Setup repos
145
+ case "$package_type" in
146
+ rpm)
147
+ # Install our keys
148
+ echo " Installing Webmin key .."
149
+ rpm --import $webmin_key
150
+ cp -f $webmin_key /etc/pki/rpm-gpg/RPM-GPG-KEY-$webmin_key_suffix
151
+ echo " .. done"
152
+ # Create repo file
153
+ echo " Setting up Webmin repository .."
154
+ echo "[webmin-noarch]" >$rhel_repo_file
155
+ echo "name=Webmin - noarch" >>$rhel_repo_file
156
+ echo "baseurl=$webmin_download/download/newkey/yum" >>$rhel_repo_file
157
+ echo "enabled=1" >>$rhel_repo_file
158
+ echo "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-$webmin_key_suffix" >>$rhel_repo_file
159
+ echo "gpgcheck=1" >>$rhel_repo_file
160
+ echo " .. done"
161
+ ;;
162
+ deb)
163
+ # Remove our keys
164
+ rm -f "/usr/share/keyrings/debian-$webmin_key_suffix.gpg" "/usr/share/keyrings/$repoid_debian_like-$webmin_key_suffix.gpg"
165
+ # Install our keys
166
+ echo " Installing Webmin key .."
167
+ gpg --import $webmin_key 1>/dev/null 2>&1
168
+ cat $webmin_key | gpg --dearmor > "/usr/share/keyrings/$repoid_debian_like-$webmin_key_suffix.gpg"
169
+ echo " .. done"
170
+ # Remove Webmin repo from sources.list
171
+ sources_list=$(grep -v "$webmin_host" /etc/apt/sources.list)
172
+ echo "$sources_list" > /etc/apt/sources.list
173
+ # Create repo file
174
+ echo " Setting up Webmin repository .."
175
+ echo "deb [signed-by=/usr/share/keyrings/$repoid_debian_like-$webmin_key_suffix.gpg] $webmin_download/download/newkey/repository stable contrib" >$debian_repo_file
176
+ echo " .. done"
177
+ # Clean meta
178
+ echo " Cleaning repository metadata .."
179
+ $clean 1>/dev/null 2>&1
180
+ echo " .. done"
181
+ # Update meta
182
+ echo " Downloading repository metadata .."
183
+ $update 1>/dev/null 2>&1
184
+ echo " .. done"
185
+ ;;
186
+ *)
187
+ echo "${RED}Error:${NORMAL} Cannot setup repositories on this system."
188
+ exit 1
189
+ ;;
190
+ esac
191
+
192
+ # Could not setup
193
+ if [ ! -x "/usr/bin/webmin" ]; then
194
+ echo "Webmin package can now be installed using ${GREEN}${BOLD}${ITALIC}$install_cmd webmin${NORMAL} command."
195
+ fi
196
+
197
+ exit 0