Ajout menu interactif et dépendances X11 complètes

- Copie locale des fichiers ROM/HDD depuis le repo cloné
- Menu interactif: résolution, couleurs, RAM, son, réseau, autostart
- Dépendances X11 (xorg-server, libx11, libxext) pour systèmes minimaux
- Options CLI: -y (non-interactif), --help
- Service systemd pour démarrage automatique
This commit is contained in:
Victor Bodinaud
2026-01-19 15:43:57 +01:00
parent bb5e5f0348
commit 61bf3217b6
2 changed files with 229 additions and 47 deletions

View File

@@ -15,17 +15,24 @@ Basilisk II auto-installer for Linux (Arch and Debian/Ubuntu). Compiles Basilisk
## Running the Installer ## Running the Installer
```bash ```bash
./install.sh git clone https://git.mahtan-melwasul.com/Mahtan/Macintosh.git
cd Macintosh
./install.sh # Interactive mode
./install.sh -y # Non-interactive (defaults)
./install.sh --help # Show help
``` ```
Requires `sudo` for package installation. Supported distributions: Arch Linux, Debian/Ubuntu. Requires `sudo` for package installation. Supported distributions: Arch Linux, Debian/Ubuntu.
## Configuration ## Interactive Options
Before running, update the placeholder URL in `install.sh`: The installer prompts for:
```bash - Screen resolution (640x480, 800x600, 1024x768, 1280x1024)
GIT_BASE_URL="https://ton-git-perso.com/basilisk" # Replace with actual URL - Color depth (8/16/24 bits)
``` - RAM (8/16/32/64 MB)
- Autostart at boot (systemd user service)
- Sound enable/disable
- Network enable/disable
## Installation Output ## Installation Output
@@ -36,10 +43,20 @@ Files are installed to `~/.basilisk2/`:
Launch with `~/.basilisk2/run.sh` or `basilisk2` if `~/bin` is in PATH. Launch with `~/.basilisk2/run.sh` or `basilisk2` if `~/bin` is in PATH.
## Autostart (systemd)
If enabled, creates `~/.config/systemd/user/basilisk2.service`.
```bash
systemctl --user status basilisk2 # Check status
systemctl --user start basilisk2 # Manual start
systemctl --user disable basilisk2 # Disable autostart
```
## Emulator Configuration ## Emulator Configuration
Default settings in generated `basilisk2_prefs`: Default settings in generated `basilisk2_prefs`:
- RAM: 16 MB - RAM: 16 MB
- Model: Quadra 900 (modelid 14, cpu 4, fpu enabled) - Model: Quadra 900 (modelid 14, cpu 4, fpu enabled)
- Display: 800x600 DGA - Display: 800x600/8 DGA
- Network: disabled - Network: disabled

View File

