mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-16 12:32:05 +01:00
Merge pull request #285 from usmannasir/qtwrkdev
CN mirror for composer
This commit is contained in:
161
cyberpanel.sh
161
cyberpanel.sh
@@ -249,13 +249,15 @@ if [[ $SERVER_COUNTRY == "CN" ]] ; then
|
||||
sed -i 's|https://www.rainloop.net/repository/webmail/rainloop-community-latest.zip|https://'$DOWNLOAD_SERVER'/misc/rainloop-community-latest.zip|g' install.py
|
||||
sed -i 's|rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm|curl -o /etc/yum.repos.d/litespeed.repo https://'$DOWNLOAD_SERVER'/litespeed/litespeed.repo|g' install.py
|
||||
sed -i 's|https://copr.fedorainfracloud.org/coprs/copart/restic/repo/epel-7/copart-restic-epel-7.repo|https://'$DOWNLOAD_SERVER'/restic/restic.repo|g' install.py
|
||||
sed -i 's|yum -y install https://cyberpanel.sh/gf-release-latest.gf.el7.noarch.rpm|wget -O /etc/yum.repos.d/gf.repo https://'$DOWNLOAD_SERVER'/gf-plus/gf.repo|g' install.py
|
||||
sed -i 's|yum -y install http://cyberpanel.sh/gf-release-latest.gf.el7.noarch.rpm|wget -O /etc/yum.repos.d/gf.repo https://'$DOWNLOAD_SERVER'/gf-plus/gf.repo|g' install.py
|
||||
sed -i 's|dovecot-2.3-latest|dovecot-2.3-latest-mirror|g' install.py
|
||||
sed -i 's|git clone https://github.com/usmannasir/cyberpanel|wget https://cyberpanel.sh/cyberpanel-git.tar.gz \&\& tar xzvf cyberpanel-git.tar.gz|g' install.py
|
||||
sed -i 's|http://repo.dovecot.org/ce-2.3-latest/centos/$releasever/RPMS/$basearch|https://'$DOWNLOAD_SERVER'/dovecot/|g' install.py
|
||||
sed -i 's|'$DOWNLOAD_SERVER'|cyberpanel.sh|g' install.py
|
||||
sed -i 's|https://www.litespeedtech.com/packages/5.0/lsws-5.4.2-ent-x86_64-linux.tar.gz|https://'$DOWNLOAD_SERVER'/litespeed/lsws-'$LSWS_STABLE_VER'-ent-x86_64-linux.tar.gz|g' installCyberPanel.py
|
||||
sed -i 's|wget -O - https://get.acme.sh \| sh|git clone https://gitee.com/qtwrk/acme.sh.git ; cd acme.sh ; ./acme.sh --install ; cd - ; rm -rf acme.sh|g' install.py
|
||||
sed -i 's|composer.sh|composer_cn.sh|g' install.py
|
||||
sed -i 's|yum -y install http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm|wget -O /etc/yum.repos.d/lux.repo https://'$DOWNLOAD_SERVER'/lux/lux.repo|g' install.py
|
||||
# global change for CN , regardless provider and system
|
||||
|
||||
if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
@@ -278,42 +280,6 @@ index-url = https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
trusted-host=pypi.tuna.tsinghua.edu.cn
|
||||
EOF
|
||||
echo -e "\nSet to Aliyun pip repo..."
|
||||
cat << EOF > composer.sh
|
||||
#!/usr/bin/env bash
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
php composer-setup.php
|
||||
php -r "unlink('composer-setup.php');"
|
||||
mv composer.phar /usr/bin/composer
|
||||
|
||||
if [ ! -d /root/.config ]; then
|
||||
mkdir /root/.config
|
||||
fi
|
||||
|
||||
if [ ! -d /root/.config/composer ]; then
|
||||
mkdir /root/.config/composer
|
||||
fi
|
||||
|
||||
echo '{
|
||||
"bitbucket-oauth": {},
|
||||
"github-oauth": {},
|
||||
"gitlab-oauth": {},
|
||||
"gitlab-token": {},
|
||||
"http-basic": {}
|
||||
}
|
||||
' > /root/.config/composer/auth.json
|
||||
|
||||
echo '{
|
||||
"config": {},
|
||||
"repositories": {
|
||||
"packagist": {
|
||||
"type": "composer",
|
||||
"url": "https://mirrors.aliyun.com/composer/"
|
||||
}
|
||||
}
|
||||
}
|
||||
' > /root/.config/composer/config.json
|
||||
composer clear-cache
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
@@ -349,79 +315,6 @@ deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted unive
|
||||
EOF
|
||||
DEBIAN_FRONTEND=noninteractive apt update -y
|
||||
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
|
||||
cat << EOF > composer.sh
|
||||
#!/usr/bin/env bash
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
php composer-setup.php
|
||||
php -r "unlink('composer-setup.php');"
|
||||
mv composer.phar /usr/bin/composer
|
||||
|
||||
if [ ! -d /root/.config ]; then
|
||||
mkdir /root/.config
|
||||
fi
|
||||
|
||||
if [ ! -d /root/.config/composer ]; then
|
||||
mkdir /root/.config/composer
|
||||
fi
|
||||
|
||||
echo '{
|
||||
"bitbucket-oauth": {},
|
||||
"github-oauth": {},
|
||||
"gitlab-oauth": {},
|
||||
"gitlab-token": {},
|
||||
"http-basic": {}
|
||||
}
|
||||
' > /root/.config/composer/auth.json
|
||||
|
||||
echo '{
|
||||
"config": {},
|
||||
"repositories": {
|
||||
"packagist": {
|
||||
"type": "composer",
|
||||
"url": "https://mirrors.cloud.tencent.com/composer/"
|
||||
}
|
||||
}
|
||||
}
|
||||
' > /root/.config/composer/config.json
|
||||
composer clear-cache
|
||||
EOF
|
||||
else
|
||||
cat << EOF > composer.sh
|
||||
#!/usr/bin/env bash
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
php composer-setup.php
|
||||
php -r "unlink('composer-setup.php');"
|
||||
mv composer.phar /usr/bin/composer
|
||||
|
||||
if [ ! -d /root/.config ]; then
|
||||
mkdir /root/.config
|
||||
fi
|
||||
|
||||
if [ ! -d /root/.config/composer ]; then
|
||||
mkdir /root/.config/composer
|
||||
fi
|
||||
|
||||
echo '{
|
||||
"bitbucket-oauth": {},
|
||||
"github-oauth": {},
|
||||
"gitlab-oauth": {},
|
||||
"gitlab-token": {},
|
||||
"http-basic": {}
|
||||
}
|
||||
' > /root/.config/composer/auth.json
|
||||
|
||||
echo '{
|
||||
"config": {},
|
||||
"repositories": {
|
||||
"packagist": {
|
||||
"type": "composer",
|
||||
"url": "https://packagist.phpcomposer.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
' > /root/.config/composer/config.json
|
||||
composer clear-cache
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -524,6 +417,8 @@ if [[ $SERVER_OS == "CentOS" ]] ; then
|
||||
timeout 10 rpm --import https://$DOWNLOAD_SERVER/powerdns/FD380FBB-pub.asc
|
||||
timeout 10 rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7
|
||||
timeout 10 rpm --import https://$DOWNLOAD_SERVER/gf-plus/RPM-GPG-KEY-gf.el7
|
||||
timeout 10 rpm --import https://$DOWNLOAD_SERVER/lux/RPM-GPG-KEY-LUX
|
||||
timeout 10 rpm --import https://$DOWNLOAD_SERVER/ius/RPM-GPG-KEY-IUS-7
|
||||
timeout 10 rpm --import https://repo.dovecot.org/DOVECOT-REPO-GPG
|
||||
timeout 10 rpm --import https://copr-be.cloud.fedoraproject.org/results/copart/restic/pubkey.gpg
|
||||
yum clean all
|
||||
@@ -548,8 +443,12 @@ if [[ $DEV == "ON" ]] ; then
|
||||
if [[ $CENTOS_8 == "False" ]] ; then
|
||||
yum -y install yum-utils
|
||||
yum -y groupinstall development
|
||||
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
|
||||
yum -y install python36u python36u-pip python36u-devel
|
||||
if [[ $SERVER_COUNTRY == "CN" ]] ; then
|
||||
wget -O /etc/yum.repos.d/ius.repo https://$DOWNLOAD_SERVER/ius/ius.repo
|
||||
else
|
||||
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
|
||||
fi
|
||||
yum -y install python36u python36u-pip python36u-devel
|
||||
check_return
|
||||
fi
|
||||
if [[ $CENTOS_8 == "True" ]] ; then
|
||||
@@ -1203,6 +1102,41 @@ cd cyberpanel/install
|
||||
curl https://cyberpanel.sh/?version
|
||||
}
|
||||
|
||||
regenerate_cert() {
|
||||
cat << EOF > /root/cyberpanel/cert_conf
|
||||
[req]
|
||||
prompt=no
|
||||
distinguished_name=cyberpanel
|
||||
[cyberpanel]
|
||||
commonName = www.example.com
|
||||
countryName = CP
|
||||
localityName = CyberPanel
|
||||
organizationName = CyberPanel
|
||||
organizationalUnitName = CyberPanel
|
||||
stateOrProvinceName = CP
|
||||
emailAddress = mail@example.com
|
||||
name = CyberPanel
|
||||
surname = CyberPanel
|
||||
givenName = CyberPanel
|
||||
initials = CP
|
||||
dnQualifier = CyberPanel
|
||||
[server_exts]
|
||||
extendedKeyUsage = 1.3.6.1.5.5.7.3.1
|
||||
EOF
|
||||
openssl req -x509 -config /root/cyberpanel/cert_conf -extensions 'server_exts' -nodes -days 820 -newkey rsa:3072 -keyout /usr/local/lscp/conf/key.pem -out /usr/local/lscp/conf/cert.pem
|
||||
|
||||
if [[ $VERSION == "OLS" ]] ; then
|
||||
key_path="/usr/local/lsws/admin/conf/webadmin.key"
|
||||
cert_path="/usr/local/lsws/admin/conf/webadmin.crt"
|
||||
else
|
||||
key_path="/usr/local/lsws/admin/conf/cert/admin.key"
|
||||
cert_path="/usr/local/lsws/admin/conf/cert/admin.crt"
|
||||
fi
|
||||
|
||||
openssl req -x509 -config /root/cyberpanel/cert_conf -extensions 'server_exts' -nodes -days 820 -newkey rsa:3072 -keyout $key_path -out $cert_path
|
||||
rm -f /root/cyberpanel/cert_conf
|
||||
}
|
||||
|
||||
after_install() {
|
||||
if [ ! -d "/var/lib/php" ]; then
|
||||
mkdir /var/lib/php
|
||||
@@ -1302,6 +1236,9 @@ MYSQLPASSWD=$(cat /etc/cyberpanel/mysqlPassword)
|
||||
echo "$ADMIN_PASS" > /etc/cyberpanel/adminPass
|
||||
/usr/local/CyberPanel/bin/python /usr/local/CyberCP/plogical/adminPass.py --password $ADMIN_PASS
|
||||
mkdir -p /etc/opendkim
|
||||
|
||||
regenerate_cert
|
||||
|
||||
systemctl restart lscpd
|
||||
systemctl restart lsws
|
||||
echo "/usr/local/CyberPanel/bin/python /usr/local/CyberCP/plogical/adminPass.py --password \$@" > /usr/bin/adminPass
|
||||
|
||||
8
install/composer_cn.sh
Executable file
8
install/composer_cn.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
wget -O composer-setup.php https://cyberpanel.sh/?composer
|
||||
sed -i "s|'://getcomposer.org'|'://mirrors.aliyun.com/composer'|g" composer-setup.php
|
||||
php composer-setup.php
|
||||
php -r "unlink('composer-setup.php');"
|
||||
mv composer.phar /usr/bin/composer
|
||||
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
|
||||
composer clear-cache
|
||||
Reference in New Issue
Block a user