diff options
author | sengedev | 2024-03-08 23:50:02 +0800 |
---|---|---|
committer | sengedev | 2024-03-08 23:50:02 +0800 |
commit | 29c5b3bbc8eaf5c711e80c279a78ed826a79b66e (patch) | |
tree | 1ac9f685d3da486e98107cbf763911a39b8c518f | |
parent | 1ce9b6b65f4355895e63fc5b97a79ee7fd779d44 (diff) | |
download | aur-29c5b3bbc8eaf5c711e80c279a78ed826a79b66e.tar.gz |
Uploaded 1panel-git, 1panel-bin is conflict with it.
-rw-r--r-- | .SRCINFO | 7 | ||||
-rw-r--r-- | 1panel.install | 89 | ||||
-rw-r--r-- | PKGBUILD | 11 |
3 files changed, 100 insertions, 7 deletions
@@ -3,16 +3,17 @@ pkgbase = 1panel-bin pkgver = 1.10.1_lts pkgrel = 1 url = https://1panel.cn - install = 1panel-bin.install + install = 1panel.install arch = x86_64 arch = aarch64 license = GPL-3.0-or-later makedepends = pwgen - depends = docker - depends = docker-compose optdepends = ufw optdepends = firewalld + optdepends = docker + optdepends = docker-compose conflicts = 1panel-dev-bin + conflicts = 1panel-git source_x86_64 = 1panel-bin-1.10.1-lts-amd64.tar.gz::https://resource.fit2cloud.com/1panel/package/stable/v1.10.1-lts/release/1panel-v1.10.1-lts-linux-amd64.tar.gz sha256sums_x86_64 = 5804421c5432eabf99eb28f8f6de3d02fac3f9b6d2abadba8b2b575cc09e2437 source_aarch64 = 1panel-bin-1.10.1-lts-arm64.tar.gz::https://resource.fit2cloud.com/1panel/package/stable/v1.10.1-lts/release/1panel-v1.10.1-lts-linux-arm64.tar.gz diff --git a/1panel.install b/1panel.install new file mode 100644 index 000000000000..c6bed080dc1c --- /dev/null +++ b/1panel.install @@ -0,0 +1,89 @@ +pre_install() { + echo -e "================== installing 1Panel ==================" +} + +post_install() { + echo -e "Obtaining the local IP address of this machine..." + _1panel_active_interface=$(ip route get 8.8.8.8 | awk 'NR==1 {print $5}') + if [[ -z $_1panel_active_interface ]]; then + _1panel_local_ip="127.0.0.1" + else + _1panel_local_ip=`ip -4 addr show dev "$_1panel_active_interface" | grep -oP '(?<=inet\s)\d+(\.\d+){3}'` + fi + echo -e "Obtaining the public IP address of this machine..." + _1panel_public_ip=`curl -s https://api64.ipify.org` + if [[ -z "$_1panel_public_ip" ]]; then + _1panel_public_ip="N/A" + fi + if echo "$_1panel_public_ip" | grep -q ":"; then + _1panel_public_ip=[${_1panel_public_ip}] + 1panel listen-ip ipv6 + fi + if [ $_1panel_public_ip == "N/A" ]; then + echo -e "\033[31mFailed to get 1Panel public IP address.\033[0m" + fi + # ORIGINAL_PORT=port (/usr/bin/1pctl) + _1panel_port=$(sed -n 's/^ORIGINAL_PORT=\(.*\)/\1/p' /usr/bin/1pctl) + _1panel_username=$(sed -n 's/^ORIGINAL_USERNAME=\(.*\)/\1/p' /usr/bin/1pctl) + _1panel_password=$(sed -n 's/^ORIGINAL_PASSWORD=\(.*\)/\1/p' /usr/bin/1pctl) + _1panel_entrance=$(sed -n 's/^ORIGINAL_ENTRANCE=\(.*\)/\1/p' /usr/bin/1pctl) + echo -e "================== 1Panel installed ===================" + echo -e "Please access 1Panel using your web browser after the \033[33m 1panel.service\033[0m service is started." + echo -e "Local IP: http://$_1panel_local_ip:$_1panel_port/$_1panel_entrance" + echo -e "Public IP: http://$_1panel_public_ip:$_1panel_port/$_1panel_entrance" + echo -e "Username: $_1panel_username" + echo -e "Password: $_1panel_password" + echo -e "If you are not Chinese user, please click \033[32m'中文(简体)'\033[0m and switch it to English." + # 判断docker和docker-compose安装 + if pacman -Qs docker >/dev/null 2>&1; then + echo -e "Docker is installed correctly." + else: + echo -e "\033[31mWarning: Docker is not installed, please install it, or most of the features of this package will not be available.\033[0m" + fi + if pacman -Qs docker-compose >/dev/null 2>&1; then + echo -e "Docker Compose is installed correctly." + else: + echo -e "\033[31mWarning: Docker Compose is not installed, please install it, or 1Panel application store will not be avaliable.\033[0m" + fi + unset _1panel_active_interface + unset _1panel_local_ip + unset _1panel_public_ip + unset _1panel_port + unset _1panel_username + unset _1panel_password + unset _1panel_entrance +} + +## arg 1: the old package version +pre_remove() { + echo -e "================== Uninstalling 1Panel ==================" + echo -e "\033[34mStopping systemd service...\033[0m" + systemctl disable --now 1panel +} + +post_remove() { + echo -e "\033[34mDeleting 1Panel configuration files...\033[0m" + rm -rf /opt/1panel + echo -e "=================== 1Panel uninstalled ==================" +} + +pre_upgrade() { + export no_need_start="false" + echo -e "================== Upgrading 1Panel ===================" + # Stop 1panel service` + if systemctl is-active --quiet 1panel; then + echo -e "Temporarily stoping 1Panel service..." + systemctl stop 1panel + export _restart_1panel_service=true + fi +} + + +post_upgrade() { + if [ -n "${_restart_1panel_service+x}" ]; then + echo -e "Restarting..." + systemctl start 1panel + unset _restart_1panel_service + fi + echo -e "=================== 1Panel upgraded ===================" +} @@ -13,10 +13,8 @@ _1panel_original_port=`expr $RANDOM % 55535 + 10000` _1panel_original_username=$(pwgen -nABCv 10 1) _1panel_original_password=$(pwgen -nBCv 20 1) _1panel_original_entrance=$(pwgen -nABCv 10 1) -install=1panel-bin.install +install=1panel.install depends=( - 'docker' - 'docker-compose' ) makedepends=( 'pwgen' @@ -24,8 +22,13 @@ makedepends=( optdepends=( 'ufw' 'firewalld' + 'docker' + 'docker-compose' +) +conflicts=( + '1panel-dev-bin' + '1panel-git' ) -conflicts=('1panel-dev-bin') source_aarch64=("${pkgname}-${pkgver//_/-}-arm64.tar.gz::https://resource.fit2cloud.com/1panel/package/stable/v${pkgver//_/-}/release/1panel-v${pkgver//_/-}-linux-arm64.tar.gz") source_x86_64=("${pkgname}-${pkgver//_/-}-amd64.tar.gz::https://resource.fit2cloud.com/1panel/package/stable/v${pkgver//_/-}/release/1panel-v${pkgver//_/-}-linux-amd64.tar.gz") sha256sums_x86_64=("5804421c5432eabf99eb28f8f6de3d02fac3f9b6d2abadba8b2b575cc09e2437") |