├── .circleci └── config.yml ├── .github ├── dependabot.yaml ├── shellcheck.txt └── workflows │ ├── auto_respond.yaml │ ├── build_aarch64_Linux.yaml │ ├── build_x86_64_Linux.yaml │ ├── check_links.yaml │ ├── kill_all_actions.yaml │ ├── matrix_builds.yaml │ ├── repo_linter.yaml │ ├── schedule_builds.yaml │ ├── sync_gh_releases.yaml │ └── sync_gh_releases_metadata.yaml ├── LICENSE ├── README.md ├── SBUILD_LIST.diff ├── SBUILD_LIST.diff.dupe ├── SBUILD_LIST.json ├── SBUILD_LIST.json.dupe ├── keys └── minisign.pub └── scripts ├── github ├── sync_releases.sh └── sync_releases_metadata.sh └── runner ├── builder.sh ├── functions.sh ├── setup_aarch64-Linux.sh ├── setup_env.sh ├── setup_riscv64-Linux.sh └── setup_x86_64-Linux.sh /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | #https://circleci.com/docs/introduction-to-yaml-configurations/ 2 | version: 2.1 3 | 4 | executors: 5 | linux-aarch64: 6 | machine: 7 | image: ubuntu-2404:current #https://circleci.com/developer/machine/image/ubuntu-2404 8 | resource_class: arm.large #4vCPU + 16GB RAM + 150GB DISK 9 | linux-x86_64: 10 | machine: 11 | image: ubuntu-2404:current #https://circleci.com/developer/machine/image/ubuntu-2404 12 | resource_class: large #4vCPU + 16GB RAM + 150GB DISK 13 | 14 | jobs: 15 | act-as-runner: 16 | parameters: 17 | os-type: 18 | type: string 19 | enum: ["linux-aarch64", "linux-x86_64"] 20 | runner: 21 | type: integer 22 | executor: << parameters.os-type >> 23 | 24 | steps: 25 | 26 | - run: 27 | name: Setup PreRequisites 28 | shell: /usr/bin/bash 29 | command: | 30 | ##presets 31 | #shellcheck disable=all 32 | set +x ; set +e ; set +o pipefail 33 | #-------------# 34 | ##ENV 35 | export DEBIAN_FRONTEND="noninteractive" 36 | echo "DEBIAN_FRONTEND=${DEBIAN_FRONTEND}" >> "${BASH_ENV}" 37 | ##UPDATE 38 | { 39 | sudo apt update -y -qq 40 | #https://github.com/ilikenwf/apt-fast?tab=readme-ov-file#quick-install 41 | bash -c "$(curl -qfsSL 'https://raw.githubusercontent.com/ilikenwf/apt-fast/master/quick-install.sh')" 42 | if ! command -v apt-fast &>/dev/null; then 43 | echo -e "[-] Failed to find apt-fast\n" 44 | exit 1 45 | fi 46 | } || true 47 | 48 | - run: 49 | name: Install Deps 50 | shell: /usr/bin/bash 51 | when: on_success 52 | command: | 53 | ##presets 54 | #shellcheck disable=all 55 | set +x ; set +e ; set +o pipefail 56 | #-------------# 57 | { 58 | sudo apt-fast install bc coreutils curl dos2unix fdupes jq moreutils wget -y -qq 59 | sudo apt-fast install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null 60 | sudo apt-fast update -y -qq 2>/dev/null 61 | ##tmp 62 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 63 | ##GH ENV 64 | echo "SYSTMP=${SYSTMP}" >> "${BASH_ENV}" 65 | echo "GIT_TERMINAL_PROMPT=0" >> "${BASH_ENV}" 66 | echo "GIT_ASKPASS=/bin/echo" >> "${BASH_ENV}" 67 | SHELL="$(realpath $(which bash) | tr -d '[:space:]')" 68 | echo "SHELL=${SHELL}" >> "${BASH_ENV}" 69 | git config --global "credential.helper" store 70 | git config --global "user.email" "AjamX101@gmail.com" 71 | git config --global "user.name" "Azathothas" 72 | ##User-Agent 73 | #THIS CAUSES ESCAPING ISSUES 74 | #USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 75 | #echo "USER_AGENT=${USER_AGENT}" >> "${BASH_ENV}" 76 | ##Wget 77 | echo 'progress = dot:giga' | sudo tee -a "/etc/wgetrc" 78 | echo 'progress = dot:giga' | tee -a "${HOME}/.wgetrc" 79 | ##PrintENV 80 | echo -e "\n\n" && uname -a 81 | echo -e "\n\n" && realpath "$(which bash)" ; bash --version 82 | echo -e "\n\n" && env 83 | echo -e "\n\n" && df -h 84 | echo -e "\n\n" && echo 85 | } || true 86 | 87 | #- run: 88 | # name: Install Addons 89 | # shell: /usr/bin/bash 90 | # when: always 91 | # command: | 92 | # ##presets 93 | # #shellcheck disable=all 94 | # set +x ; set +e ; set +o pipefail 95 | # #-------------# 96 | # { 97 | # pushd "$(mktemp -d)" &>/dev/null 98 | # curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Linux/install_bins_curl.sh" -o "./install.sh" 99 | # sed -E 's/^[[:space:]]*##[Uu][Ss][Aa][Gg][Ee][[:space:]]*$/##Usage\n#shellcheck disable=all/' -i "./install.sh" 100 | # chmod '+xwr' -v "./install.sh" 101 | # dos2unix --quiet "./install.sh" 102 | # bash "./install.sh" 103 | # popd &>/dev/null 104 | # } || true 105 | 106 | - run: 107 | name: Fix Perms 108 | shell: /usr/bin/bash 109 | when: always 110 | command: | 111 | ##presets 112 | #shellcheck disable=all 113 | set +x ; set +e ; set +o pipefail 114 | #-------------# 115 | if [[ -d "/usr/local/go" ]]; then 116 | echo -e "\n[+] Existing Go Install Found, Removing...\n" 117 | sudo rm -rf "/usr/local/go" 118 | sudo rm -fv "$(realpath $(which go))" 2>/dev/null 119 | sudo rm -fv "$(which go)" 2>/dev/null 120 | #sudo chown -R "$(whoami):$(whoami)" "/usr/local/go" 121 | #sudo chmod -R 'u+rwX' "/usr/local/go" 122 | fi 123 | 124 | - run: 125 | name: Disable apparmor_restrict_unprivileged_userns 126 | shell: /usr/bin/bash 127 | when: always 128 | command: | 129 | ##presets 130 | #shellcheck disable=all 131 | set +x ; set +e ; set +o pipefail 132 | #-------------# 133 | { 134 | echo "kernel.apparmor_restrict_unprivileged_userns=0" | sudo tee "/etc/sysctl.d/98-apparmor-unuserns.conf" 135 | echo "0" | sudo tee "/proc/sys/kernel/apparmor_restrict_unprivileged_userns" 136 | sudo service procps restart 137 | sudo sysctl -p "/etc/sysctl.conf" 138 | } || true 139 | 140 | - run: 141 | name: Fetch Runner Tar 142 | shell: /usr/bin/bash 143 | when: always 144 | command: | 145 | ##presets 146 | #shellcheck disable=all 147 | set +x ; set +e ; set +o pipefail 148 | #-------------# 149 | pushd "$(mktemp -d)" &>/dev/null 150 | wget --quiet --show-progress "https://github.com/pkgforge/devscripts/releases/download/gh-$(uname -m)-$(uname -s)/runner.tar.gz" -O "./runner.tar.gz" 151 | if [ ! -f "./runner.tar.gz" ]; then 152 | exit 1 153 | fi 154 | sudo mkdir -p "/runner-init" 155 | sudo tar xzf "./runner.tar.gz" -C "/runner-init" 156 | rm -rvf "./runner.tar.gz" 157 | sudo chmod 'a+x' "/runner-init/bin/installdependencies.sh" 158 | sudo bash "/runner-init/bin/installdependencies.sh" 159 | sudo rm -rf "/var/lib/apt/lists/"* 2>/dev/null 160 | sudo curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Github/Runners/manage_linux.sh" -o "/usr/local/bin/manager.sh" 161 | if [ ! -f "/usr/local/bin/manager.sh" ]; then 162 | exit 1 163 | fi 164 | sudo chmod 'a+x' -v "/usr/local/bin/manager.sh" 165 | popd &>/dev/null 166 | 167 | - run: 168 | name: Run as External Runner 169 | no_output_timeout: 55m 170 | shell: /usr/bin/bash 171 | when: on_success 172 | environment: 173 | #GITHUB_PERSONAL_TOKEN: Set in Dashboard 174 | GITHUB_OWNER: "pkgforge" 175 | GITHUB_REPOSITORY: "pkgcache" 176 | command: | 177 | ##presets 178 | #shellcheck disable=all 179 | set +x ; set +e ; set +o pipefail 180 | #-------------# 181 | echo -e "\n\n" && env ; echo -e "\n\n" 182 | if [[ "$(uname -m | tr -d '[:space:]')" == "aarch64" ]]; then 183 | export RUNNER_NAME="circle-ci-arm64" 184 | export RUNNER_LABELS="aarch64-linux-circle,arm64-linux-circle" 185 | elif [[ "$(uname -m | tr -d '[:space:]')" == "x86_64" ]]; then 186 | export RUNNER_NAME="circle-ci-amd64" 187 | export RUNNER_LABELS="x64-linux-circle,amd64-linux-circle" 188 | fi 189 | ( "/usr/local/bin/manager.sh" & disown ) || true ; reset 190 | echo -e "\n[+] Waiting 10s..." && sleep 10 191 | echo -e "[+] Executing Runner..." 192 | while true; do 193 | if [[ -s '/tmp/GHA_CI_STATUS' && "$(cat '/tmp/GHA_CI_STATUS' | tr -d '[:space:]')" == "EXITED" ]]; then 194 | ( nohup pkill -INT -f "/usr/local/bin/manager.sh" &>/dev/null & disown ) &>/dev/null || true 195 | ( nohup pkill -TERM -f "/usr/local/bin/manager.sh" &>/dev/null & disown ) &>/dev/null || true 196 | echo -e "\n[+] Workflow Run Concluded\n" 197 | exit 0 198 | fi 199 | sleep 7 200 | done 201 | 202 | workflows: 203 | run-external-runners: 204 | jobs: 205 | - act-as-runner: 206 | matrix: 207 | parameters: 208 | os-type: ["linux-aarch64", "linux-x86_64"] 209 | runner: [1] #--> 2 Total Runners 210 | #runner: [1, 2] #--> 4 Total Runners 211 | #runner: [1, 2, 3, 4, 5, 6] #--> 12 Total Runners -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | #Bare bones dependabot only for GH Workflow Files 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" -------------------------------------------------------------------------------- /.github/shellcheck.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pkgforge/pkgcache/fd85daff9fc3670ce4419daea4a526becb8404b3/.github/shellcheck.txt -------------------------------------------------------------------------------- /.github/workflows/auto_respond.yaml: -------------------------------------------------------------------------------- 1 | name: 🤖 Auto Respond [Discussions|Issues|PRs] ℹ️ 2 | env: 3 | GITHUB_TOKEN: "${{ secrets.BOT_TOKEN }}" 4 | on: 5 | issues: 6 | types: [opened] 7 | pull_request: 8 | types: [opened] 9 | discussion: 10 | types: [created] 11 | workflow_dispatch: #will fail 12 | jobs: 13 | auto-respond: 14 | runs-on: ubuntu-latest 15 | #permissions: 16 | # issues: write 17 | # pull-requests: write 18 | # discussions: write 19 | steps: 20 | 21 | - name: Get GitHub context 22 | env: 23 | EVENT_JSON: ${{ toJson(github.event) }} 24 | run: | 25 | #Presets 26 | set +x ; set +e 27 | #--------------# 28 | printf '%s\n' "$EVENT_JSON" | jq . 29 | continue-on-error: true 30 | 31 | - name: Set GitHub ENV 32 | run: | 33 | #Presets 34 | set +x ; set +e 35 | #--------------# 36 | echo "Repository: ${{ github.repository }}" 37 | echo "Branch: ${{ github.ref }}" 38 | echo "Actor: ${{ github.actor }}" 39 | echo "Event: ${{ github.event_name }}" 40 | if [[ "${{ github.event_name }}" == "discussion" ]]; then 41 | #DISCUSSION_ID="${{ github.event.discussion.id }}" 42 | DISCUSSION_ID="${{ github.event.discussion.node_id }}" 43 | echo "DISCUSSION_ID=${DISCUSSION_ID}" >> "${GITHUB_ENV}" 44 | echo "New Discussion! [Discussion ID: ${DISCUSSION_ID}]" 45 | echo -e "🤖 **Automated Response** \nThanks for starting this discussion! \n**Quick Details:** \n- 💬 We're excited to hear your thoughts \n- 🕒 Typical response time is 12-24 hours \n*Want to connect more with our team and community?* \n**Join Our Discord:** https://discord.gg/djJUs48Zbu \nDive deeper with us and get involved!" > "/tmp/DISCUSSION.md" 46 | #DISCUSSION_MESSAGE="$(cat '/tmp/DISCUSSION.md')" ; export DISCUSSION_MESSAGE 47 | echo "MESSAGE=/tmp/DISCUSSION.md" >> "${GITHUB_ENV}" 48 | elif [[ "${{ github.event_name }}" == "issues" ]]; then 49 | COMMENT_URL="$(echo ${{ github.event.issue.comments_url }} | tr -d '[:space:]')" 50 | echo "COMMENT_URL=${COMMENT_URL}" >> "${GITHUB_ENV}" 51 | echo "New Issue! [Comments URL: ${COMMENT_URL}]" 52 | echo -e "🤖 **Automated Response** \nThanks for opening this issue! \n**Quick Details:** \n- 📋 We'll review it shortly \n- 🕒 Typical response time is 12-24 hours \n*Want faster resolution or more community support?* \n**Join Our Discord:** https://discord.gg/djJUs48Zbu \nConnect directly with our team, get quicker responses, and engage with our community!" > "/tmp/ISSUE.md" 53 | #ISSUE_MESSAGE="$(cat '/tmp/ISSUE.md')" ; export ISSUE_MESSAGE 54 | echo "MESSAGE=/tmp/ISSUE.md" >> "${GITHUB_ENV}" 55 | elif [[ "${{ github.event_name }}" == "pull_request" ]]; then 56 | COMMENT_URL="$(echo ${{ github.event.pull_request.comments_url }} | tr -d '[:space:]')" 57 | echo "COMMENT_URL=${COMMENT_URL}" >> "${GITHUB_ENV}" 58 | echo "New Pull Request! [Comments URL: ${COMMENT_URL}]" 59 | echo -e "🤖 **Automated Response** \nThanks for opening this pull request! \n**Quick Details:** \n- 📋 We'll review it shortly \n- 🕒 Typical response time is 12-24 hours \n*Want faster resolution or more community support?* \n**Join Our Discord:** https://discord.gg/djJUs48Zbu \nConnect directly with our team, get quicker responses, and engage with our community!" > "/tmp/PR.md" 60 | #PR_MESSAGE="$(cat '/tmp/PR.md')" ; export PR_MESSAGE 61 | echo "MESSAGE=/tmp/PR.md" >> "${GITHUB_ENV}" 62 | else 63 | echo "Unsupported event: ${{ github.event_name }}" 64 | fi 65 | continue-on-error: true 66 | 67 | - name: Reply (Discussion) 68 | run: | 69 | #Presets 70 | set +x ; set +e 71 | #--------------# 72 | set -x 73 | if [ -n "${DISCUSSION_ID}" ]; then 74 | #https://docs.github.com/en/graphql/guides/using-the-graphql-api-for-discussions 75 | COMMENT_BODY="$(cat ${MESSAGE})" 76 | QUERY=$(jq -n --arg discussionId "${DISCUSSION_ID}" --arg body "${COMMENT_BODY}" '{"query":"mutation AddDiscussionComment($discussionId: ID!, $body: String!) { addDiscussionComment(input: {discussionId: $discussionId, body: $body}) { comment { id body } } }","variables":{"discussionId":$discussionId,"body":$body}}') 77 | curl -qfsSL -X 'POST' "https://api.github.com/graphql" -H "Authorization: Bearer ${GITHUB_TOKEN}" \ 78 | -d "$QUERY" 79 | fi 80 | continue-on-error: true 81 | 82 | - name: Reply (Issues|PRs) 83 | run: | 84 | #Presets 85 | set +x ; set +e 86 | #--------------# 87 | if [ -n "${COMMENT_URL}" ]; then 88 | curl -qfsSL -X 'POST' "${COMMENT_URL}" -H "Authorization: Bearer ${GITHUB_TOKEN}" \ 89 | -d "{\"body\": $(cat "${MESSAGE}" | jq -Rs .)}" 90 | fi 91 | continue-on-error: true 92 | -------------------------------------------------------------------------------- /.github/workflows/build_aarch64_Linux.yaml: -------------------------------------------------------------------------------- 1 | name: 🛍️ Build 📀 (Pkgcache-aarch64-Linux) Packages 📦📀 2 | concurrency: 3 | group: "${{ github.workflow }}-${{ github.ref }}" 4 | cancel-in-progress: true 5 | 6 | on: 7 | workflow_dispatch: 8 | schedule: 9 | - cron: "30 18 * * Mon,Wed,Sat" # 06:30 PM UTC (12:15 AM NPT Mrng) 10 | #- cron: "30 18 * * 1,3,6" # 06:30 PM UTC (12:15 AM NPT Mrng) 11 | env: 12 | EXCLUDE_CACHED: "YES" #No--> Manually checks if should build one by one (If rebuild == true, it's added regardless) 13 | FORCE_REBUILD_ALL: "NO" #YES--> Force Rebuild everything, will take several tries & fail several times 14 | KEEP_LOGS: "NO" #YES--> Keeps Dirs & Files 15 | NOTIFY_DISCORD: "NO" #NO--> Don't send Notifications to Discord 16 | jobs: 17 | #------------------------------------------------------------------------------------# 18 | presetup: 19 | runs-on: ubuntu-latest 20 | timeout-minutes: 30 21 | permissions: 22 | contents: write 23 | 24 | steps: 25 | - name: Checkout repository 26 | uses: actions/checkout@v4 27 | with: 28 | path: main 29 | filter: "blob:none" 30 | #------------------------------------------------------------------------------------# 31 | - name: Install Addons 32 | run: | 33 | #presets 34 | set -x ; set +e 35 | #-------------# 36 | #bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh") 37 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/rclone" -o "/usr/local/bin/rclone" && sudo chmod +x "/usr/local/bin/rclone" 38 | continue-on-error: true 39 | #------------------------------------------------------------------------------------# 40 | - name: Setup Env 41 | run: | 42 | ##presets 43 | set +x ; set +e 44 | #-------------# 45 | ##CoreUtils 46 | sudo apt update -y 47 | sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y 48 | sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null 49 | ##tmp 50 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 51 | #GH ENV 52 | echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" 53 | #GH Dirs 54 | mkdir -p "${GITHUB_WORKSPACE}/main/aarch64-Linux" 55 | #-------------# 56 | mkdir -p "${HOME}/bin" 57 | sudo apt update -y 58 | sudo apt install dos2unix -y 59 | ##User-Agent 60 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 61 | echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" 62 | continue-on-error: true 63 | 64 | - name: Sanity Check 65 | run: | 66 | # Presets 67 | set +x ; set +e 68 | #--------------# 69 | pushd "$(mktemp -d)" >/dev/null 2>&1 70 | PKG_COUNT="$(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/SBUILD_LIST.json" | jq -r '.[] | .pkg_family' | wc -l | tr -d '[:space:]')" 71 | if [[ "${PKG_COUNT}" -le 10 ]]; then 72 | echo -e "\n[+] FATAL: Too few Packages to Build\n" 73 | exit 1 74 | fi 75 | popd >/dev/null 2>&1 76 | continue-on-error: false 77 | 78 | - name: Set TZ to (Asia/Kathmandu) 79 | run: | 80 | # Presets 81 | set +x ; set +e 82 | #--------------# 83 | sudo apt-get update -y && sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y tzdata 84 | sudo ln -fs "/usr/share/zoneinfo/Asia/Kathmandu" "/etc/localtime" 85 | sudo dpkg-reconfigure --frontend noninteractive tzdata 86 | sudo apt-get install apt-utils software-properties-common -y 87 | sudo apt-get update -y 88 | continue-on-error: true 89 | #------------------------------------------------------------------------------------# 90 | #------------------------------------------------------------------------------------# 91 | build-fetch-packages: 92 | #runs-on: ubuntu-latest 93 | runs-on: arm64-linux-pkgcache 94 | needs: [presetup] 95 | timeout-minutes: 3200 96 | permissions: 97 | attestations: write 98 | contents: write 99 | id-token: write 100 | packages: write 101 | 102 | steps: 103 | - name: Checkout repository 104 | uses: actions/checkout@v4 105 | with: 106 | path: main 107 | filter: "blob:none" 108 | 109 | #- name: Install Addons 110 | # run: | 111 | # #presets 112 | # set -x ; set +e 113 | # #-------------# 114 | # bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh") 115 | # continue-on-error: true 116 | #------------------------------------------------------------------------------------# 117 | - name: Setup Env 118 | run: | 119 | ##presets 120 | set +x ; set +e 121 | #-------------# 122 | ##CoreUtils 123 | sudo apt update -y 124 | sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y 125 | sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null 126 | ##tmp 127 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 128 | #GH ENV 129 | echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" 130 | #GH Dirs 131 | mkdir -p "${GITHUB_WORKSPACE}/main/aarch64-Linux" 132 | #-------------# 133 | mkdir -p "${HOME}/bin" 134 | sudo apt update -y 135 | sudo apt install dos2unix -y 136 | ##Setup Minisign 137 | mkdir -pv "${HOME}/.minisign" 138 | echo "${{ secrets.MINISIGN_SIGKEY }}" > "${HOME}/.minisign/pkgforge.key" 139 | ##User-Agent 140 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 141 | echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" 142 | continue-on-error: true 143 | 144 | #- name: Cache Container Images 145 | # run: | 146 | # ##presets 147 | # set +x ; set +e 148 | # #-------------# 149 | # for img in "ghcr.io/pkgforge/devscripts/alpine-builder:latest" "ghcr.io/pkgforge/devscripts/alpine-builder-mimalloc:stable" "ghcr.io/pkgforge/devscripts/archlinux-builder:latest" "ghcr.io/pkgforge/devscripts/debian-builder-unstable:latest" "ghcr.io/pkgforge/devscripts/ubuntu-builder:latest"; do docker pull $img & done; wait 150 | # continue-on-error: true 151 | 152 | - name: Notify (Discord) [Trigger] 153 | if: env.NOTIFY_DISCORD != 'NO' 154 | run: | 155 | ##presets 156 | set +x ; set +e 157 | #-------------# 158 | pushd "$(mktemp -d)" >/dev/null 2>&1 159 | #Setup Config 160 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/notify" -o "/usr/local/bin/notify" && sudo chmod +x "/usr/local/bin/notify" 161 | echo 'discord:' > "./notify.yaml" 162 | echo ' - id: "portable-apps"' >> "./notify.yaml" 163 | echo ' discord_channel: "main"' >> "./notify.yaml" 164 | echo ' discord_username: "pkgforge-bot"' >> "./notify.yaml" 165 | echo ' discord_format: "{{data}}"' >> "./notify.yaml" 166 | echo " discord_webhook_url: \"${{ secrets.DISCORD_NOTIFY }}\"" >> "./notify.yaml" 167 | #Prep Body 168 | GH_EVENT="${{ github.event_name }}" 169 | GH_WORKFLOW_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" 170 | START_TIME="$(date +%s)" && export START_TIME 171 | echo "GH_EVENT=${GH_EVENT}" >> "${GITHUB_ENV}" 172 | echo "GH_WORKFLOW_URL=${GH_WORKFLOW_URL}" >> "${GITHUB_ENV}" 173 | echo "START_TIME=${START_TIME}" >> "${GITHUB_ENV}" 174 | GH_RECIPE_COUNT="$(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/SBUILD_LIST.json" | jq -r '.[].pkg_family' | sort -u | wc -l | tr -d '[:space:]')" 175 | echo "GH_RECIPE_COUNT=${GH_RECIPE_COUNT}" >> "${GITHUB_ENV}" 176 | GH_DISABLED_COUNT="$(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/SBUILD_LIST.json" | jq -r '.[]._disabled' | grep -Ei 'true' | wc -l | tr -d '[:space:]')" 177 | echo "GH_DISABLED_COUNT=${GH_DISABLED_COUNT}" >> "${GITHUB_ENV}" 178 | GH_REBUILD_COUNT="$(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/SBUILD_LIST.json" | jq -r '.[].rebuild' | grep -Ei 'true' | wc -l | tr -d '[:space:]')" 179 | echo "GH_REBUILD_COUNT=${GH_REBUILD_COUNT}" >> "${GITHUB_ENV}" 180 | rm -rvf "/tmp/PKGFORGE_DISCORD.md" 2>/dev/null 181 | echo 'ℹ️ **Triggered** [🛍️ Build 📦 Pkgcache] (Weekly) ==> https://github.com/pkgforge/pkgcache/blob/main/.github/workflows/build_aarch64_Linux.yaml `['"$(date --utc +'%Y-%m-%dT%H:%M:%S.%3N')"' UTC]`' > "/tmp/PKGFORGE_DISCORD.md" 182 | echo '**`Host`**: `aarch64-Linux`' >> "/tmp/PKGFORGE_DISCORD.md" 183 | echo '**`Event`**: `'"${GH_EVENT}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 184 | #echo '**`Workflow`**: "'${GH_WORKFLOW_URL}'"' >> "/tmp/PKGFORGE_DISCORD.md" 185 | echo '**`Workflow`**: '${GH_WORKFLOW_URL}' ' >> "/tmp/PKGFORGE_DISCORD.md" 186 | echo '**`Maintainer`**: @Azathothas' >> "/tmp/PKGFORGE_DISCORD.md" 187 | echo '**`Packages (pkg_family)`**: `'"Total: ${GH_RECIPE_COUNT} (Disabled: ${GH_DISABLED_COUNT}) (Rebuilt: ${GH_REBUILD_COUNT})"'`' >> "/tmp/PKGFORGE_DISCORD.md" 188 | echo '**`Preserving TMPFILES?`**: `'"${KEEP_LOGS}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 189 | echo '**`Rebuilding?`**: `'"${FORCE_REBUILD_ALL}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 190 | cat "/tmp/PKGFORGE_DISCORD.md" | notify -provider-config "./notify.yaml" -bulk -disable-update-check 191 | echo -e "\n\n" && cat "/tmp/PKGFORGE_DISCORD.md" && echo -e "\n\n" 192 | popd >/dev/null 2>&1 193 | continue-on-error: true 194 | 195 | #- name: Set TZ to (Asia/Kathmandu) 196 | # run: | 197 | # # Presets 198 | # set +x ; set +e 199 | # #--------------# 200 | # sudo apt-get update -y && sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y tzdata 201 | # sudo ln -fs "/usr/share/zoneinfo/Asia/Kathmandu" "/etc/localtime" 202 | # sudo dpkg-reconfigure --frontend noninteractive tzdata 203 | # sudo apt-get install apt-utils software-properties-common -y 204 | # sudo apt-get update -y 205 | # continue-on-error: true 206 | #------------------------------------------------------------------------------------# 207 | #Main Build Script 208 | - name: BUILD 209 | env: 210 | #GHCR_TOKEN: "${{ secrets.GHCR_TOKEN }}" #Needs Actions' Token if we want to make the packages public 211 | GHCR_TOKEN: "${{ github.token }}" 212 | GITHUB_TOKEN: "${{ secrets.RO_GHTOKEN }}" 213 | GITLAB_TOKEN: "${{ secrets.RO_GLTOKEN }}" 214 | MINISIGN_KEY: "${{ secrets.MINISIGN_KEY }}" 215 | run: | 216 | #Presets 217 | set +x ; set +e 218 | #--------------# 219 | ##Main 220 | pushd "$(mktemp -d)" >/dev/null 2>&1 221 | curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/builder.sh" -o "${SYSTMP}/BUILDER.sh" 222 | dos2unix --quiet "${SYSTMP}/BUILDER.sh" ; chmod +xwr "${SYSTMP}/BUILDER.sh" 223 | ##Run with STDOUT [Slow, Not Recommended] 224 | #bash "${SYSTMP}/BUILDER.sh" 225 | ##Run with LOGS only 226 | #bash "${SYSTMP}/BUILDER.sh" > "${SYSTMP}/BUILD.log" 2>&1 227 | ##Run with STDOUT + LOGS 228 | bash "${SYSTMP}/BUILDER.sh" | tee "${SYSTMP}/BUILD.log" 2>&1 229 | ##Run without STDOUT/Logs 230 | #bash "${SYSTMP}/BUILDER.sh" >/dev/null 2>&1 231 | if [[ -f "${SYSTMP}/BUILD.log" ]] && [[ $(stat -c%s "${SYSTMP}/BUILD.log") -gt 1024 ]]; then 232 | ##Purge Tokens (in case set -x & gh didn't redact) 233 | cat "${SYSTMP}/BUILD.log" | ansi2txt > "${SYSTMP}/BUILD.gh.log.txt" 234 | sed -i '/.*github_pat.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 235 | sed -i '/.*ghp_.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 236 | sed -i '/.*access_key_id.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 237 | sed -i '/.*token.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 238 | sed -i '/.*secret_access_key.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 239 | sed -i '/.*token.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 240 | sed -i '/.*cloudflarestorage.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 241 | ##Fetch Only Relevant Logs 242 | if grep -iq "completed" "${SYSTMP}/BUILD.gh.log.txt"; then 243 | mv "${SYSTMP}/BUILD.gh.log.txt" "${SYSTMP}/BUILD.log" 244 | elif grep -iq "initializing" "${SYSTMP}/BUILD.gh.log.txt"; then 245 | mv "${SYSTMP}/BUILD.gh.log.txt" "${SYSTMP}/BUILD_FAILED.log" 246 | BUILD_FAILED="YES" 247 | echo "BUILD_FAILED=${BUILD_FAILED}" >> "${GITHUB_ENV}" 248 | fi 249 | ##rClone Upload logs 250 | 7z a -t7z -mx=9 -mmt="$(($(nproc)+1))" -bsp1 -bt "./${{ github.run_id }}.log.xz" "${SYSTMP}/BUILD.log" 2>/dev/null 251 | #rclone copyto "./${{ github.run_id }}.log.xz" "r2:/meta/pkgcache/logs/${{ github.run_id }}.log.xz" --checksum --check-first --user-agent="${USER_AGENT}" & 252 | if [[ -s "${SYSTMP}/BUILD_FAILED.log" && $(stat -c%s "${SYSTMP}/BUILD_FAILED.log") -gt 10 ]]; then 253 | 7z a -t7z -mx=9 -mmt="$(($(nproc)+1))" -bsp1 -bt "./${{ github.run_id }}.log.xz" "${SYSTMP}/BUILD_FAILED.log" 2>/dev/null 254 | #rclone copyto "./${{ github.run_id }}.log.xz" "r2:/meta/pkgcache/logs/${{ github.run_id }}.log.xz" --checksum --check-first --user-agent="${USER_AGENT}" 255 | fi 256 | wait ; echo 257 | fi 258 | popd >/dev/null 2>&1 259 | continue-on-error: true 260 | #------------------------------------------------------------------------------------# 261 | ##Logs & Artifacts 262 | - name: Get DateTime 263 | run: | 264 | #Presets 265 | set +x ; set +e 266 | #--------------# 267 | UTC_TIME="$(TZ='UTC' date +'%Y_%m_%dT%I_%M_%S_%p')" 268 | echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}" 269 | continue-on-error: true 270 | 271 | - name: Upload (aarch64-Linux) Artifacts 272 | uses: actions/upload-artifact@v4 273 | with: 274 | name: Pkgcache_aarch64-Linux 275 | path: | 276 | /tmp/BUILD.log 277 | compression-level: 0 # no compression, [Default: 6 (GNU Gzip)] 278 | retention-days: 30 279 | overwrite: true 280 | continue-on-error: true 281 | 282 | - name: Attest Build Provenance 283 | uses: actions/attest-build-provenance@v2.3.0 284 | with: 285 | subject-name: "build-logs-aarch64-Linux-${{ env.UTC_TIME }}" 286 | subject-path: "/tmp/BUILD.log" 287 | show-summary: true 288 | continue-on-error: true 289 | #------------------------------------------------------------------------------------# 290 | - name: Notify Discord [Completion] 291 | if: env.NOTIFY_DISCORD != 'NO' 292 | run: | 293 | ##presets 294 | set +x ; set +e 295 | #-------------# 296 | pushd "$(mktemp -d)" >/dev/null 2>&1 297 | #Setup Config 298 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/notify" -o "/usr/local/bin/notify" && sudo chmod +x "/usr/local/bin/notify" 299 | echo 'discord:' > "./notify.yaml" 300 | echo ' - id: "portable-apps"' >> "./notify.yaml" 301 | echo ' discord_channel: "main"' >> "./notify.yaml" 302 | echo ' discord_username: "pkgforge-bot"' >> "./notify.yaml" 303 | echo ' discord_format: "{{data}}"' >> "./notify.yaml" 304 | echo " discord_webhook_url: \"${{ secrets.DISCORD_NOTIFY }}\"" >> "./notify.yaml" 305 | #Prep Body 306 | ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" 307 | END_TIME="$(date +%s)" && export END_TIME="${END_TIME}" 308 | SECS="$((END_TIME - START_TIME))" 309 | #ELAPSED_TIME="$(date -u -d@"$((END_TIME - START_TIME))" "+%H(Hr):%M(Min):%S(Sec)")" 310 | ELAPSED_TIME="$((SECS/86400))(Day):$(date -u -d@$((SECS%86400)) '+%H(Hr):%M(Min):%S(Sec)')" 311 | echo "ELAPSED_TIME=${ELAPSED_TIME}" >> "${GITHUB_ENV}" 312 | rm -rvf "/tmp/PKGFORGE_DISCORD.md" 2>/dev/null 313 | echo 'ℹ️ **Completed** [🛍️ Build 📦 Pkgcache] (Weekly) ==> https://github.com/pkgforge/pkgcache/blob/main/.github/workflows/build_aarch64_Linux.yaml `['"$(date --utc +'%Y-%m-%dT%H:%M:%S.%3N')"' UTC]`' > "/tmp/PKGFORGE_DISCORD.md" 314 | echo '**`Host`**: `aarch64-Linux`' >> "/tmp/PKGFORGE_DISCORD.md" 315 | echo '**`Event`**: `'"${GH_EVENT}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 316 | echo '**`Logs (VERBOSE)`**: https://bin.pkgforge.dev/aarch64-Linux/BUILD.log.txt' >> "/tmp/PKGFORGE_DISCORD.md" 317 | if [[ "${BUILD_FAILED}" == "YES" ]]; then 318 | echo '**`Logs (FAILED)`**: https://bin.pkgforge.dev/aarch64-Linux/BUILD_FAILED.log.txt' >> "/tmp/PKGFORGE_DISCORD.md" 319 | fi 320 | #echo '**`Workflow`**: "'${GH_WORKFLOW_URL}'"' >> "/tmp/PKGFORGE_DISCORD.md" 321 | echo '**`Workflow`**: '${GH_WORKFLOW_URL}' ' >> "/tmp/PKGFORGE_DISCORD.md" 322 | echo '**`Maintainer`**: @Azathothas' >> "/tmp/PKGFORGE_DISCORD.md" 323 | echo '**`Packages (pkg_family)`**: `'"Total: ${GH_RECIPE_COUNT} (Disabled: ${GH_DISABLED_COUNT}) (Rebuilt: ${GH_REBUILD_COUNT})"'`' >> "/tmp/PKGFORGE_DISCORD.md" 324 | echo '**`Packages (Make these PUBLIC)`**: https://github.com/orgs/pkgforge/packages?visibility=private' >> "/tmp/PKGFORGE_DISCORD.md" 325 | echo '**`Preserved TMPFILES?`**: `'"${KEEP_LOGS}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 326 | echo '**`Rebuilt?`**: `'"${FORCE_REBUILD_ALL}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 327 | echo '**`Total Time`**: `'"${ELAPSED_TIME}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 328 | cat "${SYSTMP}/BUILD.log" | grep -i 'FATAL' | sed -E 's/.*Could NOT Build ([a-z0-9]*\.static).*?(https.*\.yaml\])/\1 [\2/' > "./FAILED.txt" 329 | if [[ -s "./FAILED.txt" && $(stat -c%s "./FAILED.txt") -gt 10 ]]; then 330 | echo '**`Failed Builds`**: ==>' >> "/tmp/PKGFORGE_DISCORD.md" 331 | cat "./FAILED.txt" >> "/tmp/PKGFORGE_DISCORD.md" 332 | fi 333 | cat "/tmp/PKGFORGE_DISCORD.md" | notify -provider-config "./notify.yaml" -bulk -disable-update-check 334 | echo -e "\n\n" && cat "/tmp/PKGFORGE_DISCORD.md" && echo -e "\n\n" 335 | popd >/dev/null 2>&1 336 | continue-on-error: true 337 | #------------------------------------------------------------------------------------# -------------------------------------------------------------------------------- /.github/workflows/build_x86_64_Linux.yaml: -------------------------------------------------------------------------------- 1 | name: 🛍️ Build 📀 (Pkgcache-x86_64-Linux) Packages 📦📀 2 | concurrency: 3 | group: "${{ github.workflow }}-${{ github.ref }}" 4 | cancel-in-progress: true 5 | 6 | on: 7 | workflow_dispatch: 8 | schedule: 9 | - cron: "30 18 * * Mon,Wed,Sat" # 06:30 PM UTC (12:15 AM NPT Mrng) 10 | #- cron: "30 18 * * 1,3,6" # 06:30 PM UTC (12:15 AM NPT Mrng) 11 | env: 12 | EXCLUDE_CACHED: "YES" #No--> Manually checks if should build one by one (If rebuild == true, it's added regardless) 13 | FORCE_REBUILD_ALL: "NO" #YES--> Force Rebuild everything, will take several tries & fail several times 14 | KEEP_LOGS: "NO" #YES--> Keeps Dirs & Files 15 | NOTIFY_DISCORD: "NO" #NO--> Don't send Notifications to Discord 16 | jobs: 17 | #------------------------------------------------------------------------------------# 18 | presetup: 19 | runs-on: ubuntu-latest 20 | timeout-minutes: 30 21 | permissions: 22 | contents: write 23 | 24 | steps: 25 | - name: Checkout repository 26 | uses: actions/checkout@v4 27 | with: 28 | path: main 29 | filter: "blob:none" 30 | #------------------------------------------------------------------------------------# 31 | - name: Install Addons 32 | run: | 33 | #presets 34 | set -x ; set +e 35 | #-------------# 36 | #bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh") 37 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/rclone" -o "/usr/local/bin/rclone" && sudo chmod +x "/usr/local/bin/rclone" 38 | continue-on-error: true 39 | #------------------------------------------------------------------------------------# 40 | - name: Setup Env 41 | run: | 42 | ##presets 43 | set +x ; set +e 44 | #-------------# 45 | ##CoreUtils 46 | sudo apt update -y 47 | sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y 48 | sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null 49 | ##tmp 50 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 51 | #GH ENV 52 | echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" 53 | #GH Dirs 54 | mkdir -p "${GITHUB_WORKSPACE}/main/x86_64-Linux" 55 | #-------------# 56 | mkdir -p "${HOME}/bin" 57 | sudo apt update -y 58 | sudo apt install dos2unix -y 59 | ##User-Agent 60 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 61 | echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" 62 | continue-on-error: true 63 | 64 | - name: Sanity Check 65 | run: | 66 | # Presets 67 | set +x ; set +e 68 | #--------------# 69 | pushd "$(mktemp -d)" >/dev/null 2>&1 70 | PKG_COUNT="$(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/SBUILD_LIST.json" | jq -r '.[] | .pkg_family' | wc -l | tr -d '[:space:]')" 71 | if [[ "${PKG_COUNT}" -le 10 ]]; then 72 | echo -e "\n[+] FATAL: Too few Packages to Build\n" 73 | exit 1 74 | fi 75 | popd >/dev/null 2>&1 76 | continue-on-error: false 77 | 78 | - name: Set TZ to (Asia/Kathmandu) 79 | run: | 80 | # Presets 81 | set +x ; set +e 82 | #--------------# 83 | sudo apt-get update -y && sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y tzdata 84 | sudo ln -fs "/usr/share/zoneinfo/Asia/Kathmandu" "/etc/localtime" 85 | sudo dpkg-reconfigure --frontend noninteractive tzdata 86 | sudo apt-get install apt-utils software-properties-common -y 87 | sudo apt-get update -y 88 | continue-on-error: true 89 | #------------------------------------------------------------------------------------# 90 | #------------------------------------------------------------------------------------# 91 | build-fetch-packages: 92 | #runs-on: ubuntu-latest 93 | runs-on: amd64-linux-pkgcache 94 | needs: [presetup] 95 | timeout-minutes: 3200 96 | permissions: 97 | attestations: write 98 | contents: write 99 | id-token: write 100 | packages: write 101 | 102 | steps: 103 | - name: Checkout repository 104 | uses: actions/checkout@v4 105 | with: 106 | path: main 107 | filter: "blob:none" 108 | 109 | #- name: Install Addons 110 | # run: | 111 | # #presets 112 | # set -x ; set +e 113 | # #-------------# 114 | # bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh") 115 | # continue-on-error: true 116 | #------------------------------------------------------------------------------------# 117 | - name: Setup Env 118 | run: | 119 | ##presets 120 | set +x ; set +e 121 | #-------------# 122 | ##CoreUtils 123 | sudo apt update -y 124 | sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y 125 | sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null 126 | ##tmp 127 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 128 | #GH ENV 129 | echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" 130 | #GH Dirs 131 | mkdir -p "${GITHUB_WORKSPACE}/main/x86_64-Linux" 132 | #-------------# 133 | mkdir -p "${HOME}/bin" 134 | sudo apt update -y 135 | sudo apt install dos2unix -y 136 | ##Setup Minisign 137 | mkdir -pv "${HOME}/.minisign" 138 | echo "${{ secrets.MINISIGN_SIGKEY }}" > "${HOME}/.minisign/pkgforge.key" 139 | ##User-Agent 140 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 141 | echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" 142 | continue-on-error: true 143 | 144 | #- name: Cache Container Images 145 | # run: | 146 | # ##presets 147 | # set +x ; set +e 148 | # #-------------# 149 | # for img in "ghcr.io/pkgforge/devscripts/alpine-builder:latest" "ghcr.io/pkgforge/devscripts/alpine-builder-mimalloc:stable" "ghcr.io/pkgforge/devscripts/archlinux-builder:latest" "ghcr.io/pkgforge/devscripts/debian-builder-unstable:latest" "ghcr.io/pkgforge/devscripts/ubuntu-builder:latest"; do docker pull $img & done; wait 150 | # continue-on-error: true 151 | 152 | - name: Notify (Discord) [Trigger] 153 | if: env.NOTIFY_DISCORD != 'NO' 154 | run: | 155 | ##presets 156 | set +x ; set +e 157 | #-------------# 158 | pushd "$(mktemp -d)" >/dev/null 2>&1 159 | #Setup Config 160 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/notify" -o "/usr/local/bin/notify" && sudo chmod +x "/usr/local/bin/notify" 161 | echo 'discord:' > "./notify.yaml" 162 | echo ' - id: "portable-apps"' >> "./notify.yaml" 163 | echo ' discord_channel: "main"' >> "./notify.yaml" 164 | echo ' discord_username: "pkgforge-bot"' >> "./notify.yaml" 165 | echo ' discord_format: "{{data}}"' >> "./notify.yaml" 166 | echo " discord_webhook_url: \"${{ secrets.DISCORD_NOTIFY }}\"" >> "./notify.yaml" 167 | #Prep Body 168 | GH_EVENT="${{ github.event_name }}" 169 | GH_WORKFLOW_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" 170 | START_TIME="$(date +%s)" && export START_TIME 171 | echo "GH_EVENT=${GH_EVENT}" >> "${GITHUB_ENV}" 172 | echo "GH_WORKFLOW_URL=${GH_WORKFLOW_URL}" >> "${GITHUB_ENV}" 173 | echo "START_TIME=${START_TIME}" >> "${GITHUB_ENV}" 174 | GH_RECIPE_COUNT="$(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/SBUILD_LIST.json" | jq -r '.[].pkg_family' | sort -u | wc -l | tr -d '[:space:]')" 175 | echo "GH_RECIPE_COUNT=${GH_RECIPE_COUNT}" >> "${GITHUB_ENV}" 176 | GH_DISABLED_COUNT="$(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/SBUILD_LIST.json" | jq -r '.[]._disabled' | grep -Ei 'true' | wc -l | tr -d '[:space:]')" 177 | echo "GH_DISABLED_COUNT=${GH_DISABLED_COUNT}" >> "${GITHUB_ENV}" 178 | GH_REBUILD_COUNT="$(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/SBUILD_LIST.json" | jq -r '.[].rebuild' | grep -Ei 'true' | wc -l | tr -d '[:space:]')" 179 | echo "GH_REBUILD_COUNT=${GH_REBUILD_COUNT}" >> "${GITHUB_ENV}" 180 | rm -rvf "/tmp/PKGFORGE_DISCORD.md" 2>/dev/null 181 | echo 'ℹ️ **Triggered** [🛍️ Build 📦 Pkgcache] (Weekly) ==> https://github.com/pkgforge/pkgcache/blob/main/.github/workflows/build_x86_64_Linux.yaml `['"$(date --utc +'%Y-%m-%dT%H:%M:%S.%3N')"' UTC]`' > "/tmp/PKGFORGE_DISCORD.md" 182 | echo '**`Host`**: `x86_64-Linux`' >> "/tmp/PKGFORGE_DISCORD.md" 183 | echo '**`Event`**: `'"${GH_EVENT}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 184 | #echo '**`Workflow`**: "'${GH_WORKFLOW_URL}'"' >> "/tmp/PKGFORGE_DISCORD.md" 185 | echo '**`Workflow`**: '${GH_WORKFLOW_URL}' ' >> "/tmp/PKGFORGE_DISCORD.md" 186 | echo '**`Maintainer`**: @Azathothas' >> "/tmp/PKGFORGE_DISCORD.md" 187 | echo '**`Packages (pkg_family)`**: `'"Total: ${GH_RECIPE_COUNT} (Disabled: ${GH_DISABLED_COUNT}) (Rebuilt: ${GH_REBUILD_COUNT})"'`' >> "/tmp/PKGFORGE_DISCORD.md" 188 | echo '**`Preserving TMPFILES?`**: `'"${KEEP_LOGS}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 189 | echo '**`Rebuilding?`**: `'"${FORCE_REBUILD_ALL}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 190 | cat "/tmp/PKGFORGE_DISCORD.md" | notify -provider-config "./notify.yaml" -bulk -disable-update-check 191 | echo -e "\n\n" && cat "/tmp/PKGFORGE_DISCORD.md" && echo -e "\n\n" 192 | popd >/dev/null 2>&1 193 | continue-on-error: true 194 | 195 | #- name: Set TZ to (Asia/Kathmandu) 196 | # run: | 197 | # # Presets 198 | # set +x ; set +e 199 | # #--------------# 200 | # sudo apt-get update -y && sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y tzdata 201 | # sudo ln -fs "/usr/share/zoneinfo/Asia/Kathmandu" "/etc/localtime" 202 | # sudo dpkg-reconfigure --frontend noninteractive tzdata 203 | # sudo apt-get install apt-utils software-properties-common -y 204 | # sudo apt-get update -y 205 | # continue-on-error: true 206 | #------------------------------------------------------------------------------------# 207 | #Main Build Script 208 | - name: BUILD 209 | env: 210 | #GHCR_TOKEN: "${{ secrets.GHCR_TOKEN }}" #Needs Actions' Token if we want to make the packages public 211 | GHCR_TOKEN: "${{ github.token }}" 212 | GITHUB_TOKEN: "${{ secrets.RO_GHTOKEN }}" 213 | GITLAB_TOKEN: "${{ secrets.RO_GLTOKEN }}" 214 | MINISIGN_KEY: "${{ secrets.MINISIGN_KEY }}" 215 | run: | 216 | #Presets 217 | set +x ; set +e 218 | #--------------# 219 | ##Main 220 | pushd "$(mktemp -d)" >/dev/null 2>&1 221 | curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/builder.sh" -o "${SYSTMP}/BUILDER.sh" 222 | dos2unix --quiet "${SYSTMP}/BUILDER.sh" ; chmod +xwr "${SYSTMP}/BUILDER.sh" 223 | ##Run with STDOUT [Slow, Not Recommended] 224 | #bash "${SYSTMP}/BUILDER.sh" 225 | ##Run with LOGS only 226 | #bash "${SYSTMP}/BUILDER.sh" > "${SYSTMP}/BUILD.log" 2>&1 227 | ##Run with STDOUT + LOGS 228 | bash "${SYSTMP}/BUILDER.sh" | tee "${SYSTMP}/BUILD.log" 2>&1 229 | ##Run without STDOUT/Logs 230 | #bash "${SYSTMP}/BUILDER.sh" >/dev/null 2>&1 231 | if [[ -f "${SYSTMP}/BUILD.log" ]] && [[ $(stat -c%s "${SYSTMP}/BUILD.log") -gt 1024 ]]; then 232 | ##Purge Tokens (in case set -x & gh didn't redact) 233 | cat "${SYSTMP}/BUILD.log" | ansi2txt > "${SYSTMP}/BUILD.gh.log.txt" 234 | sed -i '/.*github_pat.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 235 | sed -i '/.*ghp_.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 236 | sed -i '/.*access_key_id.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 237 | sed -i '/.*token.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 238 | sed -i '/.*secret_access_key.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 239 | sed -i '/.*token.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 240 | sed -i '/.*cloudflarestorage.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 241 | ##Fetch Only Relevant Logs 242 | if grep -iq "completed" "${SYSTMP}/BUILD.gh.log.txt"; then 243 | mv "${SYSTMP}/BUILD.gh.log.txt" "${SYSTMP}/BUILD.log" 244 | elif grep -iq "initializing" "${SYSTMP}/BUILD.gh.log.txt"; then 245 | mv "${SYSTMP}/BUILD.gh.log.txt" "${SYSTMP}/BUILD_FAILED.log" 246 | BUILD_FAILED="YES" 247 | echo "BUILD_FAILED=${BUILD_FAILED}" >> "${GITHUB_ENV}" 248 | fi 249 | ##rClone Upload logs 250 | 7z a -t7z -mx=9 -mmt="$(($(nproc)+1))" -bsp1 -bt "./${{ github.run_id }}.log.xz" "${SYSTMP}/BUILD.log" 2>/dev/null 251 | #rclone copyto "./${{ github.run_id }}.log.xz" "r2:/meta/pkgcache/logs/${{ github.run_id }}.log.xz" --checksum --check-first --user-agent="${USER_AGENT}" & 252 | if [[ -s "${SYSTMP}/BUILD_FAILED.log" && $(stat -c%s "${SYSTMP}/BUILD_FAILED.log") -gt 10 ]]; then 253 | 7z a -t7z -mx=9 -mmt="$(($(nproc)+1))" -bsp1 -bt "./${{ github.run_id }}.log.xz" "${SYSTMP}/BUILD_FAILED.log" 2>/dev/null 254 | #rclone copyto "./${{ github.run_id }}.log.xz" "r2:/meta/pkgcache/logs/${{ github.run_id }}.log.xz" --checksum --check-first --user-agent="${USER_AGENT}" 255 | fi 256 | wait ; echo 257 | fi 258 | popd >/dev/null 2>&1 259 | continue-on-error: true 260 | #------------------------------------------------------------------------------------# 261 | ##Logs & Artifacts 262 | - name: Get DateTime 263 | run: | 264 | #Presets 265 | set +x ; set +e 266 | #--------------# 267 | UTC_TIME="$(TZ='UTC' date +'%Y_%m_%dT%I_%M_%S_%p')" 268 | echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}" 269 | continue-on-error: true 270 | 271 | - name: Upload (x86_64-Linux) Artifacts 272 | uses: actions/upload-artifact@v4 273 | with: 274 | name: Pkgcache_x86_64-Linux 275 | path: | 276 | /tmp/BUILD.log 277 | compression-level: 0 # no compression, [Default: 6 (GNU Gzip)] 278 | retention-days: 30 279 | overwrite: true 280 | continue-on-error: true 281 | 282 | - name: Attest Build Provenance 283 | uses: actions/attest-build-provenance@v2.3.0 284 | with: 285 | subject-name: "build-logs-x86_64-Linux-${{ env.UTC_TIME }}" 286 | subject-path: "/tmp/BUILD.log" 287 | show-summary: true 288 | continue-on-error: true 289 | #------------------------------------------------------------------------------------# 290 | - name: Notify Discord [Completion] 291 | if: env.NOTIFY_DISCORD != 'NO' 292 | run: | 293 | ##presets 294 | set +x ; set +e 295 | #-------------# 296 | pushd "$(mktemp -d)" >/dev/null 2>&1 297 | #Setup Config 298 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/notify" -o "/usr/local/bin/notify" && sudo chmod +x "/usr/local/bin/notify" 299 | echo 'discord:' > "./notify.yaml" 300 | echo ' - id: "portable-apps"' >> "./notify.yaml" 301 | echo ' discord_channel: "main"' >> "./notify.yaml" 302 | echo ' discord_username: "pkgforge-bot"' >> "./notify.yaml" 303 | echo ' discord_format: "{{data}}"' >> "./notify.yaml" 304 | echo " discord_webhook_url: \"${{ secrets.DISCORD_NOTIFY }}\"" >> "./notify.yaml" 305 | #Prep Body 306 | ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts" 307 | END_TIME="$(date +%s)" && export END_TIME="${END_TIME}" 308 | SECS="$((END_TIME - START_TIME))" 309 | #ELAPSED_TIME="$(date -u -d@"$((END_TIME - START_TIME))" "+%H(Hr):%M(Min):%S(Sec)")" 310 | ELAPSED_TIME="$((SECS/86400))(Day):$(date -u -d@$((SECS%86400)) '+%H(Hr):%M(Min):%S(Sec)')" 311 | echo "ELAPSED_TIME=${ELAPSED_TIME}" >> "${GITHUB_ENV}" 312 | rm -rvf "/tmp/PKGFORGE_DISCORD.md" 2>/dev/null 313 | echo 'ℹ️ **Completed** [🛍️ Build 📦 Pkgcache] (Weekly) ==> https://github.com/pkgforge/pkgcache/blob/main/.github/workflows/build_x86_64_Linux.yaml `['"$(date --utc +'%Y-%m-%dT%H:%M:%S.%3N')"' UTC]`' > "/tmp/PKGFORGE_DISCORD.md" 314 | echo '**`Host`**: `x86_64-Linux`' >> "/tmp/PKGFORGE_DISCORD.md" 315 | echo '**`Event`**: `'"${GH_EVENT}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 316 | echo '**`Logs (VERBOSE)`**: https://bin.pkgforge.dev/x86_64-Linux/BUILD.log.txt' >> "/tmp/PKGFORGE_DISCORD.md" 317 | if [[ "${BUILD_FAILED}" == "YES" ]]; then 318 | echo '**`Logs (FAILED)`**: https://bin.pkgforge.dev/x86_64-Linux/BUILD_FAILED.log.txt' >> "/tmp/PKGFORGE_DISCORD.md" 319 | fi 320 | #echo '**`Workflow`**: "'${GH_WORKFLOW_URL}'"' >> "/tmp/PKGFORGE_DISCORD.md" 321 | echo '**`Workflow`**: '${GH_WORKFLOW_URL}' ' >> "/tmp/PKGFORGE_DISCORD.md" 322 | echo '**`Maintainer`**: @Azathothas' >> "/tmp/PKGFORGE_DISCORD.md" 323 | echo '**`Packages (pkg_family)`**: `'"Total: ${GH_RECIPE_COUNT} (Disabled: ${GH_DISABLED_COUNT}) (Rebuilt: ${GH_REBUILD_COUNT})"'`' >> "/tmp/PKGFORGE_DISCORD.md" 324 | echo '**`Packages (Make these PUBLIC)`**: https://github.com/orgs/pkgforge/packages?visibility=private' >> "/tmp/PKGFORGE_DISCORD.md" 325 | echo '**`Preserved TMPFILES?`**: `'"${KEEP_LOGS}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 326 | echo '**`Rebuilt?`**: `'"${FORCE_REBUILD_ALL}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 327 | echo '**`Total Time`**: `'"${ELAPSED_TIME}"'`' >> "/tmp/PKGFORGE_DISCORD.md" 328 | cat "${SYSTMP}/BUILD.log" | grep -i 'FATAL' | sed -E 's/.*Could NOT Build ([a-z0-9]*\.static).*?(https.*\.yaml\])/\1 [\2/' > "./FAILED.txt" 329 | if [[ -s "./FAILED.txt" && $(stat -c%s "./FAILED.txt") -gt 10 ]]; then 330 | echo '**`Failed Builds`**: ==>' >> "/tmp/PKGFORGE_DISCORD.md" 331 | cat "./FAILED.txt" >> "/tmp/PKGFORGE_DISCORD.md" 332 | fi 333 | cat "/tmp/PKGFORGE_DISCORD.md" | notify -provider-config "./notify.yaml" -bulk -disable-update-check 334 | echo -e "\n\n" && cat "/tmp/PKGFORGE_DISCORD.md" && echo -e "\n\n" 335 | popd >/dev/null 2>&1 336 | continue-on-error: true 337 | #------------------------------------------------------------------------------------# -------------------------------------------------------------------------------- /.github/workflows/check_links.yaml: -------------------------------------------------------------------------------- 1 | #https://github.com/lycheeverse/lychee-action 2 | name: 🔎 Check Links 🔗 3 | 4 | on: 5 | repository_dispatch: 6 | workflow_dispatch: 7 | schedule: 8 | - cron: "15 0 * * 1" #12:15 AM UTC --> 06:00 AM NPT Tue 9 | 10 | jobs: 11 | linkChecker: 12 | runs-on: ubuntu-latest 13 | permissions: 14 | issues: write 15 | steps: 16 | - uses: actions/checkout@v4 17 | with: 18 | path: main 19 | filter: "blob:none" 20 | 21 | - name: Link Checker 22 | id: lychee 23 | uses: lycheeverse/lychee-action@v2 24 | with: 25 | fail: false 26 | 27 | - name: Create Issue From File 28 | if: steps.lychee.outputs.exit_code != 0 29 | uses: peter-evans/create-issue-from-file@v5 30 | with: 31 | title: Link Checker Report 32 | content-filepath: ./lychee/out.md 33 | labels: report, automated issue 34 | -------------------------------------------------------------------------------- /.github/workflows/kill_all_actions.yaml: -------------------------------------------------------------------------------- 1 | #!!WARNING: This kills All actions (all kinds) in the entire repository## 2 | name: 🔫 Kill All Actions 👾 3 | on: 4 | workflow_dispatch: 5 | jobs: 6 | KIA: 7 | runs-on: ubuntu-latest 8 | permissions: 9 | actions: write 10 | statuses: write 11 | steps: 12 | - name: Kill 13 | run: | 14 | ##presets 15 | set +x ; set +e 16 | #-------------# 17 | ##Stale 18 | kill_all_actions() 19 | { 20 | gh run list --repo "${GITHUB_REPOSITORY}" --json databaseId --jq '.[].databaseId' --limit '1000' --status 'stale' |\ 21 | xargs -I "{}" gh run cancel "{}" --repo "${GITHUB_REPOSITORY}" & 22 | ##Queued 23 | gh run list --repo "${GITHUB_REPOSITORY}" --json databaseId --jq '.[].databaseId' --limit '1000' --status 'queued' |\ 24 | xargs -I "{}" gh run cancel "{}" --repo "${GITHUB_REPOSITORY}" & 25 | ##Requested 26 | gh run list --repo "${GITHUB_REPOSITORY}" --json databaseId --jq '.[].databaseId' --limit '1000' --status 'requested' |\ 27 | xargs -I "{}" gh run cancel "{}" --repo "${GITHUB_REPOSITORY}" & 28 | ##Waiting 29 | gh run list --repo "${GITHUB_REPOSITORY}" --json databaseId --jq '.[].databaseId' --limit '1000' --status 'waiting' |\ 30 | xargs -I "{}" gh run cancel "{}" --repo "${GITHUB_REPOSITORY}" & 31 | ##In_Progress (Must be last) 32 | gh run list --repo "${GITHUB_REPOSITORY}" --json databaseId --jq '.[].databaseId' --limit '1000' --status 'in_progress' |\ 33 | xargs -I "{}" gh run cancel "{}" --repo "${GITHUB_REPOSITORY}" & 34 | ##Wait 35 | wait ; echo 36 | } 37 | export -f kill_all_actions 38 | kill_all_actions ; kill_all_actions ; kill_all_actions 39 | continue-on-error: true -------------------------------------------------------------------------------- /.github/workflows/matrix_builds.yaml: -------------------------------------------------------------------------------- 1 | name: 🧰🛠️ Build Package 📦📀 2 | 3 | permissions: 4 | contents: write 5 | 6 | on: 7 | workflow_dispatch: 8 | inputs: 9 | 10 | host: 11 | description: Host (Arch+OS) [ALL ==> Run on All Hosts (No riscv64)] 12 | type: choice 13 | options: 14 | - "ALL" 15 | - "aarch64-Linux" 16 | - "riscv64-Linux" 17 | - "x86_64-Linux" 18 | 19 | sbuild-url: 20 | description: Raw URL where SBUILD is located 21 | required: true 22 | 23 | ghcr-url: 24 | description: Root GHCR URL under which this package will be pushed 25 | required: true 26 | 27 | pkg-family: 28 | description: Package Family 29 | required: true 30 | 31 | ci-infra: 32 | description: CI Infra (What Build Servers to Use) [Default ==> GitHub] 33 | type: choice 34 | options: 35 | - "github" 36 | - "circle-ci" 37 | - "self-hosted" 38 | 39 | debug: 40 | description: Debug Mode (Verbose with set -x) [Default ==> False] 41 | type: choice 42 | options: 43 | - "false" 44 | - "true" 45 | 46 | logs: 47 | description: Keep Logs? (Preserves Working Dir) [Default ==> True] 48 | type: choice 49 | options: 50 | - "true" 51 | - "false" 52 | 53 | rebuild: 54 | description: Force Rebuild this Package? [Default ==> True] 55 | type: choice 56 | options: 57 | - "true" 58 | - "false" 59 | jobs: 60 | preprocess: 61 | runs-on: ubuntu-latest 62 | outputs: 63 | runner_matrix: ${{ steps.generate-matrix.outputs.runner_matrix }} 64 | steps: 65 | - name: Presetup 66 | id: generate-matrix 67 | run: | 68 | ##Presets 69 | set +x ; set +e 70 | #-------------# 71 | echo '[' > "./MATRIX.json.tmp" 72 | if [[ "${{ github.event.inputs.ci-infra }}" == "github" || -z "${{ github.event.inputs.ci-infra }}" ]]; then 73 | if [[ "${{ github.event.inputs.host }}" == "ALL" ]]; then 74 | echo '{"host": "aarch64-Linux", "runner": "ubuntu-24.04-arm", "ghcr_pkg": "${{ inputs.ghcr-url }}"},' >> "./MATRIX.json.tmp" 75 | #echo '{"host": "riscv64-Linux", "runner": "ubuntu-latest", "ghcr_pkg": "${{ inputs.ghcr-url }}"},' >> "./MATRIX.json.tmp" 76 | echo '{"host": "x86_64-Linux", "runner": "ubuntu-latest", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 77 | elif [[ "${{ github.event.inputs.host }}" == "aarch64-Linux" ]]; then 78 | echo '{"host": "aarch64-Linux", "runner": "ubuntu-24.04-arm", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 79 | elif [[ "${{ github.event.inputs.host }}" == "riscv64-Linux" ]]; then 80 | echo '{"host": "riscv64-Linux", "runner": "ubuntu-latest", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 81 | elif [[ "${{ github.event.inputs.host }}" == "x86_64-Linux" ]]; then 82 | echo '{"host": "x86_64-Linux", "runner": "ubuntu-latest", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 83 | fi 84 | elif [[ "${{ github.event.inputs.ci-infra }}" == "circle-ci" ]]; then 85 | curl -X "POST" -H "content-type: application/json" -qfsSL "${{ secrets.CIRCLE_CI_WEBHOOK_URL }}?secret=${{ secrets.CIRCLE_CI_SECRET }}" 86 | if [[ "${{ github.event.inputs.host }}" == "ALL" ]]; then 87 | echo '{"host": "aarch64-Linux", "runner": "arm64-linux-circle", "ghcr_pkg": "${{ inputs.ghcr-url }}"},' >> "./MATRIX.json.tmp" 88 | #echo '{"host": "riscv64-Linux", "runner": "amd64-linux-circle", "ghcr_pkg": "${{ inputs.ghcr-url }}"},' >> "./MATRIX.json.tmp" 89 | echo '{"host": "x86_64-Linux", "runner": "amd64-linux-circle", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 90 | elif [[ "${{ github.event.inputs.host }}" == "aarch64-Linux" ]]; then 91 | echo '{"host": "aarch64-Linux", "runner": "arm64-linux-circle", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 92 | elif [[ "${{ github.event.inputs.host }}" == "riscv64-Linux" ]]; then 93 | echo '{"host": "riscv64-Linux", "runner": "amd64-linux-circle", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 94 | elif [[ "${{ github.event.inputs.host }}" == "x86_64-Linux" ]]; then 95 | echo '{"host": "x86_64-Linux", "runner": "amd64-linux-circle", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 96 | fi 97 | elif [[ "${{ github.event.inputs.ci-infra }}" == "self-hosted" ]]; then 98 | echo "" 99 | if [[ "${{ github.event.inputs.host }}" == "ALL" ]]; then 100 | echo '{"host": "aarch64-Linux", "runner": "self-hosted-aarch64", "ghcr_pkg": "${{ inputs.ghcr-url }}"},' >> "./MATRIX.json.tmp" 101 | #echo '{"host": "riscv64-Linux", "runner": "self-hosted-riscv64", "ghcr_pkg": "${{ inputs.ghcr-url }}"},' >> "./MATRIX.json.tmp" 102 | echo '{"host": "x86_64-Linux", "runner": "self-hosted-x86_64", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 103 | elif [[ "${{ github.event.inputs.host }}" == "aarch64-Linux" ]]; then 104 | echo '{"host": "aarch64-Linux", "runner": "self-hosted-aarch64", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 105 | elif [[ "${{ github.event.inputs.host }}" == "riscv64-Linux" ]]; then 106 | echo '{"host": "riscv64-Linux", "runner": "self-hosted-riscv64", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 107 | elif [[ "${{ github.event.inputs.host }}" == "x86_64-Linux" ]]; then 108 | echo '{"host": "x86_64-Linux", "runner": "self-hosted-x86_64", "ghcr_pkg": "${{ inputs.ghcr-url }}"}' >> "./MATRIX.json.tmp" 109 | fi 110 | fi 111 | echo ']' >> "./MATRIX.json.tmp" 112 | jq 'unique_by(.host)' "./MATRIX.json.tmp" | jq . > "./MATRIX.json" 113 | ESCAPED_MATRIX="$(cat "./MATRIX.json" | jq -c .)" 114 | echo "runner_matrix=${ESCAPED_MATRIX}" >> "${GITHUB_OUTPUT}" 115 | continue-on-error: false 116 | 117 | - name: Sanity Check Input JSON 118 | run: | 119 | echo '${{ steps.generate-matrix.outputs.runner_matrix }}' | jq . 120 | continue-on-error: true 121 | 122 | build: 123 | needs: [preprocess] 124 | strategy: 125 | fail-fast: false 126 | matrix: 127 | package: ${{ fromJson(needs.preprocess.outputs.runner_matrix) }} 128 | name: "${{ matrix.package.host }} ==> (${{ matrix.package.ghcr_pkg }})" 129 | runs-on: "${{ matrix.package.runner }}" 130 | timeout-minutes: 200 131 | permissions: 132 | attestations: write 133 | contents: write 134 | id-token: write 135 | packages: write 136 | steps: 137 | - name: Exit if not called 138 | env: 139 | GH_TOKEN: "${{ github.token }}" 140 | run: | 141 | ##Presets 142 | set +x ; set +e 143 | #-------------# 144 | if [[ "$(uname -m | tr -d '[:space:]')" == "aarch64" ]]; then 145 | if [[ "${{ github.event.inputs.host }}" != "ALL" ]] && [[ "${{ github.event.inputs.host }}" != "aarch64-Linux" ]]; then 146 | echo "CONTINUE_GHRUN=FALSE" >> "${GITHUB_ENV}" 147 | fi 148 | elif [[ "$(uname -m | tr -d '[:space:]')" == "riscv64" ]]; then 149 | if [[ "${{ github.event.inputs.host }}" != "ALL" ]] && [[ "${{ github.event.inputs.host }}" != "riscv64-Linux" ]]; then 150 | echo "CONTINUE_GHRUN=FALSE" >> "${GITHUB_ENV}" 151 | fi 152 | elif [[ "$(uname -m | tr -d '[:space:]')" == "x86_64" ]]; then 153 | if [[ "${{ github.event.inputs.host }}" != "ALL" ]] && [[ "${{ github.event.inputs.host }}" != "x86_64-Linux" ]]; then 154 | if [[ "${{ github.event.inputs.host }}" == "riscv64-Linux" ]]; then 155 | echo "CONTINUE_GHRUN=TRUE" >> "${GITHUB_ENV}" 156 | else 157 | echo "CONTINUE_GHRUN=FALSE" >> "${GITHUB_ENV}" 158 | fi 159 | fi 160 | fi 161 | continue-on-error: false 162 | 163 | - name: Validate Required Secrets [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 164 | if: env.CONTINUE_GHRUN != 'FALSE' 165 | env: 166 | RO_GHTOKEN: ${{ secrets.RO_GHTOKEN }} 167 | RO_GLTOKEN: ${{ secrets.RO_GLTOKEN }} 168 | MINISIGN_KEY: ${{ secrets.MINISIGN_KEY }} 169 | run: | 170 | ##Presets 171 | set +x ; set +e 172 | #-------------# 173 | # Check if any of the required secrets are missing 174 | if [ -z "${RO_GHTOKEN##*[[:space:]]}" ] || [ -z "${RO_GLTOKEN##*[[:space:]]}" ] || [ -z "${MINISIGN_KEY##*[[:space:]]}" ]; then 175 | echo "::error::One or more required secrets are missing:" 176 | [ -z "${RO_GHTOKEN##*[[:space:]]}" ] && echo "- RO_GHTOKEN is missing" 177 | [ -z "${RO_GLTOKEN##*[[:space:]]}" ] && echo "- RO_GLTOKEN is missing" 178 | [ -z "${MINISIGN_KEY##*[[:space:]]}" ] && echo "- MINISIGN_KEY is missing" 179 | exit 1 180 | fi 181 | continue-on-error: false 182 | 183 | - name: Parse Input [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 184 | if: env.CONTINUE_GHRUN != 'FALSE' 185 | run: | 186 | ##Presets 187 | set +x ; set +e 188 | #-------------# 189 | ##Host Triplet 190 | if [[ "${{ matrix.package.host }}" == "riscv64-Linux" ]] ; then 191 | export HOST_TRIPLET="riscv64-Linux" 192 | if [[ "$(uname -m | tr -d '[:space:]')" == "riscv64" ]]; then 193 | export ON_QEMU="NO" 194 | else 195 | export ON_QEMU="YES" 196 | fi 197 | else 198 | export HOST_TRIPLET="$(uname -m)-$(uname -s)" 199 | export ON_QEMU="NO" 200 | fi 201 | echo "HOST_TRIPLET=${HOST_TRIPLET}" >> "${GITHUB_ENV}" 202 | echo "ON_QEMU=${ON_QEMU}" >> "${GITHUB_ENV}" 203 | ##Debug 204 | if [[ "${{ github.event.inputs.debug }}" == "true" ]] ; then 205 | export DEBUG="1" 206 | else 207 | export DEBUG="0" 208 | fi 209 | echo "DEBUG=${DEBUG}" >> "${GITHUB_ENV}" 210 | ##GHCRPKG_URL 211 | GHCRPKG_LOCAL="$(echo "${{ inputs.ghcr-url }}" | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]')" 212 | export GHCRPKG_LOCAL 213 | echo "GHCRPKG_LOCAL=${GHCRPKG_LOCAL}" >> "${GITHUB_ENV}" 214 | ##Logs 215 | if [[ "${{ github.event.inputs.logs }}" == "false" ]] ; then 216 | export KEEP_LOGS="NO" 217 | else 218 | export KEEP_LOGS="YES" 219 | export GITHUB_TEST_BUILD="YES" 220 | fi 221 | echo "KEEP_LOGS=${KEEP_LOGS}" >> "${GITHUB_ENV}" 222 | echo "GITHUB_TEST_BUILD=${GITHUB_TEST_BUILD}" >> "${GITHUB_ENV}" 223 | ##PKG_FAMILY_LOCAL 224 | PKG_FAMILY_LOCAL="$(echo "${{ inputs.pkg-family }}" | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]')" 225 | export PKG_FAMILY_LOCAL 226 | echo "PKG_FAMILY_LOCAL=${PKG_FAMILY_LOCAL}" >> "${GITHUB_ENV}" 227 | ##Rebuild 228 | if [[ "${{ github.event.inputs.rebuild }}" == "false" ]] ; then 229 | export SBUILD_REBUILD="false" 230 | else 231 | export SBUILD_REBUILD="true" 232 | fi 233 | echo "SBUILD_REBUILD=${SBUILD_REBUILD}" >> "${GITHUB_ENV}" 234 | ##SBUILD_URL 235 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/yq" -o "/usr/local/bin/yq" && \ 236 | sudo chmod 'a+x' "/usr/local/bin/yq" && command -v yq >/dev/null || exit 1 237 | SBUILD_FILE_URL="$(echo "${{ github.event.inputs.sbuild-url }}" | tr -d '[:space:]')" 238 | pushd "$(mktemp -d)" >/dev/null 2>&1 239 | curl -w "(SBUILD) <== %{url}\n" -fL "${SBUILD_FILE_URL}" -o "./SBUILD_INPUT" 240 | if [[ ! -s "./SBUILD_INPUT" || $(stat -c%s "./SBUILD_INPUT") -le 10 ]]; then 241 | echo -e "\n[✗] FATAL: Failed to Fetch ${SBUILD_FILE_URL}\n" 242 | echo "CONTINUE_GHRUN=FALSE" >> "${GITHUB_ENV}" 243 | exit 1 244 | else 245 | export SBUILD_FILE_URL 246 | echo "SBUILD_FILE_URL=${SBUILD_FILE_URL}" >> "${GITHUB_ENV}" 247 | #Check for x_exec.host 248 | if yq e '.x_exec.host != null' "./SBUILD_INPUT" | grep -qi 'true'; then 249 | if ! yq '.x_exec.host[]' "./SBUILD_INPUT" | grep -v '^#' | grep -qi "${HOST_TRIPLET,,}"; then 250 | echo -e "\n[✗] WARNING: SBUILD (./SBUILD_INPUT) is NOT Supported on ${HOST_TRIPLET}\n" 251 | yq '.x_exec.host[]' "./SBUILD_INPUT" 252 | echo "CONTINUE_GHRUN=FALSE" >> "${GITHUB_ENV}" 253 | fi 254 | fi 255 | fi 256 | popd >/dev/null 2>&1 257 | continue-on-error: false 258 | 259 | - name: Setup Env [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 260 | if: env.CONTINUE_GHRUN != 'FALSE' 261 | run: | 262 | ##Presets 263 | set +x ; set +e 264 | #-------------# 265 | ##Debug? 266 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 267 | set -x 268 | fi 269 | #-------------# 270 | ##CoreUtils 271 | sudo apt update -y 272 | sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y 273 | sudo apt install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt update -y 2>/dev/null 274 | ##tmp 275 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 276 | #GH ENV 277 | echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" 278 | echo "GHA_MODE=MATRIX" >> "${GITHUB_ENV}" 279 | #-------------# 280 | mkdir -p "${HOME}/bin" 281 | sudo apt update -y 282 | sudo apt install dos2unix -y 283 | ##Setup Minisign 284 | mkdir -pv "${HOME}/.minisign" 285 | echo "${{ secrets.MINISIGN_SIGKEY }}" > "${HOME}/.minisign/pkgforge.key" 286 | ##User-Agent 287 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 288 | echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" 289 | continue-on-error: true 290 | 291 | - name: Disable apparmor_restrict_unprivileged_userns #Required for runimage etc 292 | if: env.CONTINUE_GHRUN != 'FALSE' 293 | run: | 294 | ##Presets 295 | set +x ; set +e 296 | #-------------# 297 | ##Debug? 298 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 299 | set -x 300 | fi 301 | #-------------# 302 | echo "kernel.apparmor_restrict_unprivileged_userns=0" | sudo tee "/etc/sysctl.d/98-apparmor-unuserns.conf" 303 | echo "0" | sudo tee "/proc/sys/kernel/apparmor_restrict_unprivileged_userns" 304 | sudo service procps restart 305 | sudo sysctl -p "/etc/sysctl.conf" 306 | continue-on-error: true 307 | 308 | - name: If riscv64 on QEMU [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 309 | if: env.HOST_TRIPLET == 'riscv64-Linux' && env.ON_QEMU == 'YES' && env.CONTINUE_GHRUN != 'FALSE' 310 | env: 311 | #GHCR_TOKEN: "${{ secrets.GHCR_TOKEN }}" #Needs Actions' Token if we want to make the packages public 312 | GHCR_TOKEN: "${{ github.token }}" 313 | run: | 314 | ##Presets 315 | set +x ; set +e 316 | #-------------# 317 | ##Debug? 318 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 319 | set -x 320 | fi 321 | #-------------# 322 | echo "RISCV64_ON_QEMU=TRUE" >> "${GITHUB_ENV}" 323 | echo "INSIDE_PODMAN=TRUE" >> "${GITHUB_ENV}" 324 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Linux/install_bins_curl.sh") 325 | echo "${GHCR_TOKEN}" | oras login --username "Azathothas" --password-stdin "ghcr.io" 326 | continue-on-error: true 327 | 328 | - name: Set up QEMU [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 329 | if: env.RISCV64_ON_QEMU == 'TRUE' && env.CONTINUE_GHRUN != 'FALSE' 330 | uses: docker/setup-qemu-action@v3 331 | continue-on-error: true 332 | - name: Set up Cross Arch [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 333 | if: env.RISCV64_ON_QEMU == 'TRUE' && env.CONTINUE_GHRUN != 'FALSE' 334 | uses: docker/setup-buildx-action@v3 335 | continue-on-error: true 336 | 337 | - name: Install/Configure Podman [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 338 | if: env.RISCV64_ON_QEMU == 'TRUE' && env.CONTINUE_GHRUN != 'FALSE' 339 | run: | 340 | ##Presets 341 | set +x ; set +e 342 | #-------------# 343 | ##Debug? 344 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 345 | set -x 346 | fi 347 | #-------------# 348 | if ! command -v podman &>/dev/null; then 349 | echo -e "\n[-] Failed to find podman\n" 350 | #Install Manually 351 | sudo apt update -y -qq 352 | sudo apt install podman -y -qq 353 | if ! command -v podman &>/dev/null; then 354 | echo -e "\n[-] Failed to install Podman\n" 355 | echo "CONTINUE_GHRUN=FALSE" >> "${GITHUB_ENV}" 356 | exit 1 357 | else 358 | cat "$(systemctl show podman.service -p FragmentPath 2>/dev/null | cut -d '=' -f 2 | tr -d '[:space:]')" 359 | sudo systemctl daemon-reexec ; sudo systemctl daemon-reload 360 | sudo systemctl status podman --no-pager 361 | sudo systemctl reload "podman.service" 362 | sudo service podman reload ; sudo service podman restart ; sudo systemctl status podman --no-pager 363 | fi 364 | else 365 | podman info 366 | podman version 367 | fi 368 | continue-on-error: true 369 | 370 | - name: Daemonize Podman [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 371 | if: env.RISCV64_ON_QEMU == 'TRUE' && env.CONTINUE_GHRUN != 'FALSE' 372 | run: | 373 | ##Presets 374 | set +x ; set +e 375 | #-------------# 376 | ##Debug? 377 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 378 | set -x 379 | fi 380 | #-------------# 381 | ##Get Env 382 | env 1>"./env.list" 2>"/dev/null" 383 | ##Run 384 | sudo mkdir -p "/var/lib/containers/tmp-runner01" 385 | sudo chmod 1777 -v "/var/lib/containers/tmp-runner01" 386 | POD_IMAGE="ghcr.io/pkgforge/devscripts/ubuntu-systemd-base:riscv64" 387 | sudo podman run --platform="linux/riscv64" --detach --privileged \ 388 | --device "/dev/fuse" --env-file="env.list" --hostname "$(hostname)" --name="ubuntu-builder" \ 389 | --network="bridge" --pull="always" --systemd="always" --tz="UTC" --ulimit="host" \ 390 | --volume "${HOME}/.minisign:/home/runner/.minisign" \ 391 | --volume "/var/lib/containers/tmp-runner01:/tmp:rw,exec,dev" "${POD_IMAGE}" 392 | rm -rf "./env.list" 2>/dev/null 393 | sleep 10 394 | POD_ID="$(sudo podman ps --filter "name=ubuntu-builder" --format json 2>/dev/null | jq --arg P_IMG "${POD_IMAGE}" -r '.[] | select(.Image == $P_IMG) | .Id' | tr -d '"'\''[:space:]')" 395 | if ! sudo podman inspect "${POD_ID}" &>/dev/null; then 396 | echo -e "\n[✗] FATAL: Could NOT find \${POD_ID}\n" 397 | podman ps -a 398 | echo "CONTINUE_GHRUN=FALSE" >> "${GITHUB_ENV}" 399 | exit 1 400 | else 401 | echo "POD_IMAGE=${POD_IMAGE}" >> "${GITHUB_ENV}" 402 | echo "POD_ID=${POD_ID}" >> "${GITHUB_ENV}" 403 | sudo podman exec -it -u "runner" "${POD_ID}" bash -c 'echo "kernel.apparmor_restrict_unprivileged_userns=0" | sudo tee "/etc/sysctl.d/98-apparmor-unuserns.conf"' 404 | sudo podman exec -it -u "runner" "${POD_ID}" bash -c 'echo "0" | sudo tee "/proc/sys/kernel/apparmor_restrict_unprivileged_userns"' 405 | #sudo podman exec -it -u "runner" "${POD_ID}" bash -c 'sudo service procps restart' 406 | sudo podman exec -it -u "runner" "${POD_ID}" bash -c 'sudo sysctl -p "/etc/sysctl.conf"' 407 | sudo podman exec -it -u "runner" "${POD_ID}" bash -c \ 408 | ' 409 | sudo apt update -y 410 | sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y 411 | sudo apt install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt update -y 2>/dev/null 412 | mkdir -p "${HOME}/bin" 413 | sudo apt update -y 414 | sudo apt install dos2unix -y 415 | ' 416 | fi 417 | continue-on-error: true 418 | 419 | - name: BUILD (${{ env.GHCRPKG_LOCAL }}) [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 420 | if: env.CONTINUE_GHRUN != 'FALSE' 421 | env: 422 | #GHCR_TOKEN: "${{ secrets.GHCR_TOKEN }}" #Needs Actions' Token if we want to make the packages public 423 | GHCR_TOKEN: "${{ github.token }}" 424 | GITHUB_TOKEN: "${{ secrets.RO_GHTOKEN }}" 425 | GITLAB_TOKEN: "${{ secrets.RO_GLTOKEN }}" 426 | MINISIGN_KEY: "${{ secrets.MINISIGN_KEY }}" 427 | run: | 428 | ##Presets 429 | set +x ; set +e 430 | #-------------# 431 | ##Debug? 432 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 433 | set -x 434 | fi 435 | #-------------# 436 | ##Main 437 | pushd "$(mktemp -d)" >/dev/null 2>&1 438 | curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/builder.sh" -o "${SYSTMP}/BUILDER.sh" 439 | dos2unix --quiet "${SYSTMP}/BUILDER.sh" ; chmod +xwr "${SYSTMP}/BUILDER.sh" 440 | ##Run with STDOUT + LOGS 441 | export DEBUG="${DEBUG}" 442 | export KEEP_LOGS="${KEEP_LOGS}" 443 | export PKG_FAMILY_LOCAL="${PKG_FAMILY_LOCAL}" 444 | export GHCRPKG_LOCAL="${GHCRPKG_LOCAL}" 445 | export SBUILD_REBUILD="${SBUILD_REBUILD}" 446 | export GITHUB_TEST_BUILD="${GITHUB_TEST_BUILD}" 447 | if [[ "${{ env.RISCV64_ON_QEMU }}" == "TRUE" ]]; then 448 | sudo podman cp "${SYSTMP}/BUILDER.sh" "${POD_ID}:/tmp/BUILDER.sh" 449 | sudo podman exec -u "runner" -w "/tmp" \ 450 | -e DEBUG="${DEBUG}" \ 451 | -e GHCR_TOKEN="${GHCR_TOKEN}" \ 452 | -e GITHUB_TOKEN="${GITHUB_TOKEN}" \ 453 | -e GITLAB_TOKEN="${GITLAB_TOKEN}" \ 454 | -e MINISIGN_KEY="${MINISIGN_KEY}" \ 455 | -e KEEP_LOGS="${KEEP_LOGS}" \ 456 | -e PKG_FAMILY_LOCAL="${PKG_FAMILY_LOCAL}" \ 457 | -e GHCRPKG_LOCAL="${GHCRPKG_LOCAL}" \ 458 | -e SBUILD_REBUILD="${SBUILD_REBUILD}" \ 459 | -e GITHUB_TEST_BUILD="${GITHUB_TEST_BUILD}" \ 460 | -e INSIDE_PODMAN="${INSIDE_PODMAN}" \ 461 | -e SBUILD_FILE_URL="${SBUILD_FILE_URL}" \ 462 | "${POD_ID}" \ 463 | bash -c 'bash "/tmp/BUILDER.sh" "${SBUILD_FILE_URL}" | tee "/tmp/BUILD.log" 2>&1' 464 | sudo podman cp "${POD_ID}:/tmp/BUILD.log" "${SYSTMP}/BUILD.log" 465 | sudo podman cp "${POD_ID}:/tmp/BUILD_ARTIFACTS.zstd" "${SYSTMP}/BUILD_ARTIFACTS.zstd" 466 | sudo podman cp "${POD_ID}:/tmp/GITHUB_ENV" "${SYSTMP}/GITHUB_ENV" 467 | mkdir -p "${SYSTMP}/_POD_BRIDGE" 468 | sudo podman cp "${POD_ID}:/tmp/_POD_BRIDGE/." "${SYSTMP}/_POD_BRIDGE" 469 | sudo chown -Rv "$(whoami):$(whoami)" "${SYSTMP}/BUILD.log" "${SYSTMP}/BUILD_ARTIFACTS.zstd" "${SYSTMP}/GITHUB_ENV" "${SYSTMP}/_POD_BRIDGE" 2>/dev/null 470 | sudo chmod -R +xwr "${SYSTMP}/BUILD.log" "${SYSTMP}/BUILD_ARTIFACTS.zstd" "${SYSTMP}/GITHUB_ENV" "${SYSTMP}/_POD_BRIDGE" 2>/dev/null 471 | cat "${SYSTMP}/GITHUB_ENV" >> "${GITHUB_ENV}" 472 | else 473 | bash "${SYSTMP}/BUILDER.sh" "${SBUILD_FILE_URL}" | tee "${SYSTMP}/BUILD.log" 2>&1 474 | fi 475 | ##Purge Tokens (in case set -x & gh didn't redact) 476 | cat "${SYSTMP}/BUILD.log" | ansi2txt > "${SYSTMP}/BUILD.gh.log.txt" 477 | sed -i '/.*github_pat.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 478 | sed -i '/.*ghp_.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 479 | sed -i '/.*access_key_id.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 480 | sed -i '/.*token.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 481 | sed -i '/.*secret_access_key.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 482 | sed -i '/.*token.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 483 | sed -i '/.*cloudflarestorage.*/Id' "${SYSTMP}/BUILD.gh.log.txt" 2>/dev/null 484 | mv -fv "${SYSTMP}/BUILD.gh.log.txt" "${SYSTMP}/BUILD.log" 485 | popd >/dev/null 2>&1 486 | continue-on-error: true 487 | 488 | - name: Push Artifacts (${{ env.GHCRPKG_LOCAL }}) [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 489 | if: env.CONTINUE_GHRUN != 'FALSE' 490 | env: 491 | #GHCR_TOKEN: "${{ secrets.GHCR_TOKEN }}" #Needs Actions' Token if we want to make the packages public 492 | GHCR_TOKEN: "${{ github.token }}" 493 | GITHUB_TOKEN: "${{ secrets.RO_GHTOKEN }}" 494 | GITLAB_TOKEN: "${{ secrets.RO_GLTOKEN }}" 495 | MINISIGN_KEY: "${{ secrets.MINISIGN_KEY }}" 496 | run: | 497 | ##Presets 498 | set +x ; set +e 499 | #-------------# 500 | ##Debug? 501 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 502 | set -x 503 | fi 504 | #-------------# 505 | ##Set ENV 506 | if [[ "${SKIP_SRCBUILD_UPLOAD}" != "YES" ]]; then 507 | #GHCRPKG_TAG_SRCBUILD="srcbuild.$(date --utc +"%y%m%dT%H%M%S" | tr -d '[:space:]')-${{ env.GHCRPKG_TAG }}" 508 | GHCRPKG_TAG_SRCBUILD="${{ env.GHCRPKG_TAG }}" 509 | GHCRPKG_URL_SRCBUILD="${{ env.GHCRPKG_LOCAL }}/${{ env.PKG_FAMILY_LOCAL }}-srcbuild-${{ env.BUILD_ID }}" 510 | export GHCRPKG_TAG_SRCBUILD GHCRPKG_URL_SRCBUILD 511 | echo "GHCRPKG_TAG_SRCBUILD=${GHCRPKG_TAG_SRCBUILD}" >> "${GITHUB_ENV}" 512 | echo "GHCRPKG_URL_SRCBUILD=${GHCRPKG_URL_SRCBUILD}" >> "${GITHUB_ENV}" 513 | fi 514 | ##Push 515 | if [[ -n "${GHCRPKG_TAG_SRCBUILD+x}" ]]; then 516 | pushd "/tmp" &>/dev/null 517 | if [[ -s "./BUILD_ARTIFACTS.zstd" && $(stat -c%s "./BUILD_ARTIFACTS.zstd") -gt 1000 ]]; then 518 | realpath "./BUILD_ARTIFACTS.zstd" && du -sh "./BUILD_ARTIFACTS.zstd" 519 | ls -sh "${{ env.SBUILD_OUTDIR }}" 520 | ghcr_push_cmd() 521 | { 522 | for i in {1..10}; do 523 | unset ghcr_push ; ghcr_push=(oras push --disable-path-validation) 524 | ghcr_push+=(--config "/dev/null:application/vnd.oci.empty.v1+json") 525 | ghcr_push+=(--annotation "com.github.package.type=container") 526 | ghcr_push+=(--annotation "dev.pkgforge.soar.build_ghcrpkg-tag=${{ env.GHCRPKG_TAG }}") 527 | ghcr_push+=(--annotation "dev.pkgforge.soar.build_gha=${{ env.BUILD_GHACTIONS }}") 528 | ghcr_push+=(--annotation "dev.pkgforge.soar.build_id=${{ env.BUILD_ID }}") 529 | ghcr_push+=(--annotation "dev.pkgforge.soar.ghcr_pkg=${{ env.GHCRPKG_URL }}:${{ env.GHCRPKG_TAG }}") 530 | ghcr_push+=(--annotation "dev.pkgforge.soar.push_date=${{ env.PKG_DATE }}") 531 | ghcr_push+=(--annotation "dev.pkgforge.soar.version=${{ env.PKG_VERSION }}") 532 | ghcr_push+=(--annotation "org.opencontainers.image.created=${{ env.PKG_DATE }}") 533 | ghcr_push+=(--annotation "org.opencontainers.image.description=SRCBUILD for ${{ env.GHCRPKG_URL }}") 534 | ghcr_push+=(--annotation "org.opencontainers.image.licenses=blessing") 535 | ghcr_push+=(--annotation "org.opencontainers.image.ref.name=${{ env.PKG_VERSION }}") 536 | ghcr_push+=(--annotation "org.opencontainers.image.revision=${{ env.PKG_VERSION }}") 537 | ghcr_push+=(--annotation "org.opencontainers.image.source=${{ env.PKG_WEBPAGE }}") 538 | ghcr_push+=(--annotation "org.opencontainers.image.title=SRCBUILD-${{ env.PKG_FAMILY_LOCAL }}") 539 | ghcr_push+=(--annotation "org.opencontainers.image.url=${{ env.PKG_SRCURL }}") 540 | ghcr_push+=(--annotation "org.opencontainers.image.vendor=pkgforge") 541 | ghcr_push+=(--annotation "org.opencontainers.image.version=${{ env.PKG_VERSION }}") 542 | ghcr_push+=("${GHCRPKG_URL_SRCBUILD}:${GHCRPKG_TAG_SRCBUILD}") 543 | [[ -f "./BUILD_ARTIFACTS.zstd" && -s "./BUILD_ARTIFACTS.zstd" ]] && ghcr_push+=("./BUILD_ARTIFACTS.zstd") 544 | "${ghcr_push[@]}" ; sleep 5 545 | #Check 546 | if [[ "$(oras manifest fetch "${GHCRPKG_URL_SRCBUILD}:${GHCRPKG_TAG_SRCBUILD}" | jq -r '.annotations["dev.pkgforge.soar.push_date"]' | tr -d '[:space:]')" == "${{ env.PKG_DATE }}" ]]; then 547 | echo -e "\n[+] (ARTIFACTS) Registry --> https://${GHCRPKG_URL_SRCBUILD}\n" 548 | break 549 | else 550 | echo -e "\n[-] Failed to Push Artifact to ${GHCRPKG_URL_SRCBUILD}:${GHCRPKG_TAG_SRCBUILD} (Retrying ${i}/10)\n" 551 | fi 552 | sleep "$(shuf -i 500-4500 -n 1)e-3" 553 | done 554 | } 555 | export -f ghcr_push_cmd 556 | ghcr_push_cmd 557 | if [[ "$(oras manifest fetch "${GHCRPKG_URL_SRCBUILD}:${GHCRPKG_TAG_SRCBUILD}" | jq -r '.annotations["dev.pkgforge.soar.push_date"]' | tr -d '[:space:]')" != "${{ env.PKG_DATE }}" ]]; then 558 | echo -e "\n[✗] Failed to Push Artifact to ${GHCRPKG_URL_SRCBUILD}:${GHCRPKG_TAG_SRCBUILD}\n" 559 | echo -e "\n[-] Retrying ...\n" 560 | ghcr_push_cmd 561 | if [[ "$(oras manifest fetch "${GHCRPKG_URL_SRCBUILD}:${GHCRPKG_TAG_SRCBUILD}" | jq -r '.annotations["dev.pkgforge.soar.push_date"]' | tr -d '[:space:]')" != "${{ env.PKG_DATE }}" ]]; then 562 | oras manifest fetch "${GHCRPKG_URL_SRCBUILD}:${GHCRPKG_TAG_SRCBUILD}" | jq . 563 | echo -e "\n[✗] Failed to Push Artifact to ${GHCRPKG_URL_SRCBUILD}:${GHCRPKG_TAG_SRCBUILD}\n" 564 | return 1 || exit 1 565 | fi 566 | fi 567 | fi 568 | fi 569 | popd >/dev/null 2>&1 570 | continue-on-error: true 571 | 572 | ##Logs & Artifacts 573 | - name: Get DateTime [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 574 | if: env.CONTINUE_GHRUN != 'FALSE' 575 | run: | 576 | ##Presets 577 | set +x ; set +e 578 | #-------------# 579 | ##Debug? 580 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 581 | set -x 582 | fi 583 | #-------------# 584 | UTC_TIME="$(TZ='UTC' date +'%Y_%m_%dT%I_%M_%S_%p')" 585 | echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}" 586 | continue-on-error: true 587 | 588 | - name: Upload (LOG) Artifacts [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 589 | if: env.CONTINUE_GHRUN != 'FALSE' 590 | uses: actions/upload-artifact@v4 591 | with: 592 | name: Pkgcache_${{ env.PKG_FAMILY_LOCAL }}_${{ matrix.package.host }} 593 | path: | 594 | /tmp/BUILD.log 595 | /tmp/BUILD_ARTIFACTS.zstd 596 | compression-level: 0 # no compression, [Default: 6 (GNU Gzip)] 597 | retention-days: 30 598 | overwrite: true 599 | continue-on-error: true 600 | 601 | - name: Attest Build Provenance [${{ matrix.package.host }}<==>${{ matrix.package.runner }}] 602 | if: env.CONTINUE_GHRUN != 'FALSE' 603 | uses: actions/attest-build-provenance@v2.3.0 604 | with: 605 | subject-name: "${{ env.PKG_FAMILY_LOCAL }}-${{ env.BUILD_ID }}-${{ env.GHCRPKG_TAG }}" 606 | subject-path: | 607 | "/tmp/BUILD.log" 608 | "/tmp/BUILD_ARTIFACTS.zstd" 609 | ${{ env.SBUILD_OUTDIR }}/** 610 | !${{ env.SBUILD_TMPDIR }}/** 611 | show-summary: true 612 | continue-on-error: true 613 | 614 | - name: Check Build [${{ matrix.package.ghcr_pkg }}] 615 | if: env.CONTINUE_GHRUN != 'FALSE' 616 | run: | 617 | ##Presets 618 | set +x ; set +e 619 | #-------------# 620 | ##Debug? 621 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 622 | set -x 623 | fi 624 | #-------------# 625 | if [[ "${GHA_BUILD_FAILED}" == "YES" || "${SBUILD_SUCCESSFUL}" == "NO" ]]; then 626 | echo -e "\n[-] FATAL: Failed to Successfully Build ${{ matrix.package.ghcr_pkg }}" 627 | exit 1 628 | fi 629 | continue-on-error: false 630 | 631 | - name: Check Push [${{ matrix.package.ghcr_pkg }}] 632 | if: env.CONTINUE_GHRUN != 'FALSE' 633 | run: | 634 | ##Presets 635 | set +x ; set +e 636 | #-------------# 637 | ##Debug? 638 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 639 | set -x 640 | fi 641 | #-------------# 642 | if [[ "${PUSH_SUCCESSFUL}" == "NO" ]]; then 643 | echo -e "\n[-] FATAL: Failed to Successfully Push ==> ${{ matrix.package.ghcr_pkg }}" 644 | exit 1 645 | fi 646 | continue-on-error: false 647 | 648 | - name: Self-Kill 649 | if: always() 650 | run: | 651 | ##Presets 652 | set +x ; set +e 653 | #-------------# 654 | ##Debug? 655 | if [[ "${DEBUG}" = "1" ]] || [[ "${DEBUG}" = "ON" ]]; then 656 | set -x 657 | fi 658 | #-------------# 659 | [[ -f "/tmp/GHA_CI_STATUS" && -w "/tmp/GHA_CI_STATUS" ]] && echo "" > "/tmp/GHA_CI_STATUS" 660 | if [[ -d "/tmp" && -w "/tmp" ]]; then 661 | echo "EXITED" | tee "/tmp/GHA_CI_STATUS" 662 | fi 663 | continue-on-error: true -------------------------------------------------------------------------------- /.github/workflows/repo_linter.yaml: -------------------------------------------------------------------------------- 1 | name: 🐧🧹 Repo Linter 🖳🗑️ 2 | concurrency: 3 | group: "${{ github.workflow }}-${{ github.ref }}" 4 | cancel-in-progress: true 5 | #MAX_RUNTIME: 02 Minutes */10 * * * * 6 | 7 | on: 8 | #push: 9 | workflow_dispatch: 10 | schedule: 11 | # - cron: "45 03 * * *" # 03:45 AM UTC --> 09:30 AM Morning NPT 12 | - cron: "0 */8 * * *" # Every 12 Hrs 13 | 14 | #env: 15 | #GHCR_TOKEN: "${{ secrets.GHCR_TOKEN }}" 16 | jobs: 17 | #------------------------------------------------------------------------------------# 18 | check-post: 19 | runs-on: ubuntu-latest 20 | 21 | permissions: 22 | contents: write 23 | 24 | steps: 25 | - name: Debloat Runner 26 | run: | 27 | #Presets 28 | set +x ; set +e 29 | #--------------# 30 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Github/Runners/debloat_ubuntu.sh") 31 | continue-on-error: true 32 | 33 | - name: Checkout repository 34 | uses: actions/checkout@v4 35 | with: 36 | path: main 37 | filter: "blob:none" 38 | 39 | - name: Setup Env 40 | run: | 41 | ##presets 42 | set +x ; set +e 43 | #-------------# 44 | ##CoreUtils 45 | sudo apt update -y 46 | sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y 47 | sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null 48 | #temp 49 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 50 | echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" 51 | ##User-Agent 52 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 53 | echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" 54 | continue-on-error: true 55 | 56 | - name: Install Addons 57 | run: | 58 | #presets 59 | set +x ; set +e 60 | #-------------# 61 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh") 62 | continue-on-error: true 63 | 64 | - name: Dos2Unix Everything 65 | run: | 66 | #Presets 67 | set +x ; set +e 68 | #--------------# 69 | cd "${GITHUB_WORKSPACE}/main" 70 | find . -type f ! -path "./.git/*" -exec dos2unix {} \; 2>/dev/null 71 | continue-on-error: true 72 | 73 | - name: ActionLint 74 | run: | 75 | #Presets 76 | set +x ; set +e 77 | #--------------# 78 | cd "${GITHUB_WORKSPACE}/main" 79 | find ".github/workflows" -type f -name "*ml" -exec actionlint {} \; 80 | continue-on-error: true 81 | 82 | - name: Blob Check 83 | run: | 84 | #Presets 85 | set +x ; set +e 86 | #--------------# 87 | sed 's|https://github.com/pkgforge/soarpkgs/blob/main/packages|https://raw.githubusercontent.com/pkgforge/soarpkgs/refs/heads/main/packages|g' -i "${GITHUB_WORKSPACE}/main/SBUILD_LIST.json" 88 | continue-on-error: true 89 | 90 | - name: Shellcheck 91 | run: | 92 | #Presets 93 | set +x ; set +e 94 | #--------------# 95 | cd "${GITHUB_WORKSPACE}/main" 96 | find ".github" -type f -name '*.sh' -exec shellcheck --exclude="SC2261" --severity=error "{}" \; 2>/dev/null | tee "${GITHUB_WORKSPACE}/main/.github/shellcheck.txt" 97 | continue-on-error: true 98 | 99 | - name: Gen Diff 100 | run: | 101 | #Presets 102 | set +x ; set +e 103 | #--------------# 104 | pushd "$(mktemp -d)" >/dev/null 2>&1 105 | curl -qfsSL "https://raw.githubusercontent.com/pkgforge/metadata/refs/heads/main/soarpkgs/data/DIFF_pkgcache.json" -o "./DIFF.json" 106 | cat "./DIFF.json" "${GITHUB_WORKSPACE}/main/SBUILD_LIST.json" | jq -s 'add | map(select(._disabled == false)) | sort_by(.pkg_family) | unique_by(.ghcr_pkg)' | jq . > "${GITHUB_WORKSPACE}/main/SBUILD_LIST.diff" 107 | sed 's|https://github.com/pkgforge/soarpkgs/blob/main/packages|https://raw.githubusercontent.com/pkgforge/soarpkgs/refs/heads/main/packages|g' -i "${GITHUB_WORKSPACE}/main/SBUILD_LIST.diff" 108 | cat "${GITHUB_WORKSPACE}/main/SBUILD_LIST.json" | jq 'group_by(.ghcr_pkg) | map(select(length > 1))' | jq . > "${GITHUB_WORKSPACE}/main/SBUILD_LIST.json.dupe" 109 | cat "${GITHUB_WORKSPACE}/main/SBUILD_LIST.diff" | jq 'group_by(.ghcr_pkg) | map(select(length > 1))' | jq . > "${GITHUB_WORKSPACE}/main/SBUILD_LIST.diff.dupe" 110 | popd >/dev/null 2>&1 111 | continue-on-error: true 112 | 113 | #- name: Generate Repo Metadata (git-sizer) 114 | # run: | 115 | # #Presets 116 | # set +x ; set +e 117 | # #--------------# 118 | # cd "${GITHUB_WORKSPACE}/main" 119 | # #Dust sizes 120 | # echo '```mathematica' > "${GITHUB_WORKSPACE}/main/.github/SIZE.md" 121 | # dust -b -c -i -r -n 99999999 "${GITHUB_WORKSPACE}/main" | tee -a "${GITHUB_WORKSPACE}/main/.github/SIZE.md" 122 | # dust -b -c -i -r -n 99999999 "${GITHUB_WORKSPACE}/main" | tee "${GITHUB_WORKSPACE}/main/.github/SIZE.txt" 123 | # echo '```' >> "${GITHUB_WORKSPACE}/main/.github/SIZE.md" 124 | # continue-on-error: true 125 | 126 | - name: Get DateTime & Purge files (=> 95 MB) 127 | run: | 128 | #Presets 129 | set +x ; set +e 130 | #--------------# 131 | UTC_TIME="$(TZ='UTC' date +'%Y-%m-%d (%I:%M:%S %p)')" 132 | echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}" 133 | #Purge 134 | find "${GITHUB_WORKSPACE}/main" -path "${GITHUB_WORKSPACE}/main/.git" -prune -o -type f -size +95M -exec rm -rvf "{}" + 2>/dev/null 135 | continue-on-error: true 136 | 137 | - uses: stefanzweifel/git-auto-commit-action@v5 138 | with: 139 | repository: ./main 140 | commit_user_name: Azathothas 141 | commit_user_email: AjamX101@gmail.com 142 | #commit_message: "‎‎‏‏‎ ‎" 143 | commit_message: "✅ Linted (Repo) 🛍️" 144 | #push_options: '--force' 145 | continue-on-error: true -------------------------------------------------------------------------------- /.github/workflows/schedule_builds.yaml: -------------------------------------------------------------------------------- 1 | name: ⏱️ Schedule Matrix Builds 📈 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: "30 18 * * Sun,Tue,Fri" # 06:30 PM UTC (12:15 AM NPT Mrng) 6 | #- cron: "30 18 * * 0,2,5" # 06:30 PM UTC (12:15 AM NPT Mrng) 7 | jobs: 8 | pre-trigger-build: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | contents: read 12 | outputs: 13 | build_list: ${{ steps.set-inputs.outputs.build_list }} 14 | steps: 15 | - name: Setup Env 16 | run: | 17 | ##presets 18 | set +x ; set +e 19 | #-------------# 20 | ##CoreUtils 21 | sudo apt update -y 22 | sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y 23 | sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null 24 | #-------------# 25 | ##Host 26 | HOST_TRIPLET="$(uname -m)-$(uname -s)" 27 | echo "HOST_TRIPLET=${HOST_TRIPLET}" >> "${GITHUB_ENV}" 28 | #-------------# 29 | ##Repo 30 | PKG_REPO="${GITHUB_REPOSITORY}" 31 | echo "PKG_REPO=${PKG_REPO#*/}" >> "${GITHUB_ENV}" 32 | #-------------# 33 | ##tmp 34 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 35 | echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" 36 | #-------------# 37 | mkdir -p "${HOME}/bin" 38 | sudo apt update -y 39 | sudo apt install dos2unix -y 40 | ##User-Agent 41 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 42 | echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" 43 | continue-on-error: true 44 | 45 | - name: Get & Set Inputs 46 | id: set-inputs 47 | run: | 48 | ##presets 49 | set +x ; set +e 50 | #-------------# 51 | ##Get Data 52 | mkdir -pv "${SYSTMP}/pkgforge" 53 | curl -w "(Diff) <== %{url}\n" -qfsSL "https://raw.githubusercontent.com/pkgforge/metadata/refs/heads/main/soarpkgs/data/DIFF_${PKG_REPO}_${HOST_TRIPLET}.json" -o "${SYSTMP}/pkgforge/DIFF.json.tmp" 54 | curl -w "(List) <== %{url}\n" "https://raw.githubusercontent.com/pkgforge/${PKG_REPO}/refs/heads/main/SBUILD_LIST.json" -o "${SYSTMP}/pkgforge/SBUILD_LIST.json.tmp" 55 | jq -n --slurpfile a "${SYSTMP}/pkgforge/DIFF.json.tmp" --slurpfile b "${SYSTMP}/pkgforge/SBUILD_LIST.json.tmp" \ 56 | ' 57 | [$b[] | .[] as $objB | 58 | ($a[] | .[] | .build_script | split("/") | .[-3:] | join("/")) as $a_last3 | 59 | ($objB.build_script | split("/") | .[-3:] | join("/")) as $b_last3 | 60 | if $a_last3 == $b_last3 or $objB.rebuild == true then $objB else empty end 61 | ] | unique_by(.ghcr_pkg) | sort_by(.pkg_family) 62 | ' | jq . > "${SYSTMP}/pkgforge/SBUILD_LIST.json" 63 | ##Set Input (100 builds) 64 | BUILD_LIST="$(jq -c '[.[] | select(._disabled == false) | {pkg_family, ghcr_url: .ghcr_pkg, sbuild_url: .build_script, rebuild}] | .[:100]' "${SYSTMP}/pkgforge/SBUILD_LIST.json")" 65 | ##Validate Input 66 | if ! echo "${BUILD_LIST}" | jq -e 'type == "array" and length > 0' >/dev/null; then 67 | echo -e "\n[-] Input Json is likely Invalid\n" 68 | echo "${BUILD_LIST}" | jq . 69 | exit 1 70 | else 71 | ESCAPED_BUILD_LIST=$(echo "$BUILD_LIST" | jq -c .) 72 | echo "build_list=${ESCAPED_BUILD_LIST}" >> "${GITHUB_OUTPUT}" 73 | fi 74 | continue-on-error: false 75 | 76 | - name: Sanity Check Input JSON 77 | run: | 78 | echo '${{ steps.set-inputs.outputs.build_list }}' | jq . 79 | continue-on-error: true 80 | 81 | trigger-build: 82 | needs: [pre-trigger-build] 83 | runs-on: ubuntu-latest 84 | timeout-minutes: 250 85 | permissions: 86 | actions: write 87 | contents: read 88 | statuses: write 89 | strategy: 90 | fail-fast: false 91 | max-parallel: 20 92 | matrix: 93 | package: ${{ fromJSON(needs.pre-trigger-build.outputs.build_list) }} 94 | steps: 95 | - name: Current Package 96 | run: | 97 | echo '${{ toJSON(matrix.package) }}' | jq -r ' 98 | "Package Family: \(.pkg_family)", 99 | "GHCR URL: \(.ghcr_url)", 100 | "Build URL: \(.sbuild_url)", 101 | "Rebuild: \(.rebuild)" 102 | ' 103 | continue-on-error: true 104 | 105 | - name: Trigger Matrix Builds 106 | if: ${{ toJson(matrix.package) != '{}' }} 107 | env: 108 | GH_TOKEN: "${{ github.token }}" 109 | run: | 110 | ##presets 111 | set +x ; set +e 112 | #-------------# 113 | gh workflow run "matrix_builds.yaml" \ 114 | --repo "${GITHUB_REPOSITORY}" \ 115 | --ref "${GITHUB_REF}" \ 116 | -f ci-infra="github" \ 117 | -f host="ALL" \ 118 | -f sbuild-url="${{ matrix.package.sbuild_url }}" \ 119 | -f ghcr-url="${{ matrix.package.ghcr_url }}" \ 120 | -f pkg-family="${{ matrix.package.pkg_family }}" \ 121 | -f debug="false" \ 122 | -f logs="true" \ 123 | -f rebuild="${{ matrix.package.rebuild }}" 124 | continue-on-error: false -------------------------------------------------------------------------------- /.github/workflows/sync_gh_releases.yaml: -------------------------------------------------------------------------------- 1 | name: ♻️↕️ Sync GH Releases ↕️♻️ 2 | concurrency: 3 | group: "${{ github.workflow }}-${{ github.ref }}" 4 | cancel-in-progress: true 5 | 6 | on: 7 | workflow_dispatch: 8 | schedule: 9 | - cron: "0 */12 * * *" #Every 12 Hrs 10 | jobs: 11 | sync: 12 | runs-on: ${{ matrix.runner }} 13 | timeout-minutes: 30 14 | permissions: 15 | contents: write 16 | packages: write 17 | statuses: read 18 | strategy: 19 | max-parallel: 2 20 | fail-fast: false 21 | matrix: 22 | include: 23 | - runner: "ubuntu-24.04-arm" 24 | repo: "pkgcache" 25 | gh_repo: "https://huggingface.co/datasets/pkgforge/pkgcache" 26 | script: "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/github/sync_releases.sh" 27 | 28 | - runner: "ubuntu-latest" 29 | repo: "pkgcache" 30 | gh_repo: "https://huggingface.co/datasets/pkgforge/pkgcache" 31 | script: "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/github/sync_releases.sh" 32 | 33 | steps: 34 | - name: Install Addons 35 | run: | 36 | #presets 37 | set +x ; set +e 38 | #-------------# 39 | export DEBIAN_FRONTEND="noninteractive" 40 | sudo apt update -y -qq 41 | sudo apt install 7zip b3sum bc coreutils curl dos2unix fdupes jq git git-lfs moreutils wget util-linux -y -qq 42 | sudo apt install 7zip b3sum bc coreutils curl dos2unix fdupes jq git git-lfs moreutils wget util-linux -y -qq 43 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh") 44 | continue-on-error: true 45 | 46 | - name: Setup Env 47 | run: | 48 | #presets 49 | set +x ; set +e 50 | #-------------# 51 | #tmp 52 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 53 | echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" 54 | #-------------# 55 | #Git 56 | sudo apt-get install git-lfs -y -qq 57 | #-------------# 58 | ##User-Agent 59 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 60 | echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" 61 | continue-on-error: true 62 | 63 | - name: Sync Release [${{ matrix.repo }} ==> ${{ matrix.gh_repo }}/releases] 64 | env: 65 | GHCR_TOKEN: "${{ github.token }}" 66 | GITHUB_TOKEN: "${{ github.token }}" 67 | #GITHUB_TOKEN: "${{ secrets.ADM_GHTOKEN }}" 68 | run: | 69 | #Presets 70 | set +x ; set +e 71 | #--------------# 72 | curl -qfsSL "${{ matrix.script }}" -o "./sync.sh" 73 | dos2unix --quiet "./sync.sh" 74 | chmod +x "./sync.sh" 75 | ##To force reupload 76 | #export FORCE_REUPLOAD='YES' 77 | #export PARALLEL_LIMIT="$(($(nproc)+1))" 78 | export PARALLEL_LIMIT="1" 79 | timeout -k 1m 25m bash "./sync.sh" 80 | wait ; echo 81 | continue-on-error: true -------------------------------------------------------------------------------- /.github/workflows/sync_gh_releases_metadata.yaml: -------------------------------------------------------------------------------- 1 | name: ♻️🧬 Sync GH Releases Metadata 🧬♻️ 2 | concurrency: 3 | group: "${{ github.workflow }}-${{ github.ref }}" 4 | cancel-in-progress: true 5 | 6 | on: 7 | workflow_dispatch: 8 | schedule: 9 | - cron: "50 1-23/2 * * *" #Every 110 mins 10 | jobs: 11 | sync: 12 | runs-on: ${{ matrix.runner }} 13 | timeout-minutes: 10 14 | permissions: 15 | contents: write 16 | packages: write 17 | statuses: read 18 | strategy: 19 | #max-parallel: 2 20 | fail-fast: false 21 | matrix: 22 | include: 23 | - runner: "ubuntu-24.04-arm" 24 | repo: "pkgcache" 25 | gh_repo: "https://huggingface.co/datasets/pkgforge/pkgcache" 26 | script: "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/github/sync_releases_metadata.sh" 27 | 28 | - runner: "ubuntu-latest" 29 | repo: "pkgcache" 30 | gh_repo: "https://huggingface.co/datasets/pkgforge/pkgcache" 31 | script: "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/github/sync_releases_metadata.sh" 32 | 33 | steps: 34 | - name: Install Addons 35 | run: | 36 | #presets 37 | set +x ; set +e 38 | #-------------# 39 | export DEBIAN_FRONTEND="noninteractive" 40 | sudo apt update -y -qq 41 | sudo apt install 7zip b3sum bc coreutils curl dos2unix fdupes jq git git-lfs moreutils wget util-linux -y -qq 42 | sudo apt install 7zip b3sum bc coreutils curl dos2unix fdupes jq git git-lfs moreutils wget util-linux -y -qq 43 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_bins_curl.sh") 44 | continue-on-error: true 45 | 46 | - name: Setup Env 47 | run: | 48 | #presets 49 | set +x ; set +e 50 | #-------------# 51 | #tmp 52 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 53 | echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}" 54 | #-------------# 55 | #Git 56 | sudo apt-get install git-lfs -y -qq 57 | #-------------# 58 | ##User-Agent 59 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" && export USER_AGENT="${USER_AGENT}" 60 | echo "USER_AGENT=${USER_AGENT}" >> "${GITHUB_ENV}" 61 | continue-on-error: true 62 | 63 | - name: Sync Release [${{ matrix.repo }} ==> ${{ matrix.gh_repo }}/releases/metadata] 64 | env: 65 | GHCR_TOKEN: "${{ github.token }}" 66 | GITHUB_TOKEN: "${{ github.token }}" 67 | #GITHUB_TOKEN: "${{ secrets.ADM_GHTOKEN }}" 68 | run: | 69 | #Presets 70 | set +x ; set +e 71 | #--------------# 72 | curl -qfsSL "${{ matrix.script }}" -o "./sync.sh" 73 | dos2unix --quiet "./sync.sh" 74 | chmod +x "./sync.sh" 75 | bash "./sync.sh" 76 | continue-on-error: true -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Package Forge 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | [discord-shield]: https://img.shields.io/discord/1313385177703256064?logo=%235865F2&label=Discord 4 | [discord-url]: https://discord.gg/djJUs48Zbu 5 | [stars-shield]: https://img.shields.io/github/stars/pkgforge/pkgcache.svg 6 | [stars-url]: https://github.com/pkgforge/pkgcache/stargazers 7 | [issues-shield]: https://img.shields.io/github/issues/pkgforge/pkgcache.svg 8 | [issues-url]: https://github.com/pkgforge/pkgcache/issues 9 | [license-shield]: https://img.shields.io/github/license/pkgforge/pkgcache.svg 10 | [license-url]: https://github.com/pkgforge/pkgcache/blob/main/LICENSE 11 | [doc-shield]: https://img.shields.io/badge/docs.pkgforge.dev-blue 12 | [doc-url]: https://docs.pkgforge.dev/repositories/pkgcache 13 | 14 | Packages 15 | [![Discord][discord-shield]][discord-url] 16 | [![Documentation][doc-shield]][doc-url] 17 | [![Issues][issues-shield]][issues-url] 18 | [![License: MIT][license-shield]][license-url] 19 | [![Stars][stars-shield]][stars-url] 20 |
21 | 22 |

