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:
31
CLAUDE.md
31
CLAUDE.md
@@ -15,17 +15,24 @@ Basilisk II auto-installer for Linux (Arch and Debian/Ubuntu). Compiles Basilisk
|
||||
## Running the Installer
|
||||
|
||||
```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.
|
||||
|
||||
## Configuration
|
||||
## Interactive Options
|
||||
|
||||
Before running, update the placeholder URL in `install.sh`:
|
||||
```bash
|
||||
GIT_BASE_URL="https://ton-git-perso.com/basilisk" # Replace with actual URL
|
||||
```
|
||||
The installer prompts for:
|
||||
- Screen resolution (640x480, 800x600, 1024x768, 1280x1024)
|
||||
- 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
|
||||
|
||||
@@ -36,10 +43,20 @@ Files are installed to `~/.basilisk2/`:
|
||||
|
||||
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
|
||||
|
||||
Default settings in generated `basilisk2_prefs`:
|
||||
- RAM: 16 MB
|
||||
- Model: Quadra 900 (modelid 14, cpu 4, fpu enabled)
|
||||
- Display: 800x600 DGA
|
||||
- Display: 800x600/8 DGA
|
||||
- Network: disabled
|
||||
|
||||
225
install.sh
225
install.sh
@@ -7,18 +7,128 @@
|
||||
set -e
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Configuration - À adapter avec tes URLs
|
||||
# Configuration
|
||||
#-------------------------------------------------------------------------------
|
||||
GIT_BASE_URL="https://ton-git-perso.com/basilisk" # Remplace par ton URL
|
||||
ROM_URL="${GIT_BASE_URL}/quadra900.rom"
|
||||
HDD_URL="${GIT_BASE_URL}/system7.img"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROM_SOURCE="${SCRIPT_DIR}/Quadra.ROM"
|
||||
HDD_SOURCE="${SCRIPT_DIR}/HDD.img"
|
||||
|
||||
INSTALL_DIR="${HOME}/.basilisk2"
|
||||
ROM_FILE="${INSTALL_DIR}/quadra900.rom"
|
||||
HDD_FILE="${INSTALL_DIR}/system7.img"
|
||||
ROM_FILE="${INSTALL_DIR}/Quadra.ROM"
|
||||
HDD_FILE="${INSTALL_DIR}/HDD.img"
|
||||
CONFIG_FILE="${INSTALL_DIR}/basilisk2_prefs"
|
||||
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
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -39,7 +149,8 @@ install_deps_arch() {
|
||||
echo ">>> Installation des dépendances (Arch)..."
|
||||
sudo pacman -S --needed --noconfirm \
|
||||
base-devel git sdl2 gtk2 \
|
||||
autoconf automake pkg-config
|
||||
autoconf automake pkg-config \
|
||||
xorg-server libx11 libxext
|
||||
}
|
||||
|
||||
install_deps_debian() {
|
||||
@@ -47,7 +158,8 @@ install_deps_debian() {
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
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() {
|
||||
echo ">>> Téléchargement de la ROM et de l'image disque..."
|
||||
copy_resources() {
|
||||
echo ">>> Copie de la ROM et de l'image disque..."
|
||||
|
||||
mkdir -p "${INSTALL_DIR}"
|
||||
mkdir -p "${SHARED_DIR}"
|
||||
|
||||
if [ ! -f "${ROM_FILE}" ]; then
|
||||
echo " Téléchargement ROM..."
|
||||
wget -q --show-progress -O "${ROM_FILE}" "${ROM_URL}"
|
||||
else
|
||||
echo " ROM déjà présente, skip"
|
||||
if [ ! -f "${ROM_SOURCE}" ]; then
|
||||
echo "ERREUR: ROM non trouvée: ${ROM_SOURCE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${HDD_FILE}" ]; then
|
||||
echo " Téléchargement image disque..."
|
||||
wget -q --show-progress -O "${HDD_FILE}" "${HDD_URL}"
|
||||
else
|
||||
echo " Image disque déjà présente, skip"
|
||||
if [ ! -f "${HDD_SOURCE}" ]; then
|
||||
echo "ERREUR: Image disque non trouvée: ${HDD_SOURCE}"
|
||||
exit 1
|
||||
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() {
|
||||
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
|
||||
# Basilisk II Configuration
|
||||
# Généré automatiquement
|
||||
@@ -115,23 +234,23 @@ generate_config() {
|
||||
rom ${ROM_FILE}
|
||||
disk ${HDD_FILE}
|
||||
|
||||
# Mémoire (16 Mo)
|
||||
ramsize 16777216
|
||||
# Mémoire ($((OPT_RAM_SIZE/1048576)) Mo)
|
||||
ramsize ${OPT_RAM_SIZE}
|
||||
|
||||
# Modèle Quadra 900
|
||||
modelid 14
|
||||
cpu 4
|
||||
fpu true
|
||||
|
||||
# Affichage (plein écran, 800x600, 256 couleurs)
|
||||
screen dga/800/600/8
|
||||
# Affichage (${OPT_SCREEN_RES}, ${OPT_COLOR_DEPTH} bits)
|
||||
screen dga/${OPT_SCREEN_RES}/${OPT_COLOR_DEPTH}
|
||||
frameskip 1
|
||||
|
||||
# Audio
|
||||
nosound false
|
||||
nosound ${nosound}
|
||||
|
||||
# Réseau (désactivé par défaut)
|
||||
nonet true
|
||||
# Réseau
|
||||
nonet ${nonet}
|
||||
|
||||
# Dossier partagé avec l'hôte
|
||||
extfs ${SHARED_DIR}
|
||||
@@ -181,6 +300,40 @@ EOF
|
||||
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
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -190,6 +343,11 @@ main() {
|
||||
echo "=============================================="
|
||||
echo
|
||||
|
||||
# Menu interactif si pas en mode -y
|
||||
if [ "${INTERACTIVE_MODE}" = "true" ]; then
|
||||
interactive_menu
|
||||
fi
|
||||
|
||||
local distro=$(detect_distro)
|
||||
echo ">>> Distribution détectée: ${distro}"
|
||||
|
||||
@@ -208,9 +366,10 @@ main() {
|
||||
esac
|
||||
|
||||
compile_basilisk
|
||||
download_resources
|
||||
copy_resources
|
||||
generate_config
|
||||
create_launcher
|
||||
setup_autostart
|
||||
|
||||
echo
|
||||
echo "=============================================="
|
||||
@@ -223,7 +382,13 @@ main() {
|
||||
echo
|
||||
echo " Tu peux aussi lancer depuis le menu applications"
|
||||
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
|
||||
}
|
||||
|
||||
main "$@"
|
||||
# Parse arguments et lance main
|
||||
parse_args "$@"
|
||||
main
|
||||
|
||||
Reference in New Issue
Block a user