From 5d344ed6a909ffde2b33abed339a40ab78b5c8f1 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 13:44:14 +0100 Subject: [PATCH 01/15] tree: update Signed-off-by: AuxXxilium --- files/initrd/opt/arc/init.sh | 30 +- img-gen-n.sh | 1 + img-gen-s.sh | 1 + scripts/func.sh | 8 + scripts/make/makeself-header.sh | 714 +++++++++++++++++++++++++++++ scripts/make/makeself.1 | 158 +++++++ scripts/make/makeself.sh | 776 ++++++++++++++++++++++++++++++++ 7 files changed, 1676 insertions(+), 12 deletions(-) create mode 100755 scripts/make/makeself-header.sh create mode 100644 scripts/make/makeself.1 create mode 100755 scripts/make/makeself.sh diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index 22619f40..727687b3 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -5,9 +5,26 @@ set -e . "${ARC_PATH}/include/functions.sh" +function loadArcOverlay() { + echo -e "\033[1;34mLoading Arc Overlay...\033[0m" + echo + echo -e "Use \033[1;34mDisplay Output\033[0m or \033[1;34mhttp://${IPCON}:${TTYDPORT}\033[0m to configure Loader." + + # Check memory and load Arc + RAM=$(awk '/MemTotal:/ {printf "%.0f", $2 / 1024}' /proc/meminfo 2>/dev/null) + if [ ${RAM} -le 3500 ]; then + echo -e "\033[1;31mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of RAM.\033[0m\n\033[1;31mUse arc.sh to proceed. Not recommended!\033[0m" + else + exec arc.sh + fi +} + # Get Loader Disk Bus [ -z "${LOADER_DISK}" ] && die "Loader Disk not found!" checkBootLoader || die "The loader is corrupted, please rewrite it!" + +[ -f "${HOME}/.initialized" ] && loadArcOverlay && exit 0 || true + BUS=$(getBus "${LOADER_DISK}") EFI=$([ -d /sys/firmware/efi ] && echo 1 || echo 0) @@ -214,16 +231,5 @@ mkdir -p "${USER_UP_PATH}" touch "${HOME}/.initialized" # Load Arc Overlay -echo -e "\033[1;34mLoading Arc Overlay...\033[0m" -echo -echo -e "Use \033[1;34mDisplay Output\033[0m or \033[1;34mhttp://${IPCON}:${TTYDPORT}\033[0m to configure Loader." - -# Check memory and load Arc -RAM=$(awk '/MemTotal:/ {printf "%.0f", $2 / 1024}' /proc/meminfo 2>/dev/null) -if [ ${RAM} -le 3500 ]; then - echo -e "\033[1;31mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of RAM.\033[0m\n\033[1;31mUse arc.sh to proceed. Not recommended!\033[0m" -else - exec arc.sh -fi - +loadArcOverlay exit 0 \ No newline at end of file diff --git a/img-gen-n.sh b/img-gen-n.sh index 2dfb0389..65fdf6d0 100755 --- a/img-gen-n.sh +++ b/img-gen-n.sh @@ -46,6 +46,7 @@ echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH echo "Repack initrd" if [ -f "brx/bzImage-arc" ] && [ -f "brx/initrd-arc" ]; then cp -f "brx/bzImage-arc" "files/p3/bzImage-arc" + createArc repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc" else sudo umount "/tmp/p1" diff --git a/img-gen-s.sh b/img-gen-s.sh index ca1c8f77..ff140a8c 100755 --- a/img-gen-s.sh +++ b/img-gen-s.sh @@ -45,6 +45,7 @@ echo "${ARC_BRANCH}" >files/p1/ARC-BRANCH echo "Repack initrd" if [ -f "brs/bzImage-arc" ] && [ -f "brs/initrd-arc" ]; then cp -f "brs/bzImage-arc" "files/p3/bzImage-arc" + createArc repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc" else sudo umount "/tmp/p1" diff --git a/scripts/func.sh b/scripts/func.sh index cc9a702b..5580d05f 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -483,4 +483,12 @@ function copyBuildroot() { mkdir -p "${DEST_PATH}" cp -f "../${DEST_PATH}/bzImage" "${DEST_PATH}/bzImage-arc" cp -f "../${DEST_PATH}/rootfs.cpio.zst" "${DEST_PATH}/initrd-arc" +} + +# create arc executable +function createArc() { + ./scripts/make/makeself.sh ../arc/files/initrd/opt/arc arc arc ./init.sh --current --zstd --chown --threads=0 --quiet + rm -rf ../arc/files/initrd/opt/arc + mkdir -p ../arc/files/initrd/opt/arc + mv -f arc ../arc/files/initrd/opt/arc/ } \ No newline at end of file diff --git a/scripts/make/makeself-header.sh b/scripts/make/makeself-header.sh new file mode 100755 index 00000000..17bf32d3 --- /dev/null +++ b/scripts/make/makeself-header.sh @@ -0,0 +1,714 @@ +cat << EOF > "$archname" +#!/bin/sh +# This script was generated using Makeself $MS_VERSION +# The license covering this archive and its contents, if any, is wholly independent of the Makeself license (GPL) + +ORIG_UMASK=\`umask\` +if test "$KEEP_UMASK" = n; then + umask 077 +fi + +CRCsum="$CRCsum" +MD5="$MD5sum" +SHA="$SHAsum" +SIGNATURE="$Signature" +TMPROOT=\${TMPDIR:=/tmp} +USER_PWD="\$PWD" +export USER_PWD +ARCHIVE_DIR=\`dirname "\$0"\` +export ARCHIVE_DIR + +label="$LABEL" +script="$SCRIPT" +scriptargs="$SCRIPTARGS" +cleanup_script="${CLEANUP_SCRIPT}" +licensetxt="$LICENSE" +helpheader="${HELPHEADER}" +targetdir="$archdirname" +filesizes="$filesizes" +totalsize="$totalsize" +keep="$KEEP" +nooverwrite="$NOOVERWRITE" +quiet="n" +accept="n" +nodiskspace="n" +export_conf="$EXPORT_CONF" +decrypt_cmd="$DECRYPT_CMD" +skip="$SKIP" + +print_cmd_arg="" +if type printf > /dev/null; then + print_cmd="printf" +elif test -x /usr/ucb/echo; then + print_cmd="/usr/ucb/echo" +else + print_cmd="echo" +fi + +if test -d /usr/xpg4/bin; then + PATH=/usr/xpg4/bin:\$PATH + export PATH +fi + +if test -d /usr/sfw/bin; then + PATH=\$PATH:/usr/sfw/bin + export PATH +fi + +unset CDPATH + +MS_Printf() +{ + \$print_cmd \$print_cmd_arg "\$1" +} + +MS_PrintLicense() +{ + PAGER=\${PAGER:=more} + if test x"\$licensetxt" != x; then + PAGER_PATH=\`exec <&- 2>&-; which \$PAGER || command -v \$PAGER || type \$PAGER\` + if test -x "\$PAGER_PATH"; then + echo "\$licensetxt" | \$PAGER + else + echo "\$licensetxt" + fi + if test x"\$accept" != xy; then + while true + do + MS_Printf "Please type y to accept, n otherwise: " + read yn + if test x"\$yn" = xn; then + keep=n + eval \$finish; exit 1 + break; + elif test x"\$yn" = xy; then + break; + fi + done + fi + fi +} + +MS_diskspace() +{ + ( + df -k "\$1" | tail -1 | awk '{ if (\$4 ~ /%/) {print \$3} else {print \$4} }' + ) +} + +MS_dd() +{ + blocks=\`expr \$3 / 1024\` + bytes=\`expr \$3 % 1024\` + # Test for ibs, obs and conv feature + if dd if=/dev/zero of=/dev/null count=1 ibs=512 obs=512 conv=sync 2> /dev/null; then + dd if="\$1" ibs=\$2 skip=1 obs=1024 conv=sync 2> /dev/null | \\ + { test \$blocks -gt 0 && dd ibs=1024 obs=1024 count=\$blocks ; \\ + test \$bytes -gt 0 && dd ibs=1 obs=1024 count=\$bytes ; } 2> /dev/null + else + dd if="\$1" bs=\$2 skip=1 2> /dev/null + fi +} + +MS_dd_Progress() +{ + if test x"\$noprogress" = xy; then + MS_dd "\$@" + return \$? + fi + file="\$1" + offset=\$2 + length=\$3 + pos=0 + bsize=4194304 + while test \$bsize -gt \$length; do + bsize=\`expr \$bsize / 4\` + done + blocks=\`expr \$length / \$bsize\` + bytes=\`expr \$length % \$bsize\` + ( + dd ibs=\$offset skip=1 count=1 2>/dev/null + pos=\`expr \$pos \+ \$bsize\` + MS_Printf " 0%% " 1>&2 + if test \$blocks -gt 0; then + while test \$pos -le \$length; do + dd bs=\$bsize count=1 2>/dev/null + pcent=\`expr \$length / 100\` + pcent=\`expr \$pos / \$pcent\` + if test \$pcent -lt 100; then + MS_Printf "\b\b\b\b\b\b\b" 1>&2 + if test \$pcent -lt 10; then + MS_Printf " \$pcent%% " 1>&2 + else + MS_Printf " \$pcent%% " 1>&2 + fi + fi + pos=\`expr \$pos \+ \$bsize\` + done + fi + if test \$bytes -gt 0; then + dd bs=\$bytes count=1 2>/dev/null + fi + MS_Printf "\b\b\b\b\b\b\b" 1>&2 + MS_Printf " 100%% " 1>&2 + ) < "\$file" +} + +MS_Help() +{ + cat << EOH >&2 +Makeself version $MS_VERSION + 1) Getting help or info about \$0 : + \$0 --help Print this message + \$0 --info Print embedded info : title, default target directory, embedded script ... + \$0 --lsm Print embedded lsm entry (or no LSM) + \$0 --list Print the list of files in the archive + \$0 --check Checks integrity of the archive + \$0 --verify-sig key Verify signature agains a provided key id + + 2) Running \$0 : + \$0 [options] [--] [additional arguments to embedded script] + with following options (in that order) + --confirm Ask before running embedded script + --quiet Do not print anything except error messages + --accept Accept the license + --noexec Do not run embedded script (implies --noexec-cleanup) + --noexec-cleanup Do not run embedded cleanup script + --keep Do not erase target directory after running + the embedded script + --noprogress Do not show the progress during the decompression + --nox11 Do not spawn an xterm + --nochown Do not give the target folder to the current user + --chown Give the target folder to the current user recursively + --nodiskspace Do not check for available disk space + --target dir Extract directly to a target directory (absolute or relative) + This directory may undergo recursive chown (see --nochown). + --tar arg1 [arg2 ...] Access the contents of the archive through the tar command + --ssl-pass-src src Use the given src as the source of password to decrypt the data + using OpenSSL. See "PASS PHRASE ARGUMENTS" in man openssl. + Default is to prompt the user to enter decryption password + on the current terminal. + --cleanup-args args Arguments to the cleanup script. Wrap in quotes to provide + multiple arguments. + -- Following arguments will be passed to the embedded script\${helpheader} +EOH +} + +MS_Verify_Sig() +{ + GPG_PATH=\`exec <&- 2>&-; which gpg || command -v gpg || type gpg\` + MKTEMP_PATH=\`exec <&- 2>&-; which mktemp || command -v mktemp || type mktemp\` + test -x "\$GPG_PATH" || GPG_PATH=\`exec <&- 2>&-; which gpg || command -v gpg || type gpg\` + test -x "\$MKTEMP_PATH" || MKTEMP_PATH=\`exec <&- 2>&-; which mktemp || command -v mktemp || type mktemp\` + offset=\`head -n "\$skip" "\$1" | wc -c | sed "s/ //g"\` + temp_sig=\`mktemp -t XXXXX\` + echo \$SIGNATURE | base64 --decode > "\$temp_sig" + gpg_output=\`MS_dd "\$1" \$offset \$totalsize | LC_ALL=C "\$GPG_PATH" --verify "\$temp_sig" - 2>&1\` + gpg_res=\$? + rm -f "\$temp_sig" + if test \$gpg_res -eq 0 && test \`echo \$gpg_output | grep -c Good\` -eq 1; then + if test \`echo \$gpg_output | grep -c \$sig_key\` -eq 1; then + test x"\$quiet" = xn && echo "GPG signature is good" >&2 + else + echo "GPG Signature key does not match" >&2 + exit 2 + fi + else + test x"\$quiet" = xn && echo "GPG signature failed to verify" >&2 + exit 2 + fi +} + +MS_Check() +{ + OLD_PATH="\$PATH" + PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"} + MD5_ARG="" + MD5_PATH=\`exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum\` + test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which md5 || command -v md5 || type md5\` + test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which digest || command -v digest || type digest\` + PATH="\$OLD_PATH" + + SHA_PATH=\`exec <&- 2>&-; which shasum || command -v shasum || type shasum\` + test -x "\$SHA_PATH" || SHA_PATH=\`exec <&- 2>&-; which sha256sum || command -v sha256sum || type sha256sum\` + + if test x"\$quiet" = xn; then + MS_Printf "Verifying archive integrity..." + fi + offset=\`head -n "\$skip" "\$1" | wc -c | sed "s/ //g"\` + fsize=\`cat "\$1" | wc -c | sed "s/ //g"\` + if test \$totalsize -ne \`expr \$fsize - \$offset\`; then + echo " Unexpected archive size." >&2 + exit 2 + fi + verb=\$2 + i=1 + for s in \$filesizes + do + crc=\`echo \$CRCsum | cut -d" " -f\$i\` + if test -x "\$SHA_PATH"; then + if test x"\`basename \$SHA_PATH\`" = xshasum; then + SHA_ARG="-a 256" + fi + sha=\`echo \$SHA | cut -d" " -f\$i\` + if test x"\$sha" = x0000000000000000000000000000000000000000000000000000000000000000; then + test x"\$verb" = xy && echo " \$1 does not contain an embedded SHA256 checksum." >&2 + else + shasum=\`MS_dd_Progress "\$1" \$offset \$s | eval "\$SHA_PATH \$SHA_ARG" | cut -b-64\`; + if test x"\$shasum" != x"\$sha"; then + echo "Error in SHA256 checksums: \$shasum is different from \$sha" >&2 + exit 2 + elif test x"\$quiet" = xn; then + MS_Printf " SHA256 checksums are OK." >&2 + fi + crc="0000000000"; + fi + fi + if test -x "\$MD5_PATH"; then + if test x"\`basename \$MD5_PATH\`" = xdigest; then + MD5_ARG="-a md5" + fi + md5=\`echo \$MD5 | cut -d" " -f\$i\` + if test x"\$md5" = x00000000000000000000000000000000; then + test x"\$verb" = xy && echo " \$1 does not contain an embedded MD5 checksum." >&2 + else + md5sum=\`MS_dd_Progress "\$1" \$offset \$s | eval "\$MD5_PATH \$MD5_ARG" | cut -b-32\`; + if test x"\$md5sum" != x"\$md5"; then + echo "Error in MD5 checksums: \$md5sum is different from \$md5" >&2 + exit 2 + elif test x"\$quiet" = xn; then + MS_Printf " MD5 checksums are OK." >&2 + fi + crc="0000000000"; verb=n + fi + fi + if test x"\$crc" = x0000000000; then + test x"\$verb" = xy && echo " \$1 does not contain a CRC checksum." >&2 + else + sum1=\`MS_dd_Progress "\$1" \$offset \$s | CMD_ENV=xpg4 cksum | awk '{print \$1}'\` + if test x"\$sum1" != x"\$crc"; then + echo "Error in checksums: \$sum1 is different from \$crc" >&2 + exit 2 + elif test x"\$quiet" = xn; then + MS_Printf " CRC checksums are OK." >&2 + fi + fi + i=\`expr \$i + 1\` + offset=\`expr \$offset + \$s\` + done + if test x"\$quiet" = xn; then + echo " All good." + fi +} + +MS_Decompress() +{ + if test x"\$decrypt_cmd" != x""; then + { eval "\$decrypt_cmd" || echo " ... Decryption failed." >&2; } | eval "$GUNZIP_CMD" + else + eval "$GUNZIP_CMD" + fi + + if test \$? -ne 0; then + echo " ... Decompression failed." >&2 + fi +} + +UnTAR() +{ + if test x"\$quiet" = xn; then + tar \$1vf - $UNTAR_EXTRA 2>&1 || { echo " ... Extraction failed." >&2; kill -15 \$$; } + else + tar \$1f - $UNTAR_EXTRA 2>&1 || { echo Extraction failed. >&2; kill -15 \$$; } + fi +} + +MS_exec_cleanup() { + if test x"\$cleanup" = xy && test x"\$cleanup_script" != x""; then + cleanup=n + cd "\$tmpdir" + eval "\"\$cleanup_script\" \$scriptargs \$cleanupargs" + fi +} + +MS_cleanup() +{ + echo 'Signal caught, cleaning up' >&2 + MS_exec_cleanup + cd "\$TMPROOT" + rm -rf "\$tmpdir" + eval \$finish; exit 15 +} + +finish=true +xterm_loop= +noprogress=$NOPROGRESS +nox11=$NOX11 +copy=$COPY +ownership=$OWNERSHIP +verbose=n +cleanup=y +cleanupargs= +sig_key= + +initargs="\$@" + +while true +do + case "\$1" in + -h | --help) + MS_Help + exit 0 + ;; + -q | --quiet) + quiet=y + noprogress=y + shift + ;; + --accept) + accept=y + shift + ;; + --info) + echo Identification: "\$label" + echo Target directory: "\$targetdir" + echo Uncompressed size: $USIZE KB + echo Compression: $COMPRESS + if test x"$ENCRYPT" != x""; then + echo Encryption: $ENCRYPT + fi + echo Date of packaging: $DATE + echo Built with Makeself version $MS_VERSION + echo Build command was: "$MS_COMMAND" + if test x"\$script" != x; then + echo Script run after extraction: + echo " " \$script \$scriptargs + fi + if test x"$copy" = xcopy; then + echo "Archive will copy itself to a temporary location" + fi + if test x"$NEED_ROOT" = xy; then + echo "Root permissions required for extraction" + fi + if test x"$KEEP" = xy; then + echo "directory \$targetdir is permanent" + else + echo "\$targetdir will be removed after extraction" + fi + exit 0 + ;; + --dumpconf) + echo LABEL=\"\$label\" + echo SCRIPT=\"\$script\" + echo SCRIPTARGS=\"\$scriptargs\" + echo CLEANUPSCRIPT=\"\$cleanup_script\" + echo archdirname=\"$archdirname\" + echo KEEP=$KEEP + echo NOOVERWRITE=$NOOVERWRITE + echo COMPRESS=$COMPRESS + echo filesizes=\"\$filesizes\" + echo totalsize=\"\$totalsize\" + echo CRCsum=\"\$CRCsum\" + echo MD5sum=\"\$MD5sum\" + echo SHAsum=\"\$SHAsum\" + echo SKIP=\"\$skip\" + exit 0 + ;; + --lsm) +cat << EOLSM +EOF +eval "$LSM_CMD" +cat << EOF >> "$archname" +EOLSM + exit 0 + ;; + --list) + echo Target directory: \$targetdir + offset=\`head -n "\$skip" "\$0" | wc -c | sed "s/ //g"\` + for s in \$filesizes + do + MS_dd "\$0" \$offset \$s | MS_Decompress | UnTAR t + offset=\`expr \$offset + \$s\` + done + exit 0 + ;; + --tar) + offset=\`head -n "\$skip" "\$0" | wc -c | sed "s/ //g"\` + arg1="\$2" + shift 2 || { MS_Help; exit 1; } + for s in \$filesizes + do + MS_dd "\$0" \$offset \$s | MS_Decompress | tar "\$arg1" - "\$@" + offset=\`expr \$offset + \$s\` + done + exit 0 + ;; + --check) + MS_Check "\$0" y + exit 0 + ;; + --verify-sig) + sig_key="\$2" + shift 2 || { MS_Help; exit 1; } + MS_Verify_Sig "\$0" + ;; + --confirm) + verbose=y + shift + ;; + --noexec) + script="" + cleanup_script="" + shift + ;; + --noexec-cleanup) + cleanup_script="" + shift + ;; + --keep) + keep=y + shift + ;; + --target) + keep=y + targetdir="\${2:-.}" + shift 2 || { MS_Help; exit 1; } + ;; + --noprogress) + noprogress=y + shift + ;; + --nox11) + nox11=y + shift + ;; + --nochown) + ownership=n + shift + ;; + --chown) + ownership=y + shift + ;; + --nodiskspace) + nodiskspace=y + shift + ;; + --xwin) + if test "$NOWAIT" = n; then + finish="echo Press Return to close this window...; read junk" + fi + xterm_loop=1 + shift + ;; + --phase2) + copy=phase2 + shift + ;; + --ssl-pass-src) + if test x"$ENCRYPT" != x"openssl"; then + echo "Invalid option --ssl-pass-src: \$0 was not encrypted with OpenSSL!" >&2 + exit 1 + fi + decrypt_cmd="\$decrypt_cmd -pass \$2" + shift 2 || { MS_Help; exit 1; } + ;; + --cleanup-args) + cleanupargs="\$2" + shift 2 || { MS_Help; exit 1; } + ;; + --) + shift + break ;; + -*) + echo Unrecognized flag : "\$1" >&2 + MS_Help + exit 1 + ;; + *) + break ;; + esac +done + +if test x"\$quiet" = xy -a x"\$verbose" = xy; then + echo Cannot be verbose and quiet at the same time. >&2 + exit 1 +fi + +if test x"$NEED_ROOT" = xy -a \`id -u\` -ne 0; then + echo "Administrative privileges required for this archive (use su or sudo)" >&2 + exit 1 +fi + +if test x"\$copy" \!= xphase2; then + MS_PrintLicense +fi + +case "\$copy" in +copy) + tmpdir="\$TMPROOT"/makeself.\$RANDOM.\`date +"%y%m%d%H%M%S"\`.\$\$ + mkdir "\$tmpdir" || { + echo "Could not create temporary directory \$tmpdir" >&2 + exit 1 + } + SCRIPT_COPY="\$tmpdir/makeself" + echo "Copying to a temporary location..." >&2 + cp "\$0" "\$SCRIPT_COPY" + chmod +x "\$SCRIPT_COPY" + cd "\$TMPROOT" + export USER_PWD="\$tmpdir" + exec "\$SCRIPT_COPY" --phase2 -- \$initargs + ;; +phase2) + finish="\$finish ; rm -rf \`dirname \$0\`" + ;; +esac + +if test x"\$nox11" = xn; then + if test -t 1; then # Do we have a terminal on stdout? + : + else + if test x"\$DISPLAY" != x -a x"\$xterm_loop" = x; then # No, but do we have X? + if xset q > /dev/null 2>&1; then # Check for valid DISPLAY variable + GUESS_XTERMS="xterm gnome-terminal rxvt dtterm eterm Eterm xfce4-terminal lxterminal kvt konsole aterm terminology" + for a in \$GUESS_XTERMS; do + if type \$a >/dev/null 2>&1; then + XTERM=\$a + break + fi + done + chmod a+x \$0 || echo Please add execution rights on \$0 >&2 + if test \`echo "\$0" | cut -c1\` = "/"; then # Spawn a terminal! + exec \$XTERM -e "\$0 --xwin \$initargs" + else + exec \$XTERM -e "./\$0 --xwin \$initargs" + fi + fi + fi + fi +fi + +if test x"\$targetdir" = x.; then + tmpdir="." +else + if test x"\$keep" = xy; then + if test x"\$nooverwrite" = xy && test -d "\$targetdir"; then + echo "Target directory \$targetdir already exists, aborting." >&2 + exit 1 + fi + if test x"\$quiet" = xn; then + echo "Creating directory \$targetdir" >&2 + fi + tmpdir="\$targetdir" + dashp="-p" + else + tmpdir="\$TMPROOT/selfgz\$\$\$RANDOM" + dashp="" + fi + mkdir \$dashp "\$tmpdir" || { + echo 'Cannot create target directory' \$tmpdir >&2 + echo 'You should try option --target dir' >&2 + eval \$finish + exit 1 + } +fi + +location="\`pwd\`" +if test x"\$SETUP_NOCHECK" != x1; then + MS_Check "\$0" +fi +offset=\`head -n "\$skip" "\$0" | wc -c | sed "s/ //g"\` + +if test x"\$verbose" = xy; then + MS_Printf "About to extract $USIZE KB in \$tmpdir ... Proceed ? [Y/n] " + read yn + if test x"\$yn" = xn; then + eval \$finish; exit 1 + fi +fi + +if test x"\$quiet" = xn; then + # Decrypting with openssl will ask for password, + # the prompt needs to start on new line + if test x"$ENCRYPT" = x"openssl"; then + echo "Decrypting and uncompressing \$label..." + else + MS_Printf "Uncompressing \$label" + fi +fi +res=3 +if test x"\$keep" = xn; then + trap MS_cleanup 1 2 3 15 +fi + +if test x"\$nodiskspace" = xn; then + leftspace=\`MS_diskspace "\$tmpdir"\` + if test -n "\$leftspace"; then + if test "\$leftspace" -lt $USIZE; then + echo + echo "Not enough space left in "\`dirname \$tmpdir\`" (\$leftspace KB) to decompress \$0 ($USIZE KB)" >&2 + echo "Use --nodiskspace option to skip this check and proceed anyway" >&2 + if test x"\$keep" = xn; then + echo "Consider setting TMPDIR to a directory with more free space." + fi + eval \$finish; exit 1 + fi + fi +fi + +for s in \$filesizes +do + if MS_dd_Progress "\$0" \$offset \$s | MS_Decompress | ( cd "\$tmpdir"; umask \$ORIG_UMASK ; UnTAR xp ) 1>/dev/null; then + if test x"\$ownership" = xy; then + (cd "\$tmpdir"; chown -R \`id -u\` .; chgrp -R \`id -g\` .) + fi + else + echo >&2 + echo "Unable to decompress \$0" >&2 + eval \$finish; exit 1 + fi + offset=\`expr \$offset + \$s\` +done +if test x"\$quiet" = xn; then + echo +fi + +cd "\$tmpdir" +res=0 +if test x"\$script" != x; then + if test x"\$export_conf" = x"y"; then + MS_BUNDLE="\$0" + MS_LABEL="\$label" + MS_SCRIPT="\$script" + MS_SCRIPTARGS="\$scriptargs" + MS_ARCHDIRNAME="\$archdirname" + MS_KEEP="\$KEEP" + MS_NOOVERWRITE="\$NOOVERWRITE" + MS_COMPRESS="\$COMPRESS" + MS_CLEANUP="\$cleanup" + export MS_BUNDLE MS_LABEL MS_SCRIPT MS_SCRIPTARGS + export MS_ARCHDIRNAME MS_KEEP MS_NOOVERWRITE MS_COMPRESS + fi + + if test x"\$verbose" = x"y"; then + MS_Printf "OK to execute: \$script \$scriptargs \$* ? [Y/n] " + read yn + if test x"\$yn" = x -o x"\$yn" = xy -o x"\$yn" = xY; then + eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$?; + fi + else + eval "\"\$script\" \$scriptargs \"\\\$@\""; res=\$? + fi + if test "\$res" -ne 0; then + test x"\$verbose" = xy && echo "The program '\$script' returned an error code (\$res)" >&2 + fi +fi + +MS_exec_cleanup + +if test x"\$keep" = xn; then + cd "\$TMPROOT" + rm -rf "\$tmpdir" +fi +eval \$finish; exit \$res +EOF diff --git a/scripts/make/makeself.1 b/scripts/make/makeself.1 new file mode 100644 index 00000000..392384e7 --- /dev/null +++ b/scripts/make/makeself.1 @@ -0,0 +1,158 @@ +.TH "MAKESELF" "1" "2.5.0" +.SH "NAME" +makeself \- An utility to generate self-extractable archives. +.SH "SYNTAX" +.B makeself [\fIoptions\fP] archive_dir file_name label +.B [\fIstartup_script\fP] [\fIargs\fP] +.SH "DESCRIPTION" +This program is a free (GPL) shell utility designed to create self-extractable +compressed archives from a directory. The resulting file appears as a shell script, and can be launched as is. The archive +will then uncompress itself to a temporary directory and an optional arbitrary +command will be executed (for example an installation script). +.TP +Makeself archives also include checksums for integrity self-validation (CRC and/or MD5/SHA256 checksums). +.SH "OPTIONS" +The following options are supported: +.TP 15 +.B -v, --version +Prints out the makeself version number and exits. +.TP +.B -h, --help +Print out help information. +.TP +.B --tar-quietly +Suppress verbose output from the tar command +.TP +.B --quiet +Do not print any messages other than errors +.TP +.B --gzip +Compress using gzip (default if detected). +.TP +.B --bzip2 +Compress using bzip2. +.TP +.B --bzip3 +Compress using bzip3. +.TP +.B --pbzip2 +Compress using pbzip2. +.TP +.B --xz +Compress using xz. +.TP +.B --lzo +Compress using lzop. +.TP +.B --lz4 +Compress using lz4. +.TP +.B --pigz +Compress using pigz. +.TP +.B --zstd +Compress using zstd. +.TP +.B --base64 +Encode the archive to ASCII in Base64 format instead of compressing (base64 command required). +.TP +.B --gpg-encrypt +Encrypt the archive using GPG. This will prompt for a password to encrypt with. +.TP +.B --ssl-encrypt +Encrypt the archive using OpenSSL. This will prompt for a password to encrypt with. +.TP +.B --keep-umask +Keep the umask set to shell default, rather than overriding when executing the self-extracting archive. +.TP +.B --compress +Compress using the UNIX 'compress' command. +.TP +.B --nocomp +Do not compress the data. +.TP +.B --complevel lvl +Specify the compression level for gzip, bzip2, pbzip2, xz, zstd, lzo or lz4. Defaults to 9. +.TP +.B --threads num +Specify the number of threads to be used by compressors that support parallelization. +.TP +.B --tar-format opt + Specify the tar archive format (default is ustar); you may use any value accepted by your tar command (such as posix, v7, etc). +.TP +.B --tar-extra opt +Append more options to the tar command line. +.TP +.B --notemp +The archive will create archive_dir in the current directory and +uncompress in ./archive_dir. +.TP +.B --copy +Upon extraction, the archive will first copy itself to a temporary directory. +.TP +.B --append +Append more files to an existing makeself archive. The label and startup scripts will then be ignored. +.TP +.B --current +Files will be extracted to the current directory. Both --current and --target dir imply --notemp. +.TP +.B --target dir +Extract directly to a target directory. Directory path can be either absolute or relative. +.TP +.B --header file +Specify location of the header script. +.TP +.B --help-header file +Add a header to the archive's help output. +.TP +.B --cleanup file +Specify a cleanup script that executes on interrupt and when finished successfully. +.TP +.B --follow +Follow the symlinks in the archive. +.TP +.B --noprogress +Do not show the progress during the decompression. +.TP +.B --nooverwrite +Do not extract the archive if the target directory already exists. +.TP +.B --nox11 +Disable automatic spawn of an xterm if running in X11. +.TP +.B --nowait +Do not wait for user input after executing embedded program from an xterm. +.TP +.B --nomd5 +Do not create a MD5 checksum for the archive. +.TP +.B --sha256 +Adds a SHA256 checksum for the archive. +.TP +.B --nocrc +Do not create a CRC32 checksum for the archive. +.TP +.B --lsm file +LSM file describing the package. +.TP +.B --license file +Append a license file. +.TP +.B --packaging-date date +Use provided string as the packaging date instead of the current date. +.TP +.SH "EXAMPLES" +Here is an example, assuming the user has a package image stored in a /home/joe/mysoft, +and he wants to generate a self-extracting package named mysoft.sh, which will launch +the "setup" script initially stored in /home/joe/mysoft: +.TP +makeself.sh /home/joe/mysoft mysoft.sh "Joe's Nice Software Package" ./setup +.TP +Here is also how I created the makeself.run archive which contains the Makeself distribution: +.TP +makeself.sh --notemp makeself makeself.run "Makeself by Stephane Peter" echo "Makeself has extracted itself" +.SH "AUTHORS" +Makeself has been written by Stephane Peter . +.BR +This man page was originally written by Bartosz Fenski for the +Debian GNU/Linux distribution (but it may be used by others). diff --git a/scripts/make/makeself.sh b/scripts/make/makeself.sh new file mode 100755 index 00000000..aa55dc0e --- /dev/null +++ b/scripts/make/makeself.sh @@ -0,0 +1,776 @@ +#!/bin/sh +# +# Makeself version 2.5.x +# by Stephane Peter +# +# Utility to create self-extracting tar.gz archives. +# The resulting archive is a file holding the tar.gz archive with +# a small Shell script stub that uncompresses the archive to a temporary +# directory and then executes a given script from withing that directory. +# +# Makeself home page: https://makeself.io/ - Version history available on GitHub +# +# (C) 1998-2023 by Stephane Peter +# +# This software is released under the terms of the GNU GPL version 2 and above +# Please read the license at http://www.gnu.org/copyleft/gpl.html +# Self-extracting archives created with this script are explictly NOT released under the term of the GPL +# + +MS_VERSION=2.5.0 +MS_COMMAND="$0" +unset CDPATH + +for f in ${1+"$@"}; do + MS_COMMAND="$MS_COMMAND \\\\ + \\\"$f\\\"" +done + +# For Solaris systems +if test -d /usr/xpg4/bin; then + PATH=/usr/xpg4/bin:$PATH + export PATH +fi + +# Procedures + +MS_Usage() +{ + echo "Usage: $0 [args] archive_dir file_name label startup_script [script_args]" + echo "args can be one or more of the following :" + echo " --version | -v : Print out Makeself version number and exit" + echo " --help | -h : Print out this help message" + echo " --tar-quietly : Suppress verbose output from the tar command" + echo " --quiet | -q : Do not print any messages other than errors." + echo " --gzip : Compress using gzip (default if detected)" + echo " --pigz : Compress with pigz" + echo " --zstd : Compress with zstd" + echo " --bzip2 : Compress using bzip2 instead of gzip" + echo " --pbzip2 : Compress using pbzip2 instead of gzip" + echo " --bzip3 : Compress using bzip3 instead of gzip" + echo " --xz : Compress using xz instead of gzip" + echo " --lzo : Compress using lzop instead of gzip" + echo " --lz4 : Compress using lz4 instead of gzip" + echo " --compress : Compress using the UNIX 'compress' command" + echo " --complevel lvl : Compression level for gzip pigz zstd xz lzo lz4 bzip2 pbzip2 and bzip3 (default 9)" + echo " --threads thds : Number of threads to be used by compressors that support parallelization." + echo " Omit to use compressor's default. Most useful (and required) for opting" + echo " into xz's threading, usually with '--threads=0' for all available cores." + echo " pbzip2 and pigz are parallel by default, and setting this value allows" + echo " limiting the number of threads they use." + echo " --base64 : Instead of compressing, encode the data using base64" + echo " --gpg-encrypt : Instead of compressing, encrypt the data using GPG" + echo " --gpg-asymmetric-encrypt-sign" + echo " : Instead of compressing, asymmetrically encrypt and sign the data using GPG" + echo " --gpg-extra opt : Append more options to the gpg command line" + echo " --ssl-encrypt : Instead of compressing, encrypt the data using OpenSSL" + echo " --ssl-passwd pass : Use the given password to encrypt the data using OpenSSL" + echo " --ssl-pass-src src : Use the given src as the source of password to encrypt the data" + echo " using OpenSSL. See \"PASS PHRASE ARGUMENTS\" in man openssl." + echo " If this option is not supplied, the user will be asked to enter" + echo " encryption password on the current terminal." + echo " --ssl-no-md : Do not use \"-md\" option not supported by older OpenSSL." + echo " --nochown : Do not give the target folder to the current user (default)" + echo " --chown : Give the target folder to the current user recursively" + echo " --nocomp : Do not compress the data" + echo " --notemp : The archive will create archive_dir in the current directory" + echo " and uncompress in ./archive_dir" + echo " Note: persistent archives do not strictly require a startup_script" + echo " --needroot : Check that the root user is extracting the archive before proceeding" + echo " --copy : Upon extraction, the archive will first copy itself to" + echo " a temporary directory" + echo " --append : Append more files to an existing Makeself archive" + echo " The label and startup scripts will then be ignored" + echo " --target dir : Extract directly to a target directory" + echo " directory path can be either absolute or relative" + echo " --current : Files will be extracted to the current directory" + echo " Both --current and --target imply --notemp, and do not require a startup_script" + echo " --nooverwrite : Do not extract the archive if the specified target directory exists" + echo " --tar-format opt : Specify a tar archive format (default is ustar)" + echo " --tar-extra opt : Append more options to the tar command line" + echo " --untar-extra opt : Append more options to the during the extraction of the tar archive" + echo " --nomd5 : Don't calculate an MD5 for archive" + echo " --nocrc : Don't calculate a CRC for archive" + echo " --sha256 : Compute a SHA256 checksum for the archive" + echo " --header file : Specify location of the header script" + echo " --cleanup file : Specify a cleanup script that executes on interrupt and when finished successfully." + echo " --follow : Follow the symlinks in the archive" + echo " --noprogress : Do not show the progress during the decompression" + echo " --nox11 : Disable automatic spawn of a xterm" + echo " --nowait : Do not wait for user input after executing embedded" + echo " program from an xterm" + echo " --sign passphrase : Signature private key to sign the package with" + echo " --lsm file : LSM file describing the package" + echo " --license file : Append a license file" + echo " --help-header file : Add a header to the archive's --help output" + echo " --packaging-date date" + echo " : Use provided string as the packaging date" + echo " instead of the current date." + echo + echo " --keep-umask : Keep the umask set to shell default, rather than overriding when executing self-extracting archive." + echo " --export-conf : Export configuration variables to startup_script" + echo + echo "Do not forget to give a fully qualified startup script name" + echo "(i.e. with a ./ prefix if inside the archive)." + exit 1 +} + +# Default settings +if type gzip >/dev/null 2>&1; then + COMPRESS=gzip +elif type compress >/dev/null 2>&1; then + COMPRESS=compress +else + echo "ERROR: missing commands: gzip, compress" >&2 + MS_Usage +fi +ENCRYPT=n +PASSWD="" +PASSWD_SRC="" +OPENSSL_NO_MD=n +COMPRESS_LEVEL=9 +DEFAULT_THREADS=123456 # Sentinel value +THREADS=$DEFAULT_THREADS +KEEP=n +CURRENT=n +NOX11=n +NOWAIT=n +APPEND=n +TAR_QUIETLY=n +KEEP_UMASK=n +QUIET=n +NOPROGRESS=n +COPY=none +NEED_ROOT=n +TAR_ARGS=rvf +TAR_FORMAT=ustar +TAR_EXTRA="" +GPG_EXTRA="" +DU_ARGS=-ks +HEADER=`dirname "$0"`/makeself-header.sh +SIGNATURE="" +TARGETDIR="" +NOOVERWRITE=n +DATE=`LC_ALL=C date` +EXPORT_CONF=n +SHA256=n +OWNERSHIP=n +SIGN=n +GPG_PASSPHRASE="" + +# LSM file stuff +LSM_CMD="echo No LSM. >> \"\$archname\"" + +while true +do + case "$1" in + --version | -v) + echo Makeself version $MS_VERSION + exit 0 + ;; + --pbzip2) + COMPRESS=pbzip2 + shift + ;; + --bzip3) + COMPRESS=bzip3 + shift + ;; + --bzip2) + COMPRESS=bzip2 + shift + ;; + --gzip) + COMPRESS=gzip + shift + ;; + --pigz) + COMPRESS=pigz + shift + ;; + --zstd) + COMPRESS=zstd + shift + ;; + --xz) + COMPRESS=xz + shift + ;; + --lzo) + COMPRESS=lzo + shift + ;; + --lz4) + COMPRESS=lz4 + shift + ;; + --compress) + COMPRESS=compress + shift + ;; + --base64) + COMPRESS=base64 + shift + ;; + --gpg-encrypt) + COMPRESS=gpg + shift + ;; + --gpg-asymmetric-encrypt-sign) + COMPRESS=gpg-asymmetric + shift + ;; + --gpg-extra) + GPG_EXTRA="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --ssl-encrypt) + ENCRYPT=openssl + shift + ;; + --ssl-passwd) + PASSWD=$2 + shift 2 || { MS_Usage; exit 1; } + ;; + --ssl-pass-src) + PASSWD_SRC=$2 + shift 2 || { MS_Usage; exit 1; } + ;; + --ssl-no-md) + OPENSSL_NO_MD=y + shift + ;; + --nocomp) + COMPRESS=none + shift + ;; + --complevel) + COMPRESS_LEVEL="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --threads) + THREADS="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --nochown) + OWNERSHIP=n + shift + ;; + --chown) + OWNERSHIP=y + shift + ;; + --notemp) + KEEP=y + shift + ;; + --copy) + COPY=copy + shift + ;; + --current) + CURRENT=y + KEEP=y + shift + ;; + --tar-format) + TAR_FORMAT="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --tar-extra) + TAR_EXTRA="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --untar-extra) + UNTAR_EXTRA="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --target) + TARGETDIR="$2" + KEEP=y + shift 2 || { MS_Usage; exit 1; } + ;; + --sign) + SIGN=y + GPG_PASSPHRASE="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --nooverwrite) + NOOVERWRITE=y + shift + ;; + --needroot) + NEED_ROOT=y + shift + ;; + --header) + HEADER="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --cleanup) + CLEANUP_SCRIPT="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --license) + # We need to escape all characters having a special meaning in double quotes + LICENSE=$(sed 's/\\/\\\\/g; s/"/\\\"/g; s/`/\\\`/g; s/\$/\\\$/g' "$2") + shift 2 || { MS_Usage; exit 1; } + ;; + --follow) + TAR_ARGS=rvhf + DU_ARGS=-ksL + shift + ;; + --noprogress) + NOPROGRESS=y + shift + ;; + --nox11) + NOX11=y + shift + ;; + --nowait) + NOWAIT=y + shift + ;; + --nomd5) + NOMD5=y + shift + ;; + --sha256) + SHA256=y + shift + ;; + --nocrc) + NOCRC=y + shift + ;; + --append) + APPEND=y + shift + ;; + --lsm) + LSM_CMD="awk 1 \"$2\" >> \"\$archname\"" + shift 2 || { MS_Usage; exit 1; } + ;; + --packaging-date) + DATE="$2" + shift 2 || { MS_Usage; exit 1; } + ;; + --help-header) + HELPHEADER=`sed -e "s/'/'\\\\\''/g" $2` + shift 2 || { MS_Usage; exit 1; } + [ -n "$HELPHEADER" ] && HELPHEADER="$HELPHEADER +" + ;; + --tar-quietly) + TAR_QUIETLY=y + shift + ;; + --keep-umask) + KEEP_UMASK=y + shift + ;; + --export-conf) + EXPORT_CONF=y + shift + ;; + -q | --quiet) + QUIET=y + shift + ;; + -h | --help) + MS_Usage + ;; + -*) + echo Unrecognized flag : "$1" + MS_Usage + ;; + *) + break + ;; + esac +done + +if test $# -lt 1; then + MS_Usage +else + if test -d "$1"; then + archdir="$1" + else + echo "Directory $1 does not exist." >&2 + exit 1 + fi +fi +archname="$2" + +if test "$QUIET" = "y" || test "$TAR_QUIETLY" = "y"; then + if test "$TAR_ARGS" = "rvf"; then + TAR_ARGS="rf" + elif test "$TAR_ARGS" = "rvhf"; then + TAR_ARGS="rhf" + fi +fi + +if test "$APPEND" = y; then + if test $# -lt 2; then + MS_Usage + fi + + # Gather the info from the original archive + OLDENV=`sh "$archname" --dumpconf` + if test $? -ne 0; then + echo "Unable to update archive: $archname" >&2 + exit 1 + else + eval "$OLDENV" + OLDSKIP=`expr $SKIP + 1` + fi +else + if test "$KEEP" = n -a $# = 3; then + echo "ERROR: Making a temporary archive with no embedded command does not make sense!" >&2 + echo >&2 + MS_Usage + fi + # We don't want to create an absolute directory unless a target directory is defined + if test "$CURRENT" = y; then + archdirname="." + elif test x"$TARGETDIR" != x; then + archdirname="$TARGETDIR" + else + archdirname=`basename "$1"` + fi + + if test $# -lt 3; then + MS_Usage + fi + + LABEL="$3" + SCRIPT="$4" + test "x$SCRIPT" = x || shift 1 + shift 3 + SCRIPTARGS="$*" +fi + +if test "$KEEP" = n -a "$CURRENT" = y; then + echo "ERROR: It is A VERY DANGEROUS IDEA to try to combine --notemp and --current." >&2 + exit 1 +fi + +case $COMPRESS in +gzip) + GZIP_CMD="gzip -c$COMPRESS_LEVEL" + GUNZIP_CMD="gzip -cd" + ;; +pigz) + GZIP_CMD="pigz -$COMPRESS_LEVEL" + if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated + GZIP_CMD="$GZIP_CMD --processes $THREADS" + fi + GUNZIP_CMD="gzip -cd" + ;; +zstd) + GZIP_CMD="zstd -$COMPRESS_LEVEL" + if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated + GZIP_CMD="$GZIP_CMD --threads=$THREADS" + fi + GUNZIP_CMD="zstd -cd" + ;; +pbzip2) + GZIP_CMD="pbzip2 -c$COMPRESS_LEVEL" + if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated + GZIP_CMD="$GZIP_CMD -p$THREADS" + fi + GUNZIP_CMD="bzip2 -d" + ;; +bzip3) + # Map the compression level to a block size in MiB as 2^(level-1). + BZ3_COMPRESS_LEVEL=`echo "2^($COMPRESS_LEVEL-1)" | bc` + GZIP_CMD="bzip3 -b$BZ3_COMPRESS_LEVEL" + if test $THREADS -ne $DEFAULT_THREADS; then # Leave as the default if threads not indicated + GZIP_CMD="$GZIP_CMD -j$THREADS" + fi + JOBS=`echo "10-$COMPRESS_LEVEL" | bc` + GUNZIP_CMD="bzip3 -dj$JOBS" + ;; +bzip2) + GZIP_CMD="bzip2 -$COMPRESS_LEVEL" + GUNZIP_CMD="bzip2 -d" + ;; +xz) + GZIP_CMD="xz -c$COMPRESS_LEVEL" + # Must opt-in by specifying a value since not all versions of xz support threads + if test $THREADS -ne $DEFAULT_THREADS; then + GZIP_CMD="$GZIP_CMD --threads=$THREADS" + fi + GUNZIP_CMD="xz -d" + ;; +lzo) + GZIP_CMD="lzop -c$COMPRESS_LEVEL" + GUNZIP_CMD="lzop -d" + ;; +lz4) + GZIP_CMD="lz4 -c$COMPRESS_LEVEL" + GUNZIP_CMD="lz4 -d" + ;; +base64) + GZIP_CMD="base64" + GUNZIP_CMD="base64 --decode -i -" + ;; +gpg) + GZIP_CMD="gpg $GPG_EXTRA -ac -z$COMPRESS_LEVEL" + GUNZIP_CMD="gpg -d" + ENCRYPT="gpg" + ;; +gpg-asymmetric) + GZIP_CMD="gpg $GPG_EXTRA -z$COMPRESS_LEVEL -es" + GUNZIP_CMD="gpg --yes -d" + ENCRYPT="gpg" + ;; +compress) + GZIP_CMD="compress -fc" + GUNZIP_CMD="(type compress >/dev/null 2>&1 && compress -fcd || gzip -cd)" + ;; +none) + GZIP_CMD="cat" + GUNZIP_CMD="cat" + ;; +esac + +if test x"$ENCRYPT" = x"openssl"; then + if test x"$APPEND" = x"y"; then + echo "Appending to existing archive is not compatible with OpenSSL encryption." >&2 + fi + + ENCRYPT_CMD="openssl enc -aes-256-cbc -salt" + DECRYPT_CMD="openssl enc -aes-256-cbc -d" + + if test x"$OPENSSL_NO_MD" != x"y"; then + ENCRYPT_CMD="$ENCRYPT_CMD -md sha256" + DECRYPT_CMD="$DECRYPT_CMD -md sha256" + fi + + if test -n "$PASSWD_SRC"; then + ENCRYPT_CMD="$ENCRYPT_CMD -pass $PASSWD_SRC" + elif test -n "$PASSWD"; then + ENCRYPT_CMD="$ENCRYPT_CMD -pass pass:$PASSWD" + fi +fi + +tmpfile="${TMPDIR:-/tmp}/mkself$$" + +if test -f "$HEADER"; then + oldarchname="$archname" + archname="$tmpfile" + # Generate a fake header to count its lines + SKIP=0 + . "$HEADER" + SKIP=`cat "$tmpfile" |wc -l` + # Get rid of any spaces + SKIP=`expr $SKIP` + rm -f "$tmpfile" + if test "$QUIET" = "n"; then + echo "Header is $SKIP lines long" >&2 + fi + archname="$oldarchname" +else + echo "Unable to open header file: $HEADER" >&2 + exit 1 +fi + +if test "$QUIET" = "n"; then + echo +fi + +if test "$APPEND" = n; then + if test -f "$archname"; then + echo "WARNING: Overwriting existing file: $archname" >&2 + fi +fi + +USIZE=`du $DU_ARGS "$archdir" | awk '{print $1}'` + +if test "." = "$archdirname"; then + if test "$KEEP" = n; then + archdirname="makeself-$$-`date +%Y%m%d%H%M%S`" + fi +fi + +test -d "$archdir" || { echo "Error: $archdir does not exist."; rm -f "$tmpfile"; exit 1; } +if test "$QUIET" = "n"; then + echo "About to compress $USIZE KB of data..." + echo "Adding files to archive named \"$archname\"..." +fi + +# See if we have GNU tar +TAR=`exec <&- 2>&-; which gtar || command -v gtar || type gtar` +test -x "$TAR" || TAR=`exec <&- 2>&-; which bsdtar || command -v bsdtar || type bsdtar` +test -x "$TAR" || TAR=tar + +tmparch="${TMPDIR:-/tmp}/mkself$$.tar" +( + if test "$APPEND" = "y"; then + tail -n "+$OLDSKIP" "$archname" | eval "$GUNZIP_CMD" > "$tmparch" + fi + cd "$archdir" + # "Determining if a directory is empty" + # https://www.etalabs.net/sh_tricks.html + find . \ + \( \ + ! -type d \ + -o \ + \( -links 2 -exec sh -c ' + is_empty () ( + cd "$1" + set -- .[!.]* ; test -f "$1" && return 1 + set -- ..?* ; test -f "$1" && return 1 + set -- * ; test -f "$1" && return 1 + return 0 + ) + is_empty "$0"' {} \; \ + \) \ + \) -print \ + | LC_ALL=C sort \ + | sed 's/./\\&/g' \ + | xargs $TAR $TAR_EXTRA --format $TAR_FORMAT -$TAR_ARGS "$tmparch" +) || { + echo "ERROR: failed to create temporary archive: $tmparch" + rm -f "$tmparch" "$tmpfile" + exit 1 +} + +USIZE=`du $DU_ARGS "$tmparch" | awk '{print $1}'` + +eval "$GZIP_CMD" <"$tmparch" >"$tmpfile" || { + echo "ERROR: failed to create temporary file: $tmpfile" + rm -f "$tmparch" "$tmpfile" + exit 1 +} +rm -f "$tmparch" + +if test x"$ENCRYPT" = x"openssl"; then + echo "About to encrypt archive \"$archname\"..." + { eval "$ENCRYPT_CMD -in $tmpfile -out ${tmpfile}.enc" && mv -f ${tmpfile}.enc $tmpfile; } || \ + { echo Aborting: could not encrypt temporary file: "$tmpfile".; rm -f "$tmpfile"; exit 1; } +fi + +fsize=`cat "$tmpfile" | wc -c | tr -d " "` + +# Compute the checksums + +shasum=0000000000000000000000000000000000000000000000000000000000000000 +md5sum=00000000000000000000000000000000 +crcsum=0000000000 + +if test "$NOCRC" = y; then + if test "$QUIET" = "n"; then + echo "skipping crc at user request" + fi +else + crcsum=`CMD_ENV=xpg4 cksum < "$tmpfile" | sed -e 's/ /Z/' -e 's/ /Z/' | cut -dZ -f1` + if test "$QUIET" = "n"; then + echo "CRC: $crcsum" + fi +fi + +if test "$SHA256" = y; then + SHA_PATH=`exec <&- 2>&-; which shasum || command -v shasum || type shasum` + if test -x "$SHA_PATH"; then + shasum=`eval "$SHA_PATH -a 256" < "$tmpfile" | cut -b-64` + else + SHA_PATH=`exec <&- 2>&-; which sha256sum || command -v sha256sum || type sha256sum` + shasum=`eval "$SHA_PATH" < "$tmpfile" | cut -b-64` + fi + if test "$QUIET" = "n"; then + if test -x "$SHA_PATH"; then + echo "SHA256: $shasum" + else + echo "SHA256: none, SHA command not found" + fi + fi +fi +if test "$NOMD5" = y; then + if test "$QUIET" = "n"; then + echo "Skipping md5sum at user request" + fi +else + # Try to locate a MD5 binary + OLD_PATH=$PATH + PATH=${GUESS_MD5_PATH:-"$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"} + MD5_ARG="" + MD5_PATH=`exec <&- 2>&-; which md5sum || command -v md5sum || type md5sum` + test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which md5 || command -v md5 || type md5` + test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which digest || command -v digest || type digest` + PATH=$OLD_PATH + if test -x "$MD5_PATH"; then + if test `basename ${MD5_PATH}`x = digestx; then + MD5_ARG="-a md5" + fi + md5sum=`eval "$MD5_PATH $MD5_ARG" < "$tmpfile" | cut -b-32` + if test "$QUIET" = "n"; then + echo "MD5: $md5sum" + fi + else + if test "$QUIET" = "n"; then + echo "MD5: none, MD5 command not found" + fi + fi +fi +if test "$SIGN" = y; then + GPG_PATH=`exec <&- 2>&-; which gpg || command -v gpg || type gpg` + if test -x "$GPG_PATH"; then + SIGNATURE=`$GPG_PATH --pinentry-mode=loopback --batch --yes $GPG_EXTRA --passphrase "$GPG_PASSPHRASE" --output - --detach-sig $tmpfile | base64 | tr -d \\\\n` + if test "$QUIET" = "n"; then + echo "Signature: $SIGNATURE" + fi + else + echo "Missing gpg command" >&2 + fi +fi + +totalsize=0 +for size in $fsize; +do + totalsize=`expr $totalsize + $size` +done + +if test "$APPEND" = y; then + mv "$archname" "$archname".bak || exit + + # Prepare entry for new archive + filesizes="$fsize" + CRCsum="$crcsum" + MD5sum="$md5sum" + SHAsum="$shasum" + Signature="$SIGNATURE" + # Generate the header + . "$HEADER" + # Append the new data + cat "$tmpfile" >> "$archname" + + chmod +x "$archname" + rm -f "$archname".bak + if test "$QUIET" = "n"; then + echo "Self-extractable archive \"$archname\" successfully updated." + fi +else + filesizes="$fsize" + CRCsum="$crcsum" + MD5sum="$md5sum" + SHAsum="$shasum" + Signature="$SIGNATURE" + + # Generate the header + . "$HEADER" + + # Append the compressed tar data after the stub + if test "$QUIET" = "n"; then + echo + fi + cat "$tmpfile" >> "$archname" + chmod +x "$archname" + if test "$QUIET" = "n"; then + echo Self-extractable archive \"$archname\" successfully created. + fi +fi +rm -f "$tmpfile" From 60b1579628996659d346925e3eeac1344ae28385 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 14:04:17 +0100 Subject: [PATCH 02/15] arc: fix init Signed-off-by: AuxXxilium --- files/initrd/opt/arc/init.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index 727687b3..5e42fa63 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -23,6 +23,7 @@ function loadArcOverlay() { [ -z "${LOADER_DISK}" ] && die "Loader Disk not found!" checkBootLoader || die "The loader is corrupted, please rewrite it!" +[ -f "${USER_CONFIG_FILE}" ] && sed -i "s/'/\"/g" "${USER_CONFIG_FILE}" [ -f "${HOME}/.initialized" ] && loadArcOverlay && exit 0 || true BUS=$(getBus "${LOADER_DISK}") From d53d7ac4733e03cdbf53cc4f2a00b2aa690f1fd6 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 14:33:18 +0100 Subject: [PATCH 03/15] arc: more rework Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc.sh | 6 +++--- files/initrd/opt/arc/init.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index c1f7bc5f..ac7d2b79 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -1112,11 +1112,11 @@ fi # Inform user echo -e "Call \033[1;34marc.sh\033[0m to configure Loader" echo +echo -e "Web Terminal: \033[1;34mhttp://${IPCON}:${TTYDPORT:-7681}\033[0m" +echo -e "Web Filemanager: \033[1;34mhttp://${IPCON}:${DUFSPORT:-7304}\033[0m" +echo echo -e "SSH Access:" echo -e "IP: \033[1;34m${IPCON}\033[0m" echo -e "User: \033[1;34mroot\033[0m" echo -e "Password: \033[1;34marc\033[0m" echo -echo -e "Web Terminal: \033[1;34mhttp://${IPCON}:${TTYDPORT}\033[0m" -echo -e "Web Filemanager: \033[1;34mhttp://${IPCON}:${DUFSPORT}\033[0m" -echo diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index 5e42fa63..b69d11b6 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -8,7 +8,7 @@ set -e function loadArcOverlay() { echo -e "\033[1;34mLoading Arc Overlay...\033[0m" echo - echo -e "Use \033[1;34mDisplay Output\033[0m or \033[1;34mhttp://${IPCON}:${TTYDPORT}\033[0m to configure Loader." + echo -e "Use \033[1;34mDisplay Output\033[0m or \033[1;34mhttp://${IPCON}:${TTYDPORT:-7681}\033[0m to configure Loader." # Check memory and load Arc RAM=$(awk '/MemTotal:/ {printf "%.0f", $2 / 1024}' /proc/meminfo 2>/dev/null) From 1de80457ad8dceb377290b9c9a920984d58a4273 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 15:55:54 +0100 Subject: [PATCH 04/15] build: update local Signed-off-by: AuxXxilium --- files/initrd/opt/arc/grub.img.gz => grub.img.gz | Bin img-gen-n.sh | 2 +- img-gen-s.sh | 2 +- scripts/func.sh | 9 +++++---- 4 files changed, 7 insertions(+), 6 deletions(-) rename files/initrd/opt/arc/grub.img.gz => grub.img.gz (100%) diff --git a/files/initrd/opt/arc/grub.img.gz b/grub.img.gz similarity index 100% rename from files/initrd/opt/arc/grub.img.gz rename to grub.img.gz diff --git a/img-gen-n.sh b/img-gen-n.sh index 65fdf6d0..e3ecdb01 100755 --- a/img-gen-n.sh +++ b/img-gen-n.sh @@ -22,7 +22,7 @@ mkdir -p "brx" # Sbase IMAGE_FILE="arc.img" -gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}" +gzip -dc "./grub.img.gz" >"${IMAGE_FILE}" fdisk -l "${IMAGE_FILE}" LOOPX=$(sudo losetup -f) diff --git a/img-gen-s.sh b/img-gen-s.sh index ff140a8c..87965c12 100755 --- a/img-gen-s.sh +++ b/img-gen-s.sh @@ -21,7 +21,7 @@ getOffline "files/p3/configs" # Sbase IMAGE_FILE="arc.img" -gzip -dc "files/initrd/opt/arc/grub.img.gz" >"${IMAGE_FILE}" +gzip -dc "./grub.img.gz" >"${IMAGE_FILE}" fdisk -l "${IMAGE_FILE}" LOOPX=$(sudo losetup -f) diff --git a/scripts/func.sh b/scripts/func.sh index 5580d05f..b6a72283 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -487,8 +487,9 @@ function copyBuildroot() { # create arc executable function createArc() { - ./scripts/make/makeself.sh ../arc/files/initrd/opt/arc arc arc ./init.sh --current --zstd --chown --threads=0 --quiet - rm -rf ../arc/files/initrd/opt/arc - mkdir -p ../arc/files/initrd/opt/arc - mv -f arc ../arc/files/initrd/opt/arc/ + ./scripts/make/makeself.sh "../arc/files/initrd/opt/arc" arc arc "./init.sh" --current --zstd --chown --threads=0 --quiet + rm -rf "../arc/files/initrd/opt/arc" + mkdir -p "../arc/files/initrd/opt/arc" + mv -f "arc" "../arc/files/initrd/opt/arc/" + cp -f "./grub.img.gz" "files/initrd/opt/arc/grub.img.gz" } \ No newline at end of file From 7bec0cc7f4dfceaeb3867c4f9b2f7e4d6594eb0b Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 16:02:39 +0100 Subject: [PATCH 05/15] build: update grub Signed-off-by: AuxXxilium --- .github/workflows/grub.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/grub.yml b/.github/workflows/grub.yml index f39e1b07..d1b2e072 100644 --- a/.github/workflows/grub.yml +++ b/.github/workflows/grub.yml @@ -39,9 +39,6 @@ jobs: if: success() && inputs.push == true run: | if [ -f "grub.img.gz" ]; then - echo "Copy img ..." - mv -f grub.img.gz files/initrd/opt/arc/grub.img.gz - echo "Git push ..." git pull status=$(git status -s | grep -E 'grub.img.gz' | awk '{printf " %s", $2}') From 73d75f17692fabf88a7f9583e9db056a80d7baca Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 16:07:42 +0100 Subject: [PATCH 06/15] tree: fix latest Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc-functions.sh | 6 +++--- files/initrd/opt/arc/arc.sh | 2 +- files/initrd/opt/arc/include/update.sh | 2 +- files/initrd/opt/arc/init.sh | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/files/initrd/opt/arc/arc-functions.sh b/files/initrd/opt/arc/arc-functions.sh index 405e3d18..cfd33307 100755 --- a/files/initrd/opt/arc/arc-functions.sh +++ b/files/initrd/opt/arc/arc-functions.sh @@ -781,7 +781,7 @@ function backupMenu() { dialog --backtitle "$(backtitle)" --title "Restore Arc Config" \ --aspect 18 --infobox "Restore successful! -> Reload Arc Init now" 5 50 sleep 2 - exec init.sh + ./init.sh ;; 2) DSMROOTS="$(findDSMRoot)" @@ -871,7 +871,7 @@ function backupMenu() { dialog --backtitle "$(backtitle)" --title "Online Restore" \ --aspect 18 --infobox "Restore successful! -> Reload Arc Init now" 5 50 sleep 2 - exec init.sh + ./init.sh ;; 5) HWID="$(genHWID)" @@ -2148,7 +2148,7 @@ function rebootMenu() { elif [ "${REDEST}" = "network" ]; then clear /etc/init.d/S41dhcpcd restart - exec init.sh + ./init.sh else rebootTo ${REDEST} exit 0 diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index ac7d2b79..750cd09b 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -1071,7 +1071,7 @@ elif [ "${ARCMODE}" = "config" ]; then ;; c) ARCOFFLINE=$([ "${ARCOFFLINE}" = "true" ] && echo 'false' || echo 'true') writeConfigKey "arc.offline" "${ARCOFFLINE}" "${USER_CONFIG_FILE}" - [ "${ARCOFFLINE}" = "false" ] && exec arc.sh + [ "${ARCOFFLINE}" = "false" ] && ./arc.sh NEXT="c" ;; D) staticIPMenu; NEXT="D" ;; diff --git a/files/initrd/opt/arc/include/update.sh b/files/initrd/opt/arc/include/update.sh index 708efde6..ea792737 100755 --- a/files/initrd/opt/arc/include/update.sh +++ b/files/initrd/opt/arc/include/update.sh @@ -485,6 +485,6 @@ function dependenciesUpdate() { BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")" sleep 3 clear - exec arc.sh + ./arc.sh fi } \ No newline at end of file diff --git a/files/initrd/opt/arc/init.sh b/files/initrd/opt/arc/init.sh index b69d11b6..25fe48f8 100755 --- a/files/initrd/opt/arc/init.sh +++ b/files/initrd/opt/arc/init.sh @@ -15,7 +15,7 @@ function loadArcOverlay() { if [ ${RAM} -le 3500 ]; then echo -e "\033[1;31mYou have less than 4GB of RAM, if errors occur in loader creation, please increase the amount of RAM.\033[0m\n\033[1;31mUse arc.sh to proceed. Not recommended!\033[0m" else - exec arc.sh + ./arc.sh fi } @@ -174,7 +174,7 @@ elif [ "${ARCMODE}" = "update" ]; then echo -e "\033[1;34mStarting Update Mode...\033[0m" elif [ "${BUILDDONE}" = "true" ] && [ "${ARCMODE}" = "dsm" ]; then echo -e "\033[1;34mStarting DSM Mode...\033[0m" - exec boot.sh && exit 0 + ./boot.sh && exit 0 else echo -e "\033[1;34mStarting Config Mode...\033[0m" fi From 231eebd18bf1fd3d692d577ac51ab6042d446a04 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 16:12:28 +0100 Subject: [PATCH 07/15] taskfile: update Signed-off-by: AuxXxilium --- Taskfile.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Taskfile.yaml b/Taskfile.yaml index 3d2245ff..2241d975 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -5,11 +5,13 @@ version: "3" tasks: build-img-n: cmds: + - git reset hard - git pull - ./img-gen-n.sh build-img-s: cmds: + - git reset hard - git pull - ./img-gen-s.sh From 3cfc706a742dc9d7cfe0af42ccba7b353d3eedb7 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 16:39:42 +0100 Subject: [PATCH 08/15] arc: fix command shown Signed-off-by: AuxXxilium --- files/initrd/opt/arc/arc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/initrd/opt/arc/arc.sh b/files/initrd/opt/arc/arc.sh index 750cd09b..01a0c2a5 100755 --- a/files/initrd/opt/arc/arc.sh +++ b/files/initrd/opt/arc/arc.sh @@ -1110,7 +1110,7 @@ else fi # Inform user -echo -e "Call \033[1;34marc.sh\033[0m to configure Loader" +echo -e "Call \033[1;34marc\033[0m to configure Loader" echo echo -e "Web Terminal: \033[1;34mhttp://${IPCON}:${TTYDPORT:-7681}\033[0m" echo -e "Web Filemanager: \033[1;34mhttp://${IPCON}:${DUFSPORT:-7304}\033[0m" From edc87953a518b1749a529af3aeeed56fb19268b8 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 16:39:53 +0100 Subject: [PATCH 09/15] func: rewrite for api Signed-off-by: AuxXxilium --- scripts/func.sh | 221 ++++++++++++++++++++++++++++-------------------- 1 file changed, 129 insertions(+), 92 deletions(-) diff --git a/scripts/func.sh b/scripts/func.sh index b6a72283..a912c876 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -15,19 +15,24 @@ function getLKMs() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/rp-lkms.zip" rm -f "${CACHE_FILE}" - TAG="$(curl -s "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/latest" | grep -oP '"tag_name": "\K(.*)(?=")')" + + # Fetch the latest release tag from GitHub API + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/latest" | jq -r ".tag_name") export LKMTAG="${TAG}" - if curl -skL "https://github.com/AuxXxilium/arc-lkm/releases/download/${TAG}/rp-lkms.zip" -o "${CACHE_FILE}"; then - # Unzip LKMs - rm -rf "${DEST_PATH}" - mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting LKMs end - ${TAG}" - else - echo "Failed to get LKMs" - exit 1 - fi + + # Fetch the release assets and download the zip file + curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + if [ "${NAME}" = "rp-lkms.zip" ]; then + curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/assets/${ID}" -o "${CACHE_FILE}" + # Unzip LKMs + rm -rf "${DEST_PATH}" + mkdir -p "${DEST_PATH}" + unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" + rm -f "${CACHE_FILE}" + echo "Getting LKMs end - ${TAG}" + break + fi + done } # Get latest Addons @@ -37,28 +42,34 @@ function getAddons() { local DEST_PATH="${1}" local CACHE_DIR="/tmp/addons" local CACHE_FILE="/tmp/addons.zip" - TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-addons/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')" + rm -f "${CACHE_FILE}" + + # Fetch the latest release tag from GitHub API + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/latest" | jq -r ".tag_name") export ADDONTAG="${TAG}" - if curl -skL "https://github.com/AuxXxilium/arc-addons/releases/download/${TAG}/addons-${TAG}.zip" -o "${CACHE_FILE}"; then - # Unzip Addons - rm -rf "${CACHE_DIR}" - mkdir -p "${CACHE_DIR}" - mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${CACHE_DIR}" - echo "Installing Addons to ${DEST_PATH}" - [ -f /tmp/addons/VERSION ] && cp -f /tmp/addons/VERSION ${DEST_PATH}/ - for PKG in $(ls ${CACHE_DIR}/*.addon); do - ADDON=$(basename "${PKG}" .addon) - mkdir -p "${DEST_PATH}/${ADDON}" - echo "Extracting ${PKG} to ${DEST_PATH}/${ADDON}" - tar -xaf "${PKG}" -C "${DEST_PATH}/${ADDON}" - done - rm -f "${CACHE_FILE}" - echo "Getting Addons end - ${TAG}" - else - echo "Failed to get Addons" - exit 1 - fi + + # Fetch the release assets and download the zip file + curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + if [ "${NAME}" = "addons-${TAG}.zip" ]; then + curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/assets/${ID}" -o "${CACHE_FILE}" + # Unzip Addons + rm -rf "${CACHE_DIR}" + mkdir -p "${CACHE_DIR}" + mkdir -p "${DEST_PATH}" + unzip -o "${CACHE_FILE}" -d "${CACHE_DIR}" + echo "Installing Addons to ${DEST_PATH}" + [ -f /tmp/addons/VERSION ] && cp -f /tmp/addons/VERSION ${DEST_PATH}/ + for PKG in $(ls ${CACHE_DIR}/*.addon); do + ADDON=$(basename "${PKG}" .addon) + mkdir -p "${DEST_PATH}/${ADDON}" + echo "Extracting ${PKG} to ${DEST_PATH}/${ADDON}" + tar -xaf "${PKG}" -C "${DEST_PATH}/${ADDON}" + done + rm -f "${CACHE_FILE}" + echo "Getting Addons end - ${TAG}" + break + fi + done } # Get latest Modules @@ -68,18 +79,24 @@ function getModules() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/modules.zip" rm -f "${CACHE_FILE}" - TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-modules/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')" + + # Fetch the latest release tag from GitHub API + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/latest" | jq -r ".tag_name") export MODULETAG="${TAG}" - if curl -skL "https://github.com/AuxXxilium/arc-modules/releases/download/${TAG}/modules-${TAG}.zip" -o "${CACHE_FILE}"; then - # Unzip Modules - rm -rf "${DEST_PATH}" - mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - echo "Getting Modules end - ${TAG}" - else - echo "Failed to get Modules" - exit 1 - fi + + # Fetch the release assets and download the zip file + curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + if [ "${NAME}" = "modules-${TAG}.zip" ]; then + curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/assets/${ID}" -o "${CACHE_FILE}" + # Unzip Modules + rm -rf "${DEST_PATH}" + mkdir -p "${DEST_PATH}" + unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" + rm -f "${CACHE_FILE}" + echo "Getting Modules end - ${TAG}" + break + fi + done } # Get latest Configs @@ -89,19 +106,24 @@ function getConfigs() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/configs.zip" rm -f "${CACHE_FILE}" - TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-configs/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')" + + # Fetch the latest release tag from GitHub API + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/latest" | jq -r ".tag_name") export CONFIGTAG="${TAG}" - if curl -skL "https://github.com/AuxXxilium/arc-configs/releases/download/${TAG}/configs-${TAG}.zip" -o "${CACHE_FILE}"; then - # Unzip Configs - rm -rf "${DEST_PATH}" - mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting Configs end - ${TAG}" - else - echo "Failed to get Configs" - exit 1 - fi + + # Fetch the release assets and download the zip file + curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + if [ "${NAME}" = "configs-${TAG}.zip" ]; then + curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/assets/${ID}" -o "${CACHE_FILE}" + # Unzip Configs + rm -rf "${DEST_PATH}" + mkdir -p "${DEST_PATH}" + unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" + rm -f "${CACHE_FILE}" + echo "Getting Configs end - ${TAG}" + break + fi + done } # Get latest Patches @@ -111,19 +133,24 @@ function getPatches() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/patches.zip" rm -f "${CACHE_FILE}" - TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-patches/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')" + + # Fetch the latest release tag from GitHub API + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/latest" | jq -r ".tag_name") export PATCHTAG="${TAG}" - if curl -skL "https://github.com/AuxXxilium/arc-patches/releases/download/${TAG}/patches-${TAG}.zip" -o "${CACHE_FILE}"; then - # Unzip Patches - rm -rf "${DEST_PATH}" - mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting Patches end - ${TAG}" - else - echo "Failed to get Patches" - exit 1 - fi + + # Fetch the release assets and download the zip file + curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + if [ "${NAME}" = "patches-${TAG}.zip" ]; then + curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/assets/${ID}" -o "${CACHE_FILE}" + # Unzip Patches + rm -rf "${DEST_PATH}" + mkdir -p "${DEST_PATH}" + unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" + rm -f "${CACHE_FILE}" + echo "Getting Patches end - ${TAG}" + break + fi + done } # Get latest Custom @@ -133,19 +160,24 @@ function getCustom() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/custom.zip" rm -f "${CACHE_FILE}" - TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-custom/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')" + + # Fetch the latest release tag from GitHub API + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/latest" | jq -r ".tag_name") export CUSTOMTAG="${TAG}" - if curl -skL "https://github.com/AuxXxilium/arc-custom/releases/download/${TAG}/custom-${TAG}.zip" -o "${CACHE_FILE}"; then - # Unzip Custom - rm -rf "${DEST_PATH}" - mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting Custom end - ${TAG}" - else - echo "Failed to get Custom" - exit 1 - fi + + # Fetch the release assets and download the zip file + curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + if [ "${NAME}" = "custom-${TAG}.zip" ]; then + curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/assets/${ID}" -o "${CACHE_FILE}" + # Unzip Custom + rm -rf "${DEST_PATH}" + mkdir -p "${DEST_PATH}" + unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" + rm -f "${CACHE_FILE}" + echo "Getting Custom end - ${TAG}" + break + fi + done } # Get latest Theme @@ -155,18 +187,23 @@ function getTheme() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/theme.zip" rm -f "${CACHE_FILE}" - TAG="$(curl -s https://api.github.com/repos/AuxXxilium/arc-theme/releases/latest | grep -oP '"tag_name": "\K(.*)(?=")')" + + # Fetch the latest release tag from GitHub API + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/latest" | jq -r ".tag_name") export THEMETAG="${TAG}" - if curl -skL "https://github.com/AuxXxilium/arc-theme/releases/download/${TAG}/arc-theme-${TAG}.zip" -o "${CACHE_FILE}"; then - # Unzip Theme - mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting Theme end - ${TAG}" - else - echo "Failed to get Theme" - exit 1 - fi + + # Fetch the release assets and download the zip file + curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + if [ "${NAME}" = "arc-theme-${TAG}.zip" ]; then + curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/assets/${ID}" -o "${CACHE_FILE}" + # Unzip Theme + mkdir -p "${DEST_PATH}" + unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" + rm -f "${CACHE_FILE}" + echo "Getting Theme end - ${TAG}" + break + fi + done } # Get latest Buildroot-X @@ -487,7 +524,7 @@ function copyBuildroot() { # create arc executable function createArc() { - ./scripts/make/makeself.sh "../arc/files/initrd/opt/arc" arc arc "./init.sh" --current --zstd --chown --threads=0 --quiet + ./scripts/make/makeself.sh "../arc/files/initrd/opt/arc" arc "Arc Loader" "./init.sh" --current --base64 --chown --threads=0 --quiet rm -rf "../arc/files/initrd/opt/arc" mkdir -p "../arc/files/initrd/opt/arc" mv -f "arc" "../arc/files/initrd/opt/arc/" From f23935e6c9a506847ae4946c531684ff1f72aebc Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 16:41:01 +0100 Subject: [PATCH 10/15] task: fix local build Signed-off-by: AuxXxilium --- Taskfile.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 2241d975..9bedde87 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -5,13 +5,13 @@ version: "3" tasks: build-img-n: cmds: - - git reset hard + - git reset --hard - git pull - ./img-gen-n.sh build-img-s: cmds: - - git reset hard + - git reset --hard - git pull - ./img-gen-s.sh From efbd445a790eee8ea7e05834fa176e8fdcd9725a Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 16:46:10 +0100 Subject: [PATCH 11/15] func: rewrite more Signed-off-by: AuxXxilium --- scripts/func.sh | 164 +++++++++++++++++++++--------------------------- 1 file changed, 72 insertions(+), 92 deletions(-) diff --git a/scripts/func.sh b/scripts/func.sh index a912c876..fa269748 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -15,24 +15,21 @@ function getLKMs() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/rp-lkms.zip" rm -f "${CACHE_FILE}" - - # Fetch the latest release tag from GitHub API - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/latest" | jq -r ".tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases" | jq -r ".[].tag_name" | sort -rV | head -1) export LKMTAG="${TAG}" - - # Fetch the release assets and download the zip file - curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + while read -r ID NAME; do if [ "${NAME}" = "rp-lkms.zip" ]; then - curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/assets/${ID}" -o "${CACHE_FILE}" + curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/assets/${ID}" -o "${CACHE_FILE}" # Unzip LKMs rm -rf "${DEST_PATH}" mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting LKMs end - ${TAG}" - break + if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then + rm -f "${CACHE_FILE}" + echo "Getting LKMs end - ${TAG}" + break + fi fi - done + done <<<$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-lkm/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"') } # Get latest Addons @@ -43,33 +40,30 @@ function getAddons() { local CACHE_DIR="/tmp/addons" local CACHE_FILE="/tmp/addons.zip" rm -f "${CACHE_FILE}" - - # Fetch the latest release tag from GitHub API - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/latest" | jq -r ".tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-addons/releases" | jq -r ".[].tag_name" | sort -rV | head -1) export ADDONTAG="${TAG}" - - # Fetch the release assets and download the zip file - curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + while read -r ID NAME; do if [ "${NAME}" = "addons-${TAG}.zip" ]; then - curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/assets/${ID}" -o "${CACHE_FILE}" + curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/assets/${ID}" -o "${CACHE_FILE}" # Unzip Addons rm -rf "${CACHE_DIR}" mkdir -p "${CACHE_DIR}" mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${CACHE_DIR}" - echo "Installing Addons to ${DEST_PATH}" - [ -f /tmp/addons/VERSION ] && cp -f /tmp/addons/VERSION ${DEST_PATH}/ - for PKG in $(ls ${CACHE_DIR}/*.addon); do - ADDON=$(basename "${PKG}" .addon) - mkdir -p "${DEST_PATH}/${ADDON}" - echo "Extracting ${PKG} to ${DEST_PATH}/${ADDON}" - tar -xaf "${PKG}" -C "${DEST_PATH}/${ADDON}" - done - rm -f "${CACHE_FILE}" - echo "Getting Addons end - ${TAG}" - break + if unzip -o "${CACHE_FILE}" -d "${CACHE_DIR}"; then + echo "Installing Addons to ${DEST_PATH}" + [ -f /tmp/addons/VERSION ] && cp -f /tmp/addons/VERSION ${DEST_PATH}/ + for PKG in $(ls ${CACHE_DIR}/*.addon); do + ADDON=$(basename "${PKG}" .addon) + mkdir -p "${DEST_PATH}/${ADDON}" + echo "Extracting ${PKG} to ${DEST_PATH}/${ADDON}" + tar -xaf "${PKG}" -C "${DEST_PATH}/${ADDON}" + done + rm -f "${CACHE_FILE}" + echo "Getting Addons end - ${TAG}" + break + fi fi - done + done <<<$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-addons/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"') } # Get latest Modules @@ -79,24 +73,21 @@ function getModules() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/modules.zip" rm -f "${CACHE_FILE}" - - # Fetch the latest release tag from GitHub API - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/latest" | jq -r ".tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-modules/releases" | jq -r ".[].tag_name" | sort -rV | head -1) export MODULETAG="${TAG}" - - # Fetch the release assets and download the zip file - curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + while read -r ID NAME; do if [ "${NAME}" = "modules-${TAG}.zip" ]; then - curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/assets/${ID}" -o "${CACHE_FILE}" + curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/assets/${ID}" -o "${CACHE_FILE}" # Unzip Modules rm -rf "${DEST_PATH}" mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting Modules end - ${TAG}" - break + if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then + rm -f "${CACHE_FILE}" + echo "Getting Modules end - ${TAG}" + break + fi fi - done + done <<<$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-modules/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"') } # Get latest Configs @@ -106,24 +97,21 @@ function getConfigs() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/configs.zip" rm -f "${CACHE_FILE}" - - # Fetch the latest release tag from GitHub API - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/latest" | jq -r ".tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-configs/releases" | jq -r ".[].tag_name" | sort -rV | head -1) export CONFIGTAG="${TAG}" - - # Fetch the release assets and download the zip file - curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + while read -r ID NAME; do if [ "${NAME}" = "configs-${TAG}.zip" ]; then - curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/assets/${ID}" -o "${CACHE_FILE}" + curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/assets/${ID}" -o "${CACHE_FILE}" # Unzip Configs rm -rf "${DEST_PATH}" mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting Configs end - ${TAG}" - break + if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then + rm -f "${CACHE_FILE}" + echo "Getting Configs end - ${TAG}" + break + fi fi - done + done <<<$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-configs/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"') } # Get latest Patches @@ -133,24 +121,21 @@ function getPatches() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/patches.zip" rm -f "${CACHE_FILE}" - - # Fetch the latest release tag from GitHub API - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/latest" | jq -r ".tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-patches/releases" | jq -r ".[].tag_name" | sort -rV | head -1) export PATCHTAG="${TAG}" - - # Fetch the release assets and download the zip file - curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + while read -r ID NAME; do if [ "${NAME}" = "patches-${TAG}.zip" ]; then - curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/assets/${ID}" -o "${CACHE_FILE}" + curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/assets/${ID}" -o "${CACHE_FILE}" # Unzip Patches rm -rf "${DEST_PATH}" mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting Patches end - ${TAG}" - break + if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then + rm -f "${CACHE_FILE}" + echo "Getting Patches end - ${TAG}" + break + fi fi - done + done <<<$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-patches/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"') } # Get latest Custom @@ -160,24 +145,21 @@ function getCustom() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/custom.zip" rm -f "${CACHE_FILE}" - - # Fetch the latest release tag from GitHub API - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/latest" | jq -r ".tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-custom/releases" | jq -r ".[].tag_name" | sort -rV | head -1) export CUSTOMTAG="${TAG}" - - # Fetch the release assets and download the zip file - curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + while read -r ID NAME; do if [ "${NAME}" = "custom-${TAG}.zip" ]; then - curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/assets/${ID}" -o "${CACHE_FILE}" + curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/assets/${ID}" -o "${CACHE_FILE}" # Unzip Custom rm -rf "${DEST_PATH}" mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting Custom end - ${TAG}" - break + if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then + rm -f "${CACHE_FILE}" + echo "Getting Custom end - ${TAG}" + break + fi fi - done + done <<<$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-custom/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"') } # Get latest Theme @@ -187,23 +169,21 @@ function getTheme() { local DEST_PATH="${1}" local CACHE_FILE="/tmp/theme.zip" rm -f "${CACHE_FILE}" - - # Fetch the latest release tag from GitHub API - TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/latest" | jq -r ".tag_name") + TAG=$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases" | jq -r ".[].tag_name" | sort -rV | head -1) export THEMETAG="${TAG}" - - # Fetch the release assets and download the zip file - curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/latest" | jq -r ".assets[] | .id, .name" | while read -r ID NAME; do + while read -r ID NAME; do if [ "${NAME}" = "arc-theme-${TAG}.zip" ]; then - curl -skL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/assets/${ID}" -o "${CACHE_FILE}" + curl -kL -H "Authorization: token ${TOKEN}" -H "Accept: application/octet-stream" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/assets/${ID}" -o "${CACHE_FILE}" # Unzip Theme mkdir -p "${DEST_PATH}" - unzip -o "${CACHE_FILE}" -d "${DEST_PATH}" - rm -f "${CACHE_FILE}" - echo "Getting Theme end - ${TAG}" - break + if unzip -o "${CACHE_FILE}" -d "${DEST_PATH}"; then + rm -f "${CACHE_FILE}" + echo "Getting Theme end - ${TAG}" + break + fi fi - done + done <<<$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"') + fi } # Get latest Buildroot-X From 8676e9e3496fc4beec57939aab746d16af9bc892 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 16:46:57 +0100 Subject: [PATCH 12/15] func: fix typo Signed-off-by: AuxXxilium --- scripts/func.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/func.sh b/scripts/func.sh index fa269748..71d2dbdb 100755 --- a/scripts/func.sh +++ b/scripts/func.sh @@ -183,7 +183,6 @@ function getTheme() { fi fi done <<<$(curl -skL -H "Authorization: token ${TOKEN}" "https://api.github.com/repos/AuxXxilium/arc-theme/releases/tags/${TAG}" | jq -r '.assets[] | "\(.id) \(.name)"') - fi } # Get latest Buildroot-X From ee35d426b38eafd2dc87a7cf4deae75dbd28b76c Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 16:57:36 +0100 Subject: [PATCH 13/15] grub: update Signed-off-by: AuxXxilium --- files/p1/boot/grub/grub.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/p1/boot/grub/grub.cfg b/files/p1/boot/grub/grub.cfg index 0c9eb532..b037a5d1 100644 --- a/files/p1/boot/grub/grub.cfg +++ b/files/p1/boot/grub/grub.cfg @@ -35,7 +35,7 @@ fi if loadfont unicode; then insmod gfxterm - set gfxmode=auto + set gfxmode=1024x768 set gfxpayload=auto if [ "${grub_platform}" = "efi" ]; then terminal_output --append gfxterm From 8e10997fd5254659a8e45bc53799c752ed249bbd Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 17:00:04 +0100 Subject: [PATCH 14/15] build: update Signed-off-by: AuxXxilium --- .github/workflows/autobuild.yml | 3 ++- .github/workflows/build.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 56878306..ba774562 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -120,6 +120,7 @@ jobs: echo "Repack initrd" cp -f "brx/bzImage-arc" "files/p3/bzImage-arc" + createArc repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc" echo "Copying files" @@ -198,7 +199,7 @@ jobs: echo "Repack initrd" cp -f "brs/bzImage-arc" "files/p3/bzImage-arc" - #cp -f "brs/initrd-arc" "files/p3/initrd-arc" + createArc repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc" echo "Copying files" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 949a04cf..5950ba67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,6 +146,7 @@ jobs: echo "Repack initrd" cp -f "brx/bzImage-arc" "files/p3/bzImage-arc" + createArc repackInitrd "brx/initrd-arc" "files/initrd" "files/p3/initrd-arc" echo "Copying files" @@ -225,7 +226,7 @@ jobs: echo "Repack initrd" cp -f "brs/bzImage-arc" "files/p3/bzImage-arc" - #cp -f "brs/initrd-arc" "files/p3/initrd-arc" + createArc repackInitrd "brs/initrd-arc" "files/initrd" "files/p3/initrd-arc" echo "Copying files" From 712b5a5cb99509b9ad65cd2ce61d868da641d602 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Tue, 24 Dec 2024 17:02:15 +0100 Subject: [PATCH 15/15] build: update logic Signed-off-by: AuxXxilium --- .github/workflows/autobuild.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index ba774562..e7eb0838 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -68,8 +68,6 @@ jobs: getOffline "files/p3/configs" getLKMs "files/p3/lkms" getTheme "files/p1/boot/grub" - getBuildrootx "brx" - getBuildroots "brs" # Export Dependencies Version to env echo "ADDONTAG=${ADDONTAG}" >> $GITHUB_ENV @@ -91,6 +89,8 @@ jobs: run: | . scripts/func.sh + getBuildrootx "brx" + # Modify Source File ARC_BUILD="`date +'%y%m%d'`" ARC_VERSION="${{ inputs.version }}-dev" @@ -170,6 +170,8 @@ jobs: run: | . scripts/func.sh + getBuildroots "brs" + # Modify Source File ARC_BUILD="`date +'%y%m%d'`" ARC_VERSION="${{ inputs.version }}-dev"