Skip to content

Commit 14d45b7

Browse files
committed
CN mirror for composer
1 parent a205c5a commit 14d45b7

2 files changed

Lines changed: 9 additions & 109 deletions

File tree

cyberpanel.sh

Lines changed: 1 addition & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ if [[ $SERVER_COUNTRY == "CN" ]] ; then
256256
sed -i 's|'$DOWNLOAD_SERVER'|cyberpanel.sh|g' install.py
257257
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
258258
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
259+
sed -i 's|composer.sh|composer_cn.sh|g' install.py
259260
# global change for CN , regardless provider and system
260261

261262
if [[ $SERVER_OS == "CentOS" ]] ; then
@@ -278,42 +279,6 @@ index-url = https://pypi.tuna.tsinghua.edu.cn/simple
278279
trusted-host=pypi.tuna.tsinghua.edu.cn
279280
EOF
280281
echo -e "\nSet to Aliyun pip repo..."
281-
cat << EOF > composer.sh
282-
#!/usr/bin/env bash
283-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
284-
php composer-setup.php
285-
php -r "unlink('composer-setup.php');"
286-
mv composer.phar /usr/bin/composer
287-
288-
if [ ! -d /root/.config ]; then
289-
mkdir /root/.config
290-
fi
291-
292-
if [ ! -d /root/.config/composer ]; then
293-
mkdir /root/.config/composer
294-
fi
295-
296-
echo '{
297-
"bitbucket-oauth": {},
298-
"github-oauth": {},
299-
"gitlab-oauth": {},
300-
"gitlab-token": {},
301-
"http-basic": {}
302-
}
303-
' > /root/.config/composer/auth.json
304-
305-
echo '{
306-
"config": {},
307-
"repositories": {
308-
"packagist": {
309-
"type": "composer",
310-
"url": "https://mirrors.aliyun.com/composer/"
311-
}
312-
}
313-
}
314-
' > /root/.config/composer/config.json
315-
composer clear-cache
316-
EOF
317282
fi
318283

319284

@@ -349,79 +314,6 @@ deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted unive
349314
EOF
350315
DEBIAN_FRONTEND=noninteractive apt update -y
351316
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
352-
cat << EOF > composer.sh
353-
#!/usr/bin/env bash
354-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
355-
php composer-setup.php
356-
php -r "unlink('composer-setup.php');"
357-
mv composer.phar /usr/bin/composer
358-
359-
if [ ! -d /root/.config ]; then
360-
mkdir /root/.config
361-
fi
362-
363-
if [ ! -d /root/.config/composer ]; then
364-
mkdir /root/.config/composer
365-
fi
366-
367-
echo '{
368-
"bitbucket-oauth": {},
369-
"github-oauth": {},
370-
"gitlab-oauth": {},
371-
"gitlab-token": {},
372-
"http-basic": {}
373-
}
374-
' > /root/.config/composer/auth.json
375-
376-
echo '{
377-
"config": {},
378-
"repositories": {
379-
"packagist": {
380-
"type": "composer",
381-
"url": "https://mirrors.cloud.tencent.com/composer/"
382-
}
383-
}
384-
}
385-
' > /root/.config/composer/config.json
386-
composer clear-cache
387-
EOF
388-
else
389-
cat << EOF > composer.sh
390-
#!/usr/bin/env bash
391-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
392-
php composer-setup.php
393-
php -r "unlink('composer-setup.php');"
394-
mv composer.phar /usr/bin/composer
395-
396-
if [ ! -d /root/.config ]; then
397-
mkdir /root/.config
398-
fi
399-
400-
if [ ! -d /root/.config/composer ]; then
401-
mkdir /root/.config/composer
402-
fi
403-
404-
echo '{
405-
"bitbucket-oauth": {},
406-
"github-oauth": {},
407-
"gitlab-oauth": {},
408-
"gitlab-token": {},
409-
"http-basic": {}
410-
}
411-
' > /root/.config/composer/auth.json
412-
413-
echo '{
414-
"config": {},
415-
"repositories": {
416-
"packagist": {
417-
"type": "composer",
418-
"url": "https://packagist.phpcomposer.com"
419-
}
420-
}
421-
}
422-
' > /root/.config/composer/config.json
423-
composer clear-cache
424-
EOF
425317
fi
426318
fi
427319
fi

install/composer_cn.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
wget -O composer-setup.php https://cyberpanel.sh/?composer
3+
sed -i "s|'://getcomposer.org'|'://mirrors.aliyun.com/composer'|g" composer-setup.php
4+
php composer-setup.php
5+
php -r "unlink('composer-setup.php');"
6+
mv composer.phar /usr/bin/composer
7+
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
8+
composer clear-cache

0 commit comments

Comments
 (0)