Browse Source

Initial import.

master
Emiliano Vavassori 4 years ago
commit
1922e731e7
  1. 23
      README.md
  2. 11
      Scratch2.desktop
  3. 37
      air-installer.sh
  4. 25
      install.sh
  5. 22
      scratch-wrapper.sh
  6. BIN
      scratch.png

23
README.md

@ -0,0 +1,23 @@
# Simplify installation for Scratch 456.0.1 on Linux #
These scripts simplify the deployment and distribution of Scratch on
GNU/Linux.
## Installation ##
Run the `install.sh` script as root to install Scratch on the local machine on
`/opt/scratch`:
sudo bash install.sh
## Adobe AIR and redistribution ##
You should not distribute Adobe AIR based on Adobe AIR License, so we have
devised a script to install it on GNU/Linux systems accepting the License and
using Adobe AIR SDK for simplified management.
Adobe AIR installation is managed at first launch of Scratch (via the
`scratch-wrapper.sh` script) or it can be done launching the
`air-installer.sh` script by hand with root:
sudo bash air-installer.sh

11
Scratch2.desktop

@ -0,0 +1,11 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=/opt/scratch/scratch-wrapper.sh
Icon=/opt/scratch/scratch.png
Terminal=false
Name=Scratch 2
Comment=Programming system and content development tool
Categories=Application;Education;Development;ComputerScience;
MimeType=application/x-scratch-project

37
air-installer.sh

@ -0,0 +1,37 @@
#!/bin/bash
# LibreSchool project - info@libreschool.org
# Install AIR SDK and run AIR application from there.
echo 1
echo "1 - Installing dependencies" &> /tmp/ls-air-installer.log
# Installing depending packages
apt-get install -y libgtk2.0-0:i386 libstdc++6:i386 libxml2:i386 libxslt1.1:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386 libqt4-qt3support:i386 libgnome-keyring0:i386 libnss-mdns:i386 libnss3:i386 &>> /tmp/ls-air-installer.log
echo 25
echo "25 - Linking libraries" &>> /tmp/ls-air-installer.log
ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0 &>> /tmp/ls-air-installer.log
ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0 &>> /tmp/ls-air-installer.log
echo 30
echo "30 - Downloading AIR SDK" &>> /tmp/ls-air-installer.log
wget --no-check-certificate https://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRSDK.tbz2 -O /tmp/AdobeAIRSDK.tbz2 &>> /tmp/ls-air-installer.log
echo 50
echo "50 - Directory for AIR SDK" &>> /tmp/ls-air-installer.log
mkdir -p /opt/adobe-air-sdk &>> /tmp/ls-air-installer.log
echo 55
echo "55 - Unpacking AIR SDK" &>> /tmp/ls-air-installer.log
# Installing SDK
tar jxf /tmp/AdobeAIRSDK.tbz2 -C /opt/adobe-air-sdk &>> /tmp/ls-air-installer.log
rm -f /tmp/AdobeAIRSDK.tbz2 &>> /tmp/ls-air-installer.log
echo 75
echo "75 - Downloading AIR wrapper" &>> /tmp/ls-air-installer.log
# Installing wrapper for SDK to run AIR simply
wget --no-check-certificate https://aur.archlinux.org/cgit/aur.git/snapshot/adobe-air.tar.gz -O /tmp/adobe-air.tar.gz &>> /tmp/ls-air-installer.log
echo 85
echo "85 - Unpacking AIR wrapper" &>> /tmp/ls-air-installer.log
tar xzf /tmp/adobe-air.tar.gz -C /opt/adobe-air-sdk &>> /tmp/ls-air-installer.log
rm -f /tmp/adobe-air.tar.gz &>> /tmp/ls-air-installer.log
echo 95
echo "95 - Finishing" &>> /tmp/ls-air-installer.log
chmod +x /opt/adobe-air-sdk/adobe-air/adobe-air &>> /tmp/ls-air-installer.log
touch /opt/scratch/.air-installed &>> /tmp/ls-air-installer.log
echo 100

25
install.sh

@ -0,0 +1,25 @@
#!/bin/bash
# Copyright 2018 - LibreSchool Project <info@libreschool.org>
# Prepare and install Scratch for distribution.
# Scratch itself is distributable, Adobe AIR is not.
# So we prepare a folder for Scratch, leaving download and accepting of the
# license to the user at first launch of Scratch.
mkdir -p /opt/scratch
cp * /opt/scratch
find /opt/scratch -iname \*.sh -exec chmod +x {} \;
# Gets two different versions of Scratch from the site, links the highest one.
# Scratch 442
wget --no-check-certificates https://scratch.mit.edu/scratchr2/static/sa/Scratch-442.air -O /opt/scratch/Scratch-442.air &> /dev/null
# Scratch 456.0.1
wget --no-check-certificates https://scratch.mit.edu/scratchr2/static/sa/Scratch-456.0.1.air -O /opt/scratch/Scratch-456.0.1.air &> /dev/null
ln -sf /opt/scratch/Scratch-456.0.1.air /opt/scratch/Scratch.air &> /dev/null
desktop-file-install /opt/scratch/Scratch2.desktop

22
scratch-wrapper.sh

@ -0,0 +1,22 @@
#!/bin/bash
# LibreSchool project - info@libreschool.org
# This wrapper permits to download and install Adobe Air runtime with user
# consent
if [[ -f /opt/scratch/.air-installed ]]; then
# Run Scratch
/opt/adobe-air-sdk/adobe-air/adobe-air /opt/scratch/Scratch.air
else
zenity --info --icon-name=info --text 'Sembra che in questo sistema non sia installato Adobe AIR, necessario per eseguire Scratch 2.\nPrego <a href="https://labs.adobe.com/technologies/eula/airsdk.html">leggere ed aderire</a> ai termini di licenza di Adobe AIR.' --no-wrap
# Ask the user for the final acceptance.
zenity --question --text 'Accettare la <a href="https://labs.adobe.com/technologies/eula/airsdk.html">licenza di Adobe AIR SDK</a>?\n\nSe la licenza non viene accettata, sarà impossibile eseguire Scratch 2.' --default-cancel --no-wrap
if [[ $? -eq 1 ]]; then
exit
else
pkexec /opt/scratch/air-installer.sh | zenity --progress --text 'Installazione e configurazione di Adobe AIR in corso...' --auto-close --no-cancel --auto-kill --percentage=1
(( $? != 0 )) && zenity --error --text 'Errore in fase di configurazione di Adobe AIR.' && exit 1 || zenity --info --text "L'installazione è andata a buon fine.\nPrego rilanciare Scratch per avviare effettivamente l'applicazione." --no-wrap
fi
fi

BIN
scratch.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Loading…
Cancel
Save