Skip to content

Commit

Permalink
test aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
Azathothas committed Sep 25, 2024
1 parent bbea718 commit 7bbd92e
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/scripts/aarch64-Linux/build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ LOG SINGLE
rm -rf "${BINDIR}" 2>/dev/null ; mkdir -p "${BINDIR}"
##Build
set +x
BUILD="YES" && export BUILD="$BUILD"
BUILD="YES" && export BUILD="${BUILD}"
#ENV
BUILDSCRIPT="$(mktemp --tmpdir=${SYSTMP} XXXXX_build.sh)" && export BUILDSCRIPT="${BUILDSCRIPT}"
#Get URlS
curl -qfsSL "https://api.github.com/repos/Azathothas/Toolpacks-Extras/contents/.github/scripts/${HOST_TRIPLET}/pkgs" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" | jq -r '.[] | select(.download_url | endswith(".sh")) | .download_url' |\
grep -i "\.sh$" | sort -u -o "${SYSTMP}/BUILDURLS"
#Run
echo -e "\n\n [+] Started Building at :: $(TZ='Asia/Kathmandu' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n"
echo -e "\n\n [+] Started Building at :: $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n"
readarray -t RECIPES < "${SYSTMP}/BUILDURLS"
unset TOTAL_RECIPES ; TEMP_LOG="$(mktemp).log" && export TEMP_LOG="${TEMP_LOG}"
TOTAL_RECIPES="${#RECIPES[@]}" && export TOTAL_RECIPES="${TOTAL_RECIPES}" ; echo -e "\n[+] Total RECIPES :: ${TOTAL_RECIPES}\n"
Expand Down Expand Up @@ -123,7 +123,7 @@ set +x
ELAPSED_TIME="$(date -u -d@"$((END_TIME - START_TIME))" "+%H(Hr):%M(Min):%S(Sec)")"
echo -e "\n[+] Completed (Building|Fetching) ${BIN} [${SOURCE_URL}] :: ${ELAPSED_TIME} ==> ${LOG_PATH}\n"
done
echo -e "\n\n [+] Finished Building at :: $(TZ='Asia/Kathmandu' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n"
echo -e "\n\n [+] Finished Building at :: $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n"
#Check
BINDIR_SIZE="$(du -sh "${BINDIR}" 2>/dev/null | awk '{print $1}' 2>/dev/null)" && export "BINDIR_SIZE=${BINDIR_SIZE}"
if [ ! -d "${BINDIR}" ] || [ -z "$(ls -A "${BINDIR}")" ] || [ -z "${BINDIR_SIZE}" ] || [[ "${BINDIR_SIZE}" == *K* ]]; then
Expand Down
130 changes: 130 additions & 0 deletions .github/scripts/aarch64-Linux/pkgs/mullvad-browser.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
#!/usr/bin/env bash
set -x
#-------------------------------------------------------#
#Sanity Checks
if [ "${BUILD}" != "YES" ] || \
[ -z "${BINDIR}" ] || \
[ -z "${GIT_TERMINAL_PROMPT}" ] || \
[ -z "${GIT_ASKPASS}" ] || \
[ -z "${GITHUB_TOKEN}" ] || \
[ -z "${SYSTMP}" ] || \
[ -z "${TMPDIRS}" ]; then
#exit
echo -e "\n[+]Skipping Builds...\n"
exit 1
fi
#-------------------------------------------------------#

