diff --git a/overlay/etc/skel/add-ons/wine/02-install-vara-hf.sh b/overlay/etc/skel/add-ons/wine/02-install-vara-hf.sh index 7592ddc..2b90f1c 100755 --- a/overlay/etc/skel/add-ons/wine/02-install-vara-hf.sh +++ b/overlay/etc/skel/add-ons/wine/02-install-vara-hf.sh @@ -2,28 +2,19 @@ # # Author : Gaston Gonzalez # Date : 20 January 2025 -# Updated : 1 February 2025 +# Updated : 28 February 2025 # Purpose : Install VARA HF -set -e source ./common-checks.sh -VERSION="4.8.9" -DOWNLOAD_FILE="vara-hf-${VERSION}.zip" -URL="https://downloads.winlink.org/VARA%20Products/VARA%20HF%20v${VERSION}%20setup.zip" VARA_HOME="${HOME}/.wine32/drive_c/VARA" +VARA_PATTERN="VARA%20HF" -et-log "Installing VARA HF..." +./vara-downloader.sh "${VARA_PATTERN}" +[[ $? -ne 0 ]] && et-log "Error downloading VARA HF" && exit 1 -if [ ! -e ${DOWNLOAD_FILE} ]; then - et-log "Downloading VARA HF ${version} from ${URL}" - curl -s -f -L -o ${DOWNLOAD_FILE} "${URL}" -fi - -if [ $? -ne 0 ]; then - et-log "Error downloading VARA HF ${VERSION}." - exit 1 -fi +DOWNLOAD_FILE=$(ls *.zip | grep "${VARA_PATTERN}") +[[ ! -e "${DOWNLOAD_FILE}" ]] && et-log "VARA download file not found" && exit 1 unzip -o ${DOWNLOAD_FILE} diff --git a/overlay/etc/skel/add-ons/wine/03-install-vara-fm.sh b/overlay/etc/skel/add-ons/wine/03-install-vara-fm.sh index f2d2598..7fb6da1 100755 --- a/overlay/etc/skel/add-ons/wine/03-install-vara-fm.sh +++ b/overlay/etc/skel/add-ons/wine/03-install-vara-fm.sh @@ -2,28 +2,18 @@ # # Author : Gaston Gonzalez # Date : 20 January 2025 -# Updated : 1 February 2025 +# Updated : 28 February 2025 # Purpose : Install VARA FM -set -e source ./common-checks.sh -VERSION="4.3.8" -DOWNLOAD_FILE="vara-fm-${VERSION}.zip" -URL="https://downloads.winlink.org/VARA%20Products/VARA%20FM%20v${VERSION}%20setup.zip" -VARA_HOME="${HOME}/.wine32/drive_c/VARA FM" +VARA_PATTERN="VARA%20FM" -et-log "Installing VARA FM..." +./vara-downloader.sh "${VARA_PATTERN}" +[[ $? -ne 0 ]] && et-log "Error downloading VARA FM" && exit 1 -if [ ! -e ${DOWNLOAD_FILE} ]; then - et-log "Downloading VARA FM ${version} from ${URL}" - curl -s -f -L -o ${DOWNLOAD_FILE} "${URL}" -fi - -if [ $? -ne 0 ]; then - et-log "Error downloading VARA FM ${VERSION}." - exit 1 -fi +DOWNLOAD_FILE=$(ls *.zip | grep "${VARA_PATTERN}") +[[ ! -e "${DOWNLOAD_FILE}" ]] && et-log "VARA download file not found" && exit 1 unzip -o ${DOWNLOAD_FILE} diff --git a/overlay/etc/skel/add-ons/wine/README.md b/overlay/etc/skel/add-ons/wine/README.md index 44fc311..7c20086 100644 --- a/overlay/etc/skel/add-ons/wine/README.md +++ b/overlay/etc/skel/add-ons/wine/README.md @@ -17,7 +17,7 @@ in this directory as your normal user (do not use 'sudo'). ./03-install-vara-fm.sh -4. Run the registery editor. Follow the instructions in the terminal. In +4. Run the registry editor. Follow the instructions in the terminal. In this step we will need to map COM port 10 (COM10) to the EmComm Tools CAT control device (/dev/et-cat). @@ -31,3 +31,25 @@ in this directory as your normal user (do not use 'sudo'). It is important that you do not run any of the VARA programs until after the backup is run in step 5. + +## Including VARA in an ETC ISO image + +If you want to include VARA in a future EmComm Tools Community image build, +perform the following in Cubic after the main install script is finished. + +1. Change into the `/etc/skel` directory. + +2. Copy the WINE backup file created in step 5 using the file copy option + in Cubic (i.e. `etc-wine-backup-HOST-YYYYMMDD.tar.gz`). + +3. Unpack the backup file. This will create `/etc/skel/.wine32`. + +``` +tar -xzf etc-wine-backup-* +``` + +4. Delete the backup file on the Cubic session to save on space. + +``` +rm etc-wine-backup-* +``` diff --git a/overlay/etc/skel/add-ons/wine/vara-downloader.sh b/overlay/etc/skel/add-ons/wine/vara-downloader.sh new file mode 100755 index 0000000..9da1221 --- /dev/null +++ b/overlay/etc/skel/add-ons/wine/vara-downloader.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 28 February 2025 +# Purpose : Download utility for VARA applications + +BASE_HTML_FILE="vara-index.html" + +cleanup() { + [[ -f "$BASE_HTML_FILE" ]] && rm "${BASE_HTML_FILE}" +} + +trap cleanup EXIT + +function usage() { + echo "Usage: $(basename $0) " + echo " pattern - VARA filename substring pattern to match on" +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +FILENAME_PATTERN="$1" +BASE_URL="https://downloads.winlink.org" +INDEX_URL="${BASE_URL}/VARA%20Products/" + +# 1. Fetch main VARA download page as HTML +curl -s -f -L -o ${BASE_HTML_FILE} ${INDEX_URL} +[[ $? -ne 0 ]] && et-log "Error fetching VARA index page: ${BASE_URL}" && exit 1 + +# 2. Extract all links from index page +VARA_FILE_PATH=$(cat ${BASE_HTML_FILE} | pup 'a attr{href}' | grep "${FILENAME_PATTERN}") +[[ $? -ne 0 ]] && et-log "Error finding VARA file matching specified pattern" && exit 1 + + +#3. Check for multiple matches +if [[ "${VARA_FILE_PATH}" =~ [[:space:]] ]]; then + echo -e "\n${VARA_FILE_PATH}\n" + et-log "Multiple files matched. Try again with a more specific pattern." + exit 1 +fi + +FULL_URL="${BASE_URL}${VARA_FILE_PATH}" +et-log "Found ${VARA_FILE_PATH}" +et-log "Downloading: ${FULL_URL}" + +curl -s -f -L -O "${FULL_URL}" +exit $? diff --git a/scripts/install-pup.sh b/scripts/install-pup.sh new file mode 100755 index 0000000..32a1352 --- /dev/null +++ b/scripts/install-pup.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 28 February 2025 +# Purpose : Install pup (HTML processing) + +VERSION="0.4.0" +ZIP_FILE="pup_v${VERSION}_linux_amd64.zip" +INSTALL_DIR="/opt/pup-${VERSION}" +INSTALL_DIR_BIN="${INSTALL_DIR}/bin" +LINK_PATH="/opt/pup" + +et-log "Installing pup (HTML processing tool)..." + +URL="https://github.com/ericchiang/pup/releases/download/v${VERSION}/${ZIP_FILE}" + +et-log "Downloading pup: ${URL}" +curl -s -f -L -o ${ZIP_FILE} ${URL} + +[[ $? -ne 0 ]] && et-log "Error fetching pup" && exit 1 + +mv -v ${ZIP_FILE} ${ET_DIST_DIR} + +CWD_DIR=$(pwd) + +if [[ ! -e "${INSTALL_DIR}" ]]; then + mkdir -v -p ${INSTALL_DIR_BIN} && cd ${INSTALL_DIR_BIN} + unzip ${ET_DIST_DIR}/${ZIP_FILE} +else + et-log "${INSTALL_DIR} already exists." +fi + +chmod 755 ${INSTALL_DIR_BIN}/pup + +[[ -e ${LINK_PATH} ]] && rm ${LINK_PATH} +ln -s ${INSTALL_DIR} ${LINK_PATH} + +stow -v -d /opt pup -t /usr/local + +cd ${CWD_DIR} diff --git a/scripts/install.sh b/scripts/install.sh index 11c2da8..ece608b 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,7 +2,7 @@ # # Author : Gaston Gonzalez # Date : 16 March 2024 -# Updated : 20 January 2025 +# Updated : 28 February 2025 # Purpose : Main installer for EmComm Tools OS Community . ./env.sh @@ -15,6 +15,7 @@ exitIfNotRoot ./install-base.sh ./install-dev-tools.sh +./install-pup.sh ./install-browser.sh ./remove-packages.sh ./install-branding.sh diff --git a/tests/test-pup.sh b/tests/test-pup.sh new file mode 100755 index 0000000..3826c1b --- /dev/null +++ b/tests/test-pup.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Author : Gaston Gonzalez +# Date : 28 February 2025 +# Purpose : Test pup installation + +OUT=$(which pup) +exit $?