improved download locations on icon theme script, and made both icon theme scripts the same, will merge later. Also added todos in multiple locations.

This commit is contained in:
crowetic 2025-07-15 18:55:10 -07:00
parent 784fe56903
commit 08f1cd51e8
4 changed files with 165 additions and 108 deletions

View File

@ -50,12 +50,11 @@ echo -e "$text_010"; sleep 0.5
echo
echo -e "$text_011"; sleep 0.5
echo
echo -e "$text_012"; sleep 1
echo -e "${CYAN}$text_012${NC}"; sleep 1
echo
echo
echo -e "$text_013"
echo
BACKUP_EXECUTED=false
@ -72,7 +71,7 @@ else
exit 1
fi
echo -e "${YELLOW}📋 Detected distro: ${DISTRO} ${VERSION}${NC}"
echo -e "${YELLOW}📋 Detected distro:${NC} ${GREEN}${DISTRO}${NC} ${CYAN}${VERSION}${NC}"
# Install Required Packages
echo -e "${CYAN}🔧 Installing dependencies...${NC}"
@ -105,22 +104,26 @@ if [ -d "$HOME/qortal" ]; then
IS_SYNCING=$(echo "$STATUS_JSON" | jq -r '.isSynchronizing')
SYNC_PERCENT=$(echo "$STATUS_JSON" | jq -r '.syncPercent')
echo "🛰️ Syncing: $IS_SYNCING"
echo "📊 Sync Percent: $SYNC_PERCENT"
echo "🛰️ ${YELLOW}Syncnronizing:${NC} ${CYAN}$IS_SYNCING${NC}"
echo "📊 ${YELLOW}Sync Percent:${NC} ${CYAN}$SYNC_PERCENT${NC}"
fi
if [[ "$IS_SYNCING" == "false" || "$SYNC_PERCENT" == "100" ]]; then
echo "✅ Qortal Core is fully synchronized. No Backup needed..."
echo "${GREEN}✅ Qortal Core is fully synchronized. No Backup needed...${NC}"
BACKUP_EXECUTED=false
QORTAL_CORE_GOOD=true
else
echo "⚠️ Qortal Core is not fully synced. Proceeding with update/start/etc."
echo "${RED}⚠️ Qortal Core is not fully synced.${NC} ${CYAN}Proceeding...Will stop Qortal, backup existing data, and continue...${NC}"
if pgrep -f "qortal.jar" > /dev/null && curl -s "http://localhost:12391/admin/status" | grep -q "height"; then
if [ -f "${HOME}/qortal/stop.sh" ]; then
"${HOME}/qortal/stop.sh"
echo -e "${CYAN} Sleeping for 10 seconds to ensure that Qortal fully stopped...${NC}"
sleep 10
else
curl -X POST "http://localhost:12391/admin/stop" -H "X-API-KEY: $(cat ${HOME}/qortal/apikey.txt)"
echo -e "${CYAN} Sleeping for 20 seconds to allow Qortal to fully stop...${NC}"
sleep 20
fi
fi
mkdir -p "$HOME/backups"

View File