#-------------------------------------------------------#
##Main
export SKIP_BUILD="NO"
if [ "$SKIP_BUILD" == "NO" ]; then
#mullvad-browser : Unarchiver
export BIN="mullvad-browser"
export SOURCE_URL="https://github.com/mullvad/mullvad-browser"
echo -e "\n\n [+] (Building | Fetching) $BIN :: $SOURCE_URL\n"
#-------------------------------------------------------#
#https://github.com/mullvad/mullvad-browser/issues/11
###Fetch (NO --exclude-pre-releases)
# pushd "$($TMPDIRS)" >/dev/null 2>&1
# RELEASE_TAG="$(gh release list --repo "${SOURCE_URL}" --order "desc" --exclude-drafts --json "tagName" | jq -r '.[0].tagName | gsub("\\s+"; "")' | tr -d '[:space:]')" && export RELEASE_TAG="${RELEASE_TAG}"
# gh release view "${RELEASE_TAG}" --repo "${SOURCE_URL}" --json "assets" \
# --jq '.assets[].name' | grep -P 'linux.*aarch.*64.*\.tar\.xz$' | xargs -I "{}" \
# gh release download --repo "${SOURCE_URL}" "${RELEASE_TAG}" --clobber --pattern "{}" \
# --output "${BINDIR}/mullvad-browser.tar.xz"
##Meta
# if [[ -f "${BINDIR}/mullvad-browser.tar.xz" ]] && [[ $(stat -c%s "${BINDIR}/mullvad-browser.tar.xz") -gt 1024 ]]; then
# PKG_VERSION="$(echo ${RELEASE_TAG})" && export PKG_VERSION="${PKG_VERSION}"
# echo "${PKG_VERSION}" > "${BINDIR}/mullvad-browser.tar.xz.version"
# fi
#-------------------------------------------------------#
##Create AppImage
pushd "$($TMPDIRS)" >/dev/null 2>&1
nix bundle --bundler "github:ralismark/nix-appimage" "nixpkgs#mullvad-browser" --log-format bar-with-logs
#Copy
sudo rsync -av --copy-links "./mullvad-browser.AppImage" "./mullvad-browser.AppImage.tmp"
sudo chown -R "$(whoami):$(whoami)" "./mullvad-browser.AppImage.tmp" && chmod -R 755 "./mullvad-browser.AppImage.tmp"
du -sh "./mullvad-browser.AppImage.tmp" && file "./mullvad-browser.AppImage.tmp"
##Extract
APPIMAGE="$(realpath .)/mullvad-browser.AppImage.tmp" && export APPIMAGE="${APPIMAGE}"
"${APPIMAGE}" --appimage-extract >/dev/null && rm -f "${APPIMAGE}"
OWD="$(realpath .)" && export OWD="${OWD}"
APPIMAGE_EXTRACT="$(realpath "./squashfs-root")" && export APPIMAGE_EXTRACT="${APPIMAGE_EXTRACT}"
##Patch
if [ -d "${APPIMAGE_EXTRACT}" ] && [ "$(find "${APPIMAGE_EXTRACT}" -mindepth 1 -print -quit 2>/dev/null)" ]; then
#Media
cd "${APPIMAGE_EXTRACT}"
mkdir -p "./usr/share/applications" && mkdir -p "./usr/share/metainfo"
SHARE_DIR="$(find "${APPIMAGE_EXTRACT}" -path '*share/*mullvad-browser*' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | awk -F'/share/' '{print $1}')/share" && export SHARE_DIR="${SHARE_DIR}"
#usr/{applications,bash-completion,icons,metainfo,mullvad-browser,zsh}
rsync -av --copy-links \
--include="*/" \
--include="*.desktop" \
--include="*.png" \
--include="*.svg" \
--include="*.xml" \
--exclude="*" \
"${SHARE_DIR}/" "./usr/share/" && ls "./usr/share/"
#Icon
find "${APPIMAGE_EXTRACT}" \( -path '*128x128/apps/*.png' -o -path '*256x256/apps/*.png' \) | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} convert {} -resize "128x128" "./mullvad-browser.png"
find "${APPIMAGE_EXTRACT}" -maxdepth 1 -type f -name '*.png' -exec sh -c 'convert "$0" -resize "128x128" "${0%.svg}.png"' {} \; 2>/dev/null
cp "./mullvad-browser.png" "./.DirIcon"
##Desktop
find "${APPIMAGE_EXTRACT}" -path '*mullvad-browser*.desktop' | awk '{ print length, $0 }' | sort -n | cut -d" " -f2- | head -n 1 | xargs -I {} sh -c 'cp {} "./mullvad-browser.desktop"'
sed 's/Icon=[^ ]*/Icon=mullvad-browser/' -i "./mullvad-browser.desktop" 2>/dev/null
##Perms
find "${APPIMAGE_EXTRACT}" -maxdepth 1 -type f -exec chmod "u=rx,go=rx" {} +
##Purge Bloatware
echo -e "\n[+] Purging Bloatware...\n"
O_SIZE="$(du -sh "${APPIMAGE_EXTRACT}" 2>/dev/null | awk '{print $1}' 2>/dev/null)" && export "O_SIZE=${O_SIZE}"
#Headers
find "${APPIMAGE_EXTRACT}" -type d -path "*/include*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
#docs & manpages
find "${APPIMAGE_EXTRACT}" -type d -path "*doc/share*" ! -name "*mullvad-browser*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
find "${APPIMAGE_EXTRACT}" -type d -path "*/share/docs*" ! -name "*mullvad-browser*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
find "${APPIMAGE_EXTRACT}" -type d -path "*/share/man*" ! -name "*mullvad-browser*" -print -exec rm -rf {} 2>/dev/null \; 2>/dev/null
#static libs
find "${APPIMAGE_EXTRACT}" -type f -name "*.a" -print -exec rm -f {} 2>/dev/null \; 2>/dev/null
#systemd (need .so)
find "${APPIMAGE_EXTRACT}" -type d -name "*systemd*" -exec find {} -type f ! -name "*.so*" -delete \;
P_SIZE="$(du -sh "${APPIMAGE_EXTRACT}" 2>/dev/null | awk '{print $1}' 2>/dev/null)" && export "P_SIZE=${P_SIZE}"
echo -e "\n[+] Shaved off ${O_SIZE} --> ${P_SIZE}\n"
#(Re)Pack
cd "${OWD}"
curl -qfsSL "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" -o "./appimagetool" && chmod +x "./appimagetool"
ARCH="$(uname -m)" "./appimagetool" --comp "zstd" \
--mksquashfs-opt -root-owned \
--mksquashfs-opt -no-xattrs \
--mksquashfs-opt -noappend \
--mksquashfs-opt -b --mksquashfs-opt "1M" \
--mksquashfs-opt -mkfs-time --mksquashfs-opt "0" \
--mksquashfs-opt -Xcompression-level --mksquashfs-opt "22" \
"${APPIMAGE_EXTRACT}" "${BINDIR}/mullvad-browser.AppImage"
#clean
unset APPIMAGE APPIMAGE_EXTRACT OFFSET OWD SHARE_DIR ; popd >/dev/null 2>&1
fi
#-------------------------------------------------------#
#Meta
if [[ -f "${BINDIR}/mullvad-browser.AppImage" ]] && [[ $(stat -c%s "${BINDIR}/mullvad-browser.AppImage") -gt 1024 ]]; then
PKG_VERSION="$(nix derivation show "nixpkgs#mullvad-browser" 2>&1 | grep '"version"' | awk -F': ' '{print $2}' | tr -d '"')" && export PKG_VERSION="${PKG_VERSION}"
echo "${PKG_VERSION}" > "${BINDIR}/mullvad-browser.AppImage.version"
fi
#End
#realpath "${BINDIR}/mullvad-browser.tar.xz" | xargs -I {} sh -c 'file {}; b3sum {}; sha256sum {}; du -sh {}'
realpath "${BINDIR}/mullvad-browser.AppImage" | xargs -I {} sh -c 'file {}; b3sum {}; sha256sum {}; du -sh {}'
LOG_PATH="${BINDIR}/mullvad-browser.log" && export LOG_PATH="${LOG_PATH}"
popd >/dev/null 2>&1
fi
#-------------------------------------------------------#

