Files
imajviewer/install.sh
Alhan 440513e7be
Some checks failed
Build Windows / build-windows (push) Has been cancelled
feat: use imajviewericon.png as app icon for both Linux and Windows
- Replace generated icon in install.sh with proper imajviewericon.png (64x64 resize)
- Update deb/ icon to match source icon (64x64 PNG)
- Update windows/runner/resources/app_icon.ico from imajviewericon.png (6 sizes: 16-256)
- Add SetupIconFile to Inno Setup installer config
2026-07-27 17:15:07 +03:00

93 lines
3.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
APP=imajviewer
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
BUNDLE_DIR="${SCRIPT_DIR}/build/linux/x64/release/bundle"
INSTALL_DIR="${HOME}/.local/lib/${APP}"
BIN_LINK="${HOME}/.local/bin/${APP}"
DESKTOP_FILE="${HOME}/.local/share/applications/${APP}.desktop"
ICON_DIR="${HOME}/.local/share/icons/hicolor/64x64/apps"
ICON_FILE="${ICON_DIR}/${APP}.png"
# ── Renkler ──
RED='\033[0;31m'; GREEN='\033[0;32m'; CYAN='\033[0;36m'; NC='\033[0m'
info() { echo -e "${CYAN}${NC} $1"; }
ok() { echo -e "${GREEN}${NC} $1"; }
err() { echo -e "${RED}${NC} $1"; exit 1; }
# ── Ön koşul kontrol ──
command -v xdg-mime >/dev/null 2>&1 || err "xdg-mime bulunamadı (xdg-utils paketi gerekli)"
command -v xdg-desktop-menu >/dev/null 2>&1 || err "xdg-desktop-menu bulunamadı (xdg-utils paketi gerekli)"
if [ ! -f "$BUNDLE_DIR/${APP}" ]; then
info "Binary bulunamadı, Flutter build başlatılıyor…"
cd "$SCRIPT_DIR"
flutter build linux 2>&1 | tail -1 || err "Flutter build başarısız! Sistemde Flutter SDK kurulu olmalı veya dist/imajviewer_*.deb paketini kullanın."
BUNDLE_DIR="${SCRIPT_DIR}/build/linux/x64/release/bundle"
[ -f "$BUNDLE_DIR/${APP}" ] || err "Build başarısız!"
fi
# ── Kurulum dizinleri ──
mkdir -p "$INSTALL_DIR" "$(dirname "$BIN_LINK")" "$(dirname "$DESKTOP_FILE")" "$ICON_DIR"
# ── Binary + kütüphaneler ──
info "Binary ve kütüphaneler kopyalanıyor…"
cp -r "$BUNDLE_DIR"/* "$INSTALL_DIR/"
chmod +x "$INSTALL_DIR/${APP}"
# ── Symlink ──
ln -sf "$INSTALL_DIR/${APP}" "$BIN_LINK"
ok "Symlink: $BIN_LINK$INSTALL_DIR/${APP}"
# ── İkon (64×64 PNG) ──
if [ ! -f "$ICON_FILE" ]; then
if [ -f "$SCRIPT_DIR/imajviewericon.png" ]; then
info "İkon kopyalanıyor (64x64)…"
python3 -c "
from PIL import Image
im = Image.open('$SCRIPT_DIR/imajviewericon.png')
im.resize((64,64), Image.LANCZOS).save('$ICON_FILE')
" && ok "İkon: $ICON_FILE" || err "İkon dönüştürme başarısız!"
else
err "imajviewericon.png bulunamadı!"
fi
else
ok "İkon zaten mevcut"
fi
# ── .desktop dosyası ──
info ".desktop dosyası oluşturuluyor…"
cat > "$DESKTOP_FILE" << EOF
[Desktop Entry]
Type=Application
Name=${APP}
Comment=Ultra hafif görüntü izleyici
Exec=${BIN_LINK} %F
Icon=${APP}
Terminal=false
Categories=Graphics;Viewer;RasterGraphics;
MimeType=image/png;image/jpeg;image/webp;image/bmp;image/gif;image/jpg;
StartupNotify=false
EOF
ok "${DESKTOP_FILE}"
# ── MIME default ──
info "Varsayılan görüntü izleyici olarak ayarlanıyor…"
for mime in image/png image/jpeg image/jpg image/webp image/bmp image/gif; do
xdg-mime default "${APP}.desktop" "$mime" 2>/dev/null || true
done
# ── Masaüstü veritabanını güncelle ──
which update-desktop-database &>/dev/null && update-desktop-database "${HOME}/.local/share/applications/" 2>/dev/null || true
which gtk-update-icon-cache &>/dev/null && gtk-update-icon-cache "${HOME}/.local/share/icons/hicolor/" 2>/dev/null || true
echo ""
echo -e "${GREEN}══════════════════════════════════════════${NC}"
echo -e "${GREEN} ${APP} kuruldu!${NC}"
echo -e "${GREEN} Bir PNG/JPG/WebP dosyasına çift tıklayın${NC}"
echo -e "${GREEN} veya 'xdg-open <dosya>' ile test edin${NC}"
echo -e "${GREEN}══════════════════════════════════════════${NC}"
echo ""
echo "Kaldırmak için: rm -rf ${INSTALL_DIR} ${BIN_LINK} ${DESKTOP_FILE} ${ICON_FILE}"