@ -19,13 +19,38 @@ if [ ! -d "${ICON_SOURCE_DIR}" ]; then
echo "🔽 Downloading Qortal icon set..."
mkdir -p "${HOME}/iconTemp"
trap 'rm -rf "${HOME}/iconTemp"' EXIT
cd "${HOME}/iconTemp"
curl -L -o icons.zip https://cloud.qortal.org/s/machinePicturesFolder/download
unzip icons.zip
mv Pictures/* "${HOME}/Pictures/"
cd
cd "${HOME}/iconTemp" || exit 1
#TODO - UPDATE THESE DOWNLOAD LOCATIONS WITH QDN LOCATIONS (MOST LIKELY PUBLISHED AS A WEBSITE TO ALLOW DIRECT WGET DOWNLOADS)
PRIMARY_URL="https://cloud.qortal.org/s/machinePicturesFolder/download"
BACKUP_URL="https://cloud.crowetic.com/s/m9GZyy8k6n7NYJZ/download"
echo "🌐 Trying primary source..."
if curl -fL -o Pictures.zip "$PRIMARY_URL"; then
echo "✅ Downloaded from primary."
else
echo "⚠️ Primary download failed. Trying backup source..."
if curl -fL -o Pictures.zip "$BACKUP_URL"; then
echo "✅ Downloaded from backup."
else
echo "❌ Both downloads failed. Aborting. ICON FILES FAILED TO DOWNLOAD, PLEASE RUN ./create-icon-theme-uni.sh LATER TO TRY AGAIN!"
exit 1
fi
fi
if unzip Pictures.zip; then
echo "📂 Extracted icon archive."
mv Pictures/* "${HOME}/Pictures/"
else
echo "❌ Failed to unzip icon archive. Aborting."
exit 1
fi
cd || exit 1
fi
# Define icon mappings
declare -A ICON_MAP=(
["qortal-menu-button.png"]="qortal-menu-button"

View File

@ -1,84 +1,57 @@
#!/bin/bash
set -e
set -euo pipefail
DEBUG=${DEBUG:-false}
log() {
echo -e "$1"
}
debug() {
if [ "$DEBUG" = true ]; then echo -e "[DEBUG] $1"; fi
}
# Dependencies
for cmd in rsync curl unzip convert; do
if ! command -v $cmd &>/dev/null; then
echo "[!] Required command '$cmd' is not installed."
if ! command -v "$cmd" >/dev/null; then
echo "[!] Required command '$cmd' is not installed. Please install it and re-run."
exit 1
fi
done
# Detect icon install path
ICON_THEME_NAME="Yaru-blue-qortal"
ICON_SOURCE_DIR="${HOME}/Pictures/icons/icons_theme"
if [ -d "$HOME/.local/share/icons" ]; then
USER_ICON_ROOT="$HOME/.local/share/icons"
else
USER_ICON_ROOT="$HOME/.icons"
fi
ICON_CACHE_DIR="${USER_ICON_ROOT}/${ICON_THEME_NAME}"
ICON_THEME_NAME="Yaru-blue-qortal"
ICON_CACHE_DIR="${HOME}/.icons/${ICON_THEME_NAME}"
TARGET_THEME_DIR="${ICON_CACHE_DIR}/48x48/apps"
mkdir -p "${TARGET_THEME_DIR}"
# Download icons if missing
if [ ! -d "${ICON_SOURCE_DIR}" ]; then
log "📥 Downloading Qortal icons..."
echo "🔽 Downloading Qortal icon set..."
mkdir -p "${HOME}/iconTemp"
trap 'rm -rf "${HOME}/iconTemp"' EXIT
cd "${HOME}/iconTemp"
curl -L -O https://cloud.qortal.org/s/machinePicturesFolder/download
unzip download
mv Pictures/* "${HOME}/Pictures/"
cd
fi
cd "${HOME}/iconTemp" || exit 1
# Copy and modify base icon theme
if [ ! -d "${ICON_CACHE_DIR}" ]; then
log "🎨 Creating theme '${ICON_THEME_NAME}' from Yaru-dark..."
#TODO - UPDATE THESE DOWNLOAD LOCATIONS WITH QDN LOCATIONS (MOST LIKELY PUBLISHED AS A WEBSITE TO ALLOW DIRECT WGET DOWNLOADS)
if [ -d /usr/share/icons/Yaru-dark ]; then
rsync -a /usr/share/icons/Yaru-dark/ "${ICON_CACHE_DIR}/"
PRIMARY_URL="https://cloud.qortal.org/s/machinePicturesFolder/download"
BACKUP_URL="https://cloud.crowetic.com/s/m9GZyy8k6n7NYJZ/download"
echo "🌐 Trying primary source..."
if curl -fL -o Pictures.zip "$PRIMARY_URL"; then
echo "✅ Downloaded from primary."
else
echo "[!] Yaru-dark not found. Cannot create icon theme."
echo "⚠️ Primary download failed. Trying backup source..."
if curl -fL -o Pictures.zip "$BACKUP_URL"; then
echo "✅ Downloaded from backup."
else
echo "❌ Both downloads failed. Aborting. ICON FILES FAILED TO DOWNLOAD, PLEASE RUN ./create-icon-theme-uni.sh LATER TO TRY AGAIN!"
exit 1
fi
fi
if unzip Pictures.zip; then
echo "📂 Extracted icon archive."
mv Pictures/* "${HOME}/Pictures/"
else
echo "❌ Failed to unzip icon archive. Aborting."
exit 1
fi
# Copy over index.theme
if [ -f /usr/share/icons/Yaru-blue-dark/index.theme ]; then
cp /usr/share/icons/Yaru-blue-dark/index.theme "${ICON_CACHE_DIR}/index.theme"
elif [ ! -f "${ICON_CACHE_DIR}/index.theme" ]; then
cat <<EOF > "${ICON_CACHE_DIR}/index.theme"
[Icon Theme]
Name=${ICON_THEME_NAME}
Comment=Qortal custom icons with Yaru base
Inherits=Yaru-dark,Yaru,hicolor
Directories=48x48/apps
[48x48/apps]
Size=48
Context=Applications
Type=Fixed
EOF
fi
sed -i "s/^Name=.*/Name=${ICON_THEME_NAME}/" "${ICON_CACHE_DIR}/index.theme"
sed -i "s/^Inherits=.*/Inherits=Yaru-blue-dark,Yaru-dark,Yaru,hicolor/" "${ICON_CACHE_DIR}/index.theme"
cd || exit 1
fi
# Map and install icons
# Define icon mappings
declare -A ICON_MAP=(
["qortal-menu-button.png"]="qortal-menu-button"
["qortal-menu-button-2.png"]="qortal-menu-button-2"
@ -89,60 +62,115 @@ declare -A ICON_MAP=(
["qortal.png"]="qortal"
)
# Step 1: Choose base theme
BASE_THEME_DIR=""
if [ -d "/usr/share/icons/Yaru-dark" ]; then
BASE_THEME_DIR="/usr/share/icons/Yaru-dark"
echo "[*] Using Yaru-dark as base."
else
CURRENT_THEME=$(gsettings get org.gnome.desktop.interface icon-theme 2>/dev/null | tr -d "'")
if [ -n "$CURRENT_THEME" ] && [ -d "/usr/share/icons/$CURRENT_THEME" ]; then
BASE_THEME_DIR="/usr/share/icons/$CURRENT_THEME"
echo "[*] Falling back to current icon theme: $CURRENT_THEME"
else
echo "[!] Could not find Yaru-dark or current theme. Creating minimal fallback..."
mkdir -p "${ICON_CACHE_DIR}/48x48/apps"
cat <<EOF > "${ICON_CACHE_DIR}/index.theme"
[Icon Theme]
Name=${ICON_THEME_NAME}
Inherits=hicolor
Directories=48x48/apps
[48x48/apps]
Size=48
Context=Applications
Type=Fixed
EOF
fi
fi
# Step 2: Copy base theme if found
if [ -n "$BASE_THEME_DIR" ] && [ ! -d "${ICON_CACHE_DIR}" ]; then
echo "[*] Copying base theme from: $BASE_THEME_DIR"
mkdir -p "${ICON_CACHE_DIR}"
rsync -a "$BASE_THEME_DIR/" "${ICON_CACHE_DIR}/"
if [ -f "/usr/share/icons/Yaru-blue-dark/index.theme" ]; then
cp /usr/share/icons/Yaru-blue-dark/index.theme "${ICON_CACHE_DIR}/index.theme"
fi
sed -i 's/^Name=.*/Name=Yaru-blue-qortal/' "${ICON_CACHE_DIR}/index.theme"
sed -i 's/^Inherits=.*/Inherits=Yaru-blue-dark,Yaru-dark,Yaru,hicolor/' "${ICON_CACHE_DIR}/index.theme"
if ! grep -q "48x48/apps" "${ICON_CACHE_DIR}/index.theme"; then
echo "Directories=48x48/apps" >> "${ICON_CACHE_DIR}/index.theme"
echo "
[48x48/apps]
Size=48
Context=Applications
Type=Fixed" >> "${ICON_CACHE_DIR}/index.theme"
fi
fi
# Step 3: Install icons
mkdir -p "${TARGET_THEME_DIR}"
install_icon() {
local src="$1"
local name="$2"
local dest="${TARGET_THEME_DIR}/${name}.png"
if [ ! -f "$src" ]; then
echo "[!] Icon not found: $src"
echo "[!] Missing source icon: $src"
return
fi
if command -v convert &>/dev/null; then
convert "$src" -resize 48x48 "$dest"
debug "Installed and resized $name to $dest"
else
cp "$src" "$dest"
debug "Copied $name to $dest without resizing"
fi
echo "[*] Installing icon: $name"
convert "$src" -resize 48x48 "$dest"
}
log "🧩 Installing icons..."
for src in "${!ICON_MAP[@]}"; do
install_icon "${ICON_SOURCE_DIR}/${src}" "${ICON_MAP[$src]}"
done
# Update icon cache
if command -v gtk-update-icon-cache &>/dev/null && [ -f "${ICON_CACHE_DIR}/index.theme" ]; then
gtk-update-icon-cache -f "${ICON_CACHE_DIR}" || true
# Step 4: Update icon cache
if [ -f "${ICON_CACHE_DIR}/index.theme" ]; then
gtk-update-icon-cache -f "${ICON_CACHE_DIR}" || echo "[!] gtk-update-icon-cache failed or not found."
fi
# Set icon theme based on DE
CURRENT_DE=$(echo "${XDG_CURRENT_DESKTOP:-${DESKTOP_SESSION:-unknown}}" | tr '[:upper:]' '[:lower:]')
# Step 5: Set icon theme if DE supports it
CURRENT_DESKTOP=$(echo "${XDG_CURRENT_DESKTOP}" | tr '[:upper:]' '[:lower:]')
log "🖥️ Detected Desktop Environment: $CURRENT_DE"
case "$CURRENT_DE" in
cinnamon)
gsettings set org.cinnamon.desktop.interface icon-theme "${ICON_THEME_NAME}" 2>/dev/null || true
;;
gnome)
gsettings set org.gnome.desktop.interface icon-theme "${ICON_THEME_NAME}" 2>/dev/null || true
;;
mate)
gsettings set org.mate.interface icon-theme "${ICON_THEME_NAME}" 2>/dev/null || true
;;
xfce|xfce4)
xfconf-query -c xsettings -p /Net/IconThemeName -s "${ICON_THEME_NAME}" 2>/dev/null || true
;;
kde|plasma)
kwriteconfig5 --file kdeglobals --group Icons --key Theme "${ICON_THEME_NAME}" 2>/dev/null || true
;;
*)
log "[] Unknown or unsupported DE. Please set '${ICON_THEME_NAME}' manually in system settings."
;;
# Normalize aliases
case "$CURRENT_DESKTOP" in
x-cinnamon) CURRENT_DESKTOP="cinnamon" ;;
xfce*) CURRENT_DESKTOP="xfce" ;;
kde-plasma) CURRENT_DESKTOP="plasma" ;;
esac
log "✅ Qortal icons installed into theme '${ICON_THEME_NAME}'"
log " If icons don't appear immediately, restart your session or reapply theme."
if command -v gsettings >/dev/null; then
case "$CURRENT_DESKTOP" in
cinnamon)
gsettings set org.cinnamon.desktop.interface icon-theme "${ICON_THEME_NAME}"
;;
gnome)
gsettings set org.gnome.desktop.interface icon-theme "${ICON_THEME_NAME}"
;;
xfce)
xfconf-query -c xsettings -p /Net/IconThemeName -s "${ICON_THEME_NAME}" 2>/dev/null
;;
kde | plasma)
kwriteconfig5 --file kdeglobals --group Icons --key Theme "${ICON_THEME_NAME}"
;;
*)
echo "[!] Unsupported or unknown DE: '$CURRENT_DESKTOP'. Set icon theme manually if needed."
;;
esac
else
echo "[!] gsettings not available. Please set icon theme manually if needed."
fi
echo "✅ Qortal icons installed into local theme: ${ICON_THEME_NAME}"
echo " You can now use Icon=qortal-ui (etc.) in .desktop files."
echo "💡 If icons don't show up immediately, try logging out and back in."

View File

@ -134,6 +134,7 @@ curl -L -O https://raw.githubusercontent.com/crowetic/QORTector-scripts/main/aut
curl -L -O https://raw.githubusercontent.com/crowetic/QORTector-scripts/main/check-qortal-status.sh
curl -L -O https://raw.githubusercontent.com/crowetic/QORTector-scripts/main/start-qortal.sh
curl -L -O https://raw.githubusercontent.com/crowetic/QORTector-scripts/main/start-qortal-core.sh
#todo update the download location below to multiple locations and QDN location
curl -L -O https://cloud.qortal.org/s/machinefilesnew/download
chmod +x *.sh