mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
add rr custom
This commit is contained in:
parent
43cb096164
commit
59d829f65d
154
.github/workflows/issues.yml
vendored
154
.github/workflows/issues.yml
vendored
@ -14,6 +14,9 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@main
|
||||||
|
|
||||||
- name: Init Env
|
- name: Init Env
|
||||||
run: |
|
run: |
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
@ -21,15 +24,37 @@ jobs:
|
|||||||
sudo timedatectl set-timezone "Asia/Shanghai"
|
sudo timedatectl set-timezone "Asia/Shanghai"
|
||||||
|
|
||||||
- name: Check Issues
|
- name: Check Issues
|
||||||
|
shell: python
|
||||||
run: |
|
run: |
|
||||||
if echo "${{ github.event.issue.body }}" | grep -q "ENV"; then
|
# -*- coding: utf-8 -*-
|
||||||
echo "FALG=true" >> $GITHUB_ENV
|
import json, subprocess
|
||||||
else
|
def set_output(name, value):
|
||||||
echo "FALG=false" >> $GITHUB_ENV
|
subprocess.call(["echo '{}={}' >> $GITHUB_ENV".format(name, value)], shell=True)
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Create Issues comment
|
issuetitle = ${{ toJSON(github.event.issue.title) }};
|
||||||
if: env.FALG == 'false'
|
issuebody = ${{ toJSON(github.event.issue.body) }};
|
||||||
|
|
||||||
|
iscustom = 'false'
|
||||||
|
warinfo = 'false'
|
||||||
|
model = ''
|
||||||
|
try:
|
||||||
|
if issuetitle.lower().startswith('custom'):
|
||||||
|
json_object = json.loads(issuebody)
|
||||||
|
iscustom = 'true'
|
||||||
|
model = json_object.get('model', '')
|
||||||
|
except ValueError as e:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if iscustom == 'false':
|
||||||
|
if issuebody.find('ENV') >= 0:
|
||||||
|
warinfo = 'true'
|
||||||
|
|
||||||
|
set_output("iscustom", iscustom)
|
||||||
|
set_output("warinfo", warinfo)
|
||||||
|
set_output("model", model)
|
||||||
|
|
||||||
|
- name: Update Comment Warinfo
|
||||||
|
if: env.warinfo == 'true'
|
||||||
uses: actions-cool/issues-helper@v3
|
uses: actions-cool/issues-helper@v3
|
||||||
with:
|
with:
|
||||||
actions: "create-comment"
|
actions: "create-comment"
|
||||||
@ -68,3 +93,118 @@ jobs:
|
|||||||
... If you can't provide detailed information, then wait for someone who is destined!
|
... If you can't provide detailed information, then wait for someone who is destined!
|
||||||
|
|
||||||
emoji: heart
|
emoji: heart
|
||||||
|
|
||||||
|
- name: Update Comment Labels
|
||||||
|
if: env.iscustom == 'true'
|
||||||
|
uses: actions-cool/issues-helper@v3
|
||||||
|
with:
|
||||||
|
actions: 'add-labels'
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
issue-number: ${{ github.event.issue.number }}
|
||||||
|
labels: 'custom,${{ env.model }}'
|
||||||
|
|
||||||
|
- name: Update Comment Building
|
||||||
|
if: env.iscustom == 'true'
|
||||||
|
id: comment
|
||||||
|
uses: actions-cool/issues-helper@v3
|
||||||
|
with:
|
||||||
|
actions: 'create-comment'
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
issue-number: ${{ github.event.issue.number }}
|
||||||
|
body: |
|
||||||
|
Hi @${{ github.event.issue.user.login }}.
|
||||||
|
RR-${{ env.model }} is being build and package and will be sent to your email later..
|
||||||
|
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
----
|
||||||
|
emoji: heart
|
||||||
|
|
||||||
|
- name: Run Build
|
||||||
|
if: env.iscustom == 'true'
|
||||||
|
run: |
|
||||||
|
# 累了, 毁灭吧
|
||||||
|
|
||||||
|
REPO=${{ github.server_url }}/${{ github.repository }}
|
||||||
|
MODEL=${{ env.model }}
|
||||||
|
PRERELEASE="false"
|
||||||
|
|
||||||
|
TAG=""
|
||||||
|
if [ "${PRERELEASE}" = "true" ]; then
|
||||||
|
TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | head -1 | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/')"
|
||||||
|
else
|
||||||
|
LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")"
|
||||||
|
TAG="${LATESTURL##*/}"
|
||||||
|
fi
|
||||||
|
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
|
||||||
|
rm -f rr-${TAG}.img.zip
|
||||||
|
STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/rr-${TAG}.img.zip" -o "rr-${TAG}.img.zip")
|
||||||
|
if [ $? -ne 0 -o ${STATUS:-0} -ne 200 ]; then
|
||||||
|
echo "Download failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
unzip rr-${TAG}.img.zip -d "rr"
|
||||||
|
|
||||||
|
export TERM=xterm
|
||||||
|
|
||||||
|
sudo ./localbuild.sh init rr rr/rr.img
|
||||||
|
sudo ./localbuild.sh config ${MODEL}
|
||||||
|
sudo ./localbuild.sh pack rr/rr.img
|
||||||
|
|
||||||
|
ls rr -al
|
||||||
|
zip -9 "rr-${MODEL}-${TAG}-${{ github.run_id }}.img.zip" -j rr/rr.img
|
||||||
|
|
||||||
|
UPLOAD="$(curl -k -F "file=@rr-${MODEL}-${TAG}-${{ github.run_id }}.img.zip" -F "token=${{ secrets.TT_TOKEN }}" -F "model=0" -X POST "https://tmp-cli.vx-cdn.com/app/upload_cli")"
|
||||||
|
if ! echo "${UPLOAD}" | grep -q "Download Page"; then
|
||||||
|
echo "Upload failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
EMAIL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/users/${{ github.event.issue.user.login }}" | jq -r '.email')
|
||||||
|
TTDLURL="$(echo "${UPLOAD}" | grep "Download Page" | head -1)"
|
||||||
|
echo "TAG=${TAG}" >> $GITHUB_ENV
|
||||||
|
echo "EMAIL=${EMAIL}" >> $GITHUB_ENV
|
||||||
|
echo "TTDLURL=${TTDLURL}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Send mail
|
||||||
|
if: env.iscustom == 'true' && success()
|
||||||
|
uses: dawidd6/action-send-mail@v3
|
||||||
|
with:
|
||||||
|
server_address: smtp-mail.outlook.com
|
||||||
|
server_port: 587
|
||||||
|
username: ${{ secrets.MAIL_USERNAME }}
|
||||||
|
password: ${{ secrets.MAIL_PASSWORD }}
|
||||||
|
subject: rr-${{ env.model }}-${{ env.TAG }}
|
||||||
|
to: ${{ env.EMAIL }}
|
||||||
|
from: ${{ secrets.MAIL_USERNAME }}
|
||||||
|
body: |
|
||||||
|
${{ env.TTDLURL }}
|
||||||
|
|
||||||
|
- name: Update Comment Success
|
||||||
|
if: env.iscustom == 'true' && success()
|
||||||
|
uses: actions-cool/issues-helper@v3
|
||||||
|
with:
|
||||||
|
actions: 'update-comment'
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
comment-id: ${{ steps.comment.outputs.comment-id }}
|
||||||
|
update-mode: replace
|
||||||
|
body: |
|
||||||
|
Hi @${{ github.event.issue.user.login }}.
|
||||||
|
RR-${{ env.model }} has been sent to your email.
|
||||||
|
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
----
|
||||||
|
emoji: hooray
|
||||||
|
|
||||||
|
- name: Update Comment Fail
|
||||||
|
if: env.iscustom == 'true' && failure()
|
||||||
|
uses: actions-cool/issues-helper@v3
|
||||||
|
with:
|
||||||
|
actions: 'update-comment'
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
comment-id: ${{ steps.comment.outputs.comment-id }}
|
||||||
|
update-mode: replace
|
||||||
|
body: |
|
||||||
|
Hi @${{ github.event.issue.user.login }}.
|
||||||
|
RR-${{ env.model }} failed to build and package, please try again.
|
||||||
|
> ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
|
----
|
||||||
|
emoji: confused
|
@ -1,6 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-Hans-CN">
|
<html lang="zh-Hans-CN">
|
||||||
<head>
|
<head>
|
||||||
<script language="javascript"> location.replace("./disks.html")</script>
|
<script language="javascript"> location.replace("./issues.html")</script>
|
||||||
</head>
|
</head>
|
||||||
</html>
|
</html>
|
210
docs/issues.html
Normal file
210
docs/issues.html
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-Hans-CN" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark"
|
||||||
|
data-a11y-animated-images="system">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="dns-prefetch" href="https://github.githubassets.com" />
|
||||||
|
<link rel="dns-prefetch" href="https://avatars.githubusercontent.com" />
|
||||||
|
<link rel="dns-prefetch" href="https://github-cloud.s3.amazonaws.com" />
|
||||||
|
<link rel="dns-prefetch" href="https://user-images.githubusercontent.com/" />
|
||||||
|
<link rel="preconnect" href="https://github.githubassets.com" crossorigin />
|
||||||
|
<link rel="preconnect" href="https://avatars.githubusercontent.com" />
|
||||||
|
|
||||||
|
<link crossorigin="anonymous" media="all" rel="stylesheet"
|
||||||
|
href="https://github.githubassets.com/assets/light-0eace2597ca3.css" />
|
||||||
|
<link crossorigin="anonymous" media="all" rel="stylesheet"
|
||||||
|
href="https://github.githubassets.com/assets/dark-a167e256da9c.css" />
|
||||||
|
|
||||||
|
<link crossorigin="anonymous" media="all" rel="stylesheet"
|
||||||
|
href="https://github.githubassets.com/assets/primer-711f412bb361.css" />
|
||||||
|
<link crossorigin="anonymous" media="all" rel="stylesheet"
|
||||||
|
href="https://github.githubassets.com/assets/global-78704364aaba.css" />
|
||||||
|
<style>
|
||||||
|
select,
|
||||||
|
input {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
|
||||||
|
<script src="https://polyfill.io/v3/polyfill.min.js"></script>
|
||||||
|
<!-- <script src="https://fastly.jsdelivr.net/npm/marked/marked.min.js"></script> -->
|
||||||
|
<script type="application/javascript">
|
||||||
|
|
||||||
|
var repo = "RROrg/rr"
|
||||||
|
|
||||||
|
window.onload = function () {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
$("#model").on("change", changeModel);
|
||||||
|
changeModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeModel() {
|
||||||
|
changeproductsimage();
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeproductsimage() {
|
||||||
|
//var model = $("#model").val().replace("#","").replace("+","plus");
|
||||||
|
//$('#products').html(`<img src="https://www.synology.cn/img/products/detail/${model}/heading.png" width="20%">`);
|
||||||
|
var model = $("#model").val().replace("#", "").replace("+", "%2B");
|
||||||
|
$('#products').html(`<img src="https://www.synology.com/api/products/getPhoto?product=${model}&type=img_s&sort=0" width="20%">`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createIssues() {
|
||||||
|
var form = document.getElementById("inputs");
|
||||||
|
let formData = new FormData(form);
|
||||||
|
var title = "custom";
|
||||||
|
var body = {};
|
||||||
|
var _parameters = ["title", "model"];
|
||||||
|
for (var key in _parameters) {
|
||||||
|
var name = _parameters[key];
|
||||||
|
if (name == "title") {
|
||||||
|
if ($("#" + name).val()) {
|
||||||
|
title += " " + $("#" + name).val();
|
||||||
|
} else {
|
||||||
|
title += " " + new Date().toISOString().substr(0, 10);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($("#" + name).val()) {
|
||||||
|
body[name] = $("#" + name).val();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body = JSON.stringify(body).replace(/\+/g, "%2b");
|
||||||
|
window.location.href = `https://github.com/${repo}/issues/new?title=${title}&body=${body}`;
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<title>RR-CUSTOM</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="logged-in env-production page-responsive" style="word-wrap: break-word">
|
||||||
|
<div class="application-main left-0 text-left p-3 mx-auto container-xl px-3 px-md-4 px-lg-5 mt-4">
|
||||||
|
<pre id="logo" style="
|
||||||
|
display: block;
|
||||||
|
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas,
|
||||||
|
Liberation Mono, monospace !important;
|
||||||
|
font-size: 12px !important;
|
||||||
|
line-height: 12px !important;
|
||||||
|
margin: 15px 10px;
|
||||||
|
color: red;
|
||||||
|
">
|
||||||
|
██████╗ ██████╗ ██████╗██╗ ██╗███████╗████████╗ ██████╗ ███╗ ███╗
|
||||||
|
██╔══██╗██╔══██╗ ██╔════╝██║ ██║██╔════╝╚══██╔══╝██╔═══██╗████╗ ████║
|
||||||
|
██████╔╝██████╔╝█████╗██║ ██║ ██║███████╗ ██║ ██║ ██║██╔████╔██║
|
||||||
|
██╔══██╗██╔══██╗╚════╝██║ ██║ ██║╚════██║ ██║ ██║ ██║██║╚██╔╝██║
|
||||||
|
██║ ██║██║ ██║ ╚██████╗╚██████╔╝███████║ ██║ ╚██████╔╝██║ ╚═╝ ██║
|
||||||
|
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝
|
||||||
|
|
||||||
|
</pre>
|
||||||
|
<div class="image" id="products" style="height: 50px; margin-left: 100px;">
|
||||||
|
<img src="https://www.synology.cn/img/products/detail/SA6400/heading.png" width="20%">
|
||||||
|
</div>
|
||||||
|
<div class="flex-auto min-width-0 width-fit mr-3">
|
||||||
|
<div class="d-flex flex-wrap flex-items-center wb-break-word f3 text-normal">
|
||||||
|
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16"
|
||||||
|
data-view-component="true" class="octicon octicon-repo color-fg-muted mr-2">
|
||||||
|
<path fill-rule="evenodd"
|
||||||
|
d="M2 2.5A2.5 2.5 0 014.5 0h8.75a.75.75 0 01.75.75v12.5a.75.75 0 01-.75.75h-2.5a.75.75 0 110-1.5h1.75v-2h-8a1 1 0 00-.714 1.7.75.75 0 01-1.072 1.05A2.495 2.495 0 012 11.5v-9zm10.5-1V9h-8c-.356 0-.694.074-1 .208V2.5a1 1 0 011-1h8zM5 12.25v3.25a.25.25 0 00.4.2l1.45-1.087a.25.25 0 01.3 0L8.6 15.7a.25.25 0 00.4-.2v-3.25a.25.25 0 00-.25-.25h-3.5a.25.25 0 00-.25.25z">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
<strong itemprop="name" class="mr-2 flex-self-stretch">
|
||||||
|
<a id="titleA" data-pjax="#repo-content-pjax-container" data-turbo-frame="repo-content-turbo-frame"
|
||||||
|
href="#"></a>
|
||||||
|
</strong>
|
||||||
|
<span id="titleLabel" class="Label Label--secondary v-align-middle mr-1" id="titlelabel"
|
||||||
|
style="color: red">Public</span>
|
||||||
|
</div>
|
||||||
|
<div class="btn-link tabnav-tab preview-tab js-preview-tab flex-1 flex-md-auto width-full">
|
||||||
|
<marquee id="content" direction="up" height="36" scrollamount="1" onMouseOut="this.start()"
|
||||||
|
onMouseOver="this.stop()">
|
||||||
|
</marquee>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mt-1 mb-2 ">
|
||||||
|
<div class="form-group-header">
|
||||||
|
<label class="color-fg-default text-mono f6" for="model">Title:</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group-body">
|
||||||
|
<input class="form-control input-contrast input-sm" type="text" id="title" name="inputs[title]"
|
||||||
|
value="" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mt-1 mb-2 ">
|
||||||
|
<div class="form-group-header">
|
||||||
|
<label class="color-fg-default text-mono f6" for="model">Model:</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group-body">
|
||||||
|
<select class="form-select form-control select-sm input-contrast" id="model" name="inputs[model]"
|
||||||
|
value="">
|
||||||
|
<option value="DS1019+">DS1019+</option>
|
||||||
|
<option value="DS1520+">DS1520+</option>
|
||||||
|
<option value="DS1522+">DS1522+</option>
|
||||||
|
<option value="DS1621+">DS1621+</option>
|
||||||
|
<option value="DS1621xs+">DS1621xs+</option>
|
||||||
|
<option value="DS1819+">DS1819+</option>
|
||||||
|
<option value="DS1821+">DS1821+</option>
|
||||||
|
<option value="DS1823xs+">DS1823xs+</option>
|
||||||
|
<option value="DS220+">DS220+</option>
|
||||||
|
<option value="DS224+">DS224+</option>
|
||||||
|
<option value="DS2419+">DS2419+</option>
|
||||||
|
<option value="DS2422+">DS2422+</option>
|
||||||
|
<option value="DS3615xs">DS3615xs</option>
|
||||||
|
<option value="DS3617xs">DS3617xs</option>
|
||||||
|
<option value="DS3622xs+">DS3622xs+</option>
|
||||||
|
<option value="DS423+">DS423+</option>
|
||||||
|
<option value="DS718+">DS718+</option>
|
||||||
|
<option value="DS720+">DS720+</option>
|
||||||
|
<option value="DS723+">DS723+</option>
|
||||||
|
<!--<option value="DS916+">DS916+</option>-->
|
||||||
|
<option value="DS918+">DS918+</option>
|
||||||
|
<option value="DS920+">DS920+</option>
|
||||||
|
<option value="DS923+">DS923+</option>
|
||||||
|
<option value="DVA1622">DVA1622</option>
|
||||||
|
<option value="DVA3219">DVA3219</option>
|
||||||
|
<option value="DVA3221">DVA3221</option>
|
||||||
|
<option value="FS2500">FS2500</option>
|
||||||
|
<!--<option value="FS3017">FS3017</option>-->
|
||||||
|
<option value="FS6400">FS6400</option>
|
||||||
|
<option value="HD6500">HD6500</option>
|
||||||
|
<option value="RS1221+">RS1221+</option>
|
||||||
|
<option value="RS1619xs+">RS1619xs+</option>
|
||||||
|
<option value="RS2423+">RS2423+</option>
|
||||||
|
<option value="RS2423RP+">RS2423RP+</option>
|
||||||
|
<option value="RS3413xs+">RS3413xs+</option>
|
||||||
|
<option value="RS3618xs">RS3618xs</option>
|
||||||
|
<option value="RS3621xs+">RS3621xs+</option>
|
||||||
|
<option value="RS4021xs+">RS4021xs+</option>
|
||||||
|
<!--<option value="SA3200D">SA3200D</option>-->
|
||||||
|
<option value="SA3400">SA3400</option>
|
||||||
|
<!--<option value="SA3400D">SA3400D</option>-->
|
||||||
|
<option value="SA3410">SA3410</option>
|
||||||
|
<option value="SA3600">SA3600</option>
|
||||||
|
<option value="SA3610">SA3610</option>
|
||||||
|
<option selected="selected" value="SA6400">SA6400</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div data-replace-remote-form-target="" class="workflow-dispatch">
|
||||||
|
<form id="inputs">
|
||||||
|
<button type="button" class="btn State--merged" onclick="return createIssues()" autofocus="">
|
||||||
|
创建
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer class="footer width-full container-xl mt-3 text-center color-fg-muted">
|
||||||
|
<a aria-label="Homepage" title="GitHub" class="footer-octicon mr-2" href="https://github.com/wjz304">
|
||||||
|
<img class="avatar rounded-2 avatar-user" src="https://avatars.githubusercontent.com/u/5615843?s=88&v=4"
|
||||||
|
width="40" height="40" alt="@wjz304" />
|
||||||
|
</a>
|
||||||
|
<span> © 2022 Ing, RROrg Inc. </span>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -140,9 +140,9 @@ function modelMenu() {
|
|||||||
DIALOG --title "$(TEXT "Model")" \
|
DIALOG --title "$(TEXT "Model")" \
|
||||||
--menu "$(TEXT "Choose the model")" 0 0 0 --file "${TMP_PATH}/menu" \
|
--menu "$(TEXT "Choose the model")" 0 0 0 --file "${TMP_PATH}/menu" \
|
||||||
2>${TMP_PATH}/resp
|
2>${TMP_PATH}/resp
|
||||||
[ $? -ne 0 ] && return
|
[ $? -ne 0 ] && return 0
|
||||||
resp=$(cat ${TMP_PATH}/resp)
|
resp=$(cat ${TMP_PATH}/resp)
|
||||||
[ -z "${resp}" ] && return
|
[ -z "${resp}" ] && return 1
|
||||||
if [ "${resp}" = "c" ]; then
|
if [ "${resp}" = "c" ]; then
|
||||||
models=(DS918+ RS1619xs+ DS419+ DS1019+ DS719+ DS1621xs+)
|
models=(DS918+ RS1619xs+ DS419+ DS1019+ DS719+ DS1621xs+)
|
||||||
[ $(lspci -d ::300 2>/dev/null | grep 8086 | wc -l) -gt 0 ] && iGPU=1 || iGPU=0
|
[ $(lspci -d ::300 2>/dev/null | grep 8086 | wc -l) -gt 0 ] && iGPU=1 || iGPU=0
|
||||||
@ -195,6 +195,7 @@ function modelMenu() {
|
|||||||
break
|
break
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
[ ! -f "${WORK_PATH}/model-configs/${1}.yml" ] && return 1
|
||||||
resp="${1}"
|
resp="${1}"
|
||||||
fi
|
fi
|
||||||
# If user change model, clean build* and pat* and SN
|
# If user change model, clean build* and pat* and SN
|
||||||
@ -224,6 +225,7 @@ function modelMenu() {
|
|||||||
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" "${PART2_PATH}/"* >/dev/null 2>&1
|
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" "${PART2_PATH}/"* >/dev/null 2>&1
|
||||||
touch ${PART1_PATH}/.build
|
touch ${PART1_PATH}/.build
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -234,17 +236,17 @@ function productversMenu() {
|
|||||||
DIALOG --title "$(TEXT "Product Version")" \
|
DIALOG --title "$(TEXT "Product Version")" \
|
||||||
--no-items --menu "$(TEXT "Choose a product version")" 0 0 0 ${ITEMS} \
|
--no-items --menu "$(TEXT "Choose a product version")" 0 0 0 ${ITEMS} \
|
||||||
2>${TMP_PATH}/resp
|
2>${TMP_PATH}/resp
|
||||||
[ $? -ne 0 ] && return
|
[ $? -ne 0 ] && return 0
|
||||||
resp=$(cat ${TMP_PATH}/resp)
|
resp=$(cat ${TMP_PATH}/resp)
|
||||||
[ -z "${resp}" ] && return
|
[ -z "${resp}" ] && return 1
|
||||||
|
|
||||||
if [ "${PRODUCTVER}" = "${resp}" ]; then
|
if [ "${PRODUCTVER}" = "${resp}" ]; then
|
||||||
DIALOG --title "$(TEXT "Product Version")" \
|
DIALOG --title "$(TEXT "Product Version")" \
|
||||||
--yesno "$(printf "$(TEXT "The current version has been set to %s. Do you want to reset the version?")" "${PRODUCTVER}")" 0 0
|
--yesno "$(printf "$(TEXT "The current version has been set to %s. Do you want to reset the version?")" "${PRODUCTVER}")" 0 0
|
||||||
[ $? -ne 0 ] && return
|
[ $? -ne 0 ] && return 0
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if ! arrayExistItem "${1}" ${ITEMS}; then return; fi
|
if ! arrayExistItem "${1}" ${ITEMS}; then return 1; fi
|
||||||
resp="${1}"
|
resp="${1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -254,7 +256,7 @@ function productversMenu() {
|
|||||||
DIALOG --title "$(TEXT "Product Version")" \
|
DIALOG --title "$(TEXT "Product Version")" \
|
||||||
--msgbox "$(TEXT "This version does not support UEFI startup, Please select another version or switch the startup mode.")" 0 0
|
--msgbox "$(TEXT "This version does not support UEFI startup, Please select another version or switch the startup mode.")" 0 0
|
||||||
fi
|
fi
|
||||||
return
|
return 1
|
||||||
fi
|
fi
|
||||||
# if [ ! "usb" = "$(getBus "${LOADER_DISK}")" -a "${KVER:0:1}" = "5" ]; then
|
# if [ ! "usb" = "$(getBus "${LOADER_DISK}")" -a "${KVER:0:1}" = "5" ]; then
|
||||||
# if [ -z "${1}" ]; then
|
# if [ -z "${1}" ]; then
|
||||||
@ -269,8 +271,10 @@ function productversMenu() {
|
|||||||
idx=1
|
idx=1
|
||||||
NETERR=0
|
NETERR=0
|
||||||
while [ ${idx} -le 3 ]; do # Loop 3 times, if successful, break
|
while [ ${idx} -le 3 ]; do # Loop 3 times, if successful, break
|
||||||
DIALOG --title "$(TEXT "Product Version")" \
|
if [ -z "${1}" ]; then
|
||||||
--infobox "$(TEXT "Get pat data ...") (${idx}/3)" 0 0
|
DIALOG --title "$(TEXT "Product Version")" \
|
||||||
|
--infobox "$(TEXT "Get pat data ...") (${idx}/3)" 0 0
|
||||||
|
fi
|
||||||
idx=$((${idx} + 1))
|
idx=$((${idx} + 1))
|
||||||
NETERR=0
|
NETERR=0
|
||||||
fastest=$(_get_fastest "www.synology.com" "www.synology.cn")
|
fastest=$(_get_fastest "www.synology.com" "www.synology.cn")
|
||||||
@ -316,7 +320,7 @@ function productversMenu() {
|
|||||||
fi
|
fi
|
||||||
[ ${RET} -eq 0 ] && break # ok-button
|
[ ${RET} -eq 0 ] && break # ok-button
|
||||||
[ ${RET} -eq 3 ] && continue # extra-button
|
[ ${RET} -eq 3 ] && continue # extra-button
|
||||||
return # 1 or 255 # cancel-button or ESC
|
return 0 # 1 or 255 # cancel-button or ESC
|
||||||
done
|
done
|
||||||
paturl="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
|
paturl="$(cat "${TMP_PATH}/resp" | sed -n '1p')"
|
||||||
patsum="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
|
patsum="$(cat "${TMP_PATH}/resp" | sed -n '2p')"
|
||||||
@ -324,7 +328,7 @@ function productversMenu() {
|
|||||||
paturl="${2}"
|
paturl="${2}"
|
||||||
patsum="${3}"
|
patsum="${3}"
|
||||||
fi
|
fi
|
||||||
[ -z "${paturl}" -o -z "${patsum}" ] && return
|
[ -z "${paturl}" -o -z "${patsum}" ] && return 1
|
||||||
writeConfigKey "paturl" "${paturl}" "${USER_CONFIG_FILE}"
|
writeConfigKey "paturl" "${paturl}" "${USER_CONFIG_FILE}"
|
||||||
writeConfigKey "patsum" "${patsum}" "${USER_CONFIG_FILE}"
|
writeConfigKey "patsum" "${patsum}" "${USER_CONFIG_FILE}"
|
||||||
PRODUCTVER=${resp}
|
PRODUCTVER=${resp}
|
||||||
@ -361,6 +365,7 @@ function productversMenu() {
|
|||||||
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null 2>&1
|
rm -f "${ORI_ZIMAGE_FILE}" "${ORI_RDGZ_FILE}" "${MOD_ZIMAGE_FILE}" "${MOD_RDGZ_FILE}" >/dev/null 2>&1
|
||||||
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" "${PART2_PATH}/"* >/dev/null 2>&1
|
rm -f "${PART1_PATH}/grub_cksum.syno" "${PART1_PATH}/GRUB_VER" "${PART2_PATH}/"* >/dev/null 2>&1
|
||||||
touch ${PART1_PATH}/.build
|
touch ${PART1_PATH}/.build
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -1281,8 +1286,7 @@ function extractDsmFiles() {
|
|||||||
# Where the magic happens!
|
# Where the magic happens!
|
||||||
# 1 - silent
|
# 1 - silent
|
||||||
function make() {
|
function make() {
|
||||||
rm -f "${LOG_FILE}"
|
function __make() {
|
||||||
while true; do
|
|
||||||
if [ ! -f "${ORI_ZIMAGE_FILE}" -o ! -f "${ORI_RDGZ_FILE}" ]; then
|
if [ ! -f "${ORI_ZIMAGE_FILE}" -o ! -f "${ORI_RDGZ_FILE}" ]; then
|
||||||
extractDsmFiles
|
extractDsmFiles
|
||||||
[ $? -ne 0 ] && break
|
[ $? -ne 0 ] && break
|
||||||
@ -1295,19 +1299,19 @@ function make() {
|
|||||||
[ -f ${MOD_ZIMAGE_FILE} ] && rm -f "${MOD_ZIMAGE_FILE}" && continue
|
[ -f ${MOD_ZIMAGE_FILE} ] && rm -f "${MOD_ZIMAGE_FILE}" && continue
|
||||||
[ -f ${MOD_RDGZ_FILE} ] && rm -f "${MOD_RDGZ_FILE}" && continue
|
[ -f ${MOD_RDGZ_FILE} ] && rm -f "${MOD_RDGZ_FILE}" && continue
|
||||||
echo -e "$(TEXT "No disk space left, please clean the cache and try again!")" >"${LOG_FILE}"
|
echo -e "$(TEXT "No disk space left, please clean the cache and try again!")" >"${LOG_FILE}"
|
||||||
break 2
|
return 1
|
||||||
done
|
done
|
||||||
|
|
||||||
${WORK_PATH}/zimage-patch.sh
|
${WORK_PATH}/zimage-patch.sh
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "$(TEXT "zImage not patched,\nPlease upgrade the bootloader version and try again.\nPatch error:\n")$(cat "${LOG_FILE}")" >"${LOG_FILE}"
|
echo -e "$(TEXT "zImage not patched,\nPlease upgrade the bootloader version and try again.\nPatch error:\n")$(cat "${LOG_FILE}")" >"${LOG_FILE}"
|
||||||
break
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${WORK_PATH}/ramdisk-patch.sh
|
${WORK_PATH}/ramdisk-patch.sh
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo -e "$(TEXT "Ramdisk not patched,\nPlease upgrade the bootloader version and try again.\nPatch error:\n")$(cat "${LOG_FILE}")" >"${LOG_FILE}"
|
echo -e "$(TEXT "Ramdisk not patched,\nPlease upgrade the bootloader version and try again.\nPatch error:\n")$(cat "${LOG_FILE}")" >"${LOG_FILE}"
|
||||||
break
|
return 1
|
||||||
fi
|
fi
|
||||||
rm -f ${PART1_PATH}/.build
|
rm -f ${PART1_PATH}/.build
|
||||||
echo "$(TEXT "Cleaning ...")"
|
echo "$(TEXT "Cleaning ...")"
|
||||||
@ -1315,9 +1319,13 @@ function make() {
|
|||||||
rm -f "${LOG_FILE}"
|
rm -f "${LOG_FILE}"
|
||||||
echo "$(TEXT "Ready!")"
|
echo "$(TEXT "Ready!")"
|
||||||
sleep 3
|
sleep 3
|
||||||
break
|
return 0
|
||||||
done 2>&1 | DIALOG --title "$(TEXT "Main menu")" \
|
}
|
||||||
--progressbox "$(TEXT "Making ... ('ctrl + c' to exit)")" 20 100
|
rm -f "${LOG_FILE}"
|
||||||
|
if [ ! "${1}" = "-1" ]; then
|
||||||
|
__make 2>&1 | DIALOG --title "$(TEXT "Main menu")" \
|
||||||
|
--progressbox "$(TEXT "Making ... ('ctrl + c' to exit)")" 20 100
|
||||||
|
fi
|
||||||
if [ -f "${LOG_FILE}" ]; then
|
if [ -f "${LOG_FILE}" ]; then
|
||||||
if [ ! "${1}" = "-1" ]; then
|
if [ ! "${1}" = "-1" ]; then
|
||||||
DIALOG --title "$(TEXT "Error")" \
|
DIALOG --title "$(TEXT "Error")" \
|
||||||
@ -3202,6 +3210,7 @@ function cleanCache() {
|
|||||||
rm -rfv "${TMP_PATH}/"*
|
rm -rfv "${TMP_PATH}/"*
|
||||||
) 2>&1 | DIALOG --title "$(TEXT "Main menu")" \
|
) 2>&1 | DIALOG --title "$(TEXT "Main menu")" \
|
||||||
--progressbox "$(TEXT "Cleaning cache ...")" 20 100
|
--progressbox "$(TEXT "Cleaning cache ...")" 20 100
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
PROMPT=$(sudo -nv 2>&1)
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
echo "This script must be run as root"
|
echo "This script must be run as root"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -15,7 +16,7 @@ function help() {
|
|||||||
echo "Usage: $0 <command> [args]"
|
echo "Usage: $0 <command> [args]"
|
||||||
echo "Commands:"
|
echo "Commands:"
|
||||||
echo " init [workspace] [rr.img] - Initialize the workspace"
|
echo " init [workspace] [rr.img] - Initialize the workspace"
|
||||||
echo " config - Configure the workspace"
|
echo " config [model] - Configure the workspace"
|
||||||
echo " pack [rr.img] - Pack the workspace"
|
echo " pack [rr.img] - Pack the workspace"
|
||||||
echo " help - Show this help"
|
echo " help - Show this help"
|
||||||
exit 1
|
exit 1
|
||||||
@ -30,8 +31,8 @@ function init() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo apt update
|
sudo apt-get update
|
||||||
sudo apt install -y locales busybox dialog curl xz cpio sed
|
sudo apt-get install -y locales busybox dialog curl xz-utils cpio sed
|
||||||
sudo locale-gen en_US.UTF-8 ko_KR.UTF-8 ru_RU.UTF-8 zh_CN.UTF-8 zh_HK.UTF-8 zh_TW.UTF-8
|
sudo locale-gen en_US.UTF-8 ko_KR.UTF-8 ru_RU.UTF-8 zh_CN.UTF-8 zh_HK.UTF-8 zh_TW.UTF-8
|
||||||
|
|
||||||
YQ=$(command -v yq)
|
YQ=$(command -v yq)
|
||||||
@ -86,11 +87,24 @@ function config() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
. $(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/rr.env
|
. $(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/rr.env
|
||||||
|
RET=1
|
||||||
pushd "${CHROOT_PATH}/initrd/opt/rr"
|
pushd "${CHROOT_PATH}/initrd/opt/rr"
|
||||||
./init.sh
|
while true; do
|
||||||
./menu.sh
|
if [ -z "${1}" ]; then
|
||||||
|
./init.sh || break
|
||||||
|
./menu.sh || break
|
||||||
|
else
|
||||||
|
./init.sh || break
|
||||||
|
./menu.sh modelMenu "${1}" || break
|
||||||
|
./menu.sh productversMenu "7.2" || break
|
||||||
|
./menu.sh make -1 || break
|
||||||
|
./menu.sh cleanCache || break
|
||||||
|
RET=0
|
||||||
|
fi
|
||||||
|
done
|
||||||
popd
|
popd
|
||||||
echo "OK."
|
[ ${RET} -ne 0 ] && echo "Failed." || echo "Success."
|
||||||
|
return ${RET}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pack() {
|
function pack() {
|
||||||
@ -100,7 +114,7 @@ function pack() {
|
|||||||
fi
|
fi
|
||||||
. $(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/rr.env
|
. $(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)/rr.env
|
||||||
|
|
||||||
RRIMGPATH="$(realpath ${2:-"rr.img"})"
|
RRIMGPATH="$(realpath ${1:-"rr.img"})"
|
||||||
if [ ! -f "${RRIMGPATH}" ]; then
|
if [ ! -f "${RRIMGPATH}" ]; then
|
||||||
gzip -dc "${CHROOT_PATH}/initrd/opt/rr/grub.img.gz" >"${RRIMGPATH}"
|
gzip -dc "${CHROOT_PATH}/initrd/opt/rr/grub.img.gz" >"${RRIMGPATH}"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user