@@ -7,18 +7,128 @@
set -e set -e
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Configuration - À adapter avec tes URLs # Configuration
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
GIT_BASE_URL="https://ton-git-perso.com/basilisk" # Remplace par ton URL SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROM_URL="${GIT_BASE_URL}/quadra900.rom" ROM_SOURCE="${SCRIPT_DIR}/Quadra.ROM"
HDD_URL="${GIT_BASE_URL}/system7.img" HDD_SOURCE="${SCRIPT_DIR}/HDD.img"
INSTALL_DIR="${HOME}/.basilisk2" INSTALL_DIR="${HOME}/.basilisk2"
ROM_FILE="${INSTALL_DIR}/quadra900.rom" ROM_FILE="${INSTALL_DIR}/Quadra.ROM"
HDD_FILE="${INSTALL_DIR}/system7.img" HDD_FILE="${INSTALL_DIR}/HDD.img"
CONFIG_FILE="${INSTALL_DIR}/basilisk2_prefs" CONFIG_FILE="${INSTALL_DIR}/basilisk2_prefs"
SHARED_DIR="${INSTALL_DIR}/shared" SHARED_DIR="${INSTALL_DIR}/shared"
#-------------------------------------------------------------------------------
# Options d'installation (modifiées par le menu interactif)
#-------------------------------------------------------------------------------
OPT_SCREEN_RES="800/600"
OPT_COLOR_DEPTH="8"
OPT_RAM_SIZE="16777216"
OPT_AUTOSTART="false"
OPT_SOUND="true"
OPT_NETWORK="false"
INTERACTIVE_MODE="true"
#-------------------------------------------------------------------------------
# Parsing des arguments CLI
#-------------------------------------------------------------------------------
parse_args() {
while [[ $# -gt 0 ]]; do
case "$1" in
-y|--non-interactive)
INTERACTIVE_MODE="false"
shift
;;
-h|--help)
echo "Usage: $0 [-y|--non-interactive] [-h|--help]"
echo ""
echo "Options:"
echo " -y, --non-interactive Installation automatique avec valeurs par défaut"
echo " -h, --help Affiche cette aide"
exit 0
;;
*)
echo "Option inconnue: $1"
echo "Utilisez -h pour l'aide"
exit 1
;;
esac
done
}
#-------------------------------------------------------------------------------
# Menu interactif
#-------------------------------------------------------------------------------
ask_choice() {
local prompt="$1"
shift
local options=("$@")
local default_index=1
echo
echo "${prompt}"
for i in "${!options[@]}"; do
echo " $((i+1))) ${options[$i]}"
done
local choice
read -p "Choix [${default_index}]: " choice
choice=${choice:-${default_index}}
# Valider l'entrée
if ! [[ "$choice" =~ ^[0-9]+$ ]] || [ "$choice" -lt 1 ] || [ "$choice" -gt "${#options[@]}" ]; then
choice=${default_index}
fi
echo $((choice-1))
}
interactive_menu() {
echo
echo "=== Configuration de l'installation ==="
# Résolution d'écran
local resolutions=("640x480 (VGA)" "800x600 (SVGA) [défaut]" "1024x768 (XGA)" "1280x1024 (SXGA)")
local res_values=("640/480" "800/600" "1024/768" "1280/1024")
local res_choice=$(ask_choice "Résolution d'écran:" "${resolutions[@]}")
OPT_SCREEN_RES="${res_values[$res_choice]}"
# Profondeur de couleur
local depths=("8 bits (256 couleurs) [défaut]" "16 bits (65K couleurs)" "24 bits (16M couleurs)")
local depth_values=("8" "16" "24")
local depth_choice=$(ask_choice "Profondeur de couleur:" "${depths[@]}")
OPT_COLOR_DEPTH="${depth_values[$depth_choice]}"
# Mémoire RAM
local rams=("8 Mo" "16 Mo [défaut]" "32 Mo" "64 Mo")
local ram_values=("8388608" "16777216" "33554432" "67108864")
local ram_choice=$(ask_choice "Mémoire RAM:" "${rams[@]}")
OPT_RAM_SIZE="${ram_values[$ram_choice]}"
# Démarrage automatique
echo
read -p "Démarrer automatiquement au boot? [o/N]: " autostart
[[ "$autostart" =~ ^[oOyY]$ ]] && OPT_AUTOSTART="true"
# Son
read -p "Activer le son? [O/n]: " sound
[[ "$sound" =~ ^[nN]$ ]] && OPT_SOUND="false"
# Réseau
read -p "Activer le réseau? [o/N]: " network
[[ "$network" =~ ^[oOyY]$ ]] && OPT_NETWORK="true"
echo
echo ">>> Configuration choisie:"
echo " Écran: ${OPT_SCREEN_RES}/${OPT_COLOR_DEPTH}"
echo " RAM: $((OPT_RAM_SIZE/1048576)) Mo"
echo " Autostart: ${OPT_AUTOSTART}"
echo " Son: ${OPT_SOUND}"
echo " Réseau: ${OPT_NETWORK}"
echo
}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Détection de la distribution # Détection de la distribution
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@@ -39,7 +149,8 @@ install_deps_arch() {
echo ">>> Installation des dépendances (Arch)..." echo ">>> Installation des dépendances (Arch)..."
sudo pacman -S --needed --noconfirm \ sudo pacman -S --needed --noconfirm \
base-devel git sdl2 gtk2 \ base-devel git sdl2 gtk2 \
autoconf automake pkg-config autoconf automake pkg-config \
xorg-server libx11 libxext
} }
install_deps_debian() { install_deps_debian() {
@@ -47,7 +158,8 @@ install_deps_debian() {
sudo apt-get update sudo apt-get update
sudo apt-get install -y \ sudo apt-get install -y \
build-essential git libsdl2-dev libgtk2.0-dev \ build-essential git libsdl2-dev libgtk2.0-dev \
autoconf automake pkg-config wget autoconf automake pkg-config wget \
xserver-xorg libx11-dev libxext-dev
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@@ -78,27 +190,28 @@ compile_basilisk() {
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Téléchargement des ressources # Copie des ressources depuis le repo local
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
download_resources() { copy_resources() {
echo ">>> Téléchargement de la ROM et de l'image disque..." echo ">>> Copie de la ROM et de l'image disque..."
mkdir -p "${INSTALL_DIR}" mkdir -p "${INSTALL_DIR}"
mkdir -p "${SHARED_DIR}" mkdir -p "${SHARED_DIR}"
if [ ! -f "${ROM_FILE}" ]; then if [ ! -f "${ROM_SOURCE}" ]; then
echo " Téléchargement ROM..." echo "ERREUR: ROM non trouvée: ${ROM_SOURCE}"
wget -q --show-progress -O "${ROM_FILE}" "${ROM_URL}" exit 1
else
echo " ROM déjà présente, skip"
fi fi
if [ ! -f "${HDD_FILE}" ]; then if [ ! -f "${HDD_SOURCE}" ]; then
echo " Téléchargement image disque..." echo "ERREUR: Image disque non trouvée: ${HDD_SOURCE}"
wget -q --show-progress -O "${HDD_FILE}" "${HDD_URL}" exit 1
else
echo " Image disque déjà présente, skip"
fi fi
cp -v "${ROM_SOURCE}" "${ROM_FILE}"
cp -v "${HDD_SOURCE}" "${HDD_FILE}"
echo ">>> Fichiers copiés"
} }
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@@ -107,6 +220,12 @@ download_resources() {
generate_config() { generate_config() {
echo ">>> Génération de la configuration..." echo ">>> Génération de la configuration..."
# Calcul des valeurs booléennes inversées pour Basilisk II
local nosound="false"
local nonet="true"
[[ "${OPT_SOUND}" == "false" ]] && nosound="true"
[[ "${OPT_NETWORK}" == "true" ]] && nonet="false"
cat > "${CONFIG_FILE}" << EOF cat > "${CONFIG_FILE}" << EOF
# Basilisk II Configuration # Basilisk II Configuration
# Généré automatiquement # Généré automatiquement
@@ -115,23 +234,23 @@ generate_config() {
rom ${ROM_FILE} rom ${ROM_FILE}
disk ${HDD_FILE} disk ${HDD_FILE}
# Mémoire (16 Mo) # Mémoire ($((OPT_RAM_SIZE/1048576)) Mo)
ramsize 16777216 ramsize ${OPT_RAM_SIZE}
# Modèle Quadra 900 # Modèle Quadra 900
modelid 14 modelid 14
cpu 4 cpu 4
fpu true fpu true
# Affichage (plein écran, 800x600, 256 couleurs) # Affichage (${OPT_SCREEN_RES}, ${OPT_COLOR_DEPTH} bits)
screen dga/800/600/8 screen dga/${OPT_SCREEN_RES}/${OPT_COLOR_DEPTH}
frameskip 1 frameskip 1
# Audio # Audio
nosound false nosound ${nosound}
# Réseau (désactivé par défaut) # Réseau
nonet true nonet ${nonet}
# Dossier partagé avec l'hôte # Dossier partagé avec l'hôte
extfs ${SHARED_DIR} extfs ${SHARED_DIR}
@@ -181,6 +300,40 @@ EOF
echo " Raccourci bureau créé" echo " Raccourci bureau créé"
} }
#-------------------------------------------------------------------------------
# Configuration du démarrage automatique (systemd)
#-------------------------------------------------------------------------------
setup_autostart() {
if [ "${OPT_AUTOSTART}" != "true" ]; then
return
fi
echo ">>> Configuration du démarrage automatique..."
local service_dir="${HOME}/.config/systemd/user"
mkdir -p "${service_dir}"
cat > "${service_dir}/basilisk2.service" << EOF
[Unit]
Description=Basilisk II Macintosh Emulator
After=graphical-session.target
[Service]
ExecStart=${INSTALL_DIR}/run.sh
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable basilisk2.service
echo " Service systemd activé: basilisk2.service"
echo " Démarrer manuellement: systemctl --user start basilisk2"
}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Main # Main
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@@ -190,6 +343,11 @@ main() {
echo "==============================================" echo "=============================================="
echo echo
# Menu interactif si pas en mode -y
if [ "${INTERACTIVE_MODE}" = "true" ]; then
interactive_menu
fi
local distro=$(detect_distro) local distro=$(detect_distro)
echo ">>> Distribution détectée: ${distro}" echo ">>> Distribution détectée: ${distro}"
@@ -208,22 +366,29 @@ main() {
esac esac
compile_basilisk compile_basilisk
download_resources copy_resources
generate_config generate_config
create_launcher create_launcher
setup_autostart
echo echo
echo "==============================================" echo "=============================================="
echo " Installation terminée !" echo " Installation terminée !"
echo "==============================================" echo "=============================================="
echo echo
echo " Dossier: ${INSTALL_DIR}" echo " Dossier: ${INSTALL_DIR}"
echo " Lancer: ${INSTALL_DIR}/run.sh" echo " Lancer: ${INSTALL_DIR}/run.sh"
echo " Dossier partagé: ${SHARED_DIR}" echo " Dossier partagé: ${SHARED_DIR}"
echo echo
echo " Tu peux aussi lancer depuis le menu applications" echo " Tu peux aussi lancer depuis le menu applications"
echo " ou taper 'basilisk2' si ~/bin est dans ton PATH" echo " ou taper 'basilisk2' si ~/bin est dans ton PATH"
if [ "${OPT_AUTOSTART}" = "true" ]; then
echo
echo " Autostart activé: systemctl --user status basilisk2"
fi
echo echo
} }
main "$@" # Parse arguments et lance main
parse_args "$@"
main