Commit 18b6b6c2 authored by Tom Pillot's avatar Tom Pillot
Browse files

Add Blockly standalone

parent 0ac67adb
#!/bin/bash -e
# Download and build Blockly
on_chroot << EOF
cd /opt
git clone https://github.com/Mobsya/thymio-blockly-standalone.git
chmod -R 777 thymio-blockly-standalone/
cd thymio-blockly-standalone/
npm i
npm run build
EOF
# Script to run Blockly, thymio-device-manager needs to be launched before Blockly
cat > "${ROOTFS_DIR}/opt/thymio-blockly-standalone/run-blockly.sh" << EOF
#!/bin/bash
pgrep -f thymio-device-manager
if [ \$? -eq 0 ]; then
echo "thymio-device-manager is already running."
else
echo "Running thymio-device-manager ..."
thymio-device-manager& > /dev/null
fi
chromium-browser /opt/thymio-blockly-standalone/thymio_blockly/thymio_blockly.fr.html &> /dev/null
EOF
chmod +x "${ROOTFS_DIR}/opt/thymio-blockly-standalone/run-blockly.sh"
# Add a desktop shortcut
cat > "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/Desktop/blockly.desktop" << EOF
[Desktop Entry]
Type=Link
Name=Blockly
Icon=thymio-blockly-icon
URL=/usr/local/share/applications/blockly.desktop
EOF
cat > "${ROOTFS_DIR}/usr/local/share/applications/blockly.desktop" << EOF
[Desktop Entry]
Type=Application
Name=Blockly
Icon=thymio-blockly-icon
Exec=/opt/thymio-blockly-standalone/run-blockly.sh
Categories=Education;Science;
EOF
# Allow user to edit and run desktop entries
chmod -R 777 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/Desktop/"
# Add an icon for Blockly
cp "${ROOTFS_DIR}/opt/thymio-blockly-standalone/thymio_blockly/media/thymio-blockly-icon.png" "${ROOTFS_DIR}/usr/share/pixmaps/"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment