From 1a8eb433726e5d765c61e17f37184fcd2ceab4e3 Mon Sep 17 00:00:00 2001 From: jaromaz Date: Wed, 13 Jul 2022 01:17:01 +0200 Subject: [PATCH] Startup chimes & netinfo --- README.md | 4 +- assets/func.sh | 75 ++++++++++++++++--- cdemu/cdemu.sh | 8 +- .../share/macintoshpi/{ => macos9}/macos9.cfg | 0 .../share/macintoshpi/{ => macos9}/macos9.cfg | 0 .../share/macintoshpi/{ => macos9}/macos9.cfg | 0 launcher/mac | 31 +++++--- macos7/macos7.sh | 6 ++ macos8/macos8.sh | 4 + macos9/macos9.sh | 4 + syncterm/syncterm.sh | 8 +- vice/vice.sh | 6 +- vmodem/vmodem.sh | 7 +- 13 files changed, 122 insertions(+), 31 deletions(-) rename launcher/config/os9-480/usr/share/macintoshpi/{ => macos9}/macos9.cfg (100%) rename launcher/config/os9-600/usr/share/macintoshpi/{ => macos9}/macos9.cfg (100%) rename launcher/config/os9-768/usr/share/macintoshpi/{ => macos9}/macos9.cfg (100%) diff --git a/README.md b/README.md index b64e71e..1308d51 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The project consists of the following auto-compiling and installing bash scripts * Commodore 64/128/PET emulator **[VICE](https://vice-emu.sourceforge.io)**. * **[MacintoshPi Virtual Modem](https://github.com/jaromaz/MacintoshPi#macintoshpi-virtual-modem)** using the **[tty0tty](https://github.com/freemed/tty0tty)** and **[tcpser](http://www.jbrain.com/pub/linux/serial/)** projects, running with the two aforementioned emulators for *Apple* and *Commodore* products, and on *Raspberry Pi OS* itself, as well as allowing any original terminal retro-software to connect with modern-day telnet BBSs. * CD-ROM, DVD-ROM emulator **[CDEmu](https://cdemu.sourceforge.io)** which allows mounting CD images (iso, toast, cue/bin, mds/mdf etc.) under *Raspberry Pi OS* - runs with *BasiliskII* and *SheepShaver* emulators, as well as on *Raspberry Pi OS*. The emulators are configured automatically to support that virtual CD-ROM drive. -* A consistent **[MacintoshPi Launcher](https://github.com/jaromaz/MacintoshPi#macintoshpi-launcher)** that runs all of those systems at different resolutions (after reboot) and in different configurations. +* A consistent **[MacintoshPi Launcher](https://github.com/jaromaz/MacintoshPi#macintoshpi-launcher)** that runs all of those systems at different resolutions (after reboot), in different configurations, with autostart support and with various startup chimes. * **[SyncTERM](https://syncterm.bbsdev.net)** - an application for connecting with BBSs from the *Raspberry Pi OS*, compiled in combination with the *SDL library*. * Information how to run *Raspberry Pi OS* in **dual-boot** with **[BMC64](https://accentual.com/bmc64/)**, the fastest *Commodore* emulator for *Raspberry Pi* (bare metal/low latency emulator). @@ -143,6 +143,8 @@ The launcher's task is to launch a given version of *Mac OS*, and if one is alre The name of the directory with the data with which the system is to be overwritten is identical as the name of the parameter following the ```mac``` command, e.g. ```mac os8-480``` will restart *Raspberry Pi OS* in 640x480 resolution, and then launch ```Mac OS 8``` also in that resolution, but the ```mac os8``` command will simply launch *Mac OS 8* in the most recently selected resolution. +Various startup chimes are played at the launch of each system - depending on the selected resolution: Macintosh 128K, Macintosh Classic II, Macintosh Color Classic, Macintosh Performa 520, Power Macintosh 550, Power Macintosh G3 sounds. + The Launcher allows also ```.img``` or ```.dsk``` files to be added to *Mac OS* using e.g. ```mac os7 file.img``` - then the *Mac OS* concerned will be launched and the image content will appear on the desktop as an additional drive. ### SyncTERM diff --git a/assets/func.sh b/assets/func.sh index c5f2fb3..d569aa2 100644 --- a/assets/func.sh +++ b/assets/func.sh @@ -11,16 +11,17 @@ # Author: Jaroslaw Mazurkiewicz / jaromaz # www: https://jm.iq.pl e-mail: jm at iq.pl # -------------------------------------------------------- -# MacintoshPi functions +# MacintoshPi functions # -------------------------------------------------------- -VERSION="1.1.0" +VERSION="1.2.5" BASE_DIR="/usr/share/macintoshpi" CONF_DIR="/etc/macintoshpi" +WAV_DIR="${BASE_DIR}/sounds" SRC_DIR="${BASE_DIR}/src" BASILISK_REPO="https://github.com/kanjitalk755/macemu/archive/master.zip" SHEEPSHAVER_REPO=${BASILISK_REPO} -SDL2_SOURCE="https://www.libsdl.org/release/SDL2-2.0.7.tar.gz" +SDL2_SOURCE="https://www.libsdl.org/release/SDL2-2.0.7.tar.gz" VICE_SOURCE="https://downloads.sourceforge.net/project/vice-emu/releases/vice-3.4.tar.gz" BASILISK_FILE="/usr/local/bin/BasiliskII" SHEEPSHAVER_FILE="/usr/local/bin/SheepShaver" @@ -30,6 +31,7 @@ ROM4OS[7]="https://github.com/macmade/Macintosh-ROMs/raw/18e1d0a9756f8ae3b9c005a ROM4OS[8]="https://github.com/macmade/Macintosh-ROMs/raw/main/Quadra-650.ROM" ROM4OS[9]="https://www.redundantrobot.com/sheepshaver_files/roms/newworld86.rom.zip" + function usercheck { [ $USER != "pi" ] && echo 'Run this script as the "pi" user.' && exit } @@ -55,9 +57,29 @@ function installinfo { echo " * INFO: The build and installation process will take approximately" echo " two hours" printf "\n " -for i in {10..0}; do printf "$i ... "; sleep 1; done +for i in {10..1}; do printf "$i ... "; sleep 1; done +echo +} + + +function net_error { + echo + echo "***********" + echo + echo "Error - can't download: $1" + echo "Check your Internet connection and try again later." + echo + echo "If you still feel its a bug, then please create an issue here:" + echo "https://github.com/jaromaz/MacintoshPi/issues/new" + echo + parent=$(cat /proc/$PPID/comm) + [ "$parent" == "build_all.sh" ] && killall -q build_all.sh + exit } + + + function Base_dir { [ -d ${BASE_DIR} ] || ( sudo mkdir -p ${BASE_DIR} && sudo chown pi:pi ${BASE_DIR} ) } @@ -96,7 +118,9 @@ printf "\e[95m"; echo ' mkdir -p ${SRC_DIR} 2>/dev/null -wget -O ${SRC_DIR}/master.zip ${SHEEPSHAVER_REPO} && +wget -O ${SRC_DIR}/master.zip ${SHEEPSHAVER_REPO} +[ $? -ne 0 ] && net_error "SheepShaver sources" + unzip ${SRC_DIR}/master.zip -d ${SRC_DIR} cd ${SRC_DIR}/macemu-*/SheepShaver make links @@ -110,7 +134,6 @@ NO_CONFIGURE=1 ./autogen.sh && --without-mon \ --without-esd \ --enable-addressing=direct,0x10000000 - # --enable-sdl-framework-prefix=/Library/Frameworks make -j3 sudo make install @@ -119,7 +142,7 @@ modprobe --show sheep_net 2>/dev/null || Build_NetDriver echo "no-sighandler" | sudo tee /etc/directfbrc grep -q mmap_min_addr /etc/sysctl.conf || \ -echo "vm.mmap_min_addr = 0" | sudo tee -a /etc/sysctl.conf +echo "vm.mmap_min_addr = 0" | sudo tee -a /etc/sysctl.conf rm -rf ${SRC_DIR} @@ -135,12 +158,14 @@ printf "\e[95m"; echo ' | _ \ / _` / __| | | / __| |/ / | | | | | |_) | (_| \__ \ | | \__ \ < | | | | |____/ \__,_|___/_|_|_|___/_|\_\ |___|___| - + '; printf "\e[0m"; sleep 2 mkdir -p ${SRC_DIR} 2>/dev/null wget -O ${SRC_DIR}/master.zip ${BASILISK_REPO} +[ $? -ne 0 ] && net_error "Basilisk II sources" + unzip ${SRC_DIR}/master.zip -d /${SRC_DIR} cd ${SRC_DIR}/macemu-*/BasiliskII/src/Unix/ NO_CONFIGURE=1 ./autogen.sh && @@ -173,11 +198,14 @@ sudo apt install -y automake gobjc libudev-dev xa65 build-essential byacc texi2h libgtkglext1-dev libpulse-dev bison libnet1 libnet1-dev libpcap0.8 \ libpcap0.8-dev libvte-dev libasound2-dev raspberrypi-kernel-headers +[ $? -ne 0 ] && net_error "SDL2 apt packages" + Base_dir mkdir -p ${SRC_DIR} wget ${SDL2_SOURCE} -O - | tar -xz -C ${SRC_DIR} +[ $? -ne 0 ] && net_error "SDL2 sources" cd ${SRC_DIR}/SDL2-2.0.7 && ./configure --host=arm-raspberry-linux-gnueabihf \ @@ -200,10 +228,33 @@ rm -rf ${SRC_DIR} function Launcher { if ! [ -d ${CONF_DIR} ]; then + mkdir -p ${SRC_DIR} 2>/dev/null cd ../launcher - sudo mkdir /etc/macintoshpi - sudo cp -r config/* /etc/macintoshpi + sudo mkdir ${CONF_DIR} + sudo cp -r config/* ${CONF_DIR} sudo cp mac /usr/bin + # Chimes wav files + wget -O ${SRC_DIR}/chimes.zip ${HDD_IMAGES}/chimes.zip + unzip -d ${SRC_DIR} ${SRC_DIR}/chimes.zip + [ $? -ne 0 ] && net_error "Chimes wav files" + sudo mkdir -p ${WAV_DIR} + for i in os7-342 os7-384 os7-480 os7-600 os8-480 \ + os8-600 os9-480 os9-600 os9-768; do + sudo mkdir ${CONF_DIR}/${i}${WAV_DIR} + done + sudo cp ${SRC_DIR}/chimes/m1.wav ${CONF_DIR}/os7-342${WAV_DIR}/os7.wav + sudo cp ${SRC_DIR}/chimes/cc.wav ${CONF_DIR}/os7-384${WAV_DIR}/os7.wav + sudo cp ${SRC_DIR}/chimes/pe.wav ${CONF_DIR}/os7-480${WAV_DIR}/os7.wav + sudo cp ${SRC_DIR}/chimes/pe.wav ${CONF_DIR}/os7-600${WAV_DIR}/os7.wav + sudo cp ${SRC_DIR}/chimes/pe.wav ${CONF_DIR}/os8-480${WAV_DIR}/os8.wav + sudo cp ${SRC_DIR}/chimes/pm.wav ${CONF_DIR}/os8-600${WAV_DIR}/os8.wav + sudo cp ${SRC_DIR}/chimes/pm.wav ${CONF_DIR}/os9-480${WAV_DIR}/os9.wav + sudo cp ${SRC_DIR}/chimes/g3.wav ${CONF_DIR}/os9-600${WAV_DIR}/os9.wav + sudo cp ${SRC_DIR}/chimes/g3.wav ${CONF_DIR}/os9-768${WAV_DIR}/os9.wav + sudo cp ${SRC_DIR}/chimes/c2.wav ${WAV_DIR}/os7.wav + sudo cp ${SRC_DIR}/chimes/pm.wav ${WAV_DIR}/os8.wav + sudo cp ${SRC_DIR}/chimes/g3.wav ${WAV_DIR}/os9.wav + rm -rf ${SRC_DIR} fi } @@ -236,13 +287,13 @@ function logo { ); clear && echo - for i in {0..9}; do + for i in {0..9}; do [ $(($i % 2)) -gt "0" ] && printf "\e[93m" || printf "\e[96m" printf "${logotype[${i}]}" done echo for i in {1..47}; do printf ' '; done - printf "\e[90m" + printf "\e[90m" echo "v.${VERSION}" printf "\e[0m\n" } diff --git a/cdemu/cdemu.sh b/cdemu/cdemu.sh index d1c7d51..a10aaa7 100755 --- a/cdemu/cdemu.sh +++ b/cdemu/cdemu.sh @@ -22,17 +22,21 @@ printf "\e[92m"; echo ' \____|____/|_____|_| |_| |_|\__,_| '; printf "\e[0m"; sleep 2 +source ./assets/func.sh +updateinfo + # Software -sudo apt update && sudo apt upgrade -y sudo apt-get install -y dpkg-dev dkms libao-dev intltool libsndfile1-dev libbz2-dev \ liblzma-dev gtk-doc-tools gobject-introspection libgirepository1.0-dev \ python3-matplotlib libsamplerate0-dev cmake raspberrypi-kernel-headers \ dh-systemd +[ $? -ne 0 ] && net_error "CDEmu apt packages" + # CDemu git repo rm -rf ~/cdemusrc git clone -b 'vhba-module-20210418' --single-branch --depth 1 https://github.com/cdemu/cdemu.git ~/cdemusrc - +[ $? -ne 0 ] && net_error "CDEmu sources" # vhba-module cd ~/cdemusrc/vhba-module diff --git a/launcher/config/os9-480/usr/share/macintoshpi/macos9.cfg b/launcher/config/os9-480/usr/share/macintoshpi/macos9/macos9.cfg similarity index 100% rename from launcher/config/os9-480/usr/share/macintoshpi/macos9.cfg rename to launcher/config/os9-480/usr/share/macintoshpi/macos9/macos9.cfg diff --git a/launcher/config/os9-600/usr/share/macintoshpi/macos9.cfg b/launcher/config/os9-600/usr/share/macintoshpi/macos9/macos9.cfg similarity index 100% rename from launcher/config/os9-600/usr/share/macintoshpi/macos9.cfg rename to launcher/config/os9-600/usr/share/macintoshpi/macos9/macos9.cfg diff --git a/launcher/config/os9-768/usr/share/macintoshpi/macos9.cfg b/launcher/config/os9-768/usr/share/macintoshpi/macos9/macos9.cfg similarity index 100% rename from launcher/config/os9-768/usr/share/macintoshpi/macos9.cfg rename to launcher/config/os9-768/usr/share/macintoshpi/macos9/macos9.cfg diff --git a/launcher/mac b/launcher/mac index e4f866d..d662a77 100755 --- a/launcher/mac +++ b/launcher/mac @@ -1,6 +1,6 @@ #!/bin/bash # -------------------------------- -# MacintoshPi Launcher / 2022 +# MacintoshPi Launcher / v.1.2.5 # -------------------------------- # author: Jaroslaw Mazurkiewicz # Jaromaz @@ -46,13 +46,28 @@ function run_os { + + clear + tput civis if aplay -l 2>&1 | grep "no sound"; then SOUND=0; fi log_check + sleep 2 if [ "$SOUND" -gt 0 ]; then sudo killall pulseaudio &>/dev/null sleep 1 sudo pulseaudio -D &>/dev/null sleep 1 + if [ -f $BASE_DIR/sounds/os${VER}.wav ]; then + sudo amixer -q sset Master playback 40% + sudo aplay -q $BASE_DIR/sounds/os${VER}.wav + sudo amixer -q sset Master playback 80% + sleep 1 + sudo killall pulseaudio &>/dev/null + sleep 1 + sudo pulseaudio -D &>/dev/null + sleep 1 + fi + fi [ -z "$SKA" ] || DISK="--disk $SKA" [ "$VER" -eq 9 ] && command="sudo " @@ -61,6 +76,7 @@ [ "$VER" -lt 9 ] && command="${command} BasiliskII" ${command} --config ${MACOS_CONFIG} ${DISK} &>>${LOG} clear + tput cnorm exit } @@ -72,18 +88,11 @@ MACOS_DIR=${BASE_DIR}/macos${VER} MACOS_CONFIG=${MACOS_DIR}/macos${VER}.cfg - # Autostart + # Autostart if [ "$SKA" == "macpiautostart" ]; then sleep 5 clear SKA="" - echo "Waiting 5 sec for system start" - for i in {5..1}; do - sleep 1 - printf "${i} ... " - done - echo "Running ... " - sleep 1 # Mac OS 7/8/9 if [ "$VER" -lt 10 ]; then run_os @@ -93,7 +102,7 @@ fi - # help if not exists conf directory + # Help info [ -d ${CONF_DIR}/${SYS} ] || hlp # Copy config files @@ -108,4 +117,4 @@ exit fi - reboot + sudo reboot diff --git a/macos7/macos7.sh b/macos7/macos7.sh index 574a92d..be4bfec 100755 --- a/macos7/macos7.sh +++ b/macos7/macos7.sh @@ -33,6 +33,8 @@ sudo apt install -y automake gobjc libudev-dev xa65 build-essential byacc texi2h libnet1-dev libpcap0.8 libpcap0.8-dev libvte-dev libasound2-dev \ raspberrypi-kernel-headers +[ $? -ne 0 ] && net_error "Mac OS 7 apt packages" + # Mac OS 7 config echo " #disk ${MACOS_DIR}/system70.dsk @@ -69,7 +71,11 @@ screen win/640/480 # ROM & System cd ${MACOS_DIR} wget ${ROM} +[ $? -ne 0 ] && net_error "Mac OS 7 ROM file" + wget -O ${MACOS_DIR}/hdd.dsk.gz ${HDD_IMAGE} +[ $? -ne 0 ] && net_error "Mac OS 7 HDD image" + echo "* Decompressing the hard drive image - please wait" gzip -d hdd.dsk.gz diff --git a/macos8/macos8.sh b/macos8/macos8.sh index 3505ffc..d836a91 100755 --- a/macos8/macos8.sh +++ b/macos8/macos8.sh @@ -33,6 +33,8 @@ sudo apt install -y automake gobjc libudev-dev xa65 build-essential byacc texi2h libnet1-dev libpcap0.8 libpcap0.8-dev libvte-dev libasound2-dev \ raspberrypi-kernel-headers +[ $? -ne 0 ] && net_error "Mac OS 8 apt packages" + # Mac OS 8 config echo " rom ${MACOS_DIR}/QUAD650.ROM @@ -65,8 +67,10 @@ screen win/640/480 # ROM & System cd ${MACOS_DIR} wget ${ROM} +[ $? -ne 0 ] && net_error "Mac OS 8 ROM file" mv Quadra-650.ROM QUAD650.ROM 2>/dev/null wget -O ${MACOS_DIR}/hdd.dsk.gz ${HDD_IMAGE} +[ $? -ne 0 ] && net_error "Mac OS 8 HDD image" echo "* Decompressing the hard drive image - please wait" gzip -d hdd.dsk.gz diff --git a/macos9/macos9.sh b/macos9/macos9.sh index cec3fdb..7012dc1 100755 --- a/macos9/macos9.sh +++ b/macos9/macos9.sh @@ -35,6 +35,8 @@ sudo apt install -y libdirectfb-dev automake gobjc libudev-dev xa65 build-essent libgtk2.0-dev x11proto-xf86dga-dev libesd0-dev libxxf86dga-dev \ libxxf86dga1 libsdl1.2-dev +[ $? -ne 0 ] && net_error "Mac OS 9 apt packages" + # Mac OS 9 config echo " rom ${MACOS_DIR}/newworld86.rom @@ -63,8 +65,10 @@ screen win/800/600 # ROM & System cd ${MACOS_DIR} wget ${ROM} +[ $? -ne 0 ] && net_error "Mac OS 9 ROM file" unzip newworld86.rom.zip 2>/dev/null wget -O ${MACOS_DIR}/hdd.dsk.gz ${HDD_IMAGE} +[ $? -ne 0 ] && net_error "Mac OS 9 HDD image" echo "* Decompressing the hard drive image - please wait" gzip -d hdd.dsk.gz diff --git a/syncterm/syncterm.sh b/syncterm/syncterm.sh index 815a479..48ef5fc 100755 --- a/syncterm/syncterm.sh +++ b/syncterm/syncterm.sh @@ -22,13 +22,19 @@ printf "\e[92m"; echo ' |____/ \__, |_| |_|\___||_| |_____|_| \_\_| |_| |___/ '; printf "\e[0m"; sleep 2 +source ./assets/func.sh +updateinfo + BDIR=~/syncterm-build mkdir $BDIR -sudo apt update && sudo apt -y upgrade + sudo apt install -y libncurses5-dev libsdl1.2-dev build-essential libsdl2-dev +[ $? -ne 0 ] && net_error "SyncTERM apt packages" wget https://sourceforge.net/projects/syncterm/files/syncterm/syncterm-1.1/syncterm-1.1-src.tgz/download -O $BDIR/syncterm.tgz +[ $? -ne 0 ] && net_error "SyncTERM sources" + cd $BDIR tar -xf syncterm.tgz diff --git a/vice/vice.sh b/vice/vice.sh index 74e1ede..3de301a 100755 --- a/vice/vice.sh +++ b/vice/vice.sh @@ -23,14 +23,15 @@ __ _____ ____ _____ '; printf "\e[0m"; sleep 2 source ../assets/func.sh - +updateinfo # Packages -sudo apt update && sudo apt upgrade -y sudo apt install -y wget tcpser netcat automake gobjc libudev-dev xa65 build-essential byacc \ texi2html flex libreadline-dev libxaw7-dev texinfo libxaw7-dev libgtk2.0-cil-dev \ libgtkglext1-dev libpulse-dev bison libnet1 libnet1-dev libpcap0.8 libpcap0.8-dev \ libvte-dev libasound2-dev +[ $? -ne 0 ] && net_error "VICE apt packages" + # SDL2 check && builder [ -f $SDL2_FILE ] || Build_SDL2; @@ -38,6 +39,7 @@ sudo apt install -y wget tcpser netcat automake gobjc libudev-dev xa65 build-ess mkdir -p ${SRC_DIR} 2>/dev/null wget ${VICE_SOURCE} -O - | tar -xz -C ${SRC_DIR} +[ $? -ne 0 ] && net_error "VICE sources" cd ${SRC_DIR}/vice-3.4 ./configure --without-pulse \ diff --git a/vmodem/vmodem.sh b/vmodem/vmodem.sh index 85011bb..b1f392d 100755 --- a/vmodem/vmodem.sh +++ b/vmodem/vmodem.sh @@ -25,10 +25,13 @@ __ ___ _ _ __ __ _ \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\___|_| |_| |_| '; printf "\e[0m"; sleep 2 -sudo apt update && sudo apt upgrade -y +source ./assets/func.sh +updateinfo sudo apt install -y tcpser raspberrypi-kernel-headers build-essential +[ $? -ne 0 ] && net_error "VICE apt packages" mkdir $BDIR && cd $BDIR wget https://github.com/freemed/tty0tty/archive/refs/tags/1.2.tar.gz -O ${BDIR}/tty0tty-1.2.tar.gz +[ $? -ne 0 ] && net_error "tty0tty sources" cd $BDIR tar zxf tty0tty-1.2.tar.gz cd tty0tty-1.2/module @@ -49,7 +52,7 @@ cat << EOF > vmodem.conf # Valid BPS values: 300, 1200, 2400 (default), 9600, 19200, 38400 BPS=2400 -# Log level 0-7 +# Log level 0-7 LOG_LEVEL=7 # Log file location