install windows apps

This commit is contained in:
David Young
2026-03-24 10:24:57 -06:00
parent b474324d14
commit dcdc425376
7 changed files with 194 additions and 0 deletions

164
install-windows-apps.sh Executable file
View File

@@ -0,0 +1,164 @@
#!/bin/bash
#
# Purpose : Download latest VARA HF, FM and Terminal zips from winlink.org
BASE_URL="https://downloads.winlink.org"
DOWNLOAD_DIR="/tmp/windowsapps"
mkdir -p "$DOWNLOAD_DIR"
echo "Fetching VARA Products page..."
PAGE=$(curl -s "$BASE_URL/VARA%20Products/")
if [ -z "$PAGE" ]; then
echo "Error: could not fetch VARA Products page."
exit 1
fi
# Download and extract a VARA product by pattern
download_vara() {
local pattern="$1"
# Match against URL encoded pattern
local encoded_pattern=$(echo "$pattern" | sed 's| |%20|g')
ENCODED=$(echo "$PAGE" | grep -oP 'HREF="\K[^"]+' | grep -i "$encoded_pattern")
if [ -z "$ENCODED" ]; then
echo "Error: could not find $pattern on page."
return 1
fi
# Decode %20 to spaces for local filename
FILENAME=$(echo "$ENCODED" | sed 's|.*/||; s|%20| |g')
# Extract version number
VERSION=$(echo "$FILENAME" | grep -oP '\d+\.\d+[\.\d]*')
if [ -z "$VERSION" ]; then
echo "Error: could not determine version from filename: $FILENAME"
return 1
fi
echo "Found $pattern version: $VERSION"
echo "Filename: $FILENAME"
local DOWNLOAD_URL="$BASE_URL$ENCODED"
local FILEPATH="$DOWNLOAD_DIR/$FILENAME"
local EXTRACT_DIR="$DOWNLOAD_DIR/$(echo "$pattern" | sed 's| |_|g')"
echo "Downloading $FILENAME..."
wget -q "$DOWNLOAD_URL" -O "$FILEPATH"
if [ $? -ne 0 ]; then
echo "Error: download of $FILENAME failed."
return 1
fi
echo "Extracting to $EXTRACT_DIR..."
rm -rf "$EXTRACT_DIR"
mkdir -p "$EXTRACT_DIR"
unzip -q "$FILEPATH" -d "$EXTRACT_DIR"
if [ $? -eq 0 ]; then
echo "Extracted $pattern version $VERSION to $EXTRACT_DIR"
rm -f "$FILEPATH"
else
echo "Error: extraction of $FILENAME failed."
return 1
fi
}
# Install a VARA product using Wine
install_vara() {
local pattern="$1"
local extract_dir="$DOWNLOAD_DIR/$(echo "$pattern" | sed 's| |_|g')"
if [ ! -d "$extract_dir" ]; then
echo "Error: directory $extract_dir not found, skipping."
return 1
fi
# Find the VARA exe file in the extracted directory
local exe
exe=$(find "$extract_dir" -maxdepth 1 -iname "VARA*.exe" | head -n1)
if [ -z "$exe" ]; then
echo "Error: no VARA*.exe found in $extract_dir, skipping."
return 1
fi
local exe_name=$(basename "$exe")
echo ""
echo "=== Installing $exe_name ==="
echo "Please complete the installation in the Wine window."
echo "The script will continue once the installer is closed."
echo ""
wine "$exe"
echo "$exe_name installation complete."
}
# Download all VARA products
download_vara "VARA HF"
download_vara "VARA FM"
download_vara "VARA Terminal"
# Update Wine registry to disable window decorations
USER_REG="$HOME/.wine/user.reg"
if [ ! -f "$USER_REG" ]; then
echo "Warning: $USER_REG not found, skipping registry update."
else
echo "Updating Wine registry..."
sed -i 's/"Decorated"="Y"/"Decorated"="N"/' "$USER_REG"
echo "Set Decorated=N in $USER_REG"
fi
echo ""
echo "All VARA products downloaded and extracted to $DOWNLOAD_DIR"
# Install Wine dependencies
echo ""
echo "Installing Wine dependencies..."
winetricks -q vb6run pdh_nt4 sound=alsa
if [ $? -ne 0 ]; then
echo "Error: winetricks failed, aborting."
exit 1
fi
echo "Wine dependencies installed successfully."
# Install all VARA products
echo ""
echo "Starting VARA installations..."
install_vara "VARA HF"
install_vara "VARA FM"
install_vara "VARA Terminal"
# Install VARA desktop files
echo ""
echo "Installing VARA desktop files..."
DESKTOP_SRC="$HOME/.local/share/HamPack/desktop"
DESKTOP_DST="$HOME/.local/share/applications"
mkdir -p "$DESKTOP_DST"
for desktop in varafm.desktop varahf.desktop varaterminal.desktop; do
if [ ! -f "$DESKTOP_SRC/$desktop" ]; then
echo " Warning: $desktop not found in $DESKTOP_SRC, skipping."
continue
fi
mv "$DESKTOP_SRC/$desktop" "$DESKTOP_DST/$desktop"
chmod +x "$DESKTOP_DST/$desktop"
echo " Installed $desktop"
done
echo "Updating desktop database..."
update-desktop-database "$DESKTOP_DST"
echo ""
echo "All VARA installations complete."