- update dependencies for docker and debian install
- follow project naming guidelines
This commit is contained in:
@@ -12,7 +12,7 @@ ENV PATH="/opt/venv/bin:$PATH"
|
|||||||
|
|
||||||
COPY . ${INSTALL_DIR}/
|
COPY . ${INSTALL_DIR}/
|
||||||
|
|
||||||
RUN pip install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet \
|
RUN pip install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet dnspython\
|
||||||
&& bash -c "find ${INSTALL_DIR} -type d -exec chmod 750 {} \;" \
|
&& bash -c "find ${INSTALL_DIR} -type d -exec chmod 750 {} \;" \
|
||||||
&& bash -c "find ${INSTALL_DIR} -type f -exec chmod 640 {} \;" \
|
&& bash -c "find ${INSTALL_DIR} -type f -exec chmod 640 {} \;" \
|
||||||
&& bash -c "find ${INSTALL_DIR} -type f \( -name '*.sh' -o -name '*.py' -o -name 'pialert-cli' -o -name 'speedtest-cli' \) -exec chmod 750 {} \;"
|
&& bash -c "find ${INSTALL_DIR} -type f \( -name '*.sh' -o -name '*.py' -o -name 'pialert-cli' -o -name 'speedtest-cli' \) -exec chmod 750 {} \;"
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ RUN phpenmod -v 8.2 sqlite3
|
|||||||
# Setup virtual python environment and use pip3 to install packages
|
# Setup virtual python environment and use pip3 to install packages
|
||||||
RUN apt-get install -y python3-venv
|
RUN apt-get install -y python3-venv
|
||||||
RUN python3 -m venv myenv
|
RUN python3 -m venv myenv
|
||||||
RUN /bin/bash -c "source myenv/bin/activate && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && pip3 install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet"
|
RUN /bin/bash -c "source myenv/bin/activate && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 && pip3 install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet dnspython"
|
||||||
|
|
||||||
# Create a buildtimestamp.txt to later check if a new version was released
|
# Create a buildtimestamp.txt to later check if a new version was released
|
||||||
RUN date +%s > ${INSTALL_DIR}/front/buildtimestamp.txt
|
RUN date +%s > ${INSTALL_DIR}/front/buildtimestamp.txt
|
||||||
|
|||||||
@@ -607,7 +607,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"function": "dev_CleanDeviceName",
|
"function": "LESS_NAME_CLEANUP",
|
||||||
"type": "integer.checkbox",
|
"type": "integer.checkbox",
|
||||||
"default_value": 0,
|
"default_value": 0,
|
||||||
"options": [],
|
"options": [],
|
||||||
@@ -615,7 +615,7 @@
|
|||||||
"name": [
|
"name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
"string": "Use new algorithm to cleanup device names"
|
"string": "Less Name Cleanup"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": [
|
"description": [
|
||||||
@@ -647,7 +647,7 @@
|
|||||||
"dev_Network_Node_MAC_ADDR",
|
"dev_Network_Node_MAC_ADDR",
|
||||||
"dev_Network_Node_port",
|
"dev_Network_Node_port",
|
||||||
"dev_Icon",
|
"dev_Icon",
|
||||||
"dev_CleanDeviceName"
|
"LESS_NAME_CLEANUP"
|
||||||
],
|
],
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,4 @@ source myenv/bin/activate
|
|||||||
update-alternatives --install /usr/bin/python python /usr/bin/python3 10
|
update-alternatives --install /usr/bin/python python /usr/bin/python3 10
|
||||||
|
|
||||||
# install packages thru pip3
|
# install packages thru pip3
|
||||||
pip3 install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet
|
pip3 install requests paho-mqtt scapy cron-converter pytz json2table dhcp-leases pyunifi speedtest-cli chardet dnspython
|
||||||
|
|||||||
@@ -573,33 +573,8 @@ def resolve_device_name_pholus (pMAC, pIP, allRes, nameNotFound, match_IP = Fals
|
|||||||
import dns.resolver
|
import dns.resolver
|
||||||
|
|
||||||
def cleanDeviceName(str, match_IP):
|
def cleanDeviceName(str, match_IP):
|
||||||
if get_setting_value('NEWDEV_dev_CleanDeviceName'):
|
if get_setting_value('NEWDEV_LESS_NAME_CLEANUP'):
|
||||||
return NEW_cleanDeviceName(str, match_IP)
|
mylog('debug', ["Using new cleanDeviceName(" + str + ")"])
|
||||||
|
|
||||||
# alternative str.split('.')[0]
|
|
||||||
str = str.replace("._airplay", "")
|
|
||||||
str = str.replace("._tcp", "")
|
|
||||||
str = str.replace(".localdomain", "")
|
|
||||||
str = str.replace(".local", "")
|
|
||||||
str = str.replace("._esphomelib", "")
|
|
||||||
str = str.replace("._googlecast", "")
|
|
||||||
str = str.replace(".lan", "")
|
|
||||||
str = str.replace(".home", "")
|
|
||||||
str = re.sub(r'-[a-fA-F0-9]{32}', '', str) # removing last part of e.g. Nest-Audio-ff77ff77ff77ff77ff77ff77ff77ff77
|
|
||||||
str = re.sub(r'#.*', '', str) # Remove everything after '#' including the '#'
|
|
||||||
# remove trailing dots
|
|
||||||
if str.endswith('.'):
|
|
||||||
str = str[:-1]
|
|
||||||
|
|
||||||
|
|
||||||
if match_IP:
|
|
||||||
str = str + " (IP match)"
|
|
||||||
|
|
||||||
return str
|
|
||||||
|
|
||||||
def NEW_cleanDeviceName(str, match_IP):
|
|
||||||
|
|
||||||
mylog('debug', ["START cleanDeviceName(" + str + ")"])
|
|
||||||
|
|
||||||
# replace all labels starting with underscore
|
# replace all labels starting with underscore
|
||||||
str = re.sub(r'^_[^\.]*\.', '', str) # leading label
|
str = re.sub(r'^_[^\.]*\.', '', str) # leading label
|
||||||
@@ -629,11 +604,35 @@ def NEW_cleanDeviceName(str, match_IP):
|
|||||||
if match_IP:
|
if match_IP:
|
||||||
str = str + " (IP match)"
|
str = str + " (IP match)"
|
||||||
|
|
||||||
mylog('debug', ["END cleanDeviceName = " + str])
|
|
||||||
|
|
||||||
# done
|
# done
|
||||||
|
mylog('debug', ["cleanDeviceName = " + str])
|
||||||
return str
|
return str
|
||||||
|
|
||||||
|
################################
|
||||||
|
#
|
||||||
|
# OLD cleanDeviceName
|
||||||
|
mylog('debug', ["Using old cleanDeviceName(" + str + ")"])
|
||||||
|
|
||||||
|
# alternative str.split('.')[0]
|
||||||
|
str = str.replace("._airplay", "")
|
||||||
|
str = str.replace("._tcp", "")
|
||||||
|
str = str.replace(".localdomain", "")
|
||||||
|
str = str.replace(".local", "")
|
||||||
|
str = str.replace("._esphomelib", "")
|
||||||
|
str = str.replace("._googlecast", "")
|
||||||
|
str = str.replace(".lan", "")
|
||||||
|
str = str.replace(".home", "")
|
||||||
|
str = re.sub(r'-[a-fA-F0-9]{32}', '', str) # removing last part of e.g. Nest-Audio-ff77ff77ff77ff77ff77ff77ff77ff77
|
||||||
|
str = re.sub(r'#.*', '', str) # Remove everything after '#' including the '#'
|
||||||
|
# remove trailing dots
|
||||||
|
if str.endswith('.'):
|
||||||
|
str = str[:-1]
|
||||||
|
|
||||||
|
if match_IP:
|
||||||
|
str = str + " (IP match)"
|
||||||
|
|
||||||
|
mylog('debug', ["cleanDeviceName = " + str])
|
||||||
|
return str
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# String manipulation methods
|
# String manipulation methods
|
||||||
|
|||||||
Reference in New Issue
Block a user