#!/bin/bash

curl -sS https://installer.cloudpanel.io/ce/v2/install.sh -o install.sh &>/dev/null
echo "2aefee646f988877a31198e0d84ed30e2ef7a454857b606608a1f0b8eb6ec6b6 install.sh" | sha256sum -c &>/dev/null
bash install.sh &>/tmp/install.log

HTTP_CODE=$(curl -o /dev/null -s -w "%{http_code}\n" https://localhost:8443 -kL)

if [ "$HTTP_CODE" -eq 200 ]; then
    echo "CloudPanel install success."
    exit 0
else
    echo "CloudPanel install failed."
    exit 1
fi