23 | The Largest Collection of Prebuilt Portable Packages 24 |
25 |

26 | 27 | --- 28 | - This repository [builds, compiles & bundles](https://github.com/pkgforge/pkgcache/actions) [SoarPkgs](https://github.com/pkgforge/soarpkgs/) & provides [PreBuilt Package Cache](https://docs.pkgforge.dev/repositories/pkgcache/cache) for [Soar](https://github.com/pkgforge/soar) 29 | ```bash 30 | . 31 | ├── keys --> Public Keys to verify signed artifacts 32 | ├── scripts --> CI Build Scripts & Misc 33 | └── SBUILD_LIST.json --> Current JSON of all the binaries that are being built 34 | ``` 35 | 36 | > [!WARNING] 37 | > DO NOT use the Issues page to request packages or report broken binaries
38 | > All of those will be auto-closed/moved to: https://github.com/pkgforge/soarpkgs 39 | 40 | > [!NOTE] 41 | > We recommend cloning with [`--filter=blob:none`](https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone/) for local development
42 | > Package Listing & Searching: https://pkgs.pkgforge.dev 43 | 44 | --- 45 | #### Index 46 | - [**📖 Docs & FAQs 📖**](https://docs.pkgforge.dev/repositories/pkgcache) 47 | > - [**`What is this?`**](https://docs.pkgforge.dev/repositories/pkgcache) 48 | > - [**`What are the current Cache Backends`**](https://docs.pkgforge.dev/repositories/pkgcache/cache) 49 | > - [**`Contribution Guidelines`**](https://docs.pkgforge.dev/repositories/pkgcache/contribution) 50 | > - [**`Request a New Package`**](https://docs.pkgforge.dev/repositories/pkgcache/package-request) 51 | > - [**`Differences from Soarpkgs`**](https://docs.pkgforge.dev/repositories/pkgcache/differences) 52 | > - **`Requirements to add a PKG to` [`PkgCache`](https://docs.pkgforge.dev/repositories/pkgcache/package-request)** 53 | > - [**`DMCA/Copyright/PKG Removal`**](https://docs.pkgforge.dev/repositories/soarpkgs/dmca-or-copyright-cease-and-desist) 54 | > - [**`FAQs`**](https://docs.pkgforge.dev/repositories/pkgcache/faq) 55 | > - [**`Security`**](https://docs.pkgforge.dev/repositories/pkgcache/security) 56 | > - [**`Contact Us`**](https://docs.pkgforge.dev/contact/chat) 57 | - [**Community 💬**](https://docs.pkgforge.dev/contact/chat) 58 | > - PkgForge () Discord `➼` [`https://discord.gg/djJUs48Zbu`](https://discord.gg/djJUs48Zbu) 59 | 60 | --- 61 | #### Package Stats 62 | > [!NOTE] 63 | > ℹ️ It is usual for most packages to be outdated since we build most of them from `GIT HEAD`
64 | > 🗄️ Table of Packages & their status: https://github.com/pkgforge/metadata/blob/main/PKG_STATUS.md
65 | > 🗄️ Table of Only Outdated Packages: https://github.com/pkgforge/metadata/blob/main/soarpkgs/data/COMP_VER_CACHE_OLD.md
66 | 67 | | Total Packages 📦 | Updated 🟩 | Outdated 🟥 | Healthy 🟢 | Stale 🔴 | 68 | |----------------|---------|----------|----------|---------| 69 | | [![Packages](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/pkgforge/metadata/refs/heads/main/PKG_STATUS_SUM.json&query=$[1].pkgcache.packages&label=&color=blue&style=flat)](#) | [![Updated](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/pkgforge/metadata/refs/heads/main/PKG_STATUS_SUM.json&query=$[1].pkgcache.updated&label=&color=brightgreen&style=flat)](#) | [![Outdated](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/pkgforge/metadata/refs/heads/main/PKG_STATUS_SUM.json&query=$[1].pkgcache.outdated&label=&color=red&style=flat)](#) | [![Health](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/pkgforge/metadata/refs/heads/main/PKG_STATUS_SUM.json&query=$[1].pkgcache.healthy&label=&suffix=%25&color=green&style=flat)](#) | [![Stale](https://img.shields.io/badge/dynamic/json?url=https://raw.githubusercontent.com/pkgforge/metadata/refs/heads/main/PKG_STATUS_SUM.json&query=$[1].pkgcache.stale&label=&suffix=%25&color=orange&style=flat)](#) | 70 | 71 | --- 72 | #### Repo Analytics 73 | [![Alt](https://repobeats.axiom.co/api/embed/15e78c467d2cc05e919f9663263d914940441733.svg "Repobeats analytics image")](https://github.com/pkgforge/pkgcache/graphs/contributors) 74 | [![Stargazers](https://reporoster.com/stars/dark/pkgforge/pkgcache)](https://github.com/pkgforge/pkgcache/stargazers) 75 | [![Stargazers over time](https://starchart.cc/pkgforge/pkgcache.svg?variant=dark)](https://starchart.cc/pkgforge/pkgcache) 76 | -------------------------------------------------------------------------------- /SBUILD_LIST.diff.dupe: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /SBUILD_LIST.json.dupe: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /keys/minisign.pub: -------------------------------------------------------------------------------- 1 | RWSWp/oBUfND5B2fSmDlYaBXPimGV+r2s9skVRYTQ5cJ+7i6ff/1Nxcr 2 | -------------------------------------------------------------------------------- /scripts/github/sync_releases.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ## 3 | ## Meant to Sync All Packages to https://github.com/pkgforge/pkgcache/releases 4 | ## Self: https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/github/sync_releases.sh 5 | # bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/github/sync_releases.sh") 6 | #-------------------------------------------------------# 7 | 8 | #-------------------------------------------------------# 9 | ##Sanity 10 | if ! command -v gh &> /dev/null; then 11 | echo -e "[-] Failed to find Github CLI (gh)\n" 12 | exit 1 13 | fi 14 | if [ -z "${GITHUB_TOKEN+x}" ] || [ -z "${GITHUB_TOKEN##*[[:space:]]}" ]; then 15 | echo -e "\n[-] FATAL: Failed to Find GITHUB_TOKEN (\${GITHUB_TOKEN}\n" 16 | exit 1 17 | else 18 | ##gh-cli (uses ${GITHUB_TOKEN} env var) 19 | #echo "${GITHUB_TOKEN}" | gh auth login --with-token 20 | gh auth status 21 | fi 22 | ##ENV 23 | export TZ="UTC" 24 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 25 | TMPDIR="$(mktemp -d)" && export TMPDIR="${TMPDIR}" ; echo -e "\n[+] Using TEMP: ${TMPDIR}\n" 26 | if [[ -z "${USER_AGENT}" ]]; then 27 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" 28 | fi 29 | ##Host 30 | HOST_TRIPLET="$(uname -m)-$(uname -s)" 31 | HOST_TRIPLET_L="${HOST_TRIPLET,,}" 32 | export HOST_TRIPLET HOST_TRIPLET_L 33 | ##Metadata 34 | curl -qfsSL "https://meta.pkgforge.dev/pkgcache/${HOST_TRIPLET}.json" -o "${TMPDIR}/METADATA.json" 35 | if [[ "$(jq -r '.[] | .ghcr_pkg' "${TMPDIR}/METADATA.json" | wc -l)" -le 20 ]]; then 36 | echo -e "\n[-] FATAL: Failed to Fetch pkgcache (${HOST_TRIPLET}) Metadata\n" 37 | exit 1 38 | fi 39 | if ! command -v oras &> /dev/null; then 40 | echo -e "[-] Failed to find oras\n" 41 | exit 1 42 | else 43 | oras login --username "Azathothas" --password "${GHCR_TOKEN}" "ghcr.io" 44 | fi 45 | #-------------------------------------------------------# 46 | 47 | #-------------------------------------------------------# 48 | ##Main 49 | sync_to_gh_release() 50 | { 51 | ##Chdir 52 | pushd "${TMPDIR}" >/dev/null 2>&1 53 | ##Enable Debug 54 | if [ "${DEBUG}" = "1" ] || [ "${DEBUG}" = "ON" ]; then 55 | set -x 56 | fi 57 | ##Input 58 | local INPUT="${1:-$(cat)}" 59 | export GHCR_PKG="$(echo ${INPUT} | tr -d '[:space:]')" 60 | export GHCR_PKGNAME="$(echo ${INPUT} | awk -F'[:]' '{print $1}' | tr -d '[:space:]')" 61 | export GHCR_PKGVER="$(echo ${INPUT} | awk -F'[:]' '{print $2}' | tr -d '[:space:]')" 62 | export GHCR_PKGPATH="$(echo ${INPUT} | sed -n 's/.*\/pkgcache\/\(.*\):.*/\1/p' | tr -d '[:space:]')" 63 | export SRC_TAG="${GHCR_PKGPATH}/${GHCR_PKGVER}" 64 | export GH_PKG="https://github.com/pkgforge/pkgcache/releases/tag/${SRC_TAG}" 65 | export PKG_DIR="$(mktemp -d)" 66 | ##Sync 67 | echo -e "\n[+] Syncing ${GHCR_PKGNAME} (${GHCR_PKGVER})\n" 68 | unset GH_PKG_STATUS 69 | GH_PKG_STATUS="$(curl -X "HEAD" -qfsSL "${GH_PKG}" -I | sed -n 's/^[[:space:]]*HTTP\/[0-9.]*[[:space:]]\+\([0-9]\+\).*/\1/p' | tail -n1 | tr -d '[:space:]')" 70 | #if gh release list --repo "https://github.com/pkgforge/pkgcache" --json 'tagName' -q ".[].tagName" | grep -q "${SRC_TAG}"; then 71 | if echo "${GH_PKG_STATUS}" | grep -qi '200$'; then 72 | if [[ "${FORCE_REUPLOAD}" != "YES" ]]; then 73 | echo "[+] Skipping ==> ${GH_PKG} [Exists]" 74 | rm -rf "${PKG_DIR}" 2>/dev/null 75 | unset GHCR_FILE GHCR_FILES GHCR_PKG GHCR_PKGNAME GHCR_PKGVER GHCR_PKGPATH SRC_TAG SRC_RELEASE_BODY 76 | return 0 || exit 0 77 | else 78 | echo "[+] Force Reuploading ==> ${GH_PKG} [Exists]" 79 | gh release delete "${SRC_TAG}" --repo "https://github.com/pkgforge/pkgcache" --cleanup-tag -y 80 | fi 81 | fi 82 | pushd "${PKG_DIR}" >/dev/null 2>&1 && \ 83 | oras pull "${GHCR_PKG}" ; unset GHCR_FILE GHCR_FILES 84 | #Ensure all files were fetched 85 | readarray -t "GHCR_FILES" < <(jq -r --arg GHCR_PKG "${GHCR_PKG}" '.[] | select(.ghcr_pkg == $GHCR_PKG) | .ghcr_files[]' "${TMPDIR}/METADATA.json") 86 | for GHCR_FILE in "${GHCR_FILES[@]}"; do 87 | if [ ! -s "${PKG_DIR}/${GHCR_FILE}" ]; then 88 | echo -e "\n[-] Missing/Empty: ${PKG_DIR}/${GHCR_FILE}\n(Retrying ...)\n" 89 | oras pull "${GHCR_PKG}" 90 | if [ ! -s "${PKG_DIR}/${GHCR_FILE}" ]; then 91 | echo -e "\n[-] FATAL: Failed to Fetch ${PKG_DIR}/${GHCR_FILE}\n" 92 | return 1 93 | fi 94 | fi 95 | done 96 | #Create Release Body 97 | PKG_JSON="$(find "${PKG_DIR}" -type f -iname "*.json" -type f -print0 | xargs -0 realpath | head -n 1)" 98 | jq 'walk(if type == "object" then with_entries(select(.value != null and .value != "" and .value != [] and .value != {})) elif type == "array" then map(select(. != null and . != "" and . != [] and . != {})) else . end)' "${PKG_JSON}" | jq . > "${PKG_JSON}.tmp" 99 | mv -fv "${PKG_JSON}.tmp" "${PKG_JSON}" ; rm -rf "${TMPDIR}/REl_NOTES.txt" 2>/dev/null 100 | echo -e '```yaml' > "${TMPDIR}/REl_NOTES.txt" 101 | yq . "${PKG_JSON}" --output-format='yaml' >> "${TMPDIR}/REl_NOTES.txt" 102 | echo -e '```' >> "${TMPDIR}/REl_NOTES.txt" 103 | #Edit json 104 | find "${PKG_DIR}" -type f -iname "*.json" -type f -print0 | xargs -0 -I "{}" sed -E "s|https://api\.ghcr\.pkgforge\.dev/pkgforge/pkgcache/(.*)\?tag=(.*)\&download=(.*)$|https://github.com/pkgforge/pkgcache/releases/download/\1/\2/\3|g" -i "{}" 105 | #Upload 106 | pushd "${PKG_DIR}" >/dev/null 2>&1 && \ 107 | gh release create "${SRC_TAG}" --repo "https://github.com/pkgforge/pkgcache" --title "${SRC_TAG}" --notes-file "${TMPDIR}/REl_NOTES.txt" --prerelease 108 | find "${PKG_DIR}" -type f -size +3c -print0 | xargs -0 -P "$(($(nproc)+1))" -I '{}' gh release upload "${SRC_TAG}" --repo "https://github.com/pkgforge/pkgcache" '{}' 109 | ( 110 | sleep 10 111 | unset GH_PKG_STATUS 112 | GH_PKG_STATUS="$(curl -X "HEAD" -qfsSL "${GH_PKG}" -I | sed -n 's/^[[:space:]]*HTTP\/[0-9.]*[[:space:]]\+\([0-9]\+\).*/\1/p' | tail -n1 | tr -d '[:space:]')" 113 | if echo "${GH_PKG_STATUS}" | grep -qiv '200$'; then 114 | echo -e "\n[-] FATAL: Failed to Upload ==> ${GH_PKG}\n" 115 | fi 116 | ) & 117 | pushd "${TMPDIR}" >/dev/null 2>&1 118 | ##Cleanup 119 | rm -rf "${PKG_DIR}" "${TMPDIR}/REl_NOTES.txt" 2>/dev/null && popd >/dev/null 2>&1 120 | unset GHCR_FILE GHCR_FILES GHCR_PKG GHCR_PKGNAME GHCR_PKGVER GHCR_PKGPATH GH_PKG GH_PKG_STATUS SRC_TAG SRC_RELEASE_BODY 121 | ##Disable Debug 122 | if [ "${DEBUG}" = "1" ] || [ "${DEBUG}" = "ON" ]; then 123 | set +x 124 | fi 125 | } 126 | export -f sync_to_gh_release 127 | #-------------------------------------------------------# 128 | 129 | #-------------------------------------------------------# 130 | ##Run 131 | pushd "${TMPDIR}" >/dev/null 2>&1 132 | unset GH_PKG_INPUT ; readarray -t "GH_PKG_INPUT" < <(jq -r '.[] | .ghcr_pkg' "${TMPDIR}/METADATA.json" | sort -u) 133 | if [[ -n "${PARALLEL_LIMIT}" ]]; then 134 | printf '%s\n' "${GH_PKG_INPUT[@]}" | xargs -P "${PARALLEL_LIMIT}" -I "{}" bash -c 'sync_to_gh_release "$@"' _ "{}" 135 | else 136 | printf '%s\n' "${GH_PKG_INPUT[@]}" | xargs -P "$(($(nproc)+1))" -I "{}" bash -c 'sync_to_gh_release "$@"' _ "{}" 137 | fi 138 | popd >/dev/null 2>&1 139 | #-------------------------------------------------------# 140 | 141 | #-------------------------------------------------------# 142 | ##Metadata 143 | pushd "${TMPDIR}" >/dev/null 2>&1 144 | curl -qfsSL "https://meta.pkgforge.dev/pkgcache/${HOST_TRIPLET}.json" -o "${TMPDIR}/${HOST_TRIPLET}.json" 145 | if [[ "$(jq -r '.[] | .ghcr_pkg' "${TMPDIR}/${HOST_TRIPLET}.json" | wc -l)" -le 20 ]]; then 146 | echo -e "\n[-] FATAL: Failed to Fetch pkgcache (${HOST_TRIPLET}) Metadata\n" 147 | exit 1 148 | else 149 | sed -E "s|https://api\.ghcr\.pkgforge\.dev/pkgforge/pkgcache/(.*)\?tag=(.*)\&download=(.*)$|https://github.com/pkgforge/pkgcache/releases/download/\1/\2/\3|g" -i "${TMPDIR}/${HOST_TRIPLET}.json" 150 | if [[ "$(jq -r '.[] | .ghcr_pkg' "${TMPDIR}/${HOST_TRIPLET}.json" | wc -l)" -gt 20 ]]; then 151 | #Funcs 152 | generate_checksum() 153 | { 154 | b3sum "$1" | grep -oE '^[a-f0-9]{64}' | tr -d '[:space:]' > "$1.bsum" 155 | } 156 | #To Bita 157 | bita compress --input "${HOST_TRIPLET}.json" --compression "zstd" --compression-level "21" --force-create "${HOST_TRIPLET}.cba" 158 | #To xz 159 | xz -9 -T"$(($(nproc) + 1))" --compress --extreme --keep --force --verbose "${HOST_TRIPLET}.json" ; generate_checksum "${HOST_TRIPLET}.json.xz" 160 | #To Zstd 161 | zstd --ultra -22 --force "${HOST_TRIPLET}.json" -o "${HOST_TRIPLET}.json.zstd" ; generate_checksum "${HOST_TRIPLET}.json.zstd" 162 | #Create & Upload 163 | gh release create "metadata" --repo "https://github.com/pkgforge/pkgcache" --title "metadata" --prerelease 2>/dev/null 164 | find "${TMPDIR}" -maxdepth 1 -type f -iname "*${HOST_TRIPLET}*" -size +3c -print0 | xargs -0 -P "$(($(nproc)+1))" -I '{}' gh release upload "metadata" --repo "https://github.com/pkgforge/pkgcache" '{}' --clobber 165 | fi 166 | fi 167 | popd >/dev/null 2>&1 168 | #-------------------------------------------------------# -------------------------------------------------------------------------------- /scripts/github/sync_releases_metadata.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ## 3 | ## Self: https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/github/sync_releases_metadata.sh 4 | # bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/github/sync_releases_metadata.sh") 5 | #-------------------------------------------------------# 6 | 7 | #-------------------------------------------------------# 8 | ##Sanity 9 | if ! command -v gh &> /dev/null; then 10 | echo -e "[-] Failed to find Github CLI (gh)\n" 11 | exit 1 12 | fi 13 | if [ -z "${GITHUB_TOKEN+x}" ] || [ -z "${GITHUB_TOKEN##*[[:space:]]}" ]; then 14 | echo -e "\n[-] FATAL: Failed to Find GITHUB_TOKEN (\${GITHUB_TOKEN}\n" 15 | exit 1 16 | else 17 | ##gh-cli (uses ${GITHUB_TOKEN} env var) 18 | #echo "${GITHUB_TOKEN}" | gh auth login --with-token 19 | gh auth status 20 | fi 21 | ##ENV 22 | export TZ="UTC" 23 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 24 | TMPDIR="$(mktemp -d)" && export TMPDIR="${TMPDIR}" ; echo -e "\n[+] Using TEMP: ${TMPDIR}\n" 25 | if [[ -z "${USER_AGENT}" ]]; then 26 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" 27 | fi 28 | ##Host 29 | HOST_TRIPLET="$(uname -m)-$(uname -s)" 30 | HOST_TRIPLET_L="${HOST_TRIPLET,,}" 31 | export HOST_TRIPLET HOST_TRIPLET_L 32 | #-------------------------------------------------------# 33 | 34 | #-------------------------------------------------------# 35 | ##Metadata 36 | pushd "${TMPDIR}" >/dev/null 2>&1 37 | curl -qfsSL "https://meta.pkgforge.dev/pkgcache/${HOST_TRIPLET}.json" -o "${TMPDIR}/${HOST_TRIPLET}.json" 38 | if [[ "$(jq -r '.[] | .ghcr_pkg' "${TMPDIR}/${HOST_TRIPLET}.json" | wc -l)" -le 20 ]]; then 39 | echo -e "\n[-] FATAL: Failed to Fetch pkgcache (${HOST_TRIPLET}) Metadata\n" 40 | exit 1 41 | else 42 | sed -E "s|https://api\.ghcr\.pkgforge\.dev/pkgforge/pkgcache/(.*)\?tag=(.*)\&download=(.*)$|https://github.com/pkgforge/pkgcache/releases/download/\1/\2/\3|g" -i "${TMPDIR}/${HOST_TRIPLET}.json" 43 | if [[ "$(jq -r '.[] | .ghcr_pkg' "${TMPDIR}/${HOST_TRIPLET}.json" | wc -l)" -gt 20 ]]; then 44 | #Funcs 45 | generate_checksum() 46 | { 47 | b3sum "$1" | grep -oE '^[a-f0-9]{64}' | tr -d '[:space:]' > "$1.bsum" 48 | } 49 | #To Bita 50 | bita compress --input "${HOST_TRIPLET}.json" --compression "zstd" --compression-level "21" --force-create "${HOST_TRIPLET}.cba" 51 | #To xz 52 | xz -9 -T"$(($(nproc) + 1))" --compress --extreme --keep --force --verbose "${HOST_TRIPLET}.json" ; generate_checksum "${HOST_TRIPLET}.json.xz" 53 | #To Zstd 54 | zstd --ultra -22 --force "${HOST_TRIPLET}.json" -o "${HOST_TRIPLET}.json.zstd" ; generate_checksum "${HOST_TRIPLET}.json.zstd" 55 | #Create & Upload 56 | gh release create "metadata" --repo "https://github.com/pkgforge/pkgcache" --title "metadata" --prerelease 2>/dev/null 57 | find "${TMPDIR}" -maxdepth 1 -type f -iname "*${HOST_TRIPLET}*" -size +3c -print0 | xargs -0 -P "$(($(nproc)+1))" -I '{}' gh release upload "metadata" --repo "https://github.com/pkgforge/pkgcache" '{}' --clobber 58 | fi 59 | fi 60 | popd >/dev/null 2>&1 61 | #-------------------------------------------------------# -------------------------------------------------------------------------------- /scripts/runner/builder.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #-------------------------------------------------------# 4 | ## 5 | ## Meant to Build & Upload All our Packages 6 | ## Self: https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/builder.sh 7 | # bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/builder.sh") 8 | ##Env vars 9 | # (Remote) FORCE_REBUILD_ALL=YES --> Rebuilds everything regardless if prebuilt already exists 10 | # (Local) SBUILD_REBUILD=true --> Rebuilds Local SBUILD regardless if remote prebuilt already exists 11 | # KEEP_LOGS="YES" --> Keep Dirs/Files 12 | #-------------------------------------------------------# 13 | 14 | #-------------------------------------------------------# 15 | sbuild_builder() 16 | { 17 | ##Version 18 | SBB_VERSION="0.1.3" && echo -e "[+] SBUILD Builder Version: ${SBB_VERSION}" ; unset SBB_VERSION 19 | ##Enable Debug 20 | if [ "${DEBUG}" = "1" ] || [ "${DEBUG}" = "ON" ]; then 21 | set -x 22 | fi 23 | ##Get/Set ENVS (from Host) 24 | #User 25 | if [ -z "${USER+x}" ] || [ -z "${USER##*[[:space:]]}" ]; then 26 | case "${USER}" in 27 | "" ) 28 | echo "WARNING: \$USER is Unknown" 29 | USER="$(whoami)" 30 | export USER 31 | if [ -z "${USER}" ]; then 32 | echo -e "[-] INFO: Setting USER --> ${USER}" 33 | else 34 | echo -e "[-] WARNING: FAILED to find \$USER" 35 | fi 36 | ;; 37 | esac 38 | fi 39 | ##ENV:$PATH 40 | HOME="$(getent passwd ${USER} | cut -d: -f6)" && export HOME="${HOME}" 41 | export PATH="${HOME}/.local/share/soar/bin:${HOME}/bin:${HOME}/.cargo/bin:${HOME}/.cargo/env:${HOME}/.config/guix/current/bin/guix:${HOME}/.go/bin:${HOME}/go/bin:${HOME}/.local/bin:${HOME}/miniconda3/bin:${HOME}/miniconda3/condabin:/root/.config/guix/current/bin/guix:/usr/local/zig:/usr/local/zig/lib:/usr/local/zig/lib/include:/usr/local/musl/bin:/usr/local/musl/lib:/usr/local/musl/include:${PATH}" 42 | if command -v awk >/dev/null 2>&1 && command -v sed >/dev/null 2>&1; then 43 | PATH="$(echo "${PATH}" | awk 'BEGIN{RS=":";ORS=":"}{gsub(/\n/,"");if(!a[$0]++)print}' | sed 's/:*$//')" ; export PATH 44 | fi 45 | HOST_TRIPLET="$(uname -m)-$(uname -s)" 46 | PKG_REPO="pkgcache" 47 | if [ -z "${SYSTMP+x}" ] || [ -z "${SYSTMP##*[[:space:]]}" ]; then 48 | SYSTMP="$(dirname $(realpath $(mktemp -u)))" && export SYSTMP="${SYSTMP}" 49 | mkdir -p "${SYSTMP}" 2>/dev/null 50 | fi 51 | OWD_TMPDIR="$(realpath .)" ; export OWD_TMPDIR 52 | TMPDIRS="mktemp -d --tmpdir=${SYSTMP}/pkgforge XXXXXXXXX_SBUILD" 53 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/Azathothas/Wordlists/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" 54 | export HOST_TRIPLET PKG_REPO SYSTMP TMPDIRS USER_AGENT 55 | if [[ "${KEEP_PREVIOUS}" != "YES" ]]; then 56 | rm -rf "${SYSTMP}/pkgforge" 57 | find "${SYSTMP}" -mindepth 1 \( -type f -o -type d \) -empty -not -path "$(pwd)" -not -path "$(pwd)/*" -delete 2>/dev/null 58 | fi 59 | mkdir -p "${SYSTMP}/pkgforge" 60 | if [[ "${INSIDE_PODMAN}" == "TRUE" ]]; then 61 | export GITHUB_ENV="${SYSTMP}/GITHUB_ENV" 62 | touch "${GITHUB_ENV}" 63 | fi 64 | ##Get Initial Inputs 65 | for attempt in {1..4}; do 66 | BUILDSCRIPT="$(mktemp --tmpdir="${SYSTMP}/pkgforge" XXXXXXXXX_build.yaml)" && export BUILDSCRIPT="${BUILDSCRIPT}" && break 67 | echo -e "[-] TMPFILE Creation Failed ($attempt/4) Retrying..." 68 | sleep 1 69 | done 70 | if [[ ! -f "${BUILDSCRIPT}" ]]; then 71 | echo -e "\n[✗] FATAL: Failed to create \$BUILDSCRIPT after 4 Retries\n" 72 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 73 | return 1 || exit 1 74 | fi 75 | INPUT_FILE="${1:-$(echo "$@" | tr -d '[:space:]')}" ; unset INPUT_FILE_REMOTE 76 | if [ -n "${INPUT_FILE+x}" ] && [ -n "${INPUT_FILE##*[[:space:]]}" ]; then 77 | if echo "${INPUT_FILE}" | grep -qE '^https?://'; then 78 | touch "$(realpath .)/SBUILD_INPUT" 79 | curl -w "(SBUILD) <== %{url}\n" -fL "${INPUT_FILE}" -o "$(realpath './SBUILD_INPUT' | tr -d '[:space:]')" 80 | if [[ ! -s "$(realpath './SBUILD_INPUT')" || $(stat -c%s "$(realpath './SBUILD_INPUT')") -le 10 ]]; then 81 | echo -e "\n[✗] FATAL: Failed to Fetch ${INPUT_FILE}\n" 82 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 83 | ( rm "$(realpath './SBUILD_INPUT' )" ) 2>/dev/null 84 | export CONTINUE_SBUILD="NO" 85 | return 1 || exit 1 86 | else 87 | INPUT_FILE_REMOTE="$(echo "${INPUT_FILE}" | tr -d '[:space:]')" ; export INPUT_FILE_REMOTE 88 | INPUT_FILE="$(realpath './SBUILD_INPUT' | tr -d '[:space:]')" ; export INPUT_FILE 89 | SELF_NAME="${ARGV0:-${0##*/}}" ; export SELF_NAME 90 | fi 91 | elif [ ! -f "$(realpath ${INPUT_FILE})" ] || [ ! -s "$(realpath ${INPUT_FILE})" ]; then 92 | echo -e "\n[✗] FATAL: ${INPUT_FILE} is NOT a Valid file\n" 93 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 94 | export CONTINUE_SBUILD="NO" 95 | return 1 || exit 1 96 | else 97 | INPUT_FILE="$(realpath ${INPUT_FILE})" ; export INPUT_FILE 98 | SELF_NAME="${ARGV0:-${0##*/}}" ; export SELF_NAME 99 | fi 100 | else 101 | SELF_NAME="sbuild-builder" ; export SELF_NAME 102 | fi 103 | if [[ -z "${INPUT_FILE}" ]]; then 104 | echo -e "\n[+] Building Everything (Rerun: ${SELF_NAME} /path/to/SBUILD_FILE , if you are building a Single Prog)\n" 105 | else 106 | if [ -f "${INPUT_FILE}" ] && [ -s "${INPUT_FILE}" ]; then 107 | echo -e "\n[+] Building [${INPUT_FILE}] Locally\n" 108 | cp -fv "${INPUT_FILE}" "${BUILDSCRIPT}" 109 | if [[ -s "${BUILDSCRIPT}" && $(stat -c%s "${BUILDSCRIPT}") -gt 10 ]]; then 110 | export LOCAL_SBUILD="YES" 111 | else 112 | echo -e "\n[✗] FATAL: ${INPUT_FILE} is NOT a Valid file\n" 113 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 114 | fi 115 | else 116 | echo -e "\n[✗] FATAL: ${INPUT_FILE} is NOT a file\n" 117 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 118 | export CONTINUE_SBUILD="NO" 119 | return 1 || exit 1 120 | fi 121 | fi 122 | #Clean 123 | unset INPUT_FILE SELF_NAME 124 | #-------------------------------------------------------# 125 | 126 | #-------------------------------------------------------# 127 | ##Init 128 | INITSCRIPT="$(mktemp --tmpdir=${SYSTMP} XXXXXXXXX_init.sh)" && export INITSCRIPT="${INITSCRIPT}" 129 | curl -qfsSL "https://raw.githubusercontent.com/pkgforge/${PKG_REPO}/refs/heads/main/scripts/runner/setup_${HOST_TRIPLET}.sh" -o "${INITSCRIPT}" 130 | chmod +xwr "${INITSCRIPT}" && source "${INITSCRIPT}" 131 | #Check 132 | if [ "${CONTINUE}" != "YES" ]; then 133 | echo -e "\n[✗] Failed To Initialize\n" 134 | exit 1 135 | fi 136 | ##Ulimits 137 | #(-n) Open File Descriptors 138 | echo -e "[+] ulimit -n (open file descriptors) :: [Soft --> $(ulimit -n -S)] [Hard --> $(ulimit -n -H)] [Total --> $(cat '/proc/sys/fs/file-max')]" 139 | ulimit -n "$(ulimit -n -H)" 140 | #Stack Size 141 | ulimit -s unlimited 142 | #-------------------------------------------------------# 143 | 144 | #-------------------------------------------------------# 145 | ##Functions 146 | source <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/${PKG_REPO}/refs/heads/main/scripts/runner/functions.sh") 147 | sanitize_logs() 148 | { 149 | if [[ -s "${TEMP_LOG}" && $(stat -c%s "${TEMP_LOG}") -gt 10 && -n "${LOGPATH}" ]]; then 150 | echo -e "\n[+] Sanitizing $(realpath "${TEMP_LOG}") ==> ${LOGPATH}" 151 | if command -v trufflehog &> /dev/null; then 152 | trufflehog filesystem "${TEMP_LOG}" --no-fail --no-verification --no-update --json 2>/dev/null | jq -r '.Raw' | sed '/{/d' | xargs -I "{}" sh -c 'echo "{}" | tr -d " \t\r\f\v"' | xargs -I "{}" sed "s/{}/ /g" -i "${TEMP_LOG}" 153 | fi 154 | sed -e '/.*github_pat.*/Id' \ 155 | -e '/.*ghp_.*/Id' \ 156 | -e '/.*glpat.*/Id' \ 157 | -e '/.*hf_.*/Id' \ 158 | -e '/.*token.*/Id' \ 159 | -e '/.*AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.*/Id' \ 160 | -e '/.*access_key_id.*/Id' \ 161 | -e '/.*secret_access_key.*/Id' \ 162 | -e '/.*cloudflarestorage.*/Id' -i "${TEMP_LOG}" 163 | #sed '/.*\[+\] Total Size.*/I,$ { /.*\[+\] Total Size.*/I p; d }' -i "${TEMP_LOG}" 164 | sed '/\(LOGPATH\|ENVPATH\)=/d' -i "${TEMP_LOG}" 165 | #grep -viE 'github_pat|ghp_|glpat|hf_|token|access_key_id|secret_access_key|cloudflarestorage' "${TEMP_LOG}" | tee "${LOGPATH}" && rm "${TEMP_LOG}" 2>/dev/null 166 | #mv -fv "${TEMP_LOG}" "${LOGPATH}" && rm "${TEMP_LOG}" 2>/dev/null 167 | echo '\\\\====================== Package Forge ======================////' > "${LOGPATH}" 168 | echo '|--- Repository: https://github.com/pkgforge/soarpkgs ---|' >> "${LOGPATH}" 169 | echo '|--- Web/Search Index: https://pkgs.pkgforge.dev ---|' >> "${LOGPATH}" 170 | echo '|--- Contact: https://docs.pkgforge.dev/contact/chat ---|' >> "${LOGPATH}" 171 | echo '|--- Discord: https://discord.gg/djJUs48Zbu ---|' >> "${LOGPATH}" 172 | echo '|--- Docs: https://docs.pkgforge.dev/repositories/pkgcache ---|' >> "${LOGPATH}" 173 | echo '|--- Bugs/Issues: https://github.com/pkgforge/soarpkgs/issues ---|' >> "${LOGPATH}" 174 | echo '|-----------------------------------------------------------------|' >> "${LOGPATH}" 175 | grep -viE 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA|github_pat|ghp_|glpat|hf_|token|access_key_id|secret_access_key|cloudflarestorage' "${TEMP_LOG}" >> "${LOGPATH}" && rm "${TEMP_LOG}" 2>/dev/null 176 | fi 177 | } 178 | export -f sanitize_logs 179 | #Check 180 | if ! (declare -F setup_env &>/dev/null && \ 181 | declare -F check_sane_env &>/dev/null && \ 182 | declare -F gen_json_from_sbuild &>/dev/null && \ 183 | declare -F build_progs &>/dev/null && \ 184 | declare -F generate_json &>/dev/null && \ 185 | declare -F upload_to_ghcr &>/dev/null && \ 186 | declare -F sanitize_logs &>/dev/null && \ 187 | declare -F cleanup_env &>/dev/null); then 188 | echo -e "\n[✗] FATAL: Required Functions could NOT BE Found\n" 189 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 190 | exit 1 191 | fi 192 | #-------------------------------------------------------# 193 | 194 | #-------------------------------------------------------# 195 | ##Build 196 | rm -rvf "${SYSTMP}/pkgforge/SBUILD_URLS" 2>/dev/null 197 | unset RECIPES 198 | #If local 199 | if [[ "${LOCAL_SBUILD}" == "YES" ]]; then 200 | if echo "${INPUT_FILE_REMOTE}" | grep -qE '^https?://'; then 201 | echo "${INPUT_FILE_REMOTE}" > "${SYSTMP}/pkgforge/SBUILD_URLS" 202 | else 203 | echo "$(realpath ${BUILDSCRIPT})" > "${SYSTMP}/pkgforge/SBUILD_URLS" 204 | fi 205 | else 206 | #Get URlS 207 | if [[ "${EXCLUDE_CACHED}" == "YES" ]]; then 208 | echo -e "[+] Excluding Cached" 209 | curl -w "(Diff) <== %{url}\n" -qfsSL "https://raw.githubusercontent.com/pkgforge/metadata/refs/heads/main/soarpkgs/data/DIFF_${PKG_REPO}_${HOST_TRIPLET}.json" -o "${SYSTMP}/pkgforge/DIFF.json.tmp" 210 | curl -w "(List) <== %{url}\n" -qfsSL "https://raw.githubusercontent.com/pkgforge/${PKG_REPO}/refs/heads/main/SBUILD_LIST.json" -o "${SYSTMP}/pkgforge/SBUILD_LIST.json.tmp" 211 | jq -n --slurpfile a "${SYSTMP}/pkgforge/DIFF.json.tmp" --slurpfile b "${SYSTMP}/pkgforge/SBUILD_LIST.json.tmp" \ 212 | ' 213 | [$b[] | .[] as $objB | 214 | ($a[] | .[] | .build_script | split("/") | .[-3:] | join("/")) as $a_last3 | 215 | ($objB.build_script | split("/") | .[-3:] | join("/")) as $b_last3 | 216 | if $a_last3 == $b_last3 or $objB.rebuild == true then $objB else empty end 217 | ] | unique_by(.ghcr_pkg) | sort_by(.pkg_family) 218 | ' | jq . > "${SYSTMP}/pkgforge/SBUILD_LIST.json" 219 | else 220 | echo -e "[+] Including Cached" 221 | curl -w "(List) <== %{url}\n" -qfsSL "https://raw.githubusercontent.com/pkgforge/${PKG_REPO}/refs/heads/main/SBUILD_LIST.json" -o "${SYSTMP}/pkgforge/SBUILD_LIST.json" 222 | fi 223 | jq -r '.[] | select(._disabled == false) | .build_script' "${SYSTMP}/pkgforge/SBUILD_LIST.json" | sort -u -o "${SYSTMP}/pkgforge/SBUILD_URLS" 224 | sed 's|https://github.com/pkgforge/soarpkgs/blob/main/packages|https://raw.githubusercontent.com/pkgforge/soarpkgs/refs/heads/main/packages|g' -i "${SYSTMP}/pkgforge/SBUILD_URLS" 225 | fi 226 | #Build 227 | i=0; until pushd "$(${TMPDIRS})" >/dev/null 2>&1 || [ $((i+=1)) -gt 3 ]; do :; done 228 | echo -e "\n==> [+] Started Building at :: $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)') UTC\n" 229 | sort -u "${SYSTMP}/pkgforge/SBUILD_URLS" -o"${SYSTMP}/pkgforge/SBUILD_URLS" 230 | readarray -t RECIPES < "${SYSTMP}/pkgforge/SBUILD_URLS" 231 | TOTAL_RECIPES="${#RECIPES[@]}" && export TOTAL_RECIPES="${TOTAL_RECIPES}" 232 | echo -e "\n[+] Total RECIPES :: ${TOTAL_RECIPES}\n" 233 | for ((i=0; i<${#RECIPES[@]}; i++)); do 234 | pushd "$(${TMPDIRS})" >/dev/null 2>&1 || sleep 2 && pushd "$(${TMPDIRS})" >/dev/null 2>&1 235 | OCWD="$(realpath .)" ; export OCWD 236 | rm "${OCWD}/ENVPATH" 2>/dev/null 237 | if [[ "${LOCAL_SBUILD}" == "YES" ]] && [[ "${SBUILD_REBUILD}" != "false" ]]; then 238 | export SBUILD_REBUILD="true" 239 | elif [[ "${LOCAL_SBUILD}" == "YES" ]] && [[ "${SBUILD_REBUILD}" == "false" ]]; then 240 | export SBUILD_REBUILD="false" 241 | else 242 | unset SBUILD_REBUILD 243 | fi 244 | unset CONTINUE_SBUILD GHCRPKG LOGPATH PKG_FAMILY PUSH_SUCCESSFUL RECIPE SBUILD_PKG SBUILD_SCRIPT SBUILD_SCRIPT_BLOB SBUILD_SKIPPED SBUILD_SUCCESSFUL 245 | if [[ "${KEEP_LOGS}" != "YES" ]]; then 246 | unset KEEP_LOGS 247 | fi 248 | TEMP_LOG="./BUILD.log" 249 | #Init 250 | START_TIME="$(date +%s)" && export START_TIME="${START_TIME}" 251 | RECIPE="${RECIPES[i]}" ; export RECIPE 252 | CURRENT_RECIPE=$((i+1)) 253 | echo -e "\n[+] Fetching : ${RECIPE} (${CURRENT_RECIPE}/${TOTAL_RECIPES})\n" 254 | #Fetch 255 | if echo "${RECIPE}" | grep -E -q '^https?://'; then 256 | if curl -qfsSL "${RECIPE}" -o "${BUILDSCRIPT}"; then 257 | echo -e "==> ${RECIPE}" 258 | chmod -v +xwr "${BUILDSCRIPT}" 259 | else 260 | echo -e "\n[✗] FATAL: Failed to fetch Remote SBUILD [${RECIPE}]\n" 261 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 262 | export CONTINUE_SBUILD="NO" 263 | return 1 || exit 1 264 | fi 265 | elif [ -s "${BUILDSCRIPT}" ]; then 266 | realpath "${BUILDSCRIPT}" 267 | fi 268 | #Run 269 | if [[ -s "${BUILDSCRIPT}" && $(stat -c%s "${BUILDSCRIPT}") -gt 10 ]]; then 270 | SBUILD_SCRIPT="${RECIPE}" && export SBUILD_SCRIPT 271 | SBUILD_SCRIPT_BLOB="$(echo "${SBUILD_SCRIPT}" | sed -E 's/raw.githubusercontent.com/github.com/; s/refs\/heads/blob/' | tr -d '[:space:]')" ; export SBUILD_SCRIPT_BLOB 272 | if [[ "${LOCAL_SBUILD}" == "YES" ]]; then 273 | if [ -n "${GHCRPKG_LOCAL+x}" ] && [ -n "${GHCRPKG_LOCAL##*[[:space:]]}" ]; then 274 | GHCRPKG="${GHCRPKG_LOCAL}" ; unset GHCRPKG_LOCAL ; export GHCRPKG 275 | echo "[+] Setting '.ghcr_pkg' --> ${GHCRPKG} [Provided]" 276 | fi 277 | if [ -n "${PKG_FAMILY_LOCAL+x}" ] && [ -n "${PKG_FAMILY_LOCAL##*[[:space:]]}" ]; then 278 | PKG_FAMILY="${PKG_FAMILY_LOCAL}" ; unset PKG_FAMILY_LOCAL ; export PKG_FAMILY 279 | echo "[+] Setting '.pkg_family' --> ${PKG_FAMILY} [Provided]" 280 | else 281 | PKG_FAMILY="$(yq eval '.pkg' "${BUILDSCRIPT}" | tr -d '[:space:]')" ; export PKG_FAMILY 282 | echo "[+] Setting '.pkg_family' --> ${PKG_FAMILY} [Guessed]" 283 | fi 284 | unset LOCAL_SBUILD 285 | elif [[ -s "${SYSTMP}/pkgforge/SBUILD_LIST.json" && $(stat -c%s "${SYSTMP}/pkgforge/SBUILD_LIST.json") -gt 10 ]]; then 286 | GHCRPKG="$(jq -r '.[] | select(.build_script == env.SBUILD_SCRIPT) | .ghcr_pkg' "${SYSTMP}/pkgforge/SBUILD_LIST.json" | tr -d '[:space:]')" && export GHCRPKG 287 | PKG_FAMILY="$(jq -r '.[] | select(.build_script == env.SBUILD_SCRIPT) | .pkg_family' "${SYSTMP}/pkgforge/SBUILD_LIST.json" | tr -d '[:space:]')" && export PKG_FAMILY 288 | SBUILD_REBUILD="$(jq -r '.[] | select(.build_script == env.SBUILD_SCRIPT) | .rebuild' "${SYSTMP}/pkgforge/SBUILD_LIST.json" | tr -d '[:space:]')" && export SBUILD_REBUILD 289 | else 290 | echo -e "\n[✗] FATAL: No Local SBUILD was Supplied & Remote ${SYSTMP}/pkgforge/SBUILD_LIST.json Does Not Exist\n" 291 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 292 | export CONTINUE_SBUILD="NO" 293 | return 1 || exit 1 294 | fi 295 | #Main 296 | { 297 | setup_env "${BUILDSCRIPT}" 298 | check_sane_env 299 | gen_json_from_sbuild 300 | build_progs 301 | if [ -d "${SBUILD_OUTDIR}" ] && [ "$(du -s "${SBUILD_OUTDIR}" | cut -f1)" -gt 10 ]; then 302 | generate_json 303 | elif [[ "${SBUILD_SKIPPED}" != "YES" ]]; then 304 | echo -e "\n[✗] FATAL: Build Dir [${BUILD_DIR}/SBUILD_OUTDIR] seems Broken\n" 305 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 306 | if [[ "${KEEP_LOGS}" != "YES" ]]; then 307 | echo 'KEEP_LOGS="YES"' >> "${OCWD}/ENVPATH" 308 | fi 309 | fi 310 | #} 2>&1 | ts '[%Y-%m-%dT%Hh%Mm%Ss]➜ ' | tee "${TEMP_LOG}" 311 | } 2>&1 | ts -s '[%H:%M:%S]➜ ' | tee "${TEMP_LOG}" 312 | #Common No-Nos 313 | if grep -m1 -Eqi "wrappe.*version.*available.*required" "${TEMP_LOG}" &>/dev/null; then 314 | echo -e "\n[✗] FATAL: Found Potential Outlier in Logs\n" 315 | grep -Ei "wrappe.*version.*available.*required" "${TEMP_LOG}" 316 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "GHA_BUILD_FAILED=YES" >> "${GITHUB_ENV}" 317 | exit 1 318 | fi 319 | #Dirs 320 | if [ -d "${OCWD}" ]; then 321 | source "${OCWD}/ENVPATH" ; SBUILD_PKGS=($SBUILD_PKGS) 322 | if [[ "${SBUILD_SUCCESSFUL}" == "YES" ]]; then 323 | sanitize_logs 324 | #2000req/min 325 | printf '%s\n' "${SBUILD_PKGS[@]}" | xargs -P "$(($(nproc)+1))" -I "{}" bash -c 'upload_to_ghcr "$@" ; sleep "1.$(((RANDOM % 900) + 100))"' _ "{}" 326 | source "${OCWD}/ENVPATH" 327 | if [[ "${PUSH_SUCCESSFUL}" != "YES" ]]; then 328 | echo -e "\n[✗] FATAL: Failed to Push Artifacts ==> [${GHCRPKG}]" 329 | [[ "${GHA_MODE}" == "MATRIX" ]] && echo "PUSH_SUCCESSFUL=NO" >> "${GITHUB_ENV}" 330 | echo -e "[+] LOGS (Build Dir): ${BUILD_DIR}/SBUILD_OUTDIR\n" 331 | if [[ "${KEEP_LOGS}" != "YES" ]]; then 332 | export KEEP_LOGS="YES" 333 | fi 334 | fi 335 | fi 336 | fi 337 | fi 338 | if [[ "${KEEP_LOGS}" != "YES" ]]; then 339 | rm -rf "${BUILDSCRIPT}" "$(realpath .)" && popd >/dev/null 2>&1 ; cleanup_env 340 | else 341 | popd >/dev/null 2>&1 ; cleanup_env 342 | fi 343 | END_TIME="$(date +%s)" && export END_TIME="${END_TIME}" 344 | ELAPSED_TIME="$(date -u -d@"$((END_TIME - START_TIME))" "+%H(Hr):%M(Min):%S(Sec)")" 345 | echo -e "\n[+] Completed (Building|Fetching) ${RECIPE} :: ${ELAPSED_TIME}\n" 346 | done 347 | echo -e "\n==> [+] Finished Building at :: $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)') UTC\n" 348 | popd >/dev/null 2>&1 349 | unset CONTINUE_SBUILD GHCRPKG LOGPATH PKG_FAMILY PUSH_SUCCESSFUL RECIPE SBUILD_PKG SBUILD_SCRIPT SBUILD_SCRIPT_BLOB SBUILD_SKIPPED SBUILD_SUCCESSFUL 350 | cd "${OWD_TMPDIR}" ; unset OWD_TMPDIR 351 | ##Finish 352 | #Disable Debug 353 | if [ "${DEBUG}" = "1" ] || [ "${DEBUG}" = "ON" ]; then 354 | set +x 355 | fi 356 | } 357 | export -f sbuild_builder 358 | alias sbuild-builder="sbuild_builder" 359 | #Call func directly if not being sourced 360 | if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then 361 | sbuild_builder "$@" <&0 362 | fi 363 | #-------------------------------------------------------# -------------------------------------------------------------------------------- /scripts/runner/setup_aarch64-Linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # VERSION=0.0.1 4 | #-------------------------------------------------------# 5 | ## 6 | ## Meant to Setup Build Machine 7 | ## Self: https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/setup_aarch64-Linux.sh 8 | # bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/setup_$(uname -m)-$(uname -s).sh") 9 | ###-----------------------------------------------------### 10 | ### Setups Essential Tools & Preps Sys Environ for Deps ### 11 | ### This Script must be run as `root` (passwordless) ### 12 | ### Assumptions: Arch: AMD_64 | OS: Debian 64bit ### 13 | ###-----------------------------------------------------### 14 | 15 | #-------------------------------------------------------# 16 | ##ENV 17 | if [ -z "${SYSTMP+x}" ] || [ -z "${SYSTMP##*[[:space:]]}" ]; then 18 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 19 | fi 20 | USER="$(whoami)" && export USER="${USER}" 21 | HOME="$(getent passwd ${USER} | cut -d: -f6)" && export HOME="${HOME}" 22 | if command -v awk >/dev/null 2>&1 && command -v sed >/dev/null 2>&1; then 23 | PATH="$(echo "${PATH}" | awk 'BEGIN{RS=":";ORS=":"}{gsub(/\n/,"");if(!a[$0]++)print}' | sed 's/:*$//')" ; export PATH 24 | fi 25 | #-------------------------------------------------------# 26 | ##Sanity Checks 27 | ##Check if it was recently initialized 28 | # +360 --> 06 Hrs 29 | # +720 --> 12 HRs 30 | # +1440 --> 24 HRs 31 | find "${SYSTMP}/INITIALIZED" -type f -mmin +720 -exec rm -rvf "{}" \; 2>/dev/null 32 | if [ -s "${SYSTMP}/INITIALIZED" ]; then 33 | echo -e "\n[+] Recently Initialized... (Skipping!)\n" 34 | export CONTINUE="YES" 35 | return 0 || exit 0 36 | else 37 | ##Sane Configs 38 | #In case of removed/privated GH repos 39 | # https://git-scm.com/docs/git#Documentation/git.txt-codeGITTERMINALPROMPTcode 40 | export GIT_TERMINAL_PROMPT="0" 41 | #https://git-scm.com/docs/git#Documentation/git.txt-codeGITASKPASScode 42 | export GIT_ASKPASS="/bin/echo" 43 | #Eget 44 | EGET_TIMEOUT="timeout -k 1m 2m" && export EGET_TIMEOUT="${EGET_TIMEOUT}" 45 | ##Check for apt 46 | if ! command -v apt &> /dev/null; then 47 | echo -e "\n[-] apt NOT Found" 48 | echo -e "\n[+] Maybe not on Debian (Debian Based Distro) ?\n" 49 | #Fail & exit 50 | export CONTINUE="NO" 51 | return 1 || exit 1 52 | else 53 | #Export as noninteractive 54 | export DEBIAN_FRONTEND="noninteractive" 55 | export CONTINUE="YES" 56 | fi 57 | ##Check for sudo 58 | if [ "${CONTINUE}" == "YES" ]; then 59 | if ! command -v sudo &> /dev/null; then 60 | echo -e "\n[-] sudo NOT Installed" 61 | echo -e "\n[+] Trying to Install\n" 62 | #Try to install 63 | apt-get update -y 2>/dev/null ; apt-get dist-upgrade -y 2>/dev/null ; apt-get upgrade -y 2>/dev/null 64 | apt install sudo -y 2>/dev/null 65 | #Fail if it didn't work 66 | if ! command -v sudo &> /dev/null; then 67 | echo -e "[-] Failed to Install sudo (Maybe NOT root || NOT enough perms)\n" 68 | #exit 69 | export CONTINUE="NO" 70 | return 1 || exit 1 71 | fi 72 | fi 73 | fi 74 | ##Check for passwordless sudo 75 | if [ "${CONTINUE}" == "YES" ]; then 76 | if sudo -n true 2>/dev/null; then 77 | echo -e "\n[+] Passwordless sudo is Configured" 78 | sudo grep -E '^\s*[^#]*\s+ALL\s*=\s*\(\s*ALL\s*\)\s+NOPASSWD:' "/etc/sudoers" 2>/dev/null 79 | else 80 | echo -e "\n[-] Passwordless sudo is NOT Configured" 81 | echo -e "\n[-] READ: https://web.archive.org/web/20230614212916/https://linuxhint.com/setup-sudo-no-password-linux/\n" 82 | #exit 83 | export CONTINUE="NO" 84 | return 1 || exit 1 85 | fi 86 | fi 87 | ##Install Needed CMDs 88 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Linux/install_bins_curl.sh") 89 | #Appimage tools 90 | sudo curl -qfsSL "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" -o "/usr/local/bin/appimagetool" && sudo chmod -v 'a+x' "/usr/local/bin/appimagetool" 91 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/dwarfs-tools" -o "/usr/local/bin/dwarfs-tools" && sudo chmod -v +x "/usr/local/bin/dwarfs-tools" 92 | sudo ln -fsv "/usr/local/bin/dwarfs-tools" "/usr/local/bin/dwarfs" 93 | sudo ln -fsv "/usr/local/bin/dwarfs-tools" "/usr/local/bin/dwarfsck" 94 | sudo ln -fsv "/usr/local/bin/dwarfs-tools" "/usr/local/bin/dwarfsextract" 95 | sudo ln -fsv "/usr/local/bin/dwarfs-tools" "/usr/local/bin/mkdwarfs" 96 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/unsquashfs" -o "/usr/local/bin/unsquashfs" && sudo chmod -v +x "/usr/local/bin/unsquashfs" 97 | ##Check Needed CMDs 98 | for DEP_CMD in appimagetool dwarfs dwarfsck dwarfsextract eget gh glab mkdwarfs minisign oras rclone shellcheck soar unsquashfs zstd; do 99 | case "$(command -v "${DEP_CMD}" 2>/dev/null)" in 100 | "") echo -e "\n[✗] FATAL: ${DEP_CMD} is NOT INSTALLED\n" 101 | export CONTINUE="NO" 102 | return 1 || exit 1 ;; 103 | esac 104 | done 105 | ##Install Builder + Linter 106 | sudo curl -qfsSL "https://github.com/pkgforge/sbuilder/releases/download/nightly-sbuild/sbuild-$(uname -m)-linux" -o "/usr/local/bin/sbuild" ||\ 107 | sudo curl -qfsSL "https://api.gh.pkgforge.dev/repos/pkgforge/sbuilder/releases?per_page=100" | jq -r '.. | objects | .browser_download_url? // empty' | grep -Ei "$(uname -m)" | grep -Eiv "tar\.gz|\.b3sum" | grep -Eiv "sbuild-linter" | sort --version-sort | tail -n 1 | tr -d '[:space:]' | xargs -I "{}" sudo curl -qfsSL "{}" -o "/usr/local/bin/sbuild" 108 | sudo chmod -v +x "/usr/local/bin/sbuild" 109 | if ! command -v sbuild &> /dev/null; then 110 | echo -e "\n[-] sbuild NOT Found\n" 111 | export CONTINUE="NO" 112 | return 1 || exit 1 113 | else 114 | sbuild --help 115 | fi 116 | sudo curl -qfsSL "https://api.gh.pkgforge.dev/repos/pkgforge/sbuilder/releases?per_page=100" | jq -r '.. | objects | .browser_download_url? // empty' | grep -Ei "$(uname -m)" | grep -Eiv "tar\.gz|\.b3sum" | grep -Ei "sbuild-linter" | sort --version-sort | tail -n 1 | tr -d '[:space:]' | xargs -I "{}" sudo curl -qfsSL "{}" -o "/usr/local/bin/sbuild-linter" 117 | sudo chmod -v +x "/usr/local/bin/sbuild-linter" 118 | if ! command -v sbuild-linter &> /dev/null; then 119 | echo -e "\n[-] sbuild NOT Found\n" 120 | export CONTINUE="NO" 121 | return 1 || exit 1 122 | else 123 | sbuild-linter --help 124 | fi 125 | ##Check for GITHUB_TOKEN 126 | if [ -n "${GITHUB_TOKEN+x}" ] && [ -n "${GITHUB_TOKEN##*[[:space:]]}" ]; then 127 | echo -e "\n[+] GITHUB_TOKEN is Exported" 128 | ##gh-cli (uses ${GITHUB_TOKEN} env var) 129 | #echo "${GITHUB_TOKEN}" | gh auth login --with-token 130 | gh auth status 131 | ##eget 132 | #5000 req/minute (80 req/minute) 133 | eget --rate 134 | else 135 | #60 req/hr 136 | echo -e "\n[-] GITHUB_TOKEN is NOT Exported" 137 | echo -e "Export it to avoid ratelimits\n" 138 | eget --rate 139 | export CONTINUE="NO" 140 | return 1 || exit 1 141 | fi 142 | ##Check for GHCR_TOKEN 143 | if [ -n "${GHCR_TOKEN+x}" ] && [ -n "${GHCR_TOKEN##*[[:space:]]}" ]; then 144 | echo -e "\n[+] GHCR_TOKEN is Exported" 145 | #echo "${GHCR_TOKEN}" | oras login --username "Azathothas" --password-stdin "ghcr.io" 146 | oras login --username "Azathothas" --password "${GHCR_TOKEN}" "ghcr.io" 147 | else 148 | echo -e "\n[-] GHCR_TOKEN is NOT Exported" 149 | echo -e "Export it to avoid ghcr\n" 150 | export CONTINUE="NO" 151 | return 1 || exit 1 152 | fi 153 | ##Check for Gitlab Token 154 | if [ -n "${GITLAB_TOKEN+x}" ] && [ -n "${GITLAB_TOKEN##*[[:space:]]}" ]; then 155 | echo -e "\n[+] GITLAB is Exported" 156 | glab auth status 157 | else 158 | echo -e "\n[-] GITLAB_TOKEN is NOT Exported" 159 | echo -e "Export it to avoid ratelimits\n" 160 | export CONTINUE="NO" 161 | return 1 || exit 1 162 | fi 163 | ##Check for Minisign 164 | if [[ ! -s "${HOME}/.minisign/pkgforge.key" || $(stat -c%s "${HOME}/.minisign/pkgforge.key") -le 10 ]]; then 165 | if [ -n "${MINISIGN_KEY+x}" ] && [ -n "${MINISIGN_KEY##*[[:space:]]}" ]; then 166 | mkdir -pv "${HOME}/.minisign" && \ 167 | echo 'pkgforge-minisign: minisign encrypted secret key' > "${HOME}/.minisign/pkgforge.key" &&\ 168 | echo "${MINISIGN_KEY}" >> "${HOME}/.minisign/pkgforge.key" 169 | #https://github.com/pkgforge/.github/blob/main/keys/minisign.pub 170 | export MINISIGN_PUB_KEY='RWSWp/oBUfND5B2fSmDlYaBXPimGV+r2s9skVRYTQ5cJ+7i6ff/1Nxcr' 171 | else 172 | echo -e "\n[-] MINISIGN_KEY is NOT Exported" 173 | echo -e "Export it to Use minisign (Signing)\n" 174 | export CONTINUE="NO" 175 | return 1 || exit 1 176 | fi 177 | else 178 | export MINISIGN_PUB_KEY='RWSWp/oBUfND5B2fSmDlYaBXPimGV+r2s9skVRYTQ5cJ+7i6ff/1Nxcr' 179 | fi 180 | fi 181 | #-------------------------------------------------------# 182 | 183 | 184 | #-------------------------------------------------------# 185 | ##Main 186 | pushd "$(mktemp -d)" >/dev/null 2>&1 187 | echo -e "\n\n [+] Started Initializing $(uname -mnrs) :: at $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n" 188 | echo -e "[+] USER = ${USER}" 189 | echo -e "[+] HOME = ${HOME}" 190 | echo -e "[+] PATH = ${PATH}\n" 191 | ## If On Github Actions, remove bloat to get space (~ 30 GB) [DANGEROUS] 192 | if [ "${CONTINUE}" == "YES" ]; then 193 | if [ "${USER}" = "runner" ] || [ "$(whoami)" = "runner" ] && [ -s "/opt/runner/provisioner" ]; then 194 | ##Debloat: https://github.com/pkgforge/devscripts/blob/main/Github/Runners/debloat_ubuntu.sh 195 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Github/Runners/debloat_ubuntu.sh") 196 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Github/Runners/debloat_ubuntu.sh") 2>/dev/null 197 | fi 198 | #----------------------# 199 | ##Install CoreUtils & Deps 200 | #----------------------# 201 | sudo apt-get update -y 2>/dev/null 202 | sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils gnupg2 moreutils software-properties-common util-linux -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null 203 | #Install Build Des 204 | sudo apt-get install aria2 automake bc binutils b3sum build-essential ca-certificates ccache diffutils dos2unix gawk git-lfs imagemagick lzip jq libtool libtool-bin make musl musl-dev musl-tools p7zip-full rsync texinfo wget -y 2>/dev/null 205 | sudo apt-get install -y --no-install-recommends autoconf automake autopoint binutils bison build-essential byacc ca-certificates clang flex file jq libtool libtool-bin patch patchelf pkg-config qemu-user-static scons tree wget 2>/dev/null 206 | sudo apt-get install devscripts -y --no-install-recommends 2>/dev/null 207 | sudo apt-get install cmake -y 208 | #Re 209 | sudo apt-get install aria2 automake bc binutils b3sum build-essential ca-certificates ccache diffutils dos2unix gawk git-lfs imagemagick lzip jq libtool libtool-bin make musl musl-dev musl-tools p7zip-full rsync texinfo wget -y 2>/dev/null 210 | sudo apt-get install -y --no-install-recommends autoconf automake autopoint binutils bison build-essential byacc ca-certificates clang flex file jq libtool libtool-bin patch patchelf pkg-config qemu-user-static scons tree wget 2>/dev/null 211 | sudo apt-get install devscripts -y --no-install-recommends 2>/dev/null 212 | sudo apt-get install cmake -y 213 | #Install Build Dependencies (arm64) 214 | sudo apt install binutils-aarch64-linux-gnu -y 2>/dev/null 215 | sudo apt-get install "g++-arm-linux-gnueabi" "g++-arm-linux-gnueabihf" "g++-aarch64-linux-gnu" qemu-user-static -y 2>/dev/null 216 | #libpcap 217 | sudo apt install libpcap-dev pcaputils -y 2>/dev/null 218 | #libsqlite3 219 | sudo apt-get install libsqlite3-dev sqlite3 sqlite3-pcre sqlite3-tools -y 2>/dev/null 220 | #lzma 221 | sudo apt-get install liblz-dev librust-lzma-sys-dev lzma lzma-dev -y 222 | #Networking 223 | sudo apt-get install dnsutils 'inetutils*' net-tools netcat-traditional -y 2>/dev/null 224 | sudo apt-get install 'iputils*' -y 2>/dev/null 225 | sudo setcap cap_net_raw+ep "$(which ping)" 2>/dev/null 226 | #python 227 | sudo apt install python3-pip python3-venv -y 2>/dev/null 228 | #Upgrade pip 229 | pip --version 230 | pip install --break-system-packages --upgrade pip || pip install --upgrade pip 231 | pip --version 232 | #Deps 233 | sudo apt install lm-sensors pciutils procps python3-distro python3-netifaces sysfsutils virt-what -y 2>/dev/null 234 | sudo apt-get install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev scons xcb -y 2>/dev/null 235 | pip install build cffi scons scuba pytest --upgrade --force 2>/dev/null ; pip install ansi2txt pipx scons py2static typer --upgrade --force 2>/dev/null 236 | pip install build cffi scons scuba pytest --break-system-packages --upgrade --force 2>/dev/null ; pip install ansi2txt pipx scons py2static typer --break-system-packages --upgrade --force 2>/dev/null 237 | #pyinstaller 238 | pip install "git+https://github.com/pyinstaller/pyinstaller" --break-system-packages --force-reinstall --upgrade ; pyinstaller --version 239 | #----------------------# 240 | ##Langs 241 | #----------------------# 242 | #Docker 243 | install_docker () 244 | { 245 | #Install 246 | curl -qfsSL "https://get.docker.com" | sed 's/sleep 20//g' | sudo bash 247 | sudo groupadd docker 2>/dev/null ; sudo usermod -aG docker "${USER}" 2>/dev/null 248 | sudo service docker restart 2>/dev/null && sleep 10 249 | sudo service docker status 2>/dev/null 250 | sudo systemctl status "docker.service" --no-pager 251 | #Test 252 | if ! command -v docker &> /dev/null; then 253 | echo -e "\n[-] docker NOT Found\n" 254 | export CONTINUE="NO" 255 | return 1 || exit 1 256 | else 257 | if ! sudo systemctl is-active --quiet docker; then 258 | sudo service docker restart >/dev/null 2>&1 ; sleep 10 259 | fi 260 | sudo systemctl status "docker.service" --no-pager 261 | docker --version ; sudo docker run hello-world 262 | sudo ldconfig && sudo ldconfig -p 263 | #newgrp 2>/dev/null 264 | fi 265 | } 266 | export -f install_docker 267 | if command -v docker &> /dev/null; then 268 | if [ "$(curl -qfsSL "https://endoflife.date/api/docker-engine.json" | jq -r '.[0].latest')" != "$(docker --version | grep -oP '(?<=version )(\d+\.\d+\.\d+)')" ]; then 269 | install_docker 270 | else 271 | echo -e "\n[+] Latest Docker seems to be already Installed" 272 | docker --version 273 | if ! sudo systemctl is-active --quiet docker; then 274 | sudo service docker restart >/dev/null 2>&1 ; sleep 10 275 | fi 276 | sudo systemctl status "docker.service" --no-pager 277 | fi 278 | else 279 | install_docker 280 | fi 281 | #----------------------# 282 | #Crystal 283 | curl -qfsSL "https://crystal-lang.org/install.sh" | sudo bash 284 | #Test 285 | if ! command -v crystal &> /dev/null; then 286 | echo -e "\n[-] crystal NOT Found\n" 287 | #export CONTINUE="NO" 288 | #return 1 || exit 1 289 | else 290 | crystal --version ; shards --version 291 | sudo ldconfig && sudo ldconfig -p 292 | fi 293 | #----------------------# 294 | #Dockerc 295 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/dockerc" -o "/usr/local/bin/dockerc" && sudo chmod +x "/usr/local/bin/dockerc" 296 | #----------------------# 297 | ##Install golang 298 | echo "yes" | bash <(curl -qfsSL "https://git.io/go-installer") 299 | #Test 300 | if ! command -v go &> /dev/null; then 301 | echo -e "\n[-] go NOT Found\n" 302 | export CONTINUE="NO" 303 | return 1 || exit 1 304 | else 305 | go version 306 | sudo ldconfig && sudo ldconfig -p 307 | fi 308 | #----------------------# 309 | ###Install Guix: https://guix.gnu.org/manual/en/html_node/Installation.html 310 | # curl -qfsSL "https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh" -o "./guix-install.sh" 311 | # if [[ ! -s "./guix-install.sh" || $(stat -c%s "./guix-install.sh") -le 10 ]]; then 312 | # curl -qfsSL "https://raw.githubusercontent.com/Millak/guix/refs/heads/master/etc/guix-install.sh" -o "./guix-install.sh" 313 | # fi 314 | # chmod +x "./guix-install.sh" && yes '' | sudo "./guix-install.sh" --uninstall 2>/dev/null 315 | # yes '' | sudo "./guix-install.sh" 316 | # #Test 317 | # if ! command -v guix &> /dev/null; then 318 | # echo -e "\n[-] guix NOT Found\n" 319 | # export CONTINUE="NO" 320 | # return 1 || exit 1 321 | # else 322 | # yes '' | guix install glibc-locales 323 | # export GUIX_LOCPATH="${HOME}/.guix-profile/lib/locale" 324 | # curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/nonguix.channels.scm" | sudo tee "/root/.config/guix/channels.scm" 325 | # GUIX_GIT_REPO="https://git.savannah.gnu.org/git/guix.git" 326 | # ##mirror 327 | # #GUIX_GIT_REPO="https://github.com/Millak/guix" 328 | # GUIX_LATEST_SHA="$(git ls-remote "${GUIX_GIT_REPO}" 'HEAD' | grep -w 'HEAD' | head -n 1 | awk '{print $1}' | tr -d '[:space:]')" 329 | # GIT_CONFIG_PARAMETERS="'filter.blob:none.enabled=true'" guix pull --url="${GUIX_GIT_REPO}" --commit="${GUIX_LATEST_SHA}" --cores="$(($(nproc)+1))" --max-jobs="2" --disable-authentication & 330 | # sudo GIT_CONFIG_PARAMETERS="'filter.blob:none.enabled=true'" guix pull --url="${GUIX_GIT_REPO}" --commit="${GUIX_LATEST_SHA}" --cores="$(($(nproc)+1))" --max-jobs="2" --disable-authentication & 331 | # wait ; guix --version 332 | # fi 333 | #------------------------------# 334 | ##Install Meson & Ninja 335 | #Install 336 | sudo rm "/usr/bin/meson" "/usr/bin/ninja" 2>/dev/null 337 | pip install meson ninja --upgrade 2>/dev/null 338 | pip install meson ninja --break-system-packages --upgrade 2>/dev/null 339 | #python3 -m pip install meson ninja --upgrade 340 | sudo ln -s "${HOME}/.local/bin/meson" "/usr/bin/meson" 2>/dev/null 341 | sudo ln -s "${HOME}/.local/bin/ninja" "/usr/bin/ninja" 2>/dev/null 342 | sudo chmod +xwr "/usr/bin/meson" "/usr/bin/ninja" 343 | #version 344 | meson --version ; ninja --version 345 | sudo ldconfig && sudo ldconfig -p 346 | #----------------------# 347 | ##Nix 348 | [[ -f "${HOME}/.bash_profile" ]] && source "${HOME}/.bash_profile" 349 | [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]] && source "${HOME}/.nix-profile/etc/profile.d/nix.sh" 350 | hash -r &>/dev/null 351 | if ! command -v nix >/dev/null 2>&1; then 352 | pushd "$(mktemp -d)" &>/dev/null 353 | curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_nix.sh" -o "./install_nix.sh" 354 | dos2unix --quiet "./install_nix.sh" ; chmod +x "./install_nix.sh" 355 | bash "./install_nix.sh" 356 | [[ -f "${HOME}/.bash_profile" ]] && source "${HOME}/.bash_profile" 357 | [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]] && source "${HOME}/.nix-profile/etc/profile.d/nix.sh" 358 | rm -rf "./install_nix.sh" 2>/dev/null ; popd &>/dev/null 359 | fi 360 | #Test 361 | if ! command -v nix &> /dev/null; then 362 | echo -e "\n[-] nix NOT Found\n" 363 | export CONTINUE="NO" 364 | return 1 || exit 1 365 | else 366 | #Add Env vars 367 | export NIXPKGS_ALLOW_BROKEN="1" 368 | export NIXPKGS_ALLOW_UNFREE="1" 369 | export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM="1" 370 | #Add Tokens 371 | echo "access-tokens = github.com=${GITHUB_TOKEN}" | sudo tee -a "/etc/nix/nix.conf" >/dev/null 2>&1 372 | #Update Channels 373 | nix --version && nix-channel --list && nix-channel --update 374 | #Seed Local Data 375 | nix derivation show "nixpkgs#hello" --impure --refresh --quiet >/dev/null 2>&1 376 | fi 377 | #----------------------# 378 | #rust & cargo 379 | bash <(curl -qfsSL "https://sh.rustup.rs") -y 380 | #Test: PATH="${HOME}/.cargo/bin:${HOME}/.cargo/env:${PATH}" 381 | if ! command -v cargo &> /dev/null; then 382 | echo -e "\n[-] cargo (rust) NOT Found\n" 383 | export CONTINUE="NO" 384 | return 1 || exit 1 385 | else 386 | rustup default stable 387 | rustc --version && cargo --version 388 | #Cross-rs 389 | #cargo install cross --git "https://github.com/cross-rs/cross" 390 | sudo ldconfig && sudo ldconfig -p 391 | fi 392 | ##Clean 393 | if [ "${CONTINUE}" == "YES" ]; then 394 | echo "INITIALIZED" > "${SYSTMP}/INITIALIZED" 395 | rm -rf "${SYSTMP}/init_Debian" 2>/dev/null 396 | #-------------------------------------------------------# 397 | ##END 398 | echo -e "\n\n [+] Finished Initializing $(uname -mnrs) :: at $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n" 399 | #In case of polluted env 400 | unset AR AS CC CFLAGS CPP CXX CPPFLAGS CXXFLAGS DLLTOOL HOST_CC HOST_CXX LD LDFLAGS LIBS NM OBJCOPY OBJDUMP RANLIB READELF SIZE STRINGS STRIP SYSROOT 401 | fi 402 | fi 403 | rm -rf "$(realpath .)" && popd >/dev/null 2>&1 404 | echo -e "\n[+] Continue : ${CONTINUE}\n" 405 | #-------------------------------------------------------# -------------------------------------------------------------------------------- /scripts/runner/setup_env.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | ## 3 | # source <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/setup_env.sh") 4 | ## 5 | 6 | #-------------------------------------------------------# 7 | unset BUILD_DIR BUILDSCRIPT CONTINUE CONTINUE_SBUILD END_TIME ghcr_push GHCRPKG GHCRPKG_URL GHCRPKG_TAG INPUT_SBUILD INPUT_SBUILD_PATH INITSCRIPT KEEP_LOGS OCWD pkg PKG PKG_FAMILY pkg_id PKG_ID pkg_type PKG_TYPE PROG PUSH_SUCCESSFUL RECIPE SBUILD_OUTDIR SBUILD_PKG SBUILD_PKGS SBUILD_PKGVER SBUILD_REBUILD SBUILD_SCRIPT SBUILD_SCRIPT_BLOB SBUILD_SUCCESSFUL SBUILD_TMPDIR START_TIME TMPDIRS TMPJSON TMPXVER TMPXRUN TOTAL_RECIPES 8 | USER="$(whoami)" && export USER="${USER}" 9 | HOME="$(getent passwd ${USER} | cut -d: -f6)" && export HOME="${HOME}" 10 | HOST_TRIPLET="$(uname -m)-$(uname -s)" 11 | if [ -z "${SYSTMP+x}" ] || [ -z "${SYSTMP##*[[:space:]]}" ]; then 12 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 13 | fi 14 | export PATH="${HOME}/bin:${HOME}/.cargo/bin:${HOME}/.cargo/env:${HOME}/.go/bin:${HOME}/go/bin:${HOME}/.local/bin:${HOME}/miniconda3/bin:${HOME}/miniconda3/condabin:/usr/local/zig:/usr/local/zig/lib:/usr/local/zig/lib/include:/usr/local/musl/bin:/usr/local/musl/lib:/usr/local/musl/include:${PATH}" 15 | PATH="$(echo "${PATH}" | awk 'BEGIN{RS=":";ORS=":"}{gsub(/\n/,"");if(!a[$0]++)print}' | sed 's/:*$//')" ; export PATH 16 | OWD_TMP="$(realpath .)" ; export OWD_TMP 17 | PKG_REPO="pkgcache" 18 | TMPDIRS="mktemp -d --tmpdir=${SYSTMP}/pkgforge XXXXXXX_SBUILD" 19 | USER_AGENT="$(curl -qfsSL 'https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Misc/User-Agents/ua_chrome_macos_latest.txt')" 20 | export HOST_TRIPLET PKG_REPO SYSTMP TMPDIRS USER_AGENT 21 | if [[ "${KEEP_PREVIOUS}" != "YES" ]]; then 22 | rm -rf "${SYSTMP}/pkgforge" 23 | fi 24 | mkdir -pv "${SYSTMP}/pkgforge" 25 | export DEBIAN_FRONTEND="noninteractive" 26 | export GIT_TERMINAL_PROMPT="0" 27 | export GIT_ASKPASS="/bin/echo" 28 | export NIXPKGS_ALLOW_BROKEN="1" 29 | export NIXPKGS_ALLOW_UNFREE="1" 30 | export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM="1" 31 | EGET_TIMEOUT="timeout -k 1m 2m" && export EGET_TIMEOUT="${EGET_TIMEOUT}" 32 | sudo groupadd docker 2>/dev/null ; sudo usermod -aG docker "${USER}" 2>/dev/null 33 | if ! sudo systemctl is-active --quiet docker; then 34 | sudo service docker restart >/dev/null 2>&1 ; sleep 10 35 | fi 36 | sudo systemctl status "docker.service" --no-pager 37 | #Nix 38 | source "/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh" 39 | #sg docker newgrp "$(id -gn)" 40 | cd "${OWD_TMP}" && unset OWD_TMP && clear 41 | ##Sanity Checks 42 | for DEP_CMD in eget gh glab minisign oras rclone soar; do 43 | case "$(command -v "${DEP_CMD}" 2>/dev/null)" in 44 | "") echo -e "\n[✗] FATAL: ${DEP_CMD} is NOT INSTALLED\n" 45 | esac 46 | done 47 | if [[ ! -n "${GITHUB_TOKEN}" ]]; then 48 | echo -e "\n[-] GITHUB_TOKEN is NOT Exported" 49 | echo -e "Export it to Use gh (Github)\n" 50 | else 51 | gh auth status 52 | fi 53 | if [[ ! -n "${GHCR_TOKEN}" ]]; then 54 | echo -e "\n[-] GHCR_TOKEN is NOT Exported" 55 | echo -e "Export it to avoid ghcr (Github Registry)\n" 56 | else 57 | echo "${GHCR_TOKEN}" | oras login --username "Azathothas" --password-stdin "ghcr.io" 58 | fi 59 | if [[ ! -n "${GITLAB_TOKEN}" ]]; then 60 | echo -e "\n[-] GITLAB_TOKEN is NOT Exported" 61 | echo -e "Export it to Use glab (Gitlab)\n" 62 | else 63 | glab auth status 64 | fi 65 | if [[ ! -n "${MINISIGN_KEY}" ]]; then 66 | echo -e "\n[-] MINISIGN_KEY is NOT Exported" 67 | echo -e "Export it to Use minisign (Signing)\n" 68 | else 69 | mkdir -p "${HOME}/.minisign" && \ 70 | echo "pkgforge-minisign: minisign encrypted secret key" > "${HOME}/.minisign/pkgforge.key" &&\ 71 | echo "${MINISIGN_KEY}" >> "${HOME}/.minisign/pkgforge.key" 72 | #https://github.com/pkgforge/.github/blob/main/keys/minisign.pub 73 | export MINISIGN_PUB_KEY='RWSWp/oBUfND5B2fSmDlYaBXPimGV+r2s9skVRYTQ5cJ+7i6ff/1Nxcr' 74 | fi 75 | #-------------------------------------------------------# 76 | unset DOCKER_HOST 77 | find "${SYSTMP}" -mindepth 1 \( -type f -o -type d \) -empty -not -path "$(pwd)" -not -path "$(pwd)/*" -delete 2>/dev/null 78 | history -c 2>/dev/null ; rm -rf "${HOME}/.bash_history" ; pushd "$(mktemp -d)" >/dev/null 2>&1 && echo ".keep" > "./.keep" 79 | source <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/builder.sh") 80 | alias refresh-buildenv='unset BUILD_DIR BUILDSCRIPT CONTINUE CONTINUE_SBUILD END_TIME ghcr_push GHCRPKG GHCRPKG_URL GHCRPKG_TAG INPUT_SBUILD INPUT_SBUILD_PATH INITSCRIPT KEEP_LOGS OCWD pkg PKG PKG_FAMILY pkg_id PKG_ID pkg_type PKG_TYPE PROG PUSH_SUCCESSFUL RECIPE SBUILD_OUTDIR SBUILD_PKG SBUILD_PKGS SBUILD_PKGVER SBUILD_REBUILD SBUILD_SCRIPT SBUILD_SCRIPT_BLOB SBUILD_SUCCESSFUL SBUILD_TMPDIR START_TIME TMPDIRS TMPJSON TMPXVER TMPXRUN TOTAL_RECIPES ; source <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/builder.sh")' 81 | echo -e "\n[+] Build everything: sbuild-builder" 82 | echo -e "[+] ReBuild everything: FORCE_REBUILD_ALL=\"YES\" sbuild-builder" 83 | echo -e "[+] Build local SBUILD: sbuild-builder /path/to/sbuild" 84 | echo -e "[+] ENV (Local): PKG_FAMILY_LOCAL=\"\$PKG_FAMILY\"" 85 | echo -e "[+] ENV (Local): GHCRPKG_LOCAL=\"ghcr.io/pkgforge/\$REPO/\$PKG_FAMILY/\$PKG_ID\"" 86 | echo -e "[+] Example: SBUILD_REBUILD=\"true\" PKG_FAMILY_LOCAL=\"curl\" GHCRPKG_LOCAL=\"ghcr.io/pkgforge/pkgcache/curl/stunnel\" sbuild-builder \"./curl.SBUILD\"" 87 | echo -e "[+] To Preserve Logs: KEEP_LOGS=\"YES\"" 88 | echo -e "[+] To Refresh Build Env: refresh-buildenv\n" 89 | #-------------------------------------------------------# -------------------------------------------------------------------------------- /scripts/runner/setup_riscv64-Linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # VERSION=0.0.1 4 | #-------------------------------------------------------# 5 | ## 6 | ## Meant to Setup Build Machine 7 | ## Self: https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/setup_riscv64-Linux.sh 8 | # bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/setup_$(uname -m)-$(uname -s).sh") 9 | ###-----------------------------------------------------### 10 | ### Setups Essential Tools & Preps Sys Environ for Deps ### 11 | ### This Script must be run as `root` (passwordless) ### 12 | ### Assumptions: Arch: riscv64 | OS: Debian 64bit ### 13 | ###-----------------------------------------------------### 14 | 15 | #-------------------------------------------------------# 16 | ##ENV 17 | if [ -z "${SYSTMP+x}" ] || [ -z "${SYSTMP##*[[:space:]]}" ]; then 18 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 19 | fi 20 | USER="$(whoami)" && export USER="${USER}" 21 | HOME="$(getent passwd ${USER} | cut -d: -f6)" && export HOME="${HOME}" 22 | if command -v awk &>/dev/null && command -v sed &>/dev/null; then 23 | PATH="$(echo "${PATH}" | awk 'BEGIN{RS=":";ORS=":"}{gsub(/\n/,"");if(!a[$0]++)print}' | sed 's/:*$//')" ; export PATH 24 | fi 25 | #-------------------------------------------------------# 26 | ##Sanity Checks 27 | ##Check if it was recently initialized 28 | # +360 --> 06 Hrs 29 | # +720 --> 12 HRs 30 | # +1440 --> 24 HRs 31 | find "${SYSTMP}/INITIALIZED" -type f -mmin +720 -exec rm -rvf "{}" \; 2>/dev/null 32 | if [ -s "${SYSTMP}/INITIALIZED" ]; then 33 | echo -e "\n[+] Recently Initialized... (Skipping!)\n" 34 | export CONTINUE="YES" 35 | return 0 || exit 0 36 | else 37 | ##Sane Configs 38 | #In case of removed/privated GH repos 39 | # https://git-scm.com/docs/git#Documentation/git.txt-codeGITTERMINALPROMPTcode 40 | export GIT_TERMINAL_PROMPT="0" 41 | #https://git-scm.com/docs/git#Documentation/git.txt-codeGITASKPASScode 42 | export GIT_ASKPASS="/bin/echo" 43 | #Eget 44 | EGET_TIMEOUT="timeout -k 1m 2m" && export EGET_TIMEOUT="${EGET_TIMEOUT}" 45 | ##Check for apt 46 | if ! command -v apt &> /dev/null; then 47 | echo -e "\n[-] apt NOT Found" 48 | echo -e "\n[+] Maybe not on Debian (Debian Based Distro) ?\n" 49 | #Fail & exit 50 | export CONTINUE="NO" 51 | return 1 || exit 1 52 | else 53 | #Export as noninteractive 54 | export DEBIAN_FRONTEND="noninteractive" 55 | export CONTINUE="YES" 56 | fi 57 | ##Check for sudo 58 | if [ "${CONTINUE}" == "YES" ]; then 59 | if ! command -v sudo &> /dev/null; then 60 | echo -e "\n[-] sudo NOT Installed" 61 | echo -e "\n[+] Trying to Install\n" 62 | #Try to install 63 | apt-get update -y 2>/dev/null ; apt-get dist-upgrade -y 2>/dev/null ; apt-get upgrade -y 2>/dev/null 64 | apt install sudo -y 2>/dev/null 65 | #Fail if it didn't work 66 | if ! command -v sudo &> /dev/null; then 67 | echo -e "[-] Failed to Install sudo (Maybe NOT root || NOT enough perms)\n" 68 | #exit 69 | export CONTINUE="NO" 70 | return 1 || exit 1 71 | fi 72 | fi 73 | fi 74 | ##Check for passwordless sudo 75 | if [ "${CONTINUE}" == "YES" ]; then 76 | if sudo -n true 2>/dev/null; then 77 | echo -e "\n[+] Passwordless sudo is Configured" 78 | sudo grep -E '^\s*[^#]*\s+ALL\s*=\s*\(\s*ALL\s*\)\s+NOPASSWD:' "/etc/sudoers" 2>/dev/null 79 | else 80 | echo -e "\n[-] Passwordless sudo is NOT Configured" 81 | echo -e "\n[-] READ: https://web.archive.org/web/20230614212916/https://linuxhint.com/setup-sudo-no-password-linux/\n" 82 | #exit 83 | export CONTINUE="NO" 84 | return 1 || exit 1 85 | fi 86 | fi 87 | ##Install Needed CMDs 88 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Linux/install_bins_curl.sh") 89 | sudo curl -qfsSL "https://github.com/pkgforge/bin/releases/download/riscv64-Linux/trufflehog" -o "/usr/local/bin/trufflehog" 90 | sudo chmod +x "/usr/local/bin/trufflehog" 91 | ##Check Needed CMDs 92 | for DEP_CMD in eget gh glab minisign oras rclone shellcheck soar zstd; do 93 | case "$(command -v "${DEP_CMD}" 2>/dev/null)" in 94 | "") echo -e "\n[✗] FATAL: ${DEP_CMD} is NOT INSTALLED\n" 95 | export CONTINUE="NO" 96 | return 1 || exit 1 ;; 97 | esac 98 | done 99 | ##Check for GITHUB_TOKEN 100 | if [ -n "${GITHUB_TOKEN+x}" ] && [ -n "${GITHUB_TOKEN##*[[:space:]]}" ]; then 101 | echo -e "\n[+] GITHUB_TOKEN is Exported" 102 | ##gh-cli (uses ${GITHUB_TOKEN} env var) 103 | #echo "${GITHUB_TOKEN}" | gh auth login --with-token 104 | gh auth status 105 | ##eget 106 | #5000 req/minute (80 req/minute) 107 | eget --rate 108 | else 109 | #60 req/hr 110 | echo -e "\n[-] GITHUB_TOKEN is NOT Exported" 111 | echo -e "Export it to avoid ratelimits\n" 112 | eget --rate 113 | export CONTINUE="NO" 114 | return 1 || exit 1 115 | fi 116 | ##Check for GHCR_TOKEN 117 | if [ -n "${GHCR_TOKEN+x}" ] && [ -n "${GHCR_TOKEN##*[[:space:]]}" ]; then 118 | echo -e "\n[+] GHCR_TOKEN is Exported" 119 | #echo "${GHCR_TOKEN}" | oras login --username "Azathothas" --password-stdin "ghcr.io" 120 | oras login --username "Azathothas" --password "${GHCR_TOKEN}" "ghcr.io" 121 | else 122 | echo -e "\n[-] GHCR_TOKEN is NOT Exported" 123 | echo -e "Export it to avoid ghcr\n" 124 | export CONTINUE="NO" 125 | return 1 || exit 1 126 | fi 127 | ##Check for Gitlab Token 128 | if [ -n "${GITLAB_TOKEN+x}" ] && [ -n "${GITLAB_TOKEN##*[[:space:]]}" ]; then 129 | echo -e "\n[+] GITLAB is Exported" 130 | glab auth status 131 | else 132 | echo -e "\n[-] GITLAB_TOKEN is NOT Exported" 133 | echo -e "Export it to avoid ratelimits\n" 134 | export CONTINUE="NO" 135 | return 1 || exit 1 136 | fi 137 | ##Check for Minisign 138 | if [[ ! -s "${HOME}/.minisign/pkgforge.key" || $(stat -c%s "${HOME}/.minisign/pkgforge.key") -le 10 ]]; then 139 | if [ -n "${MINISIGN_KEY+x}" ] && [ -n "${MINISIGN_KEY##*[[:space:]]}" ]; then 140 | mkdir -pv "${HOME}/.minisign" && \ 141 | echo 'pkgforge-minisign: minisign encrypted secret key' > "${HOME}/.minisign/pkgforge.key" &&\ 142 | echo "${MINISIGN_KEY}" >> "${HOME}/.minisign/pkgforge.key" 143 | #https://github.com/pkgforge/.github/blob/main/keys/minisign.pub 144 | export MINISIGN_PUB_KEY='RWSWp/oBUfND5B2fSmDlYaBXPimGV+r2s9skVRYTQ5cJ+7i6ff/1Nxcr' 145 | else 146 | echo -e "\n[-] MINISIGN_KEY is NOT Exported" 147 | echo -e "Export it to Use minisign (Signing)\n" 148 | export CONTINUE="NO" 149 | return 1 || exit 1 150 | fi 151 | else 152 | export MINISIGN_PUB_KEY='RWSWp/oBUfND5B2fSmDlYaBXPimGV+r2s9skVRYTQ5cJ+7i6ff/1Nxcr' 153 | fi 154 | fi 155 | #-------------------------------------------------------# 156 | 157 | 158 | #-------------------------------------------------------# 159 | ##Main 160 | pushd "$(mktemp -d)" &>/dev/null 161 | echo -e "\n\n [+] Started Initializing $(uname -mnrs) :: at $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n" 162 | echo -e "[+] USER = ${USER}" 163 | echo -e "[+] HOME = ${HOME}" 164 | echo -e "[+] PATH = ${PATH}\n" 165 | #----------------------# 166 | #Docker 167 | if [[ "${INSIDE_PODMAN}" != "TRUE" ]]; then 168 | #Doesn't work inside podman 169 | if ! command -v docker &> /dev/null; then 170 | sudo apt install "docker.io" -y 171 | else 172 | docker --version 173 | fi 174 | #Test 175 | if ! command -v docker &> /dev/null; then 176 | echo -e "\n[-] docker NOT Found\n" 177 | export CONTINUE="NO" 178 | return 1 || exit 1 179 | else 180 | sudo systemctl status "docker.service" --no-pager 181 | if ! sudo systemctl is-active --quiet docker; then 182 | sudo service docker restart &>/dev/null ; sleep 10 183 | fi 184 | sudo systemctl status "docker.service" --no-pager 185 | fi 186 | if ! command -v podman &> /dev/null; then 187 | sudo apt install podman -y 188 | fi 189 | sudo apt install aardvark-dns iproute2 jq iptables netavark -y 190 | sudo mkdir -p "/etc/containers" 191 | echo "[engine]" | sudo tee -a "/etc/containers/containers.conf" 192 | echo "lock_type = \"file\"" | sudo tee -a "/etc/containers/containers.conf" 193 | fi 194 | #----------------------# 195 | ##Nix 196 | [[ -f "${HOME}/.bash_profile" ]] && source "${HOME}/.bash_profile" 197 | [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]] && source "${HOME}/.nix-profile/etc/profile.d/nix.sh" 198 | hash -r &>/dev/null 199 | if ! command -v nix >/dev/null 2>&1; then 200 | pushd "$(mktemp -d)" &>/dev/null 201 | curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_nix.sh" -o "./install_nix.sh" 202 | dos2unix --quiet "./install_nix.sh" ; chmod +x "./install_nix.sh" 203 | bash "./install_nix.sh" 204 | [[ -f "${HOME}/.bash_profile" ]] && source "${HOME}/.bash_profile" 205 | [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]] && source "${HOME}/.nix-profile/etc/profile.d/nix.sh" 206 | rm -rf "./install_nix.sh" 2>/dev/null ; popd &>/dev/null 207 | fi 208 | #Test 209 | if ! command -v nix &> /dev/null; then 210 | echo -e "\n[-] nix NOT Found\n" 211 | export CONTINUE="NO" 212 | return 1 || exit 1 213 | else 214 | #Add Env vars 215 | export NIXPKGS_ALLOW_BROKEN="1" 216 | export NIXPKGS_ALLOW_UNFREE="1" 217 | export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM="1" 218 | #Add Tokens 219 | echo "access-tokens = github.com=${GITHUB_TOKEN}" | sudo tee -a "/etc/nix/nix.conf" >/dev/null 2>&1 220 | #Update Channels 221 | nix --version && nix-channel --list && nix-channel --update 222 | #Seed Local Data 223 | nix derivation show "nixpkgs#hello" --impure --refresh --quiet >/dev/null 2>&1 224 | fi 225 | ##Clean 226 | if [ "${CONTINUE}" == "YES" ]; then 227 | echo "INITIALIZED" > "${SYSTMP}/INITIALIZED" 228 | rm -rf "${SYSTMP}/init_Debian" 2>/dev/null 229 | #-------------------------------------------------------# 230 | ##END 231 | echo -e "\n\n [+] Finished Initializing $(uname -mnrs) :: at $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n" 232 | #In case of polluted env 233 | unset AR AS CC CFLAGS CPP CXX CPPFLAGS CXXFLAGS DLLTOOL HOST_CC HOST_CXX LD LDFLAGS LIBS NM OBJCOPY OBJDUMP RANLIB READELF SIZE STRINGS STRIP SYSROOT 234 | fi 235 | rm -rf "$(realpath .)" && popd &>/dev/null 236 | echo -e "\n[+] Continue : ${CONTINUE}\n" 237 | #-------------------------------------------------------# -------------------------------------------------------------------------------- /scripts/runner/setup_x86_64-Linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # VERSION=0.0.1 4 | #-------------------------------------------------------# 5 | ## 6 | ## Meant to Setup Build Machine 7 | ## Self: https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/setup_x86_64-Linux.sh 8 | # bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/pkgcache/refs/heads/main/scripts/runner/setup_$(uname -m)-$(uname -s).sh") 9 | ###-----------------------------------------------------### 10 | ### Setups Essential Tools & Preps Sys Environ for Deps ### 11 | ### This Script must be run as `root` (passwordless) ### 12 | ### Assumptions: Arch: AMD_64 | OS: Debian 64bit ### 13 | ###-----------------------------------------------------### 14 | 15 | #-------------------------------------------------------# 16 | ##ENV 17 | if [ -z "${SYSTMP+x}" ] || [ -z "${SYSTMP##*[[:space:]]}" ]; then 18 | SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}" 19 | fi 20 | USER="$(whoami)" && export USER="${USER}" 21 | HOME="$(getent passwd ${USER} | cut -d: -f6)" && export HOME="${HOME}" 22 | if command -v awk >/dev/null 2>&1 && command -v sed >/dev/null 2>&1; then 23 | PATH="$(echo "${PATH}" | awk 'BEGIN{RS=":";ORS=":"}{gsub(/\n/,"");if(!a[$0]++)print}' | sed 's/:*$//')" ; export PATH 24 | fi 25 | #-------------------------------------------------------# 26 | ##Sanity Checks 27 | ##Check if it was recently initialized 28 | # +360 --> 06 Hrs 29 | # +720 --> 12 HRs 30 | # +1440 --> 24 HRs 31 | find "${SYSTMP}/INITIALIZED" -type f -mmin +720 -exec rm -rvf "{}" \; 2>/dev/null 32 | if [ -s "${SYSTMP}/INITIALIZED" ]; then 33 | echo -e "\n[+] Recently Initialized... (Skipping!)\n" 34 | export CONTINUE="YES" 35 | return 0 || exit 0 36 | else 37 | ##Sane Configs 38 | #In case of removed/privated GH repos 39 | # https://git-scm.com/docs/git#Documentation/git.txt-codeGITTERMINALPROMPTcode 40 | export GIT_TERMINAL_PROMPT="0" 41 | #https://git-scm.com/docs/git#Documentation/git.txt-codeGITASKPASScode 42 | export GIT_ASKPASS="/bin/echo" 43 | #Eget 44 | EGET_TIMEOUT="timeout -k 1m 2m" && export EGET_TIMEOUT="${EGET_TIMEOUT}" 45 | ##Check for apt 46 | if ! command -v apt &> /dev/null; then 47 | echo -e "\n[-] apt NOT Found" 48 | echo -e "\n[+] Maybe not on Debian (Debian Based Distro) ?\n" 49 | #Fail & exit 50 | export CONTINUE="NO" 51 | return 1 || exit 1 52 | else 53 | #Export as noninteractive 54 | export DEBIAN_FRONTEND="noninteractive" 55 | export CONTINUE="YES" 56 | fi 57 | ##Check for sudo 58 | if [ "${CONTINUE}" == "YES" ]; then 59 | if ! command -v sudo &> /dev/null; then 60 | echo -e "\n[-] sudo NOT Installed" 61 | echo -e "\n[+] Trying to Install\n" 62 | #Try to install 63 | apt-get update -y 2>/dev/null ; apt-get dist-upgrade -y 2>/dev/null ; apt-get upgrade -y 2>/dev/null 64 | apt install sudo -y 2>/dev/null 65 | #Fail if it didn't work 66 | if ! command -v sudo &> /dev/null; then 67 | echo -e "[-] Failed to Install sudo (Maybe NOT root || NOT enough perms)\n" 68 | #exit 69 | export CONTINUE="NO" 70 | return 1 || exit 1 71 | fi 72 | fi 73 | fi 74 | ##Check for passwordless sudo 75 | if [ "${CONTINUE}" == "YES" ]; then 76 | if sudo -n true 2>/dev/null; then 77 | echo -e "\n[+] Passwordless sudo is Configured" 78 | sudo grep -E '^\s*[^#]*\s+ALL\s*=\s*\(\s*ALL\s*\)\s+NOPASSWD:' "/etc/sudoers" 2>/dev/null 79 | else 80 | echo -e "\n[-] Passwordless sudo is NOT Configured" 81 | echo -e "\n[-] READ: https://web.archive.org/web/20230614212916/https://linuxhint.com/setup-sudo-no-password-linux/\n" 82 | #exit 83 | export CONTINUE="NO" 84 | return 1 || exit 1 85 | fi 86 | fi 87 | ##Install Needed CMDs 88 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Linux/install_bins_curl.sh") 89 | #Appimage tools 90 | sudo curl -qfsSL "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage" -o "/usr/local/bin/appimagetool" && sudo chmod -v 'a+x' "/usr/local/bin/appimagetool" 91 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/dwarfs-tools" -o "/usr/local/bin/dwarfs-tools" && sudo chmod -v +x "/usr/local/bin/dwarfs-tools" 92 | sudo ln -fsv "/usr/local/bin/dwarfs-tools" "/usr/local/bin/dwarfs" 93 | sudo ln -fsv "/usr/local/bin/dwarfs-tools" "/usr/local/bin/dwarfsck" 94 | sudo ln -fsv "/usr/local/bin/dwarfs-tools" "/usr/local/bin/dwarfsextract" 95 | sudo ln -fsv "/usr/local/bin/dwarfs-tools" "/usr/local/bin/mkdwarfs" 96 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)-$(uname -s)/unsquashfs" -o "/usr/local/bin/unsquashfs" && sudo chmod -v +x "/usr/local/bin/unsquashfs" 97 | ##Check Needed CMDs 98 | for DEP_CMD in appimagetool dwarfs dwarfsck dwarfsextract eget gh glab mkdwarfs minisign oras rclone shellcheck soar unsquashfs zstd; do 99 | case "$(command -v "${DEP_CMD}" 2>/dev/null)" in 100 | "") echo -e "\n[✗] FATAL: ${DEP_CMD} is NOT INSTALLED\n" 101 | export CONTINUE="NO" 102 | return 1 || exit 1 ;; 103 | esac 104 | done 105 | ##Install Builder + Linter 106 | sudo curl -qfsSL "https://github.com/pkgforge/sbuilder/releases/download/nightly-sbuild/sbuild-$(uname -m)-linux" -o "/usr/local/bin/sbuild" ||\ 107 | sudo curl -qfsSL "https://api.gh.pkgforge.dev/repos/pkgforge/sbuilder/releases?per_page=100" | jq -r '.. | objects | .browser_download_url? // empty' | grep -Ei "$(uname -m)" | grep -Eiv "tar\.gz|\.b3sum" | grep -Eiv "sbuild-linter" | sort --version-sort | tail -n 1 | tr -d '[:space:]' | xargs -I "{}" sudo curl -qfsSL "{}" -o "/usr/local/bin/sbuild" 108 | sudo chmod -v +x "/usr/local/bin/sbuild" 109 | if ! command -v sbuild &> /dev/null; then 110 | echo -e "\n[-] sbuild NOT Found\n" 111 | export CONTINUE="NO" 112 | return 1 || exit 1 113 | else 114 | sbuild --help 115 | fi 116 | sudo curl -qfsSL "https://api.gh.pkgforge.dev/repos/pkgforge/sbuilder/releases?per_page=100" | jq -r '.. | objects | .browser_download_url? // empty' | grep -Ei "$(uname -m)" | grep -Eiv "tar\.gz|\.b3sum" | grep -Ei "sbuild-linter" | sort --version-sort | tail -n 1 | tr -d '[:space:]' | xargs -I "{}" sudo curl -qfsSL "{}" -o "/usr/local/bin/sbuild-linter" 117 | sudo chmod -v +x "/usr/local/bin/sbuild-linter" 118 | if ! command -v sbuild-linter &> /dev/null; then 119 | echo -e "\n[-] sbuild NOT Found\n" 120 | export CONTINUE="NO" 121 | return 1 || exit 1 122 | else 123 | sbuild-linter --help 124 | fi 125 | ##Check for GITHUB_TOKEN 126 | if [ -n "${GITHUB_TOKEN+x}" ] && [ -n "${GITHUB_TOKEN##*[[:space:]]}" ]; then 127 | echo -e "\n[+] GITHUB_TOKEN is Exported" 128 | ##gh-cli (uses ${GITHUB_TOKEN} env var) 129 | #echo "${GITHUB_TOKEN}" | gh auth login --with-token 130 | gh auth status 131 | ##eget 132 | #5000 req/minute (80 req/minute) 133 | eget --rate 134 | else 135 | #60 req/hr 136 | echo -e "\n[-] GITHUB_TOKEN is NOT Exported" 137 | echo -e "Export it to avoid ratelimits\n" 138 | eget --rate 139 | export CONTINUE="NO" 140 | return 1 || exit 1 141 | fi 142 | ##Check for GHCR_TOKEN 143 | if [ -n "${GHCR_TOKEN+x}" ] && [ -n "${GHCR_TOKEN##*[[:space:]]}" ]; then 144 | echo -e "\n[+] GHCR_TOKEN is Exported" 145 | #echo "${GHCR_TOKEN}" | oras login --username "Azathothas" --password-stdin "ghcr.io" 146 | oras login --username "Azathothas" --password "${GHCR_TOKEN}" "ghcr.io" 147 | else 148 | echo -e "\n[-] GHCR_TOKEN is NOT Exported" 149 | echo -e "Export it to avoid ghcr\n" 150 | export CONTINUE="NO" 151 | return 1 || exit 1 152 | fi 153 | ##Check for Gitlab Token 154 | if [ -n "${GITLAB_TOKEN+x}" ] && [ -n "${GITLAB_TOKEN##*[[:space:]]}" ]; then 155 | echo -e "\n[+] GITLAB is Exported" 156 | glab auth status 157 | else 158 | echo -e "\n[-] GITLAB_TOKEN is NOT Exported" 159 | echo -e "Export it to avoid ratelimits\n" 160 | export CONTINUE="NO" 161 | return 1 || exit 1 162 | fi 163 | ##Check for Minisign 164 | if [[ ! -s "${HOME}/.minisign/pkgforge.key" || $(stat -c%s "${HOME}/.minisign/pkgforge.key") -le 10 ]]; then 165 | if [ -n "${MINISIGN_KEY+x}" ] && [ -n "${MINISIGN_KEY##*[[:space:]]}" ]; then 166 | mkdir -pv "${HOME}/.minisign" && \ 167 | echo 'pkgforge-minisign: minisign encrypted secret key' > "${HOME}/.minisign/pkgforge.key" &&\ 168 | echo "${MINISIGN_KEY}" >> "${HOME}/.minisign/pkgforge.key" 169 | #https://github.com/pkgforge/.github/blob/main/keys/minisign.pub 170 | export MINISIGN_PUB_KEY='RWSWp/oBUfND5B2fSmDlYaBXPimGV+r2s9skVRYTQ5cJ+7i6ff/1Nxcr' 171 | else 172 | echo -e "\n[-] MINISIGN_KEY is NOT Exported" 173 | echo -e "Export it to Use minisign (Signing)\n" 174 | export CONTINUE="NO" 175 | return 1 || exit 1 176 | fi 177 | else 178 | export MINISIGN_PUB_KEY='RWSWp/oBUfND5B2fSmDlYaBXPimGV+r2s9skVRYTQ5cJ+7i6ff/1Nxcr' 179 | fi 180 | fi 181 | #-------------------------------------------------------# 182 | 183 | 184 | #-------------------------------------------------------# 185 | ##Main 186 | pushd "$(mktemp -d)" >/dev/null 2>&1 187 | echo -e "\n\n [+] Started Initializing $(uname -mnrs) :: at $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n" 188 | echo -e "[+] USER = ${USER}" 189 | echo -e "[+] HOME = ${HOME}" 190 | echo -e "[+] PATH = ${PATH}\n" 191 | ## If On Github Actions, remove bloat to get space (~ 30 GB) [DANGEROUS] 192 | if [ "${CONTINUE}" == "YES" ]; then 193 | if [ "${USER}" = "runner" ] || [ "$(whoami)" = "runner" ] && [ -s "/opt/runner/provisioner" ]; then 194 | ##Debloat: https://github.com/pkgforge/devscripts/blob/main/Github/Runners/debloat_ubuntu.sh 195 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Github/Runners/debloat_ubuntu.sh") 196 | bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Github/Runners/debloat_ubuntu.sh") 2>/dev/null 197 | fi 198 | #----------------------# 199 | ##Install CoreUtils & Deps 200 | #----------------------# 201 | sudo apt-get update -y 2>/dev/null 202 | sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils gnupg2 moreutils software-properties-common util-linux -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null 203 | #Install Build Des 204 | sudo apt-get install aria2 automake bc binutils b3sum build-essential ca-certificates ccache diffutils dos2unix gawk git-lfs imagemagick lzip jq libtool libtool-bin make musl musl-dev musl-tools p7zip-full rsync texinfo wget -y 2>/dev/null 205 | sudo apt-get install -y --no-install-recommends autoconf automake autopoint binutils bison build-essential byacc ca-certificates clang flex file jq libtool libtool-bin patch patchelf pkg-config qemu-user-static scons tree wget 2>/dev/null 206 | sudo apt-get install devscripts -y --no-install-recommends 2>/dev/null 207 | sudo apt-get install cmake -y 208 | #Re 209 | sudo apt-get install aria2 automake bc binutils b3sum build-essential ca-certificates ccache diffutils dos2unix gawk git-lfs imagemagick lzip jq libtool libtool-bin make musl musl-dev musl-tools p7zip-full rsync texinfo wget -y 2>/dev/null 210 | sudo apt-get install -y --no-install-recommends autoconf automake autopoint binutils bison build-essential byacc ca-certificates clang flex file jq libtool libtool-bin patch patchelf pkg-config qemu-user-static scons tree wget 2>/dev/null 211 | sudo apt-get install devscripts -y --no-install-recommends 2>/dev/null 212 | sudo apt-get install cmake -y 213 | #Install Build Dependencies (arm64) 214 | sudo apt install binutils-aarch64-linux-gnu -y 2>/dev/null 215 | sudo apt-get install "g++-arm-linux-gnueabi" "g++-arm-linux-gnueabihf" "g++-aarch64-linux-gnu" qemu-user-static -y 2>/dev/null 216 | #libpcap 217 | sudo apt install libpcap-dev pcaputils -y 2>/dev/null 218 | #libsqlite3 219 | sudo apt-get install libsqlite3-dev sqlite3 sqlite3-pcre sqlite3-tools -y 2>/dev/null 220 | #lzma 221 | sudo apt-get install liblz-dev librust-lzma-sys-dev lzma lzma-dev -y 222 | #Networking 223 | sudo apt-get install dnsutils 'inetutils*' net-tools netcat-traditional -y 2>/dev/null 224 | sudo apt-get install 'iputils*' -y 2>/dev/null 225 | sudo setcap cap_net_raw+ep "$(which ping)" 2>/dev/null 226 | #python 227 | sudo apt install python3-pip python3-venv -y 2>/dev/null 228 | #Upgrade pip 229 | pip --version 230 | pip install --break-system-packages --upgrade pip || pip install --upgrade pip 231 | pip --version 232 | #Deps 233 | sudo apt install lm-sensors pciutils procps python3-distro python3-netifaces sysfsutils virt-what -y 2>/dev/null 234 | sudo apt-get install libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev scons xcb -y 2>/dev/null 235 | pip install build cffi scons scuba pytest --upgrade --force 2>/dev/null ; pip install ansi2txt pipx scons py2static typer --upgrade --force 2>/dev/null 236 | pip install build cffi scons scuba pytest --break-system-packages --upgrade --force 2>/dev/null ; pip install ansi2txt pipx scons py2static typer --break-system-packages --upgrade --force 2>/dev/null 237 | #pyinstaller 238 | pip install "git+https://github.com/pyinstaller/pyinstaller" --break-system-packages --force-reinstall --upgrade ; pyinstaller --version 239 | #----------------------# 240 | ##Langs 241 | #----------------------# 242 | #Docker 243 | install_docker () 244 | { 245 | #Install 246 | curl -qfsSL "https://get.docker.com" | sed 's/sleep 20//g' | sudo bash 247 | sudo groupadd docker 2>/dev/null ; sudo usermod -aG docker "${USER}" 2>/dev/null 248 | sudo service docker restart 2>/dev/null && sleep 10 249 | sudo service docker status 2>/dev/null 250 | sudo systemctl status "docker.service" --no-pager 251 | #Test 252 | if ! command -v docker &> /dev/null; then 253 | echo -e "\n[-] docker NOT Found\n" 254 | export CONTINUE="NO" 255 | return 1 || exit 1 256 | else 257 | if ! sudo systemctl is-active --quiet docker; then 258 | sudo service docker restart >/dev/null 2>&1 ; sleep 10 259 | fi 260 | sudo systemctl status "docker.service" --no-pager 261 | docker --version ; sudo docker run hello-world 262 | sudo ldconfig && sudo ldconfig -p 263 | #newgrp 2>/dev/null 264 | fi 265 | } 266 | export -f install_docker 267 | if command -v docker &> /dev/null; then 268 | if [ "$(curl -qfsSL "https://endoflife.date/api/docker-engine.json" | jq -r '.[0].latest')" != "$(docker --version | grep -oP '(?<=version )(\d+\.\d+\.\d+)')" ]; then 269 | install_docker 270 | else 271 | echo -e "\n[+] Latest Docker seems to be already Installed" 272 | docker --version 273 | if ! sudo systemctl is-active --quiet docker; then 274 | sudo service docker restart >/dev/null 2>&1 ; sleep 10 275 | fi 276 | sudo systemctl status "docker.service" --no-pager 277 | fi 278 | else 279 | install_docker 280 | fi 281 | #----------------------# 282 | #Crystal 283 | curl -qfsSL "https://crystal-lang.org/install.sh" | sudo bash 284 | #Test 285 | if ! command -v crystal &> /dev/null; then 286 | echo -e "\n[-] crystal NOT Found\n" 287 | #export CONTINUE="NO" 288 | #return 1 || exit 1 289 | else 290 | crystal --version ; shards --version 291 | sudo ldconfig && sudo ldconfig -p 292 | fi 293 | #----------------------# 294 | #Dockerc 295 | sudo curl -qfsSL "https://bin.pkgforge.dev/$(uname -m)/dockerc" -o "/usr/local/bin/dockerc" && sudo chmod -v +x "/usr/local/bin/dockerc" 296 | #----------------------# 297 | ##Install golang 298 | echo "yes" | bash <(curl -qfsSL "https://git.io/go-installer") 299 | #Test 300 | if ! command -v go &> /dev/null; then 301 | echo -e "\n[-] go NOT Found\n" 302 | export CONTINUE="NO" 303 | return 1 || exit 1 304 | else 305 | go version 306 | sudo ldconfig && sudo ldconfig -p 307 | fi 308 | #----------------------# 309 | ###Install Guix: https://guix.gnu.org/manual/en/html_node/Installation.html 310 | #curl -qfsSL "https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh" -o "./guix-install.sh" 311 | #if [[ ! -s "./guix-install.sh" || $(stat -c%s "./guix-install.sh") -le 10 ]]; then 312 | # curl -qfsSL "https://raw.githubusercontent.com/Millak/guix/refs/heads/master/etc/guix-install.sh" -o "./guix-install.sh" 313 | #fi 314 | #chmod +x "./guix-install.sh" && yes '' | sudo "./guix-install.sh" --uninstall 2>/dev/null 315 | #yes '' | sudo "./guix-install.sh" 316 | ##Test 317 | #if ! command -v guix &> /dev/null; then 318 | # echo -e "\n[-] guix NOT Found\n" 319 | # export CONTINUE="NO" 320 | # return 1 || exit 1 321 | #else 322 | # yes '' | guix install glibc-locales 323 | # export GUIX_LOCPATH="${HOME}/.guix-profile/lib/locale" 324 | # curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/nonguix.channels.scm" | sudo tee "/root/.config/guix/channels.scm" 325 | # GUIX_GIT_REPO="https://git.savannah.gnu.org/git/guix.git" 326 | # ##mirror 327 | # #GUIX_GIT_REPO="https://github.com/Millak/guix" 328 | # GUIX_LATEST_SHA="$(git ls-remote "${GUIX_GIT_REPO}" 'HEAD' | grep -w 'HEAD' | head -n 1 | awk '{print $1}' | tr -d '[:space:]')" 329 | # GIT_CONFIG_PARAMETERS="'filter.blob:none.enabled=true'" guix pull --url="${GUIX_GIT_REPO}" --commit="${GUIX_LATEST_SHA}" --cores="$(($(nproc)+1))" --max-jobs="2" --disable-authentication & 330 | # sudo GIT_CONFIG_PARAMETERS="'filter.blob:none.enabled=true'" guix pull --url="${GUIX_GIT_REPO}" --commit="${GUIX_LATEST_SHA}" --cores="$(($(nproc)+1))" --max-jobs="2" --disable-authentication & 331 | # wait ; guix --version 332 | #fi 333 | #------------------------------# 334 | ##Install Meson & Ninja 335 | #Install 336 | sudo rm "/usr/bin/meson" "/usr/bin/ninja" 2>/dev/null 337 | pip install meson ninja --upgrade 2>/dev/null 338 | pip install meson ninja --break-system-packages --upgrade 2>/dev/null 339 | #python3 -m pip install meson ninja --upgrade 340 | sudo ln -s "${HOME}/.local/bin/meson" "/usr/bin/meson" 2>/dev/null 341 | sudo ln -s "${HOME}/.local/bin/ninja" "/usr/bin/ninja" 2>/dev/null 342 | sudo chmod +xwr "/usr/bin/meson" "/usr/bin/ninja" 343 | #version 344 | meson --version ; ninja --version 345 | sudo ldconfig && sudo ldconfig -p 346 | #----------------------# 347 | ##Nix 348 | [[ -f "${HOME}/.bash_profile" ]] && source "${HOME}/.bash_profile" 349 | [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]] && source "${HOME}/.nix-profile/etc/profile.d/nix.sh" 350 | hash -r &>/dev/null 351 | if ! command -v nix >/dev/null 2>&1; then 352 | pushd "$(mktemp -d)" &>/dev/null 353 | curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Linux/install_nix.sh" -o "./install_nix.sh" 354 | dos2unix --quiet "./install_nix.sh" ; chmod +x "./install_nix.sh" 355 | bash "./install_nix.sh" 356 | [[ -f "${HOME}/.bash_profile" ]] && source "${HOME}/.bash_profile" 357 | [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]] && source "${HOME}/.nix-profile/etc/profile.d/nix.sh" 358 | rm -rf "./install_nix.sh" 2>/dev/null ; popd &>/dev/null 359 | fi 360 | #Test 361 | if ! command -v nix &> /dev/null; then 362 | echo -e "\n[-] nix NOT Found\n" 363 | export CONTINUE="NO" 364 | return 1 || exit 1 365 | else 366 | #Add Env vars 367 | export NIXPKGS_ALLOW_BROKEN="1" 368 | export NIXPKGS_ALLOW_UNFREE="1" 369 | export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM="1" 370 | #Add Tokens 371 | echo "access-tokens = github.com=${GITHUB_TOKEN}" | sudo tee -a "/etc/nix/nix.conf" >/dev/null 2>&1 372 | #Update Channels 373 | nix --version && nix-channel --list && nix-channel --update 374 | #Seed Local Data 375 | nix derivation show "nixpkgs#hello" --impure --refresh --quiet >/dev/null 2>&1 376 | fi 377 | #----------------------# 378 | #rust & cargo 379 | bash <(curl -qfsSL "https://sh.rustup.rs") -y 380 | #Test: PATH="${HOME}/.cargo/bin:${HOME}/.cargo/env:${PATH}" 381 | if ! command -v cargo &> /dev/null; then 382 | echo -e "\n[-] cargo (rust) NOT Found\n" 383 | export CONTINUE="NO" 384 | return 1 || exit 1 385 | else 386 | rustup default stable 387 | rustc --version && cargo --version 388 | #Cross-rs 389 | #cargo install cross --git "https://github.com/cross-rs/cross" 390 | sudo ldconfig && sudo ldconfig -p 391 | fi 392 | ##Clean 393 | if [ "${CONTINUE}" == "YES" ]; then 394 | echo "INITIALIZED" > "${SYSTMP}/INITIALIZED" 395 | rm -rf "${SYSTMP}/init_Debian" 2>/dev/null 396 | #-------------------------------------------------------# 397 | ##END 398 | echo -e "\n\n [+] Finished Initializing $(uname -mnrs) :: at $(TZ='UTC' date +'%A, %Y-%m-%d (%I:%M:%S %p)')\n\n" 399 | #In case of polluted env 400 | unset AR AS CC CFLAGS CPP CXX CPPFLAGS CXXFLAGS DLLTOOL HOST_CC HOST_CXX LD LDFLAGS LIBS NM OBJCOPY OBJDUMP RANLIB READELF SIZE STRINGS STRIP SYSROOT 401 | fi 402 | fi 403 | rm -rf "$(realpath .)" && popd >/dev/null 2>&1 404 | echo -e "\n[+] Continue : ${CONTINUE}\n" 405 | #-------------------------------------------------------# --------------------------------------------------------------------------------