The default SD card image that comes with of PiNet is awesome and has just about everything you could need for using Pis in the classroom or with a club. The only thing that niggled me was that you couldn't have Scratch-GPIO installed directly. You could have a shortcut on the Desktop to make it easy to install once the SD card is booted, but that seemed like a bit of a hassle, especially if you're operating somewhere with flaky (or nonexistent) Internet access.
So I set aside some time to work out away of pre-installing it on the server default image so that each clone SD card could have it ready to use when booted.
Here is my method - there may be simpler or more elegant ways but this seems to work reliably. This works with ScratchGPIO V7 as of Sept 2015.
There are two parts to the installation. You'll need some modified files which can be found on my GitHub here.
1. So clone this repo onto your PiNet server.
cd
git clone https://github.com/topshed/ScratchGPIO-on-PiNet.git
2. Then copy in the modified installer script and run it. The modified version unpacks the files needed for ScratchGPIO into /tmp as normal, but does not install them.
cp ScratchGPIO-on-PiNet/isgh7-pinet.sh /opt/ltsp/armhf/
3. Now chroot in and run it:
sudo ltsp-chroot --arch armhf
sudo bash isgh7-pinet.sh
4. Exit from the chrooted environment and copy in another file
cp ScratchGPIO-on-PiNet/installer-pinet.sh /opt/ltsp/armhf/tmp/selfextract.ZpdSK6/.
(note, your directory name will be similar but different. It should start with 'selfextract' but have a different bunch of characters at the end - use ls /opt/ltsp/armhf/tmp/ to find out what it is).
5. Next, pop back into the chrooted environment and change directory into the unpacked file archive directory.
sudo ltsp-chroot --arch armhf
cd /tmp/selfextract.ZpdSK6
sudo ./installer-pinet.sh
This installs all the necessary files but doesn't try to add desktop shortcuts or the rsc.sb file.
6. Finally, don't forget to compress the Raspbian operating system:
ltsp-update-image /opt/ltsp/armhf
7. The second stage is to add those shortcuts and the rsc.sb file manually. Exit the chrooted environment and change directory to /etc/skel/Desktop.
cd /etc/skel/Desktop
Then make a couple of directories and copy in the files from the cloned Github repo:
sudo mkdir Documents
sudo mkdir Documents/"Scratch Projects"
sudo cp ~/ScratchGPIO-on-PiNet/rsc.sb Documents/"Scratch Projects"/
sudo cp ~/ScratchGPIO-on-PiNet/ScratchGPIO7.desktop Documents/"Scratch Projects"/
sudo cp ~/ScratchGPIO-on-PiNet/ScratchGPIO7Plus.desktop Documents/"Scratch Projects"/
That should be it!
No comments:
Post a Comment