From ccaf83a02a2390e84d91aa23b3f4c7525ccc9c5f Mon Sep 17 00:00:00 2001 From: tteckster Date: Sun, 20 Mar 2022 13:02:06 -0400 Subject: [PATCH] Update photoprism.sh --- ct/photoprism.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/ct/photoprism.sh b/ct/photoprism.sh index ec2325ad..076aefef 100644 --- a/ct/photoprism.sh +++ b/ct/photoprism.sh @@ -81,9 +81,9 @@ show_menu2(){ } option_picked(){ - message=${@:-"${CL}Error: No message passed"} + message2=${@:-"${CL}Error: No message passed"} printf " ${YW}${message1}${CL}\n" - printf " ${YW}${message}${CL}\n" + printf " ${YW}${message2}${CL}\n" } show_menu2 while [ $opt != '' ] @@ -116,6 +116,51 @@ while [ $opt != '' ] esac fi done +show_menu3(){ + printf " ${YW} 1)${GN} Automatic DHCP ${CL}\n" + printf " ${YW} 2)${GN} Manual DHCP ${CL}\n" + + printf "Please choose a DHCP Type and hit enter or ${RD}x${CL} to exit." + read opt +} + +option_picked(){ + message3=${@:-"${CL}Error: No message passed"} + printf " ${YW}${message1}${CL}\n" + printf " ${YW}${message2}${CL}\n" + printf " ${YW}${message3}${CL}\n" +} +show_menu3 +while [ $opt != '' ] + do + if [ $opt = '' ]; then + exit; + else + case $opt in + 1) clear; + header_info; + option_picked "Using Automatic DHCP"; + DHCP=" " + break; + ;; + 2) clear; + header_info; + option_picked "Using Manual DHCP"; + DHCP="1" + break; + ;; + + x)exit; + ;; + \n)exit; + ;; + *)clear; + option_picked "Please choose a DHCP Type from the menu"; + show_menu3; + ;; + esac + fi + done set -o errexit set -o errtrace @@ -197,6 +242,19 @@ cat <> $LXC_CONFIG lxc.cgroup2.devices.allow: a lxc.cap.drop: EOF +if [ "$DHCP" == "1" ]; then +MAC=$(pct config $CTID \ +| grep -i hwaddr \ +| awk '{print substr($2, 31, length($3) 17 ) }') \ + +echo -e "MAC Address ${BL}$MAC${CL}" + +dhcp_reservation(){ + printf "Please set DHCP reservation and press Enter." + read +} +dhcp_reservation +fi echo -en "${GN} Starting LXC Container... " pct start $CTID