mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
modify repo
This commit is contained in:
parent
8fc4b4db62
commit
5deab88476
61
.github/workflows/grub.yml
vendored
61
.github/workflows/grub.yml
vendored
@ -1,61 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (C) 2022 Ing <https://github.com/wjz304>
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the MIT License.
|
|
||||||
# See /LICENSE for more information.
|
|
||||||
#
|
|
||||||
|
|
||||||
name: Grub
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
push:
|
|
||||||
description: "push"
|
|
||||||
default: false
|
|
||||||
type: boolean
|
|
||||||
jobs:
|
|
||||||
grub:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@main
|
|
||||||
|
|
||||||
- name: Initialization environment
|
|
||||||
run: |
|
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git config --global user.name "github-actions[bot]"
|
|
||||||
sudo timedatectl set-timezone "Asia/Shanghai"
|
|
||||||
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y build-essential bison flex dosfstools
|
|
||||||
|
|
||||||
- name: Make Grub
|
|
||||||
run: |
|
|
||||||
. scripts/grub.sh "grub-2.06" "i386-pc i386-efi x86_64-efi" "RR"
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: grub
|
|
||||||
path: |
|
|
||||||
grub.img.gz
|
|
||||||
|
|
||||||
- name: Check and Push
|
|
||||||
if: success() && inputs.push == true
|
|
||||||
run: |
|
|
||||||
if [ -f "grub.img.gz" ]; then
|
|
||||||
echo "Copy img ..."
|
|
||||||
mv -f grub.img.gz files/grub.img.gz
|
|
||||||
|
|
||||||
echo "Git push ..."
|
|
||||||
git pull
|
|
||||||
status=$(git status -s | grep -E 'grub.img.gz' | awk '{printf " %s", $2}')
|
|
||||||
if [ -n "${status}" ]; then
|
|
||||||
git add ${status}
|
|
||||||
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)"
|
|
||||||
git push -f
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "No change ..."
|
|
||||||
fi
|
|
205
.github/workflows/main.yml
vendored
205
.github/workflows/main.yml
vendored
@ -1,205 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (C) 2022 Ing <https://github.com/wjz304>
|
|
||||||
#
|
|
||||||
# This is free software, licensed under the MIT License.
|
|
||||||
# See /LICENSE for more information.
|
|
||||||
#
|
|
||||||
|
|
||||||
name: Build RR
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- v*
|
|
||||||
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: "format %y.%-m.$i or auto"
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
prerelease:
|
|
||||||
description: "pre release"
|
|
||||||
default: false
|
|
||||||
type: boolean
|
|
||||||
br_version:
|
|
||||||
description: "buildroot version"
|
|
||||||
default: "2023.08.x"
|
|
||||||
type: string
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@main
|
|
||||||
with:
|
|
||||||
lfs: 'true'
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
||||||
git config --global user.name "github-actions[bot]"
|
|
||||||
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y jq cpio gettext
|
|
||||||
|
|
||||||
# calculates the version number and push
|
|
||||||
- name: Calculate version
|
|
||||||
run: |
|
|
||||||
# Calculate version
|
|
||||||
VERSION=""
|
|
||||||
if [[ "${{ github.event_name }}" =~ ^(push|release)$ && "${{ github.ref_type }}" == 'tag' ]]; then
|
|
||||||
VERSION="${{ github.ref_name }}"
|
|
||||||
elif [ -n "${{ inputs.version }}" ]; then
|
|
||||||
if [ "`echo ${{ inputs.version }} | cut -d '.' -f 1,2`" = "`date +'%y.%-m'`" ]; then
|
|
||||||
VERSION="${{ inputs.version }}"
|
|
||||||
else
|
|
||||||
LATEST_TAG="`curl -skL "https://api.github.com/repos/${{ github.repository }}/releases" | jq -r ".[0].tag_name" 2>/dev/null`"
|
|
||||||
if [ -n "${LATEST_TAG}" -a "`echo ${LATEST_TAG} | cut -d '.' -f 1,2`" = "`date +'%y.%-m'`" ]; then # format %y.%-m.$i
|
|
||||||
VERSION="`echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.'`"
|
|
||||||
else
|
|
||||||
VERSION="`date +'%y.%-m'`.0"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
VERSION=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "VERSION: ${VERSION}"
|
|
||||||
echo "VERSION=${VERSION}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
if [ -n "${VERSION}" ]; then
|
|
||||||
# Modify Source File
|
|
||||||
echo "${VERSION}" > VERSION
|
|
||||||
echo "${VERSION}" > files/p1/RR_VERSION
|
|
||||||
sed 's/^RR_VERSION=.*/RR_VERSION="'${VERSION}'"/' -i files/initrd/opt/rr/include/consts.sh
|
|
||||||
|
|
||||||
git checkout main
|
|
||||||
git pull
|
|
||||||
status=$(git status -s | awk '{printf " %s", $2}')
|
|
||||||
if [ -n "${status}" ]; then
|
|
||||||
git add ${status}
|
|
||||||
git commit -m "update $(date +%Y-%m-%d" "%H:%M:%S)"
|
|
||||||
git push -f
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Convert po2mo, Get extractor, LKMs, addons and Modules
|
|
||||||
- name: Convert po2mo, Get extractor, LKMs, addons and Modules
|
|
||||||
run: |
|
|
||||||
. scripts/func.sh
|
|
||||||
|
|
||||||
convertpo2mo "files/initrd/opt/rr/lang"
|
|
||||||
getExtractor "files/p3/extractor"
|
|
||||||
getLKMs "files/p3/lkms" ${{ inputs.prerelease }}
|
|
||||||
getAddons "files/p3/addons" ${{ inputs.prerelease }}
|
|
||||||
getModules "files/p3/modules" ${{ inputs.prerelease }}
|
|
||||||
|
|
||||||
echo "OK"
|
|
||||||
|
|
||||||
# Build incremental
|
|
||||||
- name: Build image
|
|
||||||
run: |
|
|
||||||
. scripts/func.sh
|
|
||||||
echo "Create RR image"
|
|
||||||
gzip -dc "files/grub.img.gz" >"rr.img"
|
|
||||||
fdisk -l "rr.img"
|
|
||||||
|
|
||||||
LOOPX=$(sudo losetup -f)
|
|
||||||
sudo losetup -P "${LOOPX}" "rr.img"
|
|
||||||
|
|
||||||
echo "Mounting image file"
|
|
||||||
mkdir -p "/tmp/p1"
|
|
||||||
mkdir -p "/tmp/p3"
|
|
||||||
sudo mount ${LOOPX}p1 "/tmp/p1"
|
|
||||||
sudo mount ${LOOPX}p3 "/tmp/p3"
|
|
||||||
|
|
||||||
echo "Get Buildroot"
|
|
||||||
br_version="${{ inputs.br_version }}"
|
|
||||||
[ -z "${br_version}" ] && br_version="2023.08.x"
|
|
||||||
getBuildroot "${br_version}" "br"
|
|
||||||
[ ! -f "br/bzImage-rr" -o ! -f "br/initrd-rr" ] && return 1
|
|
||||||
|
|
||||||
echo "Repack initrd"
|
|
||||||
cp -f "br/bzImage-rr" "files/p3/bzImage-rr"
|
|
||||||
repackInitrd "br/initrd-rr" "files/initrd" "files/p3/initrd-rr"
|
|
||||||
|
|
||||||
echo "Copying files"
|
|
||||||
sudo cp -Rf "files/p1/"* "/tmp/p1"
|
|
||||||
sudo cp -Rf "files/p3/"* "/tmp/p3"
|
|
||||||
sync
|
|
||||||
|
|
||||||
echo "Unmount image file"
|
|
||||||
sudo umount "/tmp/p1"
|
|
||||||
sudo umount "/tmp/p3"
|
|
||||||
rmdir "/tmp/p1"
|
|
||||||
rmdir "/tmp/p3"
|
|
||||||
|
|
||||||
sudo losetup --detach ${LOOPX}
|
|
||||||
|
|
||||||
echo "Create RR_4GB image"
|
|
||||||
resizeImg "rr.img" "+3072M" "rr_4GB.img"
|
|
||||||
|
|
||||||
# echo "Image Converter"
|
|
||||||
# qemu-img convert -O vmdk rr.img rr-dyn.vmdk
|
|
||||||
# qemu-img convert -O vmdk -o adapter_type=lsilogic rr.img -o subformat=monolithicFlat rr.vmdk
|
|
||||||
|
|
||||||
# Zip image and generate checksum
|
|
||||||
- name: Pack
|
|
||||||
run: |
|
|
||||||
if [ -n "${{ env.VERSION }}" ]; then
|
|
||||||
zip -9 "rr-${{ env.VERSION }}.img.zip" rr.img
|
|
||||||
zip -9 "rr_4GB-${{ env.VERSION }}.img.zip" rr_4GB.img
|
|
||||||
# zip -9 "rr-${{ env.VERSION }}.vmdk-dyn.zip" rr-dyn.vmdk
|
|
||||||
# zip -9 "rr-${{ env.VERSION }}.vmdk-flat.zip" rr.vmdk rr-flat.vmdk
|
|
||||||
else
|
|
||||||
zip -9 "rr.img.zip" rr.img
|
|
||||||
zip -9 "rr_4GB.img.zip" rr_4GB.img
|
|
||||||
fi
|
|
||||||
sha256sum update-list.yml update-check.sh > sha256sum
|
|
||||||
zip -9j update.zip update-list.yml update-check.sh
|
|
||||||
while read F; do
|
|
||||||
if [ -d "${F}" ]; then
|
|
||||||
FTGZ="$(basename "${F}").tgz"
|
|
||||||
tar -czf "${FTGZ}" -C "${F}" .
|
|
||||||
sha256sum "${FTGZ}" >> sha256sum
|
|
||||||
zip -9j update.zip "${FTGZ}"
|
|
||||||
rm -f "${FTGZ}"
|
|
||||||
else
|
|
||||||
(cd $(dirname "${F}") && sha256sum $(basename "${F}")) >> sha256sum
|
|
||||||
zip -9j update.zip "${F}"
|
|
||||||
fi
|
|
||||||
done < <(yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml)
|
|
||||||
zip -9j update.zip sha256sum
|
|
||||||
|
|
||||||
# Upload artifact
|
|
||||||
- name: Upload
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: Images
|
|
||||||
path: |
|
|
||||||
rr*.zip
|
|
||||||
update.zip
|
|
||||||
retention-days: 5
|
|
||||||
|
|
||||||
# Publish a release if is a tag
|
|
||||||
- name: Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
if: env.VERSION != ''
|
|
||||||
with:
|
|
||||||
tag_name: ${{ env.VERSION }}
|
|
||||||
prerelease: ${{ inputs.prerelease }}
|
|
||||||
files: |
|
|
||||||
rr-${{ env.VERSION }}.img.zip
|
|
||||||
rr_4GB-${{ env.VERSION }}.img.zip
|
|
||||||
# rr-${{ env.VERSION }}.vmdk-dyn.zip
|
|
||||||
# rr-${{ env.VERSION }}.vmdk-flat.zip
|
|
||||||
update.zip
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
|||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
export TOKEN="${1}"
|
||||||
|
|
||||||
# Convert po2mo
|
# Convert po2mo
|
||||||
# $1 path
|
# $1 path
|
||||||
function convertpo2mo() {
|
function convertpo2mo() {
|
||||||
@ -75,16 +77,16 @@ function getBuildroot() {
|
|||||||
local DEST_PATH="${2:-buildroot}"
|
local DEST_PATH="${2:-buildroot}"
|
||||||
|
|
||||||
if [ "${1}" = "latest" ]; then
|
if [ "${1}" = "latest" ]; then
|
||||||
TAG=$(curl -s "https://api.github.com/repos/wjz304/rr-lkms/releases" | jq -r ".[0].tag_name")
|
TAG=$(curl -skLH "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-buildroot/releases" | jq -r ".[0].tag_name")
|
||||||
fi
|
fi
|
||||||
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
|
[ ! -d "${DEST_PATH}" ] && mkdir -p "${DEST_PATH}"
|
||||||
rm -rf "${DEST_PATH}/bzImage-rr"
|
rm -rf "${DEST_PATH}/bzImage-rr"
|
||||||
STATUS=$(curl -w "%{http_code}" -L "https://github.com/wjz304/rr-buildroot/releases/download/${TAG}/bzImage" -o "${DEST_PATH}/bzImage-rr")
|
STATUS=$(curl -w "%{http_code}" -LH "Authorization: token ${TOKEN}" "https://github.com/RROrg/rr-buildroot/releases/download/${TAG}/bzImage" -o "${DEST_PATH}/bzImage-rr")
|
||||||
echo "TAG=${TAG}; Status=${STATUS}"
|
echo "TAG=${TAG}; Status=${STATUS}"
|
||||||
[ ${STATUS} -ne 200 ] && exit 1
|
[ ${STATUS} -ne 200 ] && exit 1
|
||||||
|
|
||||||
rm -rf "${DEST_PATH}/initrd-rr"
|
rm -rf "${DEST_PATH}/initrd-rr"
|
||||||
STATUS=$(curl -w "%{http_code}" -L "https://github.com/wjz304/rr-buildroot/releases/download/${TAG}/rootfs.cpio.xz" -o "${DEST_PATH}/initrd-rr")
|
STATUS=$(curl -w "%{http_code}" -LH "Authorization: token ${TOKEN}" "https://github.com/RROrg/rr-buildroot/releases/download/${TAG}/rootfs.cpio.xz" -o "${DEST_PATH}/initrd-rr")
|
||||||
echo "TAG=${TAG}; Status=${STATUS}"
|
echo "TAG=${TAG}; Status=${STATUS}"
|
||||||
[ ${STATUS} -ne 200 ] && exit 1
|
[ ${STATUS} -ne 200 ] && exit 1
|
||||||
|
|
||||||
@ -100,11 +102,11 @@ function getLKMs() {
|
|||||||
local CACHE_FILE="/tmp/rp-lkms.zip"
|
local CACHE_FILE="/tmp/rp-lkms.zip"
|
||||||
rm -f "${CACHE_FILE}"
|
rm -f "${CACHE_FILE}"
|
||||||
if [ "${2}" = "true" ]; then
|
if [ "${2}" = "true" ]; then
|
||||||
TAG=$(curl -s "https://api.github.com/repos/wjz304/rr-lkms/releases" | jq -r ".[0].tag_name")
|
TAG=$(curl -skLH "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-lkms/releases" | jq -r ".[0].tag_name")
|
||||||
else
|
else
|
||||||
TAG=$(curl -s "https://api.github.com/repos/wjz304/rr-lkms/releases/latest" | jq -r ".tag_name")
|
TAG=$(curl -skLH "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-lkms/releases/latest" | jq -r ".tag_name")
|
||||||
fi
|
fi
|
||||||
STATUS=$(curl -w "%{http_code}" -L "https://github.com/wjz304/rr-lkms/releases/download/${TAG}/rp-lkms.zip" -o "${CACHE_FILE}")
|
STATUS=$(curl -w "%{http_code}" -kLH "Authorization: token ${TOKEN}" "https://github.com/RROrg/rr-lkms/releases/download/${TAG}/rp-lkms.zip" -o "${CACHE_FILE}")
|
||||||
echo "TAG=${TAG}; Status=${STATUS}"
|
echo "TAG=${TAG}; Status=${STATUS}"
|
||||||
[ ${STATUS} -ne 200 ] && exit 1
|
[ ${STATUS} -ne 200 ] && exit 1
|
||||||
# Unzip LKMs
|
# Unzip LKMs
|
||||||
@ -124,11 +126,11 @@ function getAddons() {
|
|||||||
local CACHE_DIR="/tmp/addons"
|
local CACHE_DIR="/tmp/addons"
|
||||||
local CACHE_FILE="/tmp/addons.zip"
|
local CACHE_FILE="/tmp/addons.zip"
|
||||||
if [ "${2}" = "true" ]; then
|
if [ "${2}" = "true" ]; then
|
||||||
TAG=$(curl -s "https://api.github.com/repos/wjz304/rr-addons/releases" | jq -r ".[0].tag_name")
|
TAG=$(curl -skLH "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-addons/releases" | jq -r ".[0].tag_name")
|
||||||
else
|
else
|
||||||
TAG=$(curl -s "https://api.github.com/repos/wjz304/rr-addons/releases/latest" | jq -r ".tag_name")
|
TAG=$(curl -skLH "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-addons/releases/latest" | jq -r ".tag_name")
|
||||||
fi
|
fi
|
||||||
STATUS=$(curl -w "%{http_code}" -L "https://github.com/wjz304/rr-addons/releases/download/${TAG}/addons.zip" -o "${CACHE_FILE}")
|
STATUS=$(curl -w "%{http_code}" -kLH "Authorization: token ${TOKEN}" "https://github.com/RROrg/rr-addons/releases/download/${TAG}/addons.zip" -o "${CACHE_FILE}")
|
||||||
echo "TAG=${TAG}; Status=${STATUS}"
|
echo "TAG=${TAG}; Status=${STATUS}"
|
||||||
[ ${STATUS} -ne 200 ] && exit 1
|
[ ${STATUS} -ne 200 ] && exit 1
|
||||||
rm -rf "${DEST_PATH}"
|
rm -rf "${DEST_PATH}"
|
||||||
@ -157,11 +159,11 @@ function getModules() {
|
|||||||
local CACHE_FILE="/tmp/modules.zip"
|
local CACHE_FILE="/tmp/modules.zip"
|
||||||
rm -f "${CACHE_FILE}"
|
rm -f "${CACHE_FILE}"
|
||||||
if [ "${2}" = "true" ]; then
|
if [ "${2}" = "true" ]; then
|
||||||
TAG=$(curl -s "https://api.github.com/repos/wjz304/rr-modules/releases" | jq -r ".[0].tag_name")
|
TAG=$(curl -skLH "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-modules/releases" | jq -r ".[0].tag_name")
|
||||||
else
|
else
|
||||||
TAG=$(curl -s "https://api.github.com/repos/wjz304/rr-modules/releases/latest" | jq -r ".tag_name")
|
TAG=$(curl -skLH "Authorization: token ${TOKEN}" "https://api.github.com/repos/RROrg/rr-modules/releases/latest" | jq -r ".tag_name")
|
||||||
fi
|
fi
|
||||||
STATUS=$(curl -w "%{http_code}" -L "https://github.com/wjz304/rr-modules/releases/download/${TAG}/modules.zip" -o "${CACHE_FILE}")
|
STATUS=$(curl -w "%{http_code}" -kLH "Authorization: token ${TOKEN}" "https://github.com/RROrg/rr-modules/releases/download/${TAG}/modules.zip" -o "${CACHE_FILE}")
|
||||||
echo "TAG=${TAG}; Status=${STATUS}"
|
echo "TAG=${TAG}; Status=${STATUS}"
|
||||||
[ ${STATUS} -ne 200 ] && exit 1
|
[ ${STATUS} -ne 200 ] && exit 1
|
||||||
# Unzip Modules
|
# Unzip Modules
|
||||||
|
Loading…
x
Reference in New Issue
Block a user