futurerestore/.github/workflows/mac-arm64.sh
2021-09-21 02:42:35 -07:00

51 lines
2.8 KiB
Bash
Executable file

#!/usr/bin/env zsh
echo 'step 1:'
set -e
export DIR=$(pwd)
echo "export PROCURSUS=/opt/procursus" >> ~/.bash_profile
echo "export PATH=${PROCURSUS}/bin:${PROCURSUS}/libexec/gnubin:${PATH}" >> ~/.bash_profile
echo "export PROCURSUS=/opt/procursus" >> ~/.zshrc
echo "export PATH=${PROCURSUS}/bin:${PROCURSUS}/libexec/gnubin:${PATH}" >> ~/.zshrc
export BASE=/Users/runner/work/futurerestore/futurerestore/.github/workflows
export PROCURSUS=/opt/procursus
export PATH=${PROCURSUS}/bin:${PROCURSUS}/libexec/gnubin:${PATH}
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo 'step 2:'
curl -sO https://mac.cryptiiiic.com/CI-Scripts/bootstrap_arm64.tar.zst
zstd -dk bootstrap_arm64.tar.zst
sudo gtar xf ${BASE}/bootstrap_arm64.tar -C / --warning=none || true || true
sudo ${PROCURSUS}/bin/apt update -y
sudo ${PROCURSUS}/bin/apt dist-upgrade -y
sudo ${PROCURSUS}/bin/apt install autopoint autoconf autoconf-archive automake bash bison cmake coreutils docbook-xml docbook-xsl dpkg fakeroot flex findutils gawk gnupg git grep groff ldid libtool make ncurses-bin openssl patch pkg-config po4a python3 sed tar triehash wget xz-utils zstd fd libgeneral-proc libimg4tool-proc libimobiledevice-glue-proc libimobiledevice-proc libinsn-proc libipatcher-proc libirecovery-proc liboffsetfinder64-proc libplist-proc libpng16-proc libssl-proc libusbmuxd-proc libxpwn-proc libzip-proc libfragmentzip-proc -y
echo 'step 3:'
cd ${BASE}/../..
export FUTURERESTORE_VERSION=$(git rev-list --count HEAD | tr -d '\n')
export FUTURERESTORE_VERSION_RELEASE=$(cat version.txt | tr -d '\n')
echo 'step 4:'
git submodule init; git submodule update --recursive
cd external/tsschecker
git submodule init; git submodule update --recursive
cd ${BASE}
mkdir -p /Users/runner/Procursus
sudo chown -R $(id -u):$(id -g) /Users/runner/Procursus
cd /Users/runner/Procursus
touch .keep
git init
git remote add origin https://github.com/ProcursusTeam/Procursus.git
git checkout -b main
git fetch origin 50c8311232cadc238a13673f734dcadc1b445537
git reset --hard FETCH_HEAD
git apply ${BASE}/proc_ci.diff
sudo chown -R $(id -u):$(id -g) /Users/runner/Procursus
echo 'step 5:'
gmake futurerestore-package NO_PGP=1 MEMO_TARGET=darwin-arm64 MEMO_CFVER=1700 DEBUG=0
echo 'step 6:'
rm -rf build_stage/darwin-arm64/1700/futurerestore/*
dpkg -X build_dist/darwin-arm64/1700/futurerestore*.deb build_stage/darwin-arm64/1700/futurerestore
cp -v build_stage/darwin-arm64/1700/futurerestore/opt/procursus/bin/futurerestore ${BASE}/futurerestore-arm64-${FUTURERESTORE_VERSION_RELEASE}
cd ${BASE}
otool -L ${BASE}/futurerestore-arm64-${FUTURERESTORE_VERSION_RELEASE} || true
${BASE}/futurerestore-arm64-${FUTURERESTORE_VERSION_RELEASE} || true
gtar cpJvf ${BASE}/futurerestore-${FUTURERESTORE_VERSION_RELEASE}-macOS-arm64.tar.xz futurerestore-arm64-${FUTURERESTORE_VERSION_RELEASE}
echo 'End'