forked from RROrg/rr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
2,161 additions
and
1,810 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ cache | |
files/initrd/opt/rr/lang/*.mo | ||
tests | ||
/extractor | ||
/br |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
RR_VERSION="23.10.4" | ||
RR_TITLE="rr v${RR_VERSION}" | ||
RR_TITLE="RR v${RR_VERSION}" | ||
|
||
# Define paths | ||
|
||
PART1_PATH="/mnt/p1" | ||
PART2_PATH="/mnt/p2" | ||
PART3_PATH="/mnt/p3" | ||
DSMROOT_PATH="/mnt/dsmroot" | ||
TMP_PATH="/tmp" | ||
|
||
UNTAR_PAT_PATH="${TMP_PATH}/pat" | ||
RAMDISK_PATH="${TMP_PATH}/ramdisk" | ||
LOG_FILE="${TMP_PATH}/log.txt" | ||
|
||
USER_CONFIG_FILE="${BOOTLOADER_PATH}/user-config.yml" | ||
GRUB_PATH="${BOOTLOADER_PATH}/boot/grub" | ||
USER_CONFIG_FILE="${PART1_PATH}/user-config.yml" | ||
GRUB_PATH="${PART1_PATH}/boot/grub" | ||
|
||
ORI_ZIMAGE_FILE="${SLPART_PATH}/zImage" | ||
ORI_RDGZ_FILE="${SLPART_PATH}/rd.gz" | ||
ORI_ZIMAGE_FILE="${PART2_PATH}/zImage" | ||
ORI_RDGZ_FILE="${PART2_PATH}/rd.gz" | ||
|
||
RR_BZIMAGE_FILE="${CACHE_PATH}/bzImage-rr" | ||
RR_RAMDISK_FILE="${CACHE_PATH}/initrd-rr" | ||
MOD_ZIMAGE_FILE="${CACHE_PATH}/zImage-dsm" | ||
MOD_RDGZ_FILE="${CACHE_PATH}/initrd-dsm" | ||
ADDONS_PATH="${CACHE_PATH}/addons" | ||
LKM_PATH="${CACHE_PATH}/lkms" | ||
MODULES_PATH="${CACHE_PATH}/modules" | ||
USER_UP_PATH="${CACHE_PATH}/users" | ||
RR_BZIMAGE_FILE="${PART3_PATH}/bzImage-rr" | ||
RR_RAMDISK_FILE="${PART3_PATH}/initrd-rr" | ||
MOD_ZIMAGE_FILE="${PART3_PATH}/zImage-dsm" | ||
MOD_RDGZ_FILE="${PART3_PATH}/initrd-dsm" | ||
|
||
MODEL_CONFIG_PATH="/opt/rr/model-configs" | ||
INCLUDE_PATH="/opt/rr/include" | ||
PATCH_PATH="/opt/rr/patch" | ||
LKM_PATH="${PART3_PATH}/lkms" | ||
ADDONS_PATH="${PART3_PATH}/addons" | ||
MODULES_PATH="${PART3_PATH}/modules" | ||
USER_UP_PATH="${PART3_PATH}/users" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2022 Ing <https://github.com/wjz304> | ||
# | ||
# This is free software, licensed under the MIT License. | ||
# See /LICENSE for more information. | ||
# | ||
|
||
import os, click | ||
|
||
WORK_PATH = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
@click.group() | ||
def cli(): | ||
""" | ||
The CLI is a commands to arpl. | ||
""" | ||
pass | ||
|
||
@cli.command() | ||
@click.option('-d', "--data", type=str, required=True, help="The data of QRCode.") | ||
@click.option('-l', "--location", type=str, required=True, help="The location of QRCode. (tl, tr, bl, br, mid)") | ||
@click.option('-o', "--output", type=str, required=True, help="The output file of QRCode.") | ||
def makeqr(data, location, output): | ||
""" | ||
Generate a QRCode. | ||
""" | ||
import qrcode | ||
from PIL import Image | ||
qr = qrcode.QRCode(version=1, box_size=10, error_correction=qrcode.constants.ERROR_CORRECT_H, border=4) | ||
qr.add_data(data) | ||
qr.make(fit=True) | ||
img = qr.make_image(fill_color="purple", back_color="white") | ||
img = img.convert("RGBA") | ||
pixels = img.load() | ||
for i in range(img.size[0]): | ||
for j in range(img.size[1]): | ||
if pixels[i, j] == (255, 255, 255, 255): | ||
pixels[i, j] = (255, 255, 255, 0) | ||
|
||
if os.path.exists(os.path.join(WORK_PATH, "logo.png")): | ||
icon = Image.open(os.path.join(WORK_PATH, "logo.png")) | ||
icon = icon.convert("RGBA") | ||
img.paste(icon.resize((int(img.size[0] / 5), int(img.size[1] / 5))), (int((img.size[0] - int(img.size[0] / 5)) / 2), int((img.size[1] - int(img.size[1] / 5)) / 2))) | ||
|
||
alpha = Image.new("RGBA", (img.size[0] * 4, img.size[1] * 3), (0, 0, 0, 0)) | ||
if location == "tl": | ||
loc = (0, 0) | ||
elif location == "tr": | ||
loc = (alpha.size[0] - img.size[0], 0) | ||
elif location == "bl": | ||
loc = (0, alpha.size[1] - img.size[1]) | ||
elif location == "br": | ||
loc = (alpha.size[0] - img.size[0], alpha.size[1] - img.size[1]) | ||
else: # elif location == "mid": | ||
loc = (int((alpha.size[0] - img.size[0]) / 2), int((alpha.size[1] - img.size[1]) / 2)) | ||
|
||
alpha.paste(img, loc) | ||
alpha.save(output) | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() |
Oops, something went wrong.