diff --git a/README.md b/README.md index 4ec33382..ec2a1499 100644 --- a/README.md +++ b/README.md @@ -190,6 +190,16 @@ Then, open the settings file and edit it to match the settings from the previous If you have elected to run a TLS-enabled web server, see [THIS LINK](docs/tls_webserver.md) for some additional information on how to handle self-signed certificates when attempting to visit your webpanel and enabling auth for the admin pages. +## In-Situ Upgrade + +Want to switch your existing RN2 installation to a different Github branch without loosing your settings and images? + + **Introduction of RN2 Upgrade tool** + + `${HOME}/.rn2_utils/rn2_upgrade.sh https://github.com/jekhokie/raspberry-noaa-v2.git -b aarch64-support` + + Just point to the branch you want to switch to by modifying the above line as needed. + ## Post Install There are and will be future "optional" features for this framework. Below is a list of optional capabilities that you may wish diff --git a/ansible/roles/common/files/rn2_backup_restore.sh b/ansible/roles/common/files/rn2_backup_restore.sh new file mode 100644 index 00000000..4cb23821 --- /dev/null +++ b/ansible/roles/common/files/rn2_backup_restore.sh @@ -0,0 +1,381 @@ +#!/bin/bash +# +# Purpose: Backup or Restore RN2 key directories +# +# (audio, videos, images, db and config) +# +# Author: Richard Creasey (AI4Y) +# +# Created: 28-July-2024 +# +# +# Input parameters: +# +# 1. Input mode [backup|backup_stage|restore|restore_stage] +# +# Example: +# ./rn2_backup_restore.sh backup +# ./rn2_backup_restore.sh backup_stage +# ./rn2_backup_restore.sh restore +# ./rn2_backup_restore.sh restore_stage + +# input params +MODE=$1 + +echo "" +if [[ -z ${MODE} ]]; then + echo "Argument required: ./rn2_backup_restore.sh backup or ./rn2_backup_restore.sh backup_stage" + echo " ./rn2_backup_restore.sh restore or ./rn2_backup_restore.sh restore_stage" + echo "" + exit 1 +else + vMODE=$(echo ${MODE} | tr '[:upper:]' '[:lower:]') + if [[ ${vMODE} != "backup" && ${vMODE} != "backup_stage" && ${vMODE} != "restore" && ${vMODE} != "restore_stage" ]]; then + echo "Argument required: ./rn2_backup_restore.sh backup or ./rn2_backup_restore.sh backup_stage" + echo " ./rn2_backup_restore.sh restore or ./rn2_backup_restore.sh restore_stage" + echo "" + exit 1 + fi +fi + +start=$(date +%s) + +secs_to_human() { + if [[ -z ${1} || ${1} -lt 60 ]] ;then + min=0 ; secs="${1}" + else + time_mins=$(echo "scale=2; ${1}/60" | bc) + min=$(echo ${time_mins} | cut -d'.' -f1) + secs="0.$(echo ${time_mins} | cut -d'.' -f2)" + secs=$(echo ${secs}*60|bc|awk '{print int($1+0.5)}') + fi + echo "Time Elapsed : ${min} minutes and ${secs} seconds." +} + +# Define RN2 Utils location +RN2_UTILS="${HOME}/.rn2_utils" + +# Define backup location +BACKUP_LOC="${RN2_UTILS}/backup" + +# Make sure backup location exists +mkdir -p ${BACKUP_LOC} ${BACKUP_LOC}/srv + +# Define log file for backup/restore activity +LOG="${BACKUP_LOC}/backup_restore.log" + +# loggit function +loggit() { + local log_type=$1 + local log_message=$2 + + echo "${log_type} : ${log_message}" + + # log output to a log file + echo $(date '+%d-%m-%Y %H:%M') "${log_type} : ${log_message}" >> "$LOG" +} + +backup() { + + if [[ ${stage} -eq 0 ]]; then + # Making a full copy of /srv/audio, /srv/videos, /srv/ images + + if [[ -d /srv ]]; then + + srcSIZE=$(du -sm /srv | awk -F" " '{print $1}') + FreeSpace=$(df -m ${BACKUP_LOC} | grep -vi "Filesystem" | awk -F" " '{print $(NF-2)}') + + # To ensure stability of the OS and processes, lets make sure we have at least 2GB of free space beyond the minimun needed before making a backup + RequiredSpace=$((${srcSIZE} + 2000)) + + if [[ ${RequiredSpace} -lt ${FreeSpace} ]]; then + loggit "INFO" "Required space for backup is ${RequiredSpace} MB and Free space is ${FreeSpace} MB, preceeding to backup RN2 key files..." + + loggit "INFO" "Backing up /srv/audio, please wait..." + cp -pr /srv/audio ${BACKUP_LOC}/srv/audio + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully backed up /srv/audio" + else + loggit "FAIL" "Failed to backup /srv/audio, aborting..." + exit 1 + fi + + loggit "INFO" "Backing up /srv/videos, please wait..." + cp -pr /srv/videos ${BACKUP_LOC}/srv/videos + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully backed up /srv/videos" + else + loggit "FAIL" "Failed to backup /srv/videos, aborting..." + exit 1 + fi + + loggit "INFO" "Backing up /srv/images, please wait..." + cp -pr /srv/images ${BACKUP_LOC}/srv/images + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully backed up /srv/images" + else + loggit "FAIL" "Failed to backup /srv/images, aborting..." + exit 1 + fi + + else + loggit "FAIL" "Required space for backup is ${RequiredSpace} MB and Free space is only ${FreeSpace} MB, aborting..." + exit 1 + fi + + else + + loggit "INFO" "/srv directory not found, skipping backup..." + + fi + + else + + # Staging /srv so no extra space or time is required + if [[ ! -d /srv_staged ]]; then + loggit "INFO" "Staging /srv as /srv_staged" + sudo mv /srv /srv_staged + else + loggit "FAIL" "/srv_staged already exists, aborting..." + exit 1 + fi + + fi + + + if [[ -f ${HOME}/raspberry-noaa-v2/config/settings.yml ]]; then + cp -pr ${HOME}/raspberry-noaa-v2/config/settings.yml ${BACKUP_LOC}/settings.yml + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully backed up settings.yml" + else + loggit "FAIL" "Failed to backup settings.yml, aborting..." + exit 1 + fi + else + loggit "FAIL" "${HOME}/raspberry-noaa-v2/config/settings.yml not found, aborting..." + exit + fi + + if [[ -f ${HOME}/raspberry-noaa-v2/config/annotation/annotation.html.j2 ]]; then + cp -pr ${HOME}/raspberry-noaa-v2/config/annotation/annotation.html.j2 ${BACKUP_LOC}/annotation.html.j2 + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully backed up annotation.html.j2" + else + loggit "FAIL" "Failed to backup annotation.html.j2, aborting..." + exit 1 + fi + else + loggit "FAIL" "${HOME}/raspberry-noaa-v2/config/settings.yml, not found, aborting..." + exit + fi + + if [[ -f ${HOME}/raspberry-noaa-v2/db/panel.db ]]; then + cp -pr ${HOME}/raspberry-noaa-v2/db/panel.db ${BACKUP_LOC}/panel.db + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully backed up panel.db" + else + loggit "FAIL" "Failed to backup panel.db, aborting..." + exit 1 + fi + else + loggit "FAIL" "${HOME}/raspberry-noaa-v2/db/panel.db, not found, aborting..." + exit + fi + +} + +restore() { + + + if [[ ${stage} -eq 0 ]]; then + # Restoring a full copy of /srv/audio, /srv/videos, /srv/ images + + if [[ -d ${BACKUP_LOC}/srv ]]; then + srcSIZE=$(du -sm ${BACKUP_LOC} | awk -F" " '{print $1}') + FreeSpace=$(df -m /srv | grep -vi "Filesystem" | awk -F" " '{print $(NF-2)}') + + # To ensure stability of the OS and processes, lets make sure we have at least 2GB of free space beyond the minimun needed before restoring + RequiredSpace=$((${srcSIZE} + 2000)) + + if [[ ${RequiredSpace} -lt ${FreeSpace} ]]; then + loggit "INFO" "Required space for restore is ${RequiredSpace} MB and Free space is ${FreeSpace} MB, preceeding to restore RN2 key files..." + + loggit "INFO" "Restoring /srv/audio, please wait..." + cp -pr ${BACKUP_LOC}/srv/audio /srv/audio + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully restored /srv/audio" + else + loggit "FAIL" "Failed to restore /srv/audio, aborting..." + exit 1 + fi + + loggit "INFO" "Restoring /srv/videos, please wait..." + cp -pr ${BACKUP_LOC}/srv/videos /srv/videos + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully restored /srv/videos" + else + loggit "FAIL" "Failed to restore /srv/videos, aborting..." + exit 1 + fi + + loggit "INFO" "Restoring /srv/images, please wait..." + cp -pr ${BACKUP_LOC}/srv/images /srv/images + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully restored /srv/images" + else + loggit "FAIL" "Failed to restore /srv/images, aborting..." + exit 1 + fi + + # Ensure previously installed environment has correct ownership/permissions + sudo chown ${USER}:${USER} /srv/audio + sudo chown ${USER}:www-data /srv /srv/images /srv/images/thumb /srv/videos + sudo chmod 755 /srv + sudo chmod 775 /srv/audio /srv/images /srv/images/thumb /srv/videos + + else + loggit "FAIL" "Required space for restore is ${RequiredSpace} MB and Free space is only ${FreeSpace} MB, aborting..." + exit 1 + fi + + else + + loggit "INFO" "${BACKUP_LOC}/srv directory not found, skipping restore..." + + fi + + else + + # Restoring /srv_staged as /srv so no extra space or time is required + if [[ -d /srv_staged ]]; then + loggit "INFO" "UnStaging /srv_staged as /srv" + sudo mv /srv_staged /srv + # Ensure previously installed environment has correct ownership/permissions + sudo chown ${USER}:${USER} /srv/audio + sudo chown ${USER}:www-data /srv /srv/images /srv/images/thumb /srv/videos + sudo chmod 755 /srv + sudo chmod 775 /srv/audio /srv/images /srv/images/thumb /srv/videos + else + loggit "FAIL" "/srv_staged does not exist, aborting..." + exit 1 + fi + + fi + + + if [[ -f ${BACKUP_LOC}/settings.yml ]]; then + # Keep github original + if [[ ! -f ${HOME}/raspberry-noaa-v2/config/settings.yml.original ]]; then + if [[ -f ${HOME}/raspberry-noaa-v2/config/settings.yml ]]; then + loggit "INFO" "Backing up GitHub settings.yml as settings.yml.original" + cp -pr ${HOME}/raspberry-noaa-v2/config/settings.yml ${HOME}/raspberry-noaa-v2/config/settings.yml.original + fi + fi + + # Check for missing parameters from backup settings.yml that exist in latest Github version and merge them in if found + PARMS_REQUIRED=/tmp/parameters_required + PARMS_FOUND=/tmp/parameters_found + NEED_NEWFILE=0 + NEWFILE_CREATED=0 + NEWFILE=/tmp/settings.yml + COUNT=$(cat ${BACKUP_LOC}/settings.yml | wc -l) + LINE=$((${COUNT} - 1)) + + # Skip lines starting with # and skip blank lines and list the parameter + cat ${HOME}/raspberry-noaa-v2/config/settings.yml.original | grep -Ev "^#|^---|^\...|^[[:blank:]]*$" | awk -F":" '{print $1}' > /tmp/parameters_required + cat ${BACKUP_LOC}/settings.yml | grep -Ev "^#|^---|^\...|^[[:blank:]]*$" | awk -F":" '{print $1}' > /tmp/parameters_found + + # Search for missing parameters and append them to users settings.yml file + while IFS= read -r parm; do + vFOUND=$(grep ${parm} ${PARMS_FOUND} | wc -l) + if [[ ${vFOUND} -eq 0 ]]; then + NEED_NEWFILE=1 + if [[ ${NEWFILE_CREATED} -eq 0 ]]; then + NEWFILE_CREATED=1 + cat ${BACKUP_LOC}/settings.yml | head -${COUNT} > ${NEWFILE} + echo "" >> ${NEWFILE} + echo "# The following parameters were added" >> ${NEWFILE} + fi + cat ${HOME}/raspberry-noaa-v2/config/settings.yml.original | grep ${parm} >> ${NEWFILE} + fi + done < ${PARMS_REQUIRED} + + if [[ ${NEWFILE_CREATED} -eq 1 ]]; then + echo "..." >> ${NEWFILE} + cp -pr ${NEWFILE} ${HOME}/raspberry-noaa-v2/config/settings.yml + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully merged settings.yml" + else + loggit "FAIL" "Failed to merge settings.yml" + fi + else + # No new setting needing to be merged, so lets restore the users original file back + cp -pr ${BACKUP_LOC}/settings.yml ${HOME}/raspberry-noaa-v2/config/settings.yml + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully restored settings.yml" + else + loggit "FAIL" "Failed to restore settings.yml, aborting..." + exit 1 + fi + fi + + else + loggit "FAIL" "${BACKUP_LOC}/settings.yml not found, aborting..." + exit 1 + fi + + if [[ -f ${BACKUP_LOC}/annotation.html.j2 ]]; then + # Keep github original + if [[ ! -f ${HOME}/raspberry-noaa-v2/config/annotation/annotation.html.j2.original ]]; then + if [[ -f ${HOME}/raspberry-noaa-v2/config/annotation/annotation.html.j2 ]]; then + cp -pr ${HOME}/raspberry-noaa-v2/config/annotation/annotation.html.j2 ${HOME}/raspberry-noaa-v2/config/annotation/annotation.html.j2.original + fi + fi + cp -pr ${BACKUP_LOC}/annotation.html.j2 ${HOME}/raspberry-noaa-v2/config/annotation/annotation.html.j2 + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully restored annotation.html.j2" + else + loggit "FAIL" "Failed to restore annotation.html.j2, aborting..." + exit 1 + fi + else + loggit "FAIL" "${BACKUP_LOC}/annotation.html.j2, not found, aborting..." + exit + fi + + if [[ -f ${BACKUP_LOC}/panel.db ]]; then + # Keep github original + if [[ ! -f ${HOME}/raspberry-noaa-v2/db/panel.db.original ]]; then + if [[ -f ${HOME}/raspberry-noaa-v2/db/panel.db ]]; then + cp -pr ${HOME}/raspberry-noaa-v2/db/panel.db ${HOME}/raspberry-noaa-v2/db/panel.db.original + fi + fi + cp -pr ${BACKUP_LOC}/panel.db ${HOME}/raspberry-noaa-v2/db/panel.db + if [[ $? -eq 0 ]]; then + loggit "PASS" "Successfully backed up panel.db" + else + loggit "FAIL" "Failed to backup panel.db, aborting..." + exit 1 + fi + else + loggit "FAIL" "${HOME}/raspberry-noaa-v2/db/panel.db, not found, aborting..." + exit + fi + +} + +if [[ ${vMODE} == "backup" ]]; then + stage=0 + backup +elif [[ ${vMODE} == "backup_stage" ]]; then + stage=1 + backup +elif [[ ${vMODE} == "restore" ]]; then + stage=0 + restore +elif [[ ${vMODE} == "restore_stage" ]]; then + stage=1 + restore +fi + +secs_to_human "$(($(date +%s) - ${start}))" diff --git a/scripts/tools/caution_uninstall_rn2.sh b/ansible/roles/common/files/rn2_uninstall.sh similarity index 94% rename from scripts/tools/caution_uninstall_rn2.sh rename to ansible/roles/common/files/rn2_uninstall.sh index 8db5927d..eb30f729 100644 --- a/scripts/tools/caution_uninstall_rn2.sh +++ b/ansible/roles/common/files/rn2_uninstall.sh @@ -13,7 +13,7 @@ start=$(date +%s) UNINSTALL_LOG=/tmp/uninstall.log PACKAGES_BULLSEYE="satdump wxtoimg nginx predict php7.4-intl php8.0-sqlite3 php8.0-mbstring php8.0-fpm" PACKAGES_BOOKWORM="satdump wxtoimg nginx predict php8.2-intl php8.2-sqlite3 php8.2-mbstring php8.2-fpm" -PATHS="/srv/audio /srv/videos /srv/images $HOME/.config/composer $HOME/.config/gmic $HOME/.config/matplotlib $HOME/.config/meteordemod $HOME/.config/composer $HOME/.config/satdump $HOME/raspberry-noaa-v2 $HOME/.predict $HOME/.noaa-v2.conf $HOME/.wxtoimglic $HOME/.wxtoimgrc /usr/local/bin/rtl_* /var/log/raspberry-noaa-v2 /etc/sudoers.d/020_www-data-atrm-nopasswd /var/www/wx-new /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default /tmp/rtl-sdr" +PATHS="/srv/audio /srv/videos /srv/images $HOME/.config/composer $HOME/.config/gmic $HOME/.config/matplotlib $HOME/.config/meteordemod $HOME/.config/composer $HOME/.config/satdump $HOME/raspberry-noaa-v2 $HOME/.predict $HOME/.noaa-v2.conf $HOME/.wxtoimglic $HOME/.wxtoimgrc /usr/local/bin/rtl_* /var/log/raspberry-noaa-v2 /etc/sudoers.d/020_www-data-atrm-nopasswd /var/www/wx-new /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default /tmp/rtl-sdr /etc/modprobe.d/rtlsdr.conf" SERVICES="phpsessionclean.service phpsessionclean.timer nginx.service" OS=$(grep -E "^deb http://raspbian.raspberry.org/raspbian|^deb http://raspbian.raspberrypi.org/raspbian|^deb http://deb.debian.org/debian|^deb https://deb.debian.org/debian" /etc/apt/sources.list /etc/apt/sources.list.d/official-package-repositories.list 2> /dev/null | head -n 1 | awk '{print $3}') @@ -145,6 +145,10 @@ remove_paths() { done } +# kill any RN2 AT processes as part of clean up, otherwise danglers +# may have the RTL-SDR open and verification dryrun test will fail + +ps aux | grep -E "receive_|satdump" | grep -v grep | awk -F" " '{print $2}' | xargs kill -9 2>/dev/null package_statuses remove_services remove_packages @@ -173,4 +177,4 @@ loggit "INFO" "" loggit "INFO" "Log of results --> ${UNINSTALL_LOG}" echo "" -secs_to_human "$(($(date +%s) - ${start}))" \ No newline at end of file +secs_to_human "$(($(date +%s) - ${start}))" diff --git a/ansible/roles/common/files/rn2_upgrade.sh b/ansible/roles/common/files/rn2_upgrade.sh new file mode 100644 index 00000000..61ca43e2 --- /dev/null +++ b/ansible/roles/common/files/rn2_upgrade.sh @@ -0,0 +1,147 @@ +#!/bin/bash +# +# Purpose: Upgrade an existing RN2 installation in situ while retaining key files +# +# Process Flow: +# +# 1) Backup/Stage RN2 key directories +# +# 2) Uninstall existing RN2 installation +# +# 3) git clone new repository +# +# 4) Restore/UnStage RN2 key directories +# +# 5) install_and_upgrade +# +# 6) verification tool +# +# +# Author: Richard Creasey (AI4Y) +# +# Created: 28-July-2024 +# +# +# Input parameter: +# +# 1. Input Repo URL / branch name +# +# ./rn2_upgrade.sh "https://github.com/jekhokie/raspberry-noaa-v2.git -b aarch64-support" +# + +ACNT=$# +REPO=$1 +BARG=$2 +BRANCH=$3 + +echo "" +if [[ -z ${REPO} ]]; then + echo "Argument required: ./rn2_upgrade.sh https://github.com/jekhokie/raspberry-noaa-v2.git -b aarch64-support" + echo "" + exit 1 +fi + +if [[ ${ACNT} -gt 1 ]]; then + + if [[ ${BARG} != "-b" ]]; then + echo "2nd Argument must be -b" + echo "" + echo " ./rn2_upgrade.sh https://github.com/jekhokie/raspberry-noaa-v2.git -b aarch64-support" + echo "" + exit 1 + fi + + if [[ -z ${BRANCH} ]]; then + echo "3rd Argument branch-name required:" + echo "" + echo " ./rn2_upgrade.sh https://github.com/jekhokie/raspberry-noaa-v2.git -b aarch64-support" + echo "" + exit 1 + fi + +fi + +start=$(date +%s) + +secs_to_human() { + if [[ -z ${1} || ${1} -lt 60 ]] ;then + min=0 ; secs="${1}" + else + time_mins=$(echo "scale=2; ${1}/60" | bc) + min=$(echo ${time_mins} | cut -d'.' -f1) + secs="0.$(echo ${time_mins} | cut -d'.' -f2)" + secs=$(echo ${secs}*60|bc|awk '{print int($1+0.5)}') + fi + echo "RN2 Upgrade Time Elapsed : ${min} minutes and ${secs} seconds." +} + +# Define RN2 Utils location +RN2_UTILS="${HOME}/.rn2_utils" + +# Define log file for backup/restore activity +LOG="${RN2_UTILS}/rn2_upgrade.log" + +{ + +echo "##########################################################################" +echo "# Testing git clone arguments passed before destructive tasks are performed" +echo "##########################################################################" +cd /tmp +echo "git clone --depth 1 ${REPO} ${BARG} ${BRANCH}" +git clone --depth 1 ${REPO} ${BARG} ${BRANCH} + +if [[ $? != 0 ]]; then + echo "FAILED to git clone repo/branch passed, please check and try again" + exit 1 +fi + +echo "#####################################################" +echo "# Perform RN2 Key file backup/stage" +echo "#####################################################" +${RN2_UTILS}/rn2_backup_restore.sh backup_stage + +echo "#####################################################" +echo "# Uninstall existing RN2 installation" +echo "#####################################################" +${RN2_UTILS}/rn2_uninstall.sh + +echo "#####################################################" +echo "# Swap in git cloned repository into users home" +echo "#####################################################" +cd ${HOME} +mv /tmp/raspberry-noaa-v2 ${HOME} + +if [[ $? == 0 ]]; then + echo "Succcessfully moved RN2 tree from /tmp to home directory" +else + echo "FAILED to move RN2 tree from /tmp to home directory, aborting..." + exit 1 +fi + +echo "#####################################################" +echo "# Restore/UnStage RN2 key directories" +echo "#####################################################" +${RN2_UTILS}/rn2_backup_restore.sh restore_stage + +echo "#####################################################" +echo "# Execute install_and_upgrade" +echo "#####################################################" +cd ${HOME}/raspberry-noaa-v2 +./install_and_upgrade.sh + +# Determine if verification tool was in the repo cloned +if [[ -f ${HOME}/raspberry-noaa-v2/scripts/tools/verification_tool/verification.sh ]]; then + # Confirm if install_and_upgrade.sh script code already executed it or not + vFound=$(cat ${HOME}/raspberry-noaa-v2/install_and_upgrade.sh | grep verification.sh | wc -l) + if [[ ${vFound} -eq 0 ]]; then + echo "#####################################################" + echo "# Execute Verification Tool" + echo "#####################################################" + ${HOME}/raspberry-noaa-v2/scripts/tools/verification_tool/verification.sh quick + fi +else + echo "The installed GitHub REPO has not been updated with the Verification Tool, skipping..." +fi + +secs_to_human "$(($(date +%s) - ${start}))" +} | tee -a ${LOG} diff --git a/ansible/roles/common/tasks/configs.yml b/ansible/roles/common/tasks/configs.yml index b31208cb..15b67cd2 100644 --- a/ansible/roles/common/tasks/configs.yml +++ b/ansible/roles/common/tasks/configs.yml @@ -129,4 +129,36 @@ owner: "{{ target_user }}" group: "{{ target_user }}" mode: 0600 + +- name: rn2_utils directory + file: + path: /home/{{ target_user }}/.rn2_utils + state: directory + owner: "{{ target_user }}" + group: "{{ target_user }}" + mode: 0755 + +- name: rn2_backup_restore script + copy: + src: rn2_backup_restore.sh + dest: /home/{{ target_user }}/.rn2_utils + owner: "{{ target_user }}" + group: "{{ target_user }}" + mode: 0755 + +- name: rn2_uninstall script + copy: + src: rn2_uninstall.sh + dest: /home/{{ target_user }}/.rn2_utils + owner: "{{ target_user }}" + group: "{{ target_user }}" + mode: 0755 + +- name: rn2_upgrade script + copy: + src: rn2_upgrade.sh + dest: /home/{{ target_user }}/.rn2_utils + owner: "{{ target_user }}" + group: "{{ target_user }}" + mode: 0755 ... diff --git a/ansible/roles/common/tasks/tools.yml b/ansible/roles/common/tasks/tools.yml index 0fc0a1ec..caf21eef 100644 --- a/ansible/roles/common/tasks/tools.yml +++ b/ansible/roles/common/tasks/tools.yml @@ -52,14 +52,6 @@ group: "{{ target_user }}" mode: 0755 -- name: Set permissions on caution_uninstall_rn2.sh - file: - path: "/home/{{ target_user }}/raspberry-noaa-v2/scripts/tools/caution_uninstall_rn2.sh" - state: file - owner: "{{ target_user }}" - group: "{{ target_user }}" - mode: 0755 - - name: Set kernel to kernel8.img become: yes command: "/home/{{ target_user }}/raspberry-noaa-v2/scripts/tools/set_os_config_kernel8.sh" diff --git a/install_and_upgrade.sh b/install_and_upgrade.sh index 67881eda..a2457977 100755 --- a/install_and_upgrade.sh +++ b/install_and_upgrade.sh @@ -173,13 +173,9 @@ echo "-------------------------------------------------------------------------- echo "" if [ $install_type == 'install' ]; then - log_running "It looks like this is a fresh install of the tooling for captures." - log_running "If you've never had the software tools installed previously (e.g. if you've" - log_running "not installed the original raspberry-noaa repo content), you likely need to" - log_running "restart your device. Please do this to rule out any potential issues in the" - log_running "software and libraries that have been installed." - - log_running "Automatically rebooting your device now to finish the new install." - echo -e "\n\n\nAutomatically rebooting your device now to finish the new install." - sudo reboot + log_running "Reloading udev rules and trigger so correct permissions fire for SDR Dongles" + sudo udevadm control --reload-rules && sudo udevadm trigger + log_running "Running RN2 Verification Tool..." + ${HOME}/raspberry-noaa-v2/scripts/tools/verification_tool/verification.sh quick + #sudo reboot fi