├── .gitignore ├── version.txt ├── screenshots ├── etcher.png └── balena-etcher.png ├── .github └── workflows │ ├── Build-armhf.yml │ └── Build-arm64.yml ├── update-etcher-repo.sh ├── old-experiments └── compile-etcher.sh ├── README.md ├── auto-script.sh ├── compile-etcher_v1.7.9.sh ├── compile-etcher-on-arm.sh └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | v1.5.120 2 | -------------------------------------------------------------------------------- /screenshots/etcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Itai-Nelken/BalenaEtcher-arm/HEAD/screenshots/etcher.png -------------------------------------------------------------------------------- /screenshots/balena-etcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Itai-Nelken/BalenaEtcher-arm/HEAD/screenshots/balena-etcher.png -------------------------------------------------------------------------------- /.github/workflows/Build-armhf.yml: -------------------------------------------------------------------------------- 1 | name: Build-armhf 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | 13 | - name: setup node 14 | uses: actions/setup-node@v2 15 | with: 16 | node-version: '14' 17 | 18 | - name: save working directory in variable 'DIR' 19 | run: echo "DIR=$(pwd)" >> $GITHUB_ENV 20 | 21 | - name: save current date to the 'DATE' variable 22 | run: echo "DATE=$(date +"%F")" >> $GITHUB_ENV 23 | 24 | - name: Install Dependencies 25 | run: | 26 | sudo apt update 27 | sudo apt -y install git python gcc g++ make libx11-dev libxkbfile-dev fakeroot rpm libsecret-1-dev jq python2.7-dev python3-pip python-setuptools libudev-dev ruby-dev 28 | sudo gem install fpm -v 1.10.2 --no-document 29 | 30 | - name: clone etcher repo and checkout latest release 31 | run: | 32 | cd $DIR 33 | git clone --recursive https://github.com/balena-io/etcher 34 | cd etcher 35 | git checkout $(git describe --abbrev=0 --tags) 36 | echo "TAG=$(git describe --abbrev=0 --tags | sed 's/v//')" >> $GITHUB_ENV 37 | - name: Build 38 | run: | 39 | cd $DIR/etcher 40 | pip install -r requirements.txt 41 | make electron-develop 42 | USE_SYSTEM_FPM=true make electron-build 43 | echo "DEB=$(basename dist/balena-etcher-electron_${{ env.TAG }}_armv7l.deb)" >> $GITHUB_ENV 44 | echo "RPM=$(basename dist/balena-etcher-electron-${{ env.TAG }}.armv7l.rpm)" >> $GITHUB_ENV 45 | echo "APPIMAGE=$(basename dist/balenaEtcher-${{ env.TAG }}-armv7l.AppImage)" >> $GITHUB_ENV 46 | - name: prepare-upload 47 | run: | 48 | cd $DIR/ 49 | mkdir etcher-armv7l_$DATE/ 50 | mv etcher/dist/$DEB etcher-armv7l_$DATE/ 51 | mv etcher/dist/$RPM etcher-armv7l_$DATE/ 52 | mv etcher/dist/$APPIMAGE etcher-armv7l_$DATE/ 53 | - name: upload 54 | uses: actions/upload-artifact@v2 55 | with: 56 | name: etcher-armv7l_${{ env.DATE }} 57 | path: ${{ env.DIR }}/etcher-armv7l_${{ env.DATE }}/ 58 | -------------------------------------------------------------------------------- /.github/workflows/Build-arm64.yml: -------------------------------------------------------------------------------- 1 | name: Build-arm64 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v2 12 | 13 | - name: save working directory in variable 'DIR' 14 | run: echo "DIR=$(pwd)" >> $GITHUB_ENV 15 | 16 | - name: save current date to the 'DATE' variable 17 | run: echo "DATE=$(date +"%F")" >> $GITHUB_ENV 18 | 19 | - name: Install Dependencies 20 | run: | 21 | sudo apt update 22 | sudo apt -y install git python gcc g++ make libx11-dev libxkbfile-dev fakeroot rpm libsecret-1-dev jq python2.7-dev python3-pip python-setuptools libudev-dev ruby-dev 23 | sudo gem install fpm -v 1.10.2 --no-document 24 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash 25 | export NVM_DIR="$HOME/.nvm" 26 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm 27 | [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion 28 | 29 | 30 | - name: clone etcher repo and checkout latest release 31 | run: | 32 | cd $DIR 33 | git clone --recursive https://github.com/balena-io/etcher 34 | cd etcher 35 | git checkout $(git describe --abbrev=0 --tags) 36 | echo "TAG=$(git describe --abbrev=0 --tags | sed 's/v//')" >> $GITHUB_ENV 37 | 38 | - name: Build 39 | run: | 40 | cd $DIR/etcher 41 | pip install -r requirements.txt 42 | make electron-develop 43 | USE_SYSTEM_FPM=true make electron-build 44 | echo "DEB=$(basename dist/balena-etcher-electron_${{ env.TAG }}_arm64.deb)" >> $GITHUB_ENV 45 | echo "RPM=$(basename dist/balena-etcher-electron-${{ env.TAG }}.aarch64.rpm)" >> $GITHUB_ENV 46 | echo "APPIMAGE=$(basename dist/balenaEtcher-${{ env.TAG }}-arm64.AppImage)" >> $GITHUB_ENV 47 | 48 | - name: prepare-upload 49 | run: | 50 | cd $DIR/ 51 | mkdir etcher-arm64_$DATE/ 52 | mv etcher/dist/$DEB etcher-arm64_$DATE/ 53 | mv etcher/dist/$RPM etcher-arm64_$DATE/ 54 | mv etcher/dist/$APPIMAGE etcher-arm64_$DATE/ 55 | 56 | - name: upload 57 | uses: actions/upload-artifact@v2 58 | with: 59 | name: etcher-arm64_${{ env.DATE }} 60 | path: ${{ env.DIR }}/etcher-arm64_${{ env.DATE }}/ 61 | 62 | -------------------------------------------------------------------------------- /update-etcher-repo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # error function, prints text in red then exits 4 | function error { 5 | echo -e "\e[91m$1\e[39m" 6 | exit 1 7 | } 8 | 9 | # check internet, if none, exit 10 | printf "checking if you are online..." 11 | wget -q --spider http://github.com 12 | if [ $? -eq 0 ]; then 13 | echo "Online. Continuing." 14 | else 15 | error "Offline. Go connect to the internet then run the script again." 16 | fi 17 | 18 | # defining variables 19 | EMAIL="$(cat /home/pi/cronscripts/etcher/email)" 20 | GPGPASS="$(cat /home/pi/cronscripts/etcher/gpgpass)" 21 | last="$(cat /home/pi/cronscripts/etcher/local_version.txt)" 22 | echo "Last upload was: $last" 23 | release=$(curl -s https://api.github.com/repos/Itai-Nelken/Etcher-arm-32-64/releases/latest | grep "tag_name" | sed "s/[\",tag_name: ]//g") 24 | echo "Last saved version is: $release" 25 | PKGDIR="/home/pi/Documents/balenaetcher-debs/debian/" 26 | REPODIR="/home/pi/Documents/balenaetcher-debs/" 27 | 28 | if [[ "$last" != "$release" ]]; then 29 | rm -rf $PKGDIR/* 30 | LATEST=$(curl -s https://api.github.com/repos/Itai-Nelken/Etcher-arm-32-64/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")' | tr -d 'v') 31 | curl -s https://api.github.com/repos/Itai-Nelken/Etcher-arm-32-64/releases/latest \ 32 | | grep browser_download_url \ 33 | | grep 'armv7l.deb"' \ 34 | | cut -d '"' -f 4 \ 35 | | xargs -n 1 curl -L -o $PKGDIR/balena-etcher-electron-$LATEST-armhf.deb 36 | 37 | curl -s https://api.github.com/repos/Itai-Nelken/Etcher-arm-32-64/releases/latest \ 38 | | grep browser_download_url \ 39 | | grep 'arm64.deb"' \ 40 | | cut -d '"' -f 4 \ 41 | | xargs -n 1 curl -L -o $PKGDIR/balena-etcher-electron-$LATEST-arm64.deb 42 | COMPLETE=$(curl -s https://api.github.com/repos/Itai-Nelken/Etcher-arm-32-64/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")') 43 | echo $COMPLETE > /home/pi/cronscripts/etcher/local_version.txt 44 | cd $PKGDIR 45 | dpkg-scanpackages --multiversion . > Packages 46 | gzip -k -f Packages 47 | apt-ftparchive release . > Release 48 | gpg --default-key "${EMAIL}" --batch --pinentry-mode="loopback" --passphrase="$GPGPASS" -abs -o - Release > Release.gpg 49 | gpg --default-key "${EMAIL}" --batch --pinentry-mode="loopback" --passphrase="$GPGPASS" --clearsign -o - Release > InRelease 50 | cd $REPODIR 51 | git pull origin master 52 | git add . 53 | git commit -m "Updated etcher to $COMPLETE" 54 | git push origin master 55 | else 56 | echo "not today :(" 57 | fi 58 | fi 59 | -------------------------------------------------------------------------------- /old-experiments/compile-etcher.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #check if CPU is ARM (32bit or 64bit) 4 | ARCH=$(uname -m) 5 | if [ "${ARCH}" != "aarch64" ]; then 6 | #check if CPU is ARM 32bit 7 | ARCH=$(uname -m) 8 | if [[ "${ARCH}" != "armv7l" ]]; then 9 | echo "your cpu architecture isn't ARM, this script is only intended for arm cpu's" 10 | echo "exiting in 5 seconds..." 11 | sleep 5; exit 12 | else 13 | echo "CPU architecture is ARM 32bit" 14 | ARCH1="32bit ARM" 15 | fi 16 | 17 | else 18 | echo "CPU architecture is ARM 64bit" 19 | ARCH1="ARM 64bit" 20 | fi 21 | 22 | 23 | #ask if user wants to continue 24 | clear 25 | echo this script will compile and package etcher for $ARCH1 26 | echo "this will take around 30 minutes on a pi 4 on stock clock speed and consume almost all memory and cpu during some parts." 27 | echo "a fan or at least a heatsink is recommended for the pi 4. Do you want to continue? [y/n]" 28 | read answer 29 | if [ "$answer" == n ];then 30 | echo "exiting in 5 seconds" 31 | sleep 5 32 | exit 33 | fi 34 | if [ "$answer" == y ];then 35 | echo "continuing..." 36 | sleep 1 37 | fi 38 | 39 | #changeto downloads folder 40 | cd ~/Downloads 41 | 42 | #ask for version to compile 43 | echo "Enter etcher version to compile (e.g 1.5.116): " 44 | read VERSION 45 | 46 | #if no user input, set to v1.5.116 (doesn't work yet) 47 | #if [[ "$VERSION" == "" ]];then 48 | #VERSION="1.5.116" 49 | #fi 50 | 51 | #tell user what version will be compiled 52 | echo "version compiled will be v$VERSION" 53 | 54 | #ask user to install dependencies and install/skip 55 | echo -n "install dependencies (required unless already installed (e.g running script 2nd time)), **answering no isn't recommended** [y/n]" 56 | read answer 57 | if [[ "$answer" == n ]];then 58 | echo "dependencies won't be installed. BEWARE: compiling and packaging will fail unless dependencies are already installed" 59 | fi 60 | if [[ "$answer" == y ]];then 61 | cd ~/Downloads 62 | echo "$(tput setaf 3)installing dependencies...$(tput sgr 0)" 63 | sudo apt update 64 | sudo apt-get install -y curl git python gcc g++ make libx11-dev libxkbfile-dev fakeroot rpm libsecret-1-dev jq python2.7-dev python-pip python-setuptools libudev-dev jq 65 | sudo apt-get install -y ruby-dev 66 | sudo gem install fpm -v 1.10.2 --no-document 67 | curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash - 68 | sudo apt-get install -y nodejs 69 | sleep 4 70 | clear 71 | fi 72 | 73 | #clone etcher repo and checkout realease to be compiled 74 | echo "$(tput setaf 3)cloning etcher repo and checking out realease (your input)$(tput sgr 0)" 75 | git clone --recursive https://github.com/balena-io/etcher 76 | cd etcher 77 | git checkout v$VERSION 78 | 79 | #install requirements 80 | echo "$(tput setaf 3)installing requirements...$(tput sgr 0)" 81 | pip install -r requirements.txt 82 | 83 | #set up and install npm modules 84 | echo "$(tput setaf 3)setting up and installing NPM modules...$(tput sgr 0)" 85 | make electron-develop 86 | sleep 4 87 | clear 88 | 89 | #ask user to run a test of etcher to see if compile worked and do it/skip it 90 | echo -n "do you want to run a test of etcher to see if compile worked? [y/n] " 91 | read answer 92 | if [ "$answer" == y ];then 93 | echo "$(tput setaf 3)close etcher window to continue to packaging.$(tput sgr 0)" 94 | sleep 5 95 | npm start 96 | fi 97 | if [ "$answer" == n ];then 98 | echo "$(tput setaf 3)continuing...$(tput sgr 0)" 99 | fi 100 | 101 | #build and pacakge etcher to a .deb package 102 | echo "$(tput setaf 3)building & packaging etcher into a .deb file...$(tput sgr 0)" 103 | sed -i 's/tiffutil/#tiffutil/g' Makefile 104 | sed -i 's/TARGETS="deb rpm appimage"/TARGETS="deb"/g' scripts/resin/electron/build.sh 105 | USE_SYSTEM_FPM="true" make electron-build 106 | sleep 5 107 | clear 108 | 109 | echo ".deb file will be in ~/Downloads/etcher/dist/" 110 | 111 | echo -n "do you want to delete this script? [y/n] " 112 | read answer 113 | if [[ "$answer" == y ]];then 114 | rm ~/compile-etcher.sh 115 | fi 116 | if [[ "$answer" == n ]];then 117 | echo "$(tput setaf 3)the script WILL NOT be deleted$(tput sgr 0)" 118 | fi 119 | 120 | echo "$(tput setaf 3)exiting in 10 seconds... $(tput sgr 0)" 121 | sleep 10 122 | exit 123 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WARNING: This repository is unmaintained. Please use [pi-apps](https://pi-apps.io/) to get the latest version or compile etcher yourself. 2 | # etcher-logoBalenaEtcher-arm 3 | balena-etcher v1.5.109 and later compiled from [source](https://github.com/balena-io/etcher) for armhf and arm64 for the [Raspberry Pi](https://www.raspberrypi.org) and other [ARM](https://en.wikipedia.org/wiki/ARM_architecture) based [Linux](https://en.wikipedia.org/wiki/Linux) computers. 4 | >NOTE: This only works on Debian and Debian based OS's like Ubuntu. 5 | 6 | ![Etcher on rpi screenshot](/screenshots/etcher.png) 7 | 8 | 9 | ## Install 10 | There are 2 ways to get this version of etcher: 11 | 1) [RECOMMENDED]: Use Pi-Apps (click the badge below for more info)
12 | [![badge](https://github.com/Botspot/pi-apps/blob/master/icons/badge.png?raw=true)](https://github.com/Botspot/pi-apps) 13 | 2) Install it manually: 14 | - download the .deb file for your system architecture from the [latest release](https://github.com/Itai-Nelken/BalenaEtcher-arm/releases/latest) (armv7l is 32bit arm and arm64 is 64bit arm) 15 | - open the .deb file with a package installer (just double click it) if you have one installed, or open terminal in the directory where the .deb file is and type 16 | ```bash 17 | sudo apt install -y --fix-broken the-file-name.deb 18 | ``` 19 | but replace `the-file-name.deb` with the name of the .deb file you downloaded or path to it (E.G. ~/Downloads/balena-etcher-electron_1.5.116+37769efb_armv7l.deb) . 20 | >**explanation:**
the `-y` flag tells `apt` to answer yes to all questions,
`--fix-broken` tells `apt` to install any needed dependencies. 21 | 22 | ## Compile Etcher yourself: 23 | 24 | Use my compile scripts, they simply run the instructions found [here](https://github.com/futurejones/balena-etcher-arm/blob/master/etcher-build/BUILD.md). 25 | the first script compiles the newest version (v1.7.0), you can run it by copying and pasting the following line in terminal: 26 | ```bash 27 | wget -q https://github.com/Itai-Nelken/Etcher-arm-32-64/raw/main/compile-etcher_v1.7.0.sh; bash compile-etcher_v1.7.0.sh; rm compile-etcher_v1.7.0.sh 28 | ``` 29 | the second script asks you what version you want to compile, you can run it by copying and pasting the following line in terminal: 30 | ```bash 31 | wget -qO- https://raw.githubusercontent.com/Itai-Nelken/Etcher-arm-32-64/main/compile-etcher-on-arm.sh; bash compile-etcher-on-arm.sh; rm compile-etcher-on-arm.sh 32 | ``` 33 | Alternatively compile, build and package manually with the instructions [here](https://github.com/futurejones/balena-etcher-arm/blob/master/etcher-build/BUILD.md) 34 | but replace this line: 35 | ```bash 36 | git checkout v1.5.63 37 | ``` 38 | with this line: 39 | ```bash 40 | git checkout v1.7.0 41 | ``` 42 | so you compile v1.7.0 (latest) instead of v1.5.63. 43 | >**NOTE:**
you can put any version you want instead of `1.7.0`, refer to the [table below](https://github.com/Itai-Nelken/BalenaEtcher-arm#recommended-version-numbers-for-the-script). 44 | 45 | ### recommended version numbers for the script: 46 | version number | notes | compilation armhf/armv7l | compilation arm64/aarch64 | 47 | ------------ | ------------- | ------------- | ------------- | 48 | |1.5.63 | very old and outdated version but tested and working reliably.
not recommended, use only when other versions don't work. | works | not tested,
will probably work. | 49 | |1.7.0 | latest version. | works | works | 50 |
51 | Rest of the table above (click to expand) 52 |
53 | 54 | | version number | notes | compilation armhf/armv7l | compilation arm64/aarch64 | 55 | | ------------ | ------------- | ------------- | ------------- | 56 | | 1.5.109 | | works | works | 57 | | 1.5.110 | | works | works | 58 | | 1.5.111 | | works | works | 59 | | 1.5.112 | [changelog](https://github.com/balena-io/etcher/blob/master/CHANGELOG.md#v15112). | works | works | 60 | | 1.5.113 | | works | works | 61 | | 1.5.114 | | works | works | 62 | | 1.5.115 | | works | works | 63 | | 1.5.116 | | works | works | 64 | | 1.5.117 | | works | works | 65 | | 1.5.118 | | works | works | 66 | | 1.5.119 | | works | works | 67 | |1.5.120 | | works | works | 68 | |1.5.121 | | works | works | 69 | |1.5.122 | | works | works | 70 | |1.6.0 | | works | works | 71 | |1.7.3 | | works | works | 72 | 73 |
74 | 75 | ## Uninstall 76 | If you installed from [Pi-Apps](https://github.com/Botspot/pi-apps), then you can also uninstall it from there. If you want to manually uninstall, run the following in terminal: 77 | ```bash 78 | sudo apt purge balena-etcher-electron 79 | ``` 80 | 81 | ## Credits 82 | Big thanks to futurejones for finding a way to compile Etcher for ARM. 83 | 84 | - [RaspberryPi Forums thread](https://www.raspberrypi.org/forums/viewtopic.php?f=62&t=255205&start=25). 85 | - [futurejones github repo for balena-etcher-arm](https://github.com/futurejones/balena-etcher-arm) 86 | -------------------------------------------------------------------------------- /auto-script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ###functions### 4 | function error() { 5 | echo -e "$(tput setaf 1)$(tput bold)$1$(tput sgr 0)" 6 | exit 1 7 | } 8 | 9 | function warning() { 10 | echo -e "$(tput setaf 3)$(tput bold)$1$(tput sgr 0)" 11 | sleep 5 12 | } 13 | 14 | function warning-sleep() { 15 | #USAGE: 16 | #warning-sleep "warning: something happened" 2 17 | # 18 | #$1 is the text 19 | #$2 is the amount of seconds to sleep 20 | echo -e "$(tput setaf 3)$(tput bold)$1$(tput sgr 0)" 21 | sleep $2 22 | } 23 | 24 | function pkg-manage() { 25 | #USAGE: 26 | #usage: pkg-manage install "package1 package2 package3" 27 | #pkg-manage uninstall "package1 package2 package3" 28 | #pkg-manage check "packag1 package2 package3" 29 | #pkg-manage clean 30 | # 31 | #$1 is the operation: install or uninstall 32 | #$2 is the packages to operate on. 33 | if [[ "$1" == "install" ]]; then 34 | TOINSTALL="$(dpkg -l $2 2>&1 | awk '{if (/^D|^\||^\+/) {next} else if(/^dpkg-query:/) { print $6} else if(!/^[hi]i/) {print $2}}' | tr '\n' ' ')" 35 | sudo apt -f -y install $TOINSTALL || sudo apt -f -y install "$TOINSTALL" 36 | elif [[ "$1" == "uninstall" ]]; then 37 | sudo apt purge $2 -y 38 | elif [[ "$1" == "check" ]]; then 39 | TOINSTALL="$(dpkg -l $2 2>&1 | awk '{if (/^D|^\||^\+/) {next} else if(/^dpkg-query:/) { print $6} else if(!/^[hi]i/) {print $2}}' | tr '\n' ' ')" 40 | elif [[ "$1" == "clean" ]]; then 41 | sudo apt clean 42 | sudo apt autoremove -y 43 | sudo apt autoclean 44 | else 45 | error "operation not specified!" 46 | fi 47 | } 48 | 49 | function install-nvm() { 50 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash 51 | export NVM_DIR="$HOME/.nvm" 52 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm 53 | [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion 54 | } 55 | 56 | function install-depends() { 57 | pkg-manage install "$DEPENDS" || error "Failed to install dependencies!" 58 | sudo gem install fpm -v 1.10.2 --no-document #note: must be v1.10.2 NOT v1.11.0 59 | if ! command -v node >/dev/null ; then 60 | install-nvm || error "Failed to install nvm!" 61 | nvm install node --latest-npm || error "nvm failed to install node.js and npm!" 62 | npm install -g npm@6.14.8 || error "Failed to install npm 6.14.8 (required for building etcher)!" 63 | fi 64 | 65 | } 66 | 67 | #####things start to get done here##### 68 | 69 | #check that system is compatible 70 | #is CPU armv6? 71 | if [ ! -z "$(cat /proc/cpuinfo | grep ARMv6)" ];then 72 | error "armv6 CPU not supported!" 73 | fi 74 | 75 | #check if arch is arm 76 | ARCH="$(uname -m)" 77 | if [[ "$ARCH" == "armv7l" ]] || [[ "$ARCH" == "armhf" ]] || [[ "$ARCH" == "arm64" ]] || [[ "$ARCH" == "aarch64" ]]; then 78 | if [ ! -z "$(file "$(readlink -f "/sbin/init")" | grep 64)" ];then 79 | ARCH="arm64" 80 | elif [ ! -z "$(file "$(readlink -f "/sbin/init")" | grep 32)" ];then 81 | ARCH="armhf" 82 | else 83 | error "Can't detect OS architecture! something is very wrong!" 84 | fi 85 | else 86 | error "Unsuported architecture! this script is only intended to be run on linux arm devices." 87 | fi 88 | 89 | last="$(cat local_version.txt)" 90 | echo "last build was: $last" 91 | local=$(curl -s https://api.github.com/repos/Itai-Nelken/Etcher-arm-32-64/releases/latest | grep "tag_name" | sed "s/[\",tag_name: ]//g") 92 | echo "last saved version is: $local" 93 | release=$(curl -s https://api.github.com/repos/balena-io/etcher/releases/latest | grep "tag_name" | sed "s/[\",tag_name: ]//g") 94 | echo "latest version is: $release" 95 | #if latest etcher release isn't the last version compiled (continued)--> 96 | if [[ "$release" != "$last" ]]; then 97 | #--> and the latest etcher release is newer than the latest arm release, compile etcher. 98 | if [[ "$release" > "$local" ]]; then 99 | #compile and package etcher 100 | echo "today!" 101 | #variables 102 | DEPENDS="git python gcc g++ make libx11-dev libxkbfile-dev fakeroot rpm libsecret-1-dev jq python2.7-dev python-pip python-setuptools libudev-dev ruby-dev" 103 | install-depends 104 | DIR="$HOME/Documents/etcher-build" 105 | if [[ ! -d "$DIR" ]]; then 106 | mkdir $DIR 107 | fi 108 | cd "$DIR" 109 | #clone the etcher repo 110 | git clone --recursive https://github.com/balena-io/etcher 111 | cd "etcher" 112 | git checkout $release 113 | #install requirements (with pip) 114 | pip install -r requirements.txt 115 | #setup and install NPM modules 116 | make electron-develop 117 | #npm start 118 | 119 | ##patch build files## 120 | # disable tiffutil in the Makefile as this is a Mac only app and will cause the build to fail 121 | sed -i 's/tiffutil/#tiffutil/g' Makefile || error "Failed to patch Makefile!" 122 | sed -i 's/TARGETS="deb rpm appimage"/TARGETS="deb appimage"/g' scripts/resin/electron/build.sh || error "Failed to patch 'build.sh' script to build both a deb and a AppImage!" 123 | ##compile and build etcher## 124 | # use USE_SYSTEM_FPM="true" to force the use of the installed FPM version 125 | USE_SYSTEM_FPM="true" make electron-build || error "Failed to run \"USE_SYSTEM_FPM="true" make electron-buil\"!" 126 | mv $DIR/etcher/dist/*.AppImage $DIR || sudo mv $DIR/etcher/dist/*.AppImage $DIR 127 | mv $DIR/etcher/dist/*.deb $DIR || sudo mv $DIR/etcher/dist/*.deb $DIR 128 | 129 | #write new release 130 | echo "$release" > local_version.txt 131 | else 132 | echo "not today :(" 133 | fi 134 | fi 135 | -------------------------------------------------------------------------------- /compile-etcher_v1.7.9.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ###instructions from here: https://github.com/futurejones/balena-etcher-arm/blob/master/etcher-build/BUILD.md### 4 | 5 | 6 | #variables 7 | DEPENDS="git python gcc g++ make libx11-dev libxkbfile-dev fakeroot rpm libsecret-1-dev jq python2.7-dev python-pip python-setuptools libudev-dev ruby-dev" 8 | ETCHER_VER="v1.7.9" 9 | 10 | ###functions### 11 | function error() { 12 | echo -e "$(tput setaf 1)$(tput bold)$1$(tput sgr 0)" 13 | exit 1 14 | } 15 | 16 | function warning() { 17 | echo -e "$(tput setaf 3)$(tput bold)$1$(tput sgr 0)" 18 | sleep 5 19 | } 20 | 21 | function warning-sleep() { 22 | #USAGE: 23 | #warning-sleep "warning: something happened" 2 24 | # 25 | #$1 is the text 26 | #$2 is the amount of seconds to sleep 27 | echo -e "$(tput setaf 3)$(tput bold)$1$(tput sgr 0)" 28 | sleep $2 29 | } 30 | 31 | function pkg-manage() { 32 | #USAGE: 33 | #usage: pkg-manage install "package1 package2 package3" 34 | #pkg-manage uninstall "package1 package2 package3" 35 | #pkg-manage check "packag1 package2 package3" 36 | #pkg-manage clean 37 | # 38 | #$1 is the operation: install or uninstall 39 | #$2 is the packages to operate on. 40 | if [[ "$1" == "install" ]]; then 41 | TOINSTALL="$(dpkg -l $2 2>&1 | awk '{if (/^D|^\||^\+/) {next} else if(/^dpkg-query:/) { print $6} else if(!/^[hi]i/) {print $2}}' | tr '\n' ' ')" 42 | sudo apt -f -y install $TOINSTALL || sudo apt -f -y install "$TOINSTALL" 43 | elif [[ "$1" == "uninstall" ]]; then 44 | sudo apt purge $2 -y 45 | elif [[ "$1" == "check" ]]; then 46 | TOINSTALL="$(dpkg -l $2 2>&1 | awk '{if (/^D|^\||^\+/) {next} else if(/^dpkg-query:/) { print $6} else if(!/^[hi]i/) {print $2}}' | tr '\n' ' ')" 47 | elif [[ "$1" == "clean" ]]; then 48 | sudo apt clean 49 | sudo apt autoremove -y 50 | sudo apt autoclean 51 | else 52 | error "operation not specified!" 53 | fi 54 | } 55 | 56 | function install-nvm() { 57 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash 58 | export NVM_DIR="$HOME/.nvm" 59 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm 60 | [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion 61 | } 62 | 63 | function install-node() { 64 | warning-sleep "WARNING: using this method to install Node.js is known to BREAK SYSTEM PERMISSIONS!" 2 65 | if ! command -v curl >/dev/null ; then 66 | echo -e "\033[0;31mcurl: command not found.\n\e[39m You need to install curl first. If you are on a debian system, this command should install it: \e[4msudo apt install curl\e[0m" 67 | exit 1 68 | fi 69 | curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - 70 | sudo apt install -y nodejs 71 | } 72 | 73 | function install-depends() { 74 | pkg-manage install "$DEPENDS" || error "Failed to install dependencies!" 75 | sudo gem install fpm -v 1.10.2 --no-document #note: must be v1.10.2 NOT v1.11.0 76 | sleep 1 77 | clear -x 78 | if ! command -v node >/dev/null ; then 79 | while true; do 80 | echo -ne "Node.js and npm aren't installed but required,\ndo you want to install them with nvm (recommended) or with apt from the nodesource repo (NOT RECOMENDED!, KNOWN TO BREAK SYSTEM PERMISSIONS!) [nvm/nodesource]?" 81 | read answer 82 | if [[ "$answer" == "nvm" ]]; then 83 | install-nvm || error "Failed to install nvm!" 84 | nvm install node --latest-npm || error "nvm failed to install node.js and npm!" 85 | npm install -g npm@6.14.8 || error "Failed to install npm 6.14.8 (required for building etcher)!" 86 | break 87 | elif [[ "$answer" == "nodesource" ]]; then 88 | warning-sleep "WARNING: using THIS method to install Node.js is KNOWN to BREAK SYSTEM PERMISSIONS!" 2 89 | while true; do 90 | echo -ne "are you sure you want to continue [+/n]?" 91 | read answer 92 | if [[ "$answer" == "+" ]]; then 93 | warning-sleep "BEWARE: I'm not responsible if your system breaks as the result of using this method!\npress [CTRL+C] in the next 10 seconds to exit." 10 94 | install-node 95 | break 96 | elif [[ "$answer" =~ [nNnoNonONO] ]]; then 97 | echo -e "OK, you made the better choice :)\nrun the script again." 98 | sleep 0.5 99 | exit 0 100 | else 101 | warning-sleep "inalid answer \"$answer\"! please try again" 0 102 | fi 103 | done 104 | break 105 | else 106 | warning-sleep "invalid answer \"$answer\"! please try again" 0 107 | fi 108 | done 109 | fi 110 | 111 | } 112 | 113 | 114 | #####things start to get done here##### 115 | #check that system is compatible 116 | #is CPU armv6? 117 | if [ ! -z "$(cat /proc/cpuinfo | grep ARMv6)" ];then 118 | error "armv6 CPU not supported!" 119 | fi 120 | 121 | #check if arch is arm 122 | ARCH="$(uname -m)" 123 | if [[ "$ARCH" == "armv7l" ]] || [[ "$ARCH" == "armhf" ]] || [[ "$ARCH" == "arm64" ]] || [[ "$ARCH" == "aarch64" ]]; then 124 | if [ ! -z "$(file "$(readlink -f "/sbin/init")" | grep 64)" ];then 125 | ARCH="arm64" 126 | elif [ ! -z "$(file "$(readlink -f "/sbin/init")" | grep 32)" ];then 127 | ARCH="armhf" 128 | else 129 | error "Can't detect OS architecture! something is very wrong!" 130 | fi 131 | else 132 | error "Unsuported architecture! this script is only intended to be run on linux arm devices." 133 | fi 134 | while true; do 135 | echo -ne "This script will compile and package etcher for arm32/64,\nthis will take around 30 minutes on a pi 4b 4gb on stock clock speeds booting from a samsung evo+ 32gb sd card and consume almost all memory and cpu.\nA fan or at least a heatsink is recommended.\nWARNING: THIS SCRIPT WON'T UNINSTALL THE DEPENDENCIES IT INSTALLS!\nDo you want to continue [y/n]? " 136 | sleep 0.5 137 | read answer 138 | if [[ "$answer" =~ [nN] ]]; then 139 | echo "exiting in 2 seconds..." 140 | sleep 2 141 | exit 142 | break #in case exit fails (very unlikely) 143 | elif [[ "$answer" =~ [yY] ]]; then 144 | true 145 | break 146 | else 147 | echo "invalid answer '$answer'! please try again." 148 | fi 149 | done 150 | 151 | #install all the dependencies 152 | install-depends 153 | sleep 0.5 154 | clear -x 155 | #get directory to build etcher in 156 | while true; do 157 | echo -ne "Enter full path to the directory where you want to build etcher:\n" 158 | read -r DIR 159 | if [ ! -d $DIR ]; then 160 | echo -e "\e[1mdirectory does not exist, please try again\e[0m" 161 | else 162 | echo -e "\e[1mEtcher will be built and packaged here: $DIR\e[0m" 163 | break 164 | fi 165 | done 166 | cd "$DIR" 167 | #clone the etcher repo 168 | git clone --recursive https://github.com/balena-io/etcher 169 | cd etcher 170 | #get version of etcher to compile and check it out (using git) 171 | #read -p "Enter Etcher version to compile (newest: v1.5.117)" ETCHER_VER 172 | #if [[ $ETCHER_VER == v* ]]; then 173 | # git checkout $ETCHER_VER || error "Failed to checkout version \"$ETCHER_VER\"!" 174 | #else 175 | # git checkout v$ETCHER_VER || error "Failed to checkout version \"v$ETCHER_VER\"!" 176 | #fi 177 | git checkout $ETCHER_VER 178 | #install requirements (with pip) 179 | pip install -r requirements.txt 180 | #setup and install NPM modules 181 | make electron-develop 182 | #ask if you want to test if the build worked before packaging it (using npm start) 183 | while true; do 184 | echo -n "do you want to run a test of etcher to see if compilation worked [y/n]? " 185 | read answer 186 | if [[ "$answer" =~ [yY] ]]; then 187 | echo -ne "$(tput setaf 3)close etcher window to continue to packaging.$(tput sgr 0)\nwaiting for 5 seconds" 188 | #fancy "progress bar" 189 | while true;do echo -n .;sleep 1;done & 190 | sleep 5 191 | kill $!; trap 'kill $!' SIGTERM 192 | echo -e "\nStarting Etcher..." 193 | npm start || error "Etcher failed to start!" 194 | break 195 | elif [[ "$answer" =~ [nN] ]];then 196 | echo "$(tput setaf 3)continuing...$(tput sgr 0)" 197 | break 198 | else 199 | echo "invalid option '$answer', please try again." 200 | fi 201 | done 202 | 203 | ##patch build files## 204 | # disable tiffutil in the Makefile as this is a Mac only app and will cause the build to fail 205 | #sed -i 's/tiffutil/#tiffutil/g' Makefile || error "Failed to patch Makefile!" 206 | 207 | sleep 1 208 | clear -x 209 | while true; do 210 | echo -ne "\e[1mDo you want to build a .(d)eb, an (A)ppimage or both [d/A/b]?\e[0m" 211 | read answer 212 | if [[ "$answer" =~ [dD] ]]; then 213 | echo -n "patching build.sh to build only a .deb..." 214 | #restrict output to .deb package only to save build time 215 | sed -i 's/TARGETS="deb rpm appimage"/TARGETS="deb"/g' scripts/resin/electron/build.sh || error "Failed to patch 'build.sh' script to only build a deb!" 216 | out="deb" 217 | echo "done" 218 | break 219 | elif [[ "$answer" =~ [Aa] ]]; then 220 | echo -n "patching build.sh to build only a AppImage..." 221 | #restrict output to .AppImage package only to save build time 222 | sed -i 's/TARGETS="deb rpm appimage"/TARGETS="appimage"/g' scripts/resin/electron/build.sh || error "Failed to patch 'build.sh' script to only build a AppImage!" 223 | out="appimage" 224 | echo "done" 225 | break 226 | elif [[ "$answer" =~ [bB] ]]; then 227 | echo -n "building both a deb and appimage..." 228 | #sed -i 's/TARGETS="deb rpm appimage"/TARGETS="deb appimage"/g' scripts/resin/electron/build.sh || error "Failed to patch 'build.sh' script to build both a deb and a AppImage!" 229 | out=all 230 | echo "done" 231 | break 232 | else 233 | echo -e "\e[31minvalid answer \"$answer\"! please try again.\e[0m" 234 | fi 235 | done 236 | 237 | ##compile and build etcher## 238 | # use USE_SYSTEM_FPM="true" to force the use of the installed FPM version 239 | USE_SYSTEM_FPM="true" make electron-build || error "Failed to run \"USE_SYSTEM_FPM="true" make electron-buil\"!" 240 | 241 | #get the finished output's name 242 | if [[ "$out" == "deb" ]]; then 243 | OUTNAME="$(basename $DIR/etcher/dist/balena-etcher-electron*.deb)" 244 | sleep 1 245 | clear -x 246 | echo "The deb is in \"$DIR/etcher/dist/$OUTNAME\"." 247 | echo "install it with \"sudo apt -f install ./$DIR/etcher/dist/$OUTNAME\"" 248 | elif [[ "$out" == "appimage" ]]; then 249 | OUTNAME="$(basename $DIR/etcher/dist/balena-etcher-electron*.AppImage)" 250 | sleep 1 251 | clear -x 252 | echo "The AppImage is in \"$DIR/etcher/dist/$OUTNAME\"." 253 | elif [[ "$out" == "all" ]]; then 254 | DEBNAME="$(basename $DIR/etcher/dist/balena-etcher-electron*.deb)" 255 | OUTNAME="$(basename $DIR/etcher/dist/balena-etcher-electron*.AppImage)" 256 | echo "The deb is in \"$DIR/etcher/dist/$DEBNAME\"" 257 | echo -e "The AppImage is in \"$DIR/etcher/dist/$OUTNAME\"\n" 258 | echo "Install the deb with \"sudo apt -f install .$DIR/etcher/dist/$OUTNAME\"" 259 | fi 260 | sleep 2 261 | echo "DONE!" 262 | exit 0 263 | -------------------------------------------------------------------------------- /compile-etcher-on-arm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ###instructions from here: https://github.com/futurejones/balena-etcher-arm/blob/master/etcher-build/BUILD.md### 4 | 5 | 6 | #variables 7 | DEPENDS="git python gcc g++ make libx11-dev libxkbfile-dev fakeroot rpm libsecret-1-dev jq python2.7-dev python-pip python-setuptools libudev-dev ruby-dev" 8 | 9 | ###functions### 10 | function error() { 11 | echo -e "$(tput setaf 1)$(tput bold)$1$(tput sgr 0)" 12 | exit 1 13 | } 14 | 15 | function warning() { 16 | echo -e "$(tput setaf 3)$(tput bold)$1$(tput sgr 0)" 17 | sleep 5 18 | } 19 | 20 | function warning-sleep() { 21 | #USAGE: 22 | #warning-sleep "warning: something happened" 2 23 | # 24 | #$1 is the text 25 | #$2 is the amount of seconds to sleep 26 | echo -e "$(tput setaf 3)$(tput bold)$1$(tput sgr 0)" 27 | sleep $2 28 | } 29 | 30 | function pkg-manage() { 31 | #USAGE: 32 | #usage: pkg-manage install "package1 package2 package3" 33 | #pkg-manage uninstall "package1 package2 package3" 34 | #pkg-manage check "packag1 package2 package3" 35 | #pkg-manage clean 36 | # 37 | #$1 is the operation: install or uninstall 38 | #$2 is the packages to operate on. 39 | if [[ "$1" == "install" ]]; then 40 | TOINSTALL="$(dpkg -l $2 2>&1 | awk '{if (/^D|^\||^\+/) {next} else if(/^dpkg-query:/) { print $6} else if(!/^[hi]i/) {print $2}}' | tr '\n' ' ')" 41 | sudo apt -f -y install $TOINSTALL || sudo apt -f -y install "$TOINSTALL" 42 | elif [[ "$1" == "uninstall" ]]; then 43 | sudo apt purge $2 -y 44 | elif [[ "$1" == "check" ]]; then 45 | TOINSTALL="$(dpkg -l $2 2>&1 | awk '{if (/^D|^\||^\+/) {next} else if(/^dpkg-query:/) { print $6} else if(!/^[hi]i/) {print $2}}' | tr '\n' ' ')" 46 | elif [[ "$1" == "clean" ]]; then 47 | sudo apt clean 48 | sudo apt autoremove -y 49 | sudo apt autoclean 50 | else 51 | error "operation not specified!" 52 | fi 53 | } 54 | 55 | function install-nvm() { 56 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash 57 | export NVM_DIR="$HOME/.nvm" 58 | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm 59 | [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion 60 | } 61 | 62 | function install-node() { 63 | warning-sleep "WARNING: using this method to install Node.js is known to BREAK SYSTEM PERMISSIONS!" 2 64 | if ! command -v curl >/dev/null ; then 65 | echo -e "\033[0;31mcurl: command not found.\n\e[39m You need to install curl first. If you are on a debian system, this command should install it: \e[4msudo apt install curl\e[0m" 66 | exit 1 67 | fi 68 | curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash - 69 | sudo apt install -y nodejs 70 | } 71 | 72 | function install-depends() { 73 | pkg-manage install "$DEPENDS" || error "Failed to install dependencies!" 74 | sudo gem install fpm -v 1.10.2 --no-document #note: must be v1.10.2 NOT v1.11.0 75 | sleep 1 76 | clear -x 77 | if ! command -v node >/dev/null ; then 78 | while true; do 79 | echo -ne "Node.js and npm aren't installed but required,\ndo you want to install them with nvm (recommended) or with apt from the nodesource repo (NOT RECOMENDED!, KNOWN TO BREAK SYSTEM PERMISSIONS!) [nvm/nodesource]?" 80 | read answer 81 | if [[ "$answer" == "nvm" ]]; then 82 | install-nvm || error "Failed to install nvm!" 83 | nvm install node --latest-npm || error "nvm failed to install node.js and npm!" 84 | npm install -g npm@6.14.8 || error "Failed to install npm 6.14.8 (required for building etcher)!" 85 | break 86 | elif [[ "$answer" == "nodesource" ]]; then 87 | warning-sleep "WARNING: using THIS method to install Node.js is KNOWN to BREAK SYSTEM PERMISSIONS!" 2 88 | while true; do 89 | echo -ne "are you sure you want to continue [+/n]?" 90 | read answer 91 | if [[ "$answer" == "+" ]]; then 92 | warning-sleep "BEWARE: I'm not responsible if your system breaks as the result of using this method!\npress [CTRL+C] in the next 10 seconds to exit." 10 93 | install-node 94 | break 95 | elif [[ "$answer" =~ [nNnoNonONO] ]]; then 96 | echo -e "OK, you made the better choice :)\nrun the script again." 97 | sleep 0.5 98 | exit 0 99 | else 100 | warning-sleep "inalid answer \"$answer\"! please try again" 0 101 | fi 102 | done 103 | break 104 | else 105 | warning-sleep "invalid answer \"$answer\"! please try again" 0 106 | fi 107 | done 108 | fi 109 | 110 | } 111 | 112 | 113 | #####things start to get done here##### 114 | #check that system is compatible 115 | #is CPU armv6? 116 | if [ ! -z "$(cat /proc/cpuinfo | grep ARMv6)" ];then 117 | error "armv6 CPU not supported!" 118 | fi 119 | 120 | #check if arch is arm 121 | ARCH="$(uname -m)" 122 | if [[ "$ARCH" == "armv7l" ]] || [[ "$ARCH" == "armhf" ]] || [[ "$ARCH" == "arm64" ]] || [[ "$ARCH" == "aarch64" ]]; then 123 | if [ ! -z "$(file "$(readlink -f "/sbin/init")" | grep 64)" ];then 124 | ARCH="arm64" 125 | elif [ ! -z "$(file "$(readlink -f "/sbin/init")" | grep 32)" ];then 126 | ARCH="armhf" 127 | else 128 | error "Can't detect OS architecture! something is very wrong!" 129 | fi 130 | else 131 | error "Unsuported architecture! this script is only intended to be run on linux arm devices." 132 | fi 133 | while true; do 134 | echo -ne "This script will compile and package etcher for arm32/64,\nthis will take around 30 minutes on a pi 4b 4gb on stock clock speeds booting from a samsung evo+ 32gb sd card and consume almost all memory and cpu.\nA fan or at least a heatsink is recommended.\nWARNING: THIS SCRIPT WON'T UNINSTALL THE DEPENDENCIES IT INSTALLS!\nDo you want to continue [y/n]? " 135 | sleep 0.5 136 | read answer 137 | if [[ "$answer" =~ [nN] ]]; then 138 | echo "exiting in 2 seconds..." 139 | sleep 2 140 | exit 141 | break #in case exit fails (very unlikely) 142 | elif [[ "$answer" =~ [yY] ]]; then 143 | true 144 | break 145 | else 146 | echo "invalid answer '$answer'! please try again." 147 | fi 148 | done 149 | 150 | #install all the dependencies 151 | install-depends 152 | sleep 0.5 153 | clear -x 154 | #get directory to build etcher in 155 | while true; do 156 | echo -ne "Enter full path to the directory where you want to build etcher:\n" 157 | read -r DIR 158 | if [ ! -d $DIR ]; then 159 | echo -e "\e[1mdirectory does not exist, please try again\e[0m" 160 | else 161 | echo -e "\e[1mEtcher will be built and packaged here: $DIR\e[0m" 162 | break 163 | fi 164 | done 165 | cd "$DIR" 166 | #clone the etcher repo 167 | git clone --recursive https://github.com/balena-io/etcher 168 | cd etcher 169 | clear -x 170 | #get version of etcher to compile and check it out (using git) 171 | read -p "Enter Etcher version to compile (newest: v1.5.117)" ETCHER_VER 172 | if [[ $ETCHER_VER == v* ]]; then 173 | git checkout $ETCHER_VER || error "Failed to checkout version \"$ETCHER_VER\"!" 174 | else 175 | git checkout v$ETCHER_VER || error "Failed to checkout version \"v$ETCHER_VER\"!" 176 | fi 177 | #install requirements (with pip) 178 | pip install -r requirements.txt 179 | #setup and install NPM modules 180 | make electron-develop 181 | #ask if you want to test if the build worked before packaging it (using npm start) 182 | while true; do 183 | echo -n "do you want to run a test of etcher to see if compilation worked [y/n]? " 184 | read answer 185 | if [[ "$answer" =~ [yY] ]]; then 186 | echo -ne "$(tput setaf 3)close etcher window to continue to packaging.$(tput sgr 0)\nwaiting for 5 seconds" 187 | #fancy "progress bar" 188 | while true;do echo -n .;sleep 1;done & 189 | sleep 5 190 | kill $!; trap 'kill $!' SIGTERM 191 | echo -e "\nStarting Etcher..." 192 | npm start || error "Etcher failed to start!" 193 | break 194 | elif [[ "$answer" =~ [nN] ]];then 195 | echo "$(tput setaf 3)continuing...$(tput sgr 0)" 196 | break 197 | else 198 | echo "invalid option '$answer', please try again." 199 | fi 200 | done 201 | 202 | ##patch build files## 203 | # disable tiffutil in the Makefile as this is a Mac only app and will cause the build to fail 204 | sed -i 's/tiffutil/#tiffutil/g' Makefile || error "Failed to patch Makefile!" 205 | 206 | sleep 1 207 | clear -x 208 | while true; do 209 | echo -ne "\e[1mDo you want to build a .(d)eb, (A)ppimage, (r)pm, or deb & appimage (da) [d/A/r/da]?\e[0m" 210 | read answer 211 | if [[ "$answer" =~ [dD] ]]; then 212 | echo -n "patching build.sh to build only a .deb..." 213 | #restrict output to .deb package only to save build time 214 | sed -i 's/TARGETS="deb rpm appimage"/TARGETS="deb"/g' scripts/resin/electron/build.sh || error "Failed to patch 'build.sh' script to only build a deb!" 215 | echo "done" 216 | break 217 | elif [[ "$answer" =~ [Aa] ]]; then 218 | echo -n "patching build.sh to build only a AppImage..." 219 | #restrict output to .AppImage package only to save build time 220 | sed -i 's/TARGETS="deb rpm appimage"/TARGETS="appimage"/g' scripts/resin/electron/build.sh || error "Failed to patch 'build.sh' script to only build a AppImage!" 221 | echo "done" 222 | break 223 | elif [[ "$answer" == "da" || "$answer" == "DA" ]]; then 224 | echo -n "patching build.sh to build both a .deb and AppImage..." 225 | sed -i 's/TARGETS="deb rpm appimage"/TARGETS="deb appimage"/g' scripts/resin/electron/build.sh || error "Failed to patch 'build.sh' script to build both a deb and a AppImage!" 226 | echo "done" 227 | break 228 | elif [[ "$answer" =~ [rR] ]]; then 229 | echo -n "patching build.sh to build a rpm package..." 230 | sed -i 's/TARGETS="deb rpm appimage"/TARGETS="rpm"/g' scripts/resin/electron/build.sh || error "Failed to patch 'build.sh' script to build rpm package!" 231 | else 232 | echo -e "\e[31minvalid answer \"$answer\"! please try again.\e[0m" 233 | fi 234 | done 235 | 236 | ##compile and build etcher## 237 | # use USE_SYSTEM_FPM="true" to force the use of the installed FPM version 238 | USE_SYSTEM_FPM="true" make electron-build || error "Failed to run \"USE_SYSTEM_FPM="true" make electron-buil\"!" 239 | 240 | #get the finished output's name 241 | if [[ "$out" == "deb" ]]; then 242 | OUTNAME="$(basename $DIR/etcher/dist/balena-etcher-electron*.deb)" 243 | sleep 1 244 | clear -x 245 | echo "The deb is in \"$DIR/etcher/dist/$OUTNAME\"." 246 | echo "install it with \"sudo apt -f install ./$DIR/etcher/dist/$OUTNAME\"" 247 | elif [[ "$out" == "appimage" ]]; then 248 | OUTNAME="$(basename $DIR/etcher/dist/balena-etcher-electron*.AppImage)" 249 | sleep 1 250 | clear -x 251 | echo "The AppImage is in \"$DIR/etcher/dist/$OUTNAME\"." 252 | elif [[ "$out" == "all" ]]; then 253 | DEBNAME="$(basename $DIR/etcher/dist/balena-etcher-electron*.deb)" 254 | OUTNAME="$(basename $DIR/etcher/dist/balena-etcher-electron*.AppImage)" 255 | echo "The deb is in \"$DIR/etcher/dist/$DEBNAME\"" 256 | echo -e "The AppImage is in \"$DIR/etcher/dist/$OUTNAME\"\n" 257 | echo "Install the deb with \"sudo apt -f install .$DIR/etcher/dist/$OUTNAME\"" 258 | fi 259 | sleep 2 260 | echo "DONE!" 261 | exit 0 262 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------