Compare commits
2 Commits
2760ab4897
...
23662003da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23662003da | ||
|
|
34ed92a647 |
@@ -1,37 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installe (ou met à jour) l'entrée de menu "Farm Tracker" pointant vers l'AppImage déjà construit.
|
||||
set -e
|
||||
# Installation initiale de Farm Tracker (AppImage + entrée de menu).
|
||||
# À lancer une seule fois. Les mises à jour suivantes sont automatiques.
|
||||
set -euo pipefail
|
||||
|
||||
APPDIR="/home/shamiiow/GitHub/farm-tracker-app/dist"
|
||||
APPIMAGE=$(ls "$APPDIR"/*.AppImage 2>/dev/null | head -n1)
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
DIST_DIR="$SCRIPT_DIR/dist"
|
||||
|
||||
if [ -z "$APPIMAGE" ]; then
|
||||
echo "Aucun fichier .AppImage trouvé dans : $APPDIR"
|
||||
echo "Lance d'abord (depuis le dossier du projet) : npm run dist"
|
||||
# Trouve l'AppImage dans dist/
|
||||
APPIMAGE_SRC=$(ls "$DIST_DIR"/*.AppImage 2>/dev/null | head -n1)
|
||||
if [ -z "$APPIMAGE_SRC" ]; then
|
||||
echo "Aucun .AppImage trouvé dans dist/. Lance d'abord : npm run dist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
chmod +x "$APPIMAGE"
|
||||
# Chemin stable — indépendant de la version
|
||||
INSTALL_DIR="$HOME/.local/bin"
|
||||
STABLE_PATH="$INSTALL_DIR/farm-tracker.AppImage"
|
||||
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
cp "$APPIMAGE_SRC" "$STABLE_PATH"
|
||||
chmod +x "$STABLE_PATH"
|
||||
|
||||
# Entrée de menu
|
||||
DESKTOP_DIR="$HOME/.local/share/applications"
|
||||
mkdir -p "$DESKTOP_DIR"
|
||||
DESKTOP_FILE="$DESKTOP_DIR/farm-tracker.desktop"
|
||||
|
||||
cat > "$DESKTOP_FILE" << INNEREOF
|
||||
cat > "$DESKTOP_DIR/farm-tracker.desktop" << EOF
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Farm Tracker
|
||||
Comment=Suivi de loot Minecraft en direct
|
||||
Exec="$APPIMAGE" %U
|
||||
Exec="$STABLE_PATH" %U
|
||||
Icon=applications-games
|
||||
Terminal=false
|
||||
Categories=Game;Utility;
|
||||
StartupWMClass=farm-tracker
|
||||
INNEREOF
|
||||
EOF
|
||||
|
||||
chmod +x "$DESKTOP_FILE"
|
||||
chmod +x "$DESKTOP_DIR/farm-tracker.desktop"
|
||||
update-desktop-database "$DESKTOP_DIR" >/dev/null 2>&1 || true
|
||||
|
||||
echo "Entrée installée : $DESKTOP_FILE"
|
||||
echo "AppImage détecté : $APPIMAGE"
|
||||
echo "Cherche \"Farm Tracker\" dans ton menu d'applications (déconnexion/reconnexion parfois nécessaire selon le bureau)."
|
||||
echo "Installé dans : $STABLE_PATH"
|
||||
echo "Entrée de menu : $DESKTOP_DIR/farm-tracker.desktop"
|
||||
echo ""
|
||||
echo "Les prochaines mises à jour s'installeront automatiquement sans rien retoucher."
|
||||
|
||||
12
main.js
12
main.js
@@ -153,9 +153,15 @@ async function downloadAndInstall(downloadUrl, version) {
|
||||
sendUpdateProgress(100, 'installing');
|
||||
if (process.platform === 'linux') {
|
||||
fs.chmodSync(tmpPath, 0o755);
|
||||
const current = process.env.APPIMAGE;
|
||||
if (current) { fs.copyFileSync(tmpPath, current); fs.unlinkSync(tmpPath); app.relaunch(); }
|
||||
else app.relaunch({ execPath: tmpPath });
|
||||
const stablePath = path.join(require('os').homedir(), '.local', 'bin', 'farm-tracker.AppImage');
|
||||
const target = fs.existsSync(stablePath) ? stablePath : process.env.APPIMAGE;
|
||||
if (target) {
|
||||
fs.copyFileSync(tmpPath, target);
|
||||
fs.unlinkSync(tmpPath);
|
||||
app.relaunch({ execPath: target });
|
||||
} else {
|
||||
app.relaunch({ execPath: tmpPath });
|
||||
}
|
||||
app.exit(0);
|
||||
} else if (process.platform === 'win32') {
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "farm-tracker",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "farm-tracker",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"dist": "^0.1.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "farm-tracker",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "Suivi de loot Minecraft en direct, avec sauvegarde automatique des stats et des chances de drop.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user