1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-22 15:20:09 +01:00

added RHEL etc workings.

This commit is contained in:
Dselen 2024-08-23 12:27:41 -05:00
parent 3012619049
commit 27c7e33773
5 changed files with 7 additions and 30 deletions

1
docker/WGDashboard Submodule

@ -0,0 +1 @@
Subproject commit 30126190496f079749a00726885bd7277c5ac4b0

View File

@ -10,7 +10,7 @@ ensure_installation() {
if [ -z "$(ls -A "${WGDASH}")" ]; then if [ -z "$(ls -A "${WGDASH}")" ]; then
echo "Detected empty directory, moving over..." echo "Detected empty directory, moving over..."
mv /setup/app/* "${WGDASH}" mv /setup/app/{.[!.],}* "${WGDASH}"
python3 -m venv "${WGDASH}"/src/venv python3 -m venv "${WGDASH}"/src/venv
. "${WGDASH}/src/venv/bin/activate" . "${WGDASH}/src/venv/bin/activate"
chmod +x "${WGDASH}"/src/wgd.sh chmod +x "${WGDASH}"/src/wgd.sh
@ -90,16 +90,6 @@ clean_up() {
set_envvars() { set_envvars() {
printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n" printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n"
# If the timezone is different, for example in North-America or Asia.
if [ "${tz}" != "$(cat /etc/localtime)" ]; then
echo "Changing timezone."
ln -sf /usr/share/zoneinfo/"${tz}" /etc/localtime
echo "${tz}" > /etc/timezone
else
echo "Timezone is set correctly."
fi
# Changing the DNS used for clients and the dashboard itself. # Changing the DNS used for clients and the dashboard itself.
if [ "${global_dns}" != "$(grep "peer_global_dns = " /opt/wireguarddashboard/src/wg-dashboard.ini | awk '{print $NF}')" ]; then if [ "${global_dns}" != "$(grep "peer_global_dns = " /opt/wireguarddashboard/src/wg-dashboard.ini | awk '{print $NF}')" ]; then
echo "Changing default dns." echo "Changing default dns."

View File

@ -10,7 +10,7 @@ ensure_installation() {
if [ -z "$(ls -A "${WGDASH}")" ]; then if [ -z "$(ls -A "${WGDASH}")" ]; then
echo "Detected empty directory, moving over..." echo "Detected empty directory, moving over..."
mv /setup/app/* "${WGDASH}" mv /setup/app/{.[!.],}* "${WGDASH}"
python3 -m venv "${WGDASH}"/src/venv python3 -m venv "${WGDASH}"/src/venv
. "${WGDASH}/src/venv/bin/activate" . "${WGDASH}/src/venv/bin/activate"
chmod +x "${WGDASH}"/src/wgd.sh chmod +x "${WGDASH}"/src/wgd.sh
@ -89,17 +89,7 @@ clean_up() {
# === SET ENV VARS === # === SET ENV VARS ===
set_envvars() { set_envvars() {
printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n" printf "\n------------- SETTING ENVIRONMENT VARIABLES ----------------\n"
# If the timezone is different, for example in North-America or Asia.
if [ "${tz}" != "$(cat /etc/localtime)" ]; then
echo "Changing timezone."
ln -sf /usr/share/zoneinfo/"${tz}" /etc/localtime
echo "${tz}" > /etc/timezone
else
echo "Timezone is set correctly."
fi
# Changing the DNS used for clients and the dashboard itself. # Changing the DNS used for clients and the dashboard itself.
if [ "${global_dns}" != "$(grep "peer_global_dns = " /opt/wireguarddashboard/src/wg-dashboard.ini | awk '{print $NF}')" ]; then if [ "${global_dns}" != "$(grep "peer_global_dns = " /opt/wireguarddashboard/src/wg-dashboard.ini | awk '{print $NF}')" ]; then
echo "Changing default dns." echo "Changing default dns."

View File

@ -1074,7 +1074,7 @@ def regex_match(regex, text):
def iPv46RegexCheck(ip): def iPv46RegexCheck(ip):
return re.match( return re.match(
'((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d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:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))',
ip) ip)
class DashboardAPIKey: class DashboardAPIKey:

View File

@ -281,15 +281,11 @@ install_wgd(){
{ date; python3 -m pip install --upgrade pip; printf "\n\n"; } >> ./log/install.txt { date; python3 -m pip install --upgrade pip; printf "\n\n"; } >> ./log/install.txt
printf "[WGDashboard] Installing latest Python dependencies\n" printf "[WGDashboard] Installing latest Python dependencies\n"
printf "$OS"
case "$OS" in case "$OS" in
ubuntu|debian) ubuntu|debian|centos|fedora|redhat|rhel)
echo "Lol" { date; python3 -m pip install -r requirements.txt ; printf "\n\n"; } >> ./log/install.txt #This all works on the default installation.
{ date; python3 -m pip install -r requirements.txt ; printf "\n\n"; } >> ./log/install.txt
;; ;;
## TO DO ADD RHEL and ROCKY SUPPORT
alpine) alpine)
printf "[WGDashboard] Grabbing Alpine dependencies.\n"
{ date; sudo apk add gcc python3-dev musl-dev linux-headers ; python3 -m pip install -r requirements.txt ; printf "\n\n"; } >> ./log/install.txt { date; sudo apk add gcc python3-dev musl-dev linux-headers ; python3 -m pip install -r requirements.txt ; printf "\n\n"; } >> ./log/install.txt
;; ;;
*) *)