-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscratch-desktop-linux.sh
executable file
·61 lines (49 loc) · 2.37 KB
/
scratch-desktop-linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
# Copyright (C) 2021 Gaëtan LE HEURT-FINOT
# This file is part of scratch-desktop-linux <https://github.com/gaetanlhf/scratch-desktop-linux>.
#
# scratch-desktop-linux is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# scratch-desktop-linux is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with scratch-desktop-linux. If not, see <http://www.gnu.org/licenses/>.
# Create some variables
ROOT_FOLDER=$(pwd)
MAKE_FOLDER=$(pwd)/.build
EXTRACT_FOLDER=$MAKE_FOLDER/scratch-desktop
PACKAGES_FOLDER=$(pwd)/packages
SCRATCH_VERSION=3.29.1
ELECTRON_VERSION=15.3.1
# Clean and create some folders
rm -rf "$MAKE_FOLDER"
mkdir "$MAKE_FOLDER"
rm -rf "$PACKAGES_FOLDER"
mkdir "$PACKAGES_FOLDER"
cd "$MAKE_FOLDER" || exit
# Install npm dependencies
npm install electron@$ELECTRON_VERSION --save-dev
npm install electron-installer-debian
npm install electron-installer-redhat
# Download the latest version of Scratch Desktop for Microsoft Windows and extract it
wget https://downloads.scratch.mit.edu/desktop/Scratch%20$SCRATCH_VERSION%20Setup.exe -O scratch-desktop.exe
7za x -aoa -y "$MAKE_FOLDER"/scratch-desktop.exe -o"$EXTRACT_FOLDER"
# Create electron app
cp -rf "$MAKE_FOLDER"/node_modules/electron/dist/* "$EXTRACT_FOLDER"
ln -fsr "$EXTRACT_FOLDER"/electron "$EXTRACT_FOLDER"/scratch-desktop
# Fix permissions
chmod 755 -R "$EXTRACT_FOLDER"
# Get application icon
cp "$ROOT_FOLDER"/Icon.svg "$EXTRACT_FOLDER"/resources/Icon.svg
# Remove Microsoft Windows executables
rm "$EXTRACT_FOLDER"/"Scratch 3.exe"
rm "$EXTRACT_FOLDER"/resources/elevate.exe
# Create packages
"$MAKE_FOLDER"/node_modules/.bin/electron-installer-debian --src "$EXTRACT_FOLDER" --dest "$PACKAGES_FOLDER" --arch amd64 --icon "$EXTRACT_FOLDER"/resources/Icon.svg --config "$ROOT_FOLDER"/config.json
"$MAKE_FOLDER"/node_modules/.bin/electron-installer-redhat --src "$EXTRACT_FOLDER" --dest "$PACKAGES_FOLDER" --arch x86_64 --icon "$EXTRACT_FOLDER"/resources/Icon.svg --config "$ROOT_FOLDER"/config.json