diff --git a/install_prereq.sh b/install_prereq.sh index 8b45cba..b26a170 100755 --- a/install_prereq.sh +++ b/install_prereq.sh @@ -12,6 +12,11 @@ archInstall() { sudo python -m pip install --user --upgrade git+https://github.com/drbild/sslpsk.git } +fedoraInstall() { + sudo dnf -y install git iw dnsmasq hostapd screen curl python3-pip python3-wheel python3-pycryptodomex python3-paho-mqtt python3-tornado mosquitto haveged iproute iputils openssl + sudo python3 -m pip install --user --upgrade git+https://github.com/doronz88/sslpsk.git@refactor/ssl-context +} + if [[ -e /etc/os-release ]]; then source /etc/os-release else @@ -23,6 +28,8 @@ if [[ ${ID} == 'debian' ]] || [[ ${ID_LIKE-} == 'debian' ]]; then debianInstall elif [[ ${ID} == 'arch' ]] || [[ ${ID_LIKE-} == 'arch' ]]; then archInstall +elif [[ ${ID} == 'fedora' ]] || [[ ${ID_LIKE-} == 'fedora' ]]; then + fedoraInstall else if [[ -n ${ID_LIKE-} ]]; then printID="${ID}/${ID_LIKE}" diff --git a/start_flash.sh b/start_flash.sh index d4916e7..a7212db 100755 --- a/start_flash.sh +++ b/start_flash.sh @@ -2,9 +2,21 @@ bold=$(tput bold) normal=$(tput sgr0) . ./config.txt +# whether we found systemd-resolved during setup +resolved="" setup () { echo "tuya-convert $(git describe --tags)" + if sudo systemctl is-active systemd-resolved.service > /dev/null 2>&1; then + resolved="yes" + echo "systemd-resolved is running! we must disable it." + echo "name resolution will not work until this script is done." + echo "if this script does not exit cleanly, you may need to run:" + echo "sudo systemctl unmask systemd-resolved.service" + echo "sudo systemctl start systemd-resolved.service" + sudo systemctl stop systemd-resolved.service + sudo systemctl mask systemd-resolved.service + fi pushd scripts >/dev/null || exit . ./setup_checks.sh screen_minor=$(screen --version | cut -d . -f 2) @@ -41,6 +53,11 @@ cleanup () { sudo screen -S smarthack-udp -X stuff '^C' echo "Closing AP" sudo pkill hostapd + if [ -n ${resolved} ]; then + echo "Re-enabling systemd-resolved..." + sudo systemctl unmask systemd-resolved.service || echo "Unmasking systemd-resolved.service failed! Please clean up manually" + sudo systemctl start systemd-resolved.service || echo "Restarting systemd-resolved.service failed! Please clean up manually" + fi echo "Exiting..." popd >/dev/null || exit }