#-------------------------------------------------------#
##Cleanup
unset SKIP_BUILD ; export BUILT="YES"
#In case of zig polluted env
unset AR CC CFLAGS CXX CPPFLAGS CXXFLAGS DLLTOOL HOST_CC HOST_CXX LDFLAGS LIBS OBJCOPY RANLIB
#In case of go polluted env
unset GOARCH GOOS CGO_ENABLED CGO_CFLAGS
#PKG Config
unset PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR PKG_CONFIG_SYSTEM_INCLUDE_PATH PKG_CONFIG_SYSTEM_LIBRARY_PATH
set +x
#-------------------------------------------------------#
14 changes: 14 additions & 0 deletions .github/scripts/aarch64-Linux/pkgs/mullvad-browser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "mullvad-browser"
bin_name: "mullvad-browser"
bins:
- "mullvad-browser.AppImage"
category:
- "anonymity"
- "browser"
- "privacy"
- "tor"
description: "Privacy-focused browser for Linux, macOS and Windows"
note: "This PKG has Multiple Formats (CI_VERIFIED: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/pipelines)"
web_url: "https://mullvad.net/en/browser"
path: "/"
src_url: "https://gitlab.torproject.org/tpo/applications/mullvad-browser/"
6 changes: 3 additions & 3 deletions .github/scripts/x86_64-Linux/build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ fi
rm -rf "${BINDIR}" 2>/dev/null ; mkdir -p "${BINDIR}"
##Build
set +x
BUILD="YES" && export BUILD="$BUILD"
BUILD="YES" && export BUILD="${BUILD}"
#ENV
BUILDSCRIPT="$(mktemp --tmpdir=${SYSTMP} XXXXX_build.sh)" && export BUILDSCRIPT="${BUILDSCRIPT}"
#Get URlS
curl -qfsSL "https://api.github.com/repos/Azathothas/Toolpacks-Extras/contents/.github/scripts/${HOST_TRIPLET}/pkgs" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" | jq -r '.[] | select(.download_url | endswith(".sh")) | .download_url' |\
grep -i "\.sh$" | sort -u -o "${SYSTMP}/BUILDURLS"
#Run
echo -e "\n\n [+] Started Building at :: $(TZ='Asia/Kathmandu' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n"
echo -e "\n\n [+] Started Building at :: $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n"
readarray -t RECIPES < "${SYSTMP}/BUILDURLS"
unset TOTAL_RECIPES ; TEMP_LOG="$(mktemp).log" && export TEMP_LOG="${TEMP_LOG}"
TOTAL_RECIPES="${#RECIPES[@]}" && export TOTAL_RECIPES="${TOTAL_RECIPES}" ; echo -e "\n[+] Total RECIPES :: ${TOTAL_RECIPES}\n"
Expand Down Expand Up @@ -119,7 +119,7 @@ set +x
ELAPSED_TIME="$(date -u -d@"$((END_TIME - START_TIME))" "+%H(Hr):%M(Min):%S(Sec)")"
echo -e "\n[+] Completed (Building|Fetching) ${BIN} [${SOURCE_URL}] :: ${ELAPSED_TIME} ==> ${LOG_PATH}\n"
done
echo -e "\n\n [+] Finished Building at :: $(TZ='Asia/Kathmandu' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n"
echo -e "\n\n [+] Finished Building at :: $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n"
#Check
BINDIR_SIZE="$(du -sh "${BINDIR}" 2>/dev/null | awk '{print $1}' 2>/dev/null)" && export "BINDIR_SIZE=${BINDIR_SIZE}"
if [ ! -d "${BINDIR}" ] || [ -z "$(ls -A "${BINDIR}")" ] || [ -z "${BINDIR_SIZE}" ] || [[ "${BINDIR_SIZE}" == *K* ]]; then
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/healthchecks_housekeeping.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ jobs:
- name: Get DateTime
run: |
# Date Time
NEPALI_TIME=$(TZ='Asia/Kathmandu' date +'%Y-%m-%d (%I:%M:%S %p)')
NEPALI_TIME=$(TZ='UTC' date +'%Y-%m-%d (%I:%M:%S %p)')
echo "NEPALI_TIME=$NEPALI_TIME" >> $GITHUB_ENV
continue-on-error: true

Expand Down Expand Up @@ -1255,7 +1255,7 @@ jobs:
- name: Get DateTime
run: |
# Date Time
NEPALI_TIME=$(TZ='Asia/Kathmandu' date +'%Y-%m-%d (%I:%M:%S %p)')
NEPALI_TIME=$(TZ='UTC' date +'%Y-%m-%d (%I:%M:%S %p)')
echo "NEPALI_TIME=$NEPALI_TIME" >> $GITHUB_ENV
continue-on-error: true

Expand Down

0 comments on commit 7bbd92e

Please sign in to comment.