thorium-mirror/infra/APPIMAGE/build_appimage.sh

82 lines
1.9 KiB
Bash
Raw Normal View History

2022-06-17 18:24:43 -04:00
#!/bin/bash
# Copyright (c) 2022 Alex313031.
YEL='\033[1;33m' # Yellow
RED='\033[1;31m' # Red
GRE='\033[1;32m' # Green
c0=$'\033[0m' # Reset Text
bold=$'\033[1m' # Bold Text
underline=$'\033[4m' # Underline Text
# Error handling
yell() { echo "$0: $*" >&2; }
die() { yell "$*"; exit 111; }
try() { "$@" || die "${RED}Failed $*"; }
# --help
displayHelp () {
printf "\n" &&
2022-06-25 12:44:07 -04:00
printf "${bold}${GRE}Script to build Thorium .appimage on Linux.${c0}\n" &&
2022-06-17 18:24:43 -04:00
printf "${bold}${YEL}Please place the Thorium .deb file in this directory before running.${c0}\n" &&
printf "\n"
}
case $1 in
--help) displayHelp; exit 0;;
esac
printf "\n" &&
printf "${bold}${RED}NOTE: You must place the Thorium .deb file in this directory before running.${c0}\n" &&
printf "${YEL}Extracting & Copying files from Thorium .deb package...\n" &&
printf "${c0}\n" &&
2022-08-03 17:46:14 -04:00
rm -r -f ./temp/ &&
2022-06-17 18:24:43 -04:00
2022-06-19 00:41:32 -04:00
sleep 2 &&
2022-06-17 18:24:43 -04:00
# Extract data.tar.xz
2022-06-19 00:41:32 -04:00
mkdir -v ./temp &&
ar xv *.deb &&
tar xvf ./data.tar.xz &&
2022-07-10 03:50:20 -04:00
cp -r -v ./opt/chromium.org/thorium/* ./temp/ &&
2022-06-19 00:41:32 -04:00
cp -r -v ./usr/bin/chromedriver temp/ &&
cp -r -v ./usr/bin/pak temp/ &&
cp -r -v ./files/product_logo_512.png ./temp/ &&
cp -r -v ./files/product_logo_22.png ./temp/ &&
cp -r -v ./files/thorium-shell ./temp/ &&
rm -r -v ./temp/cron &&
rm -r -v ./temp/thorium-browser &&
rm -r -v ./temp/thorium-browser-unstable &&
2022-06-17 18:24:43 -04:00
printf "\n" &&
printf "${YEL}Building .Appimage using Thorium.yml...\n" &&
printf "${c0}\n" &&
2022-06-19 00:41:32 -04:00
sleep 2 &&
2022-06-17 18:24:43 -04:00
# Build Appimage
chmod +x pkg2appimage &&
./pkg2appimage Thorium.yml &&
printf "\n" &&
printf "${YEL}Cleaning up...\n" &&
printf "${c0}\n" &&
2022-06-19 00:41:32 -04:00
sleep 2 &&
2022-06-17 18:24:43 -04:00
# Cleanup
2022-08-31 00:44:11 -04:00
rm -r -v -f ./opt &&
rm -r -v -f ./etc &&
rm -r -v -f ./usr &&
rm -r -v -f ./control.tar.xz &&
rm -r -v -f ./data.tar.xz &&
rm -r -v -f ./debian-binary &&
rm -r -v -f ./Thorium/ &&
rm -r -v -f ./temp/ &&
2022-06-17 18:24:43 -04:00
2022-06-19 00:41:32 -04:00
printf "\n" &&
2022-06-17 18:24:43 -04:00
printf "${GRE}Done! ${YEL}Appimage at //out/thorium*.Appimage\n" &&
printf "\n" &&
tput sgr0