Skip to content

Commit

Permalink
feat: Control device nodes #382
Browse files Browse the repository at this point in the history
feat: Control device nodes #382
  • Loading branch information
kroese authored Nov 17, 2023
2 parents 451a569 + 6334cfc commit f0ce992
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -Eeuo pipefail

: ${DEV:='Y'} # Controls whether device nodes are created.

if [ -f "$STORAGE"/dsm.ver ]; then
BASE=$(cat "${STORAGE}/dsm.ver")
else
Expand Down Expand Up @@ -107,8 +109,14 @@ if [ -f "${RDC}" ]; then
{ xz -dc <"$RDC" >"$TMP/rd" 2>/dev/null; rc=$?; } || :
(( rc != 1 )) && error "Failed to unxz $RDC, reason $rc" && exit 91

{ (cd "$TMP" && cpio -idm <"$TMP/rd" 2>/dev/null); rc=$?; } || :
(( rc != 0 )) && error "Failed to cpio $RDC, reason $rc" && exit 92
if [[ "${DEV}" == [Nn]* ]]; then
# Exclude dev/ from cpio extract
{ (cd "$TMP" && cpio -it < "$TMP/rd" | grep -Ev 'dev/' | while read -r entry; do cpio -idm "$entry" < "$TMP/rd" 2>/dev/null; done); rc=$?; } || :
(( rc != 0 )) && error "Failed to extract $RDC, reason $rc" && exit 92
else
{ (cd "$TMP" && cpio -idm <"$TMP/rd" 2>/dev/null); rc=$?; } || :
(( rc != 0 )) && error "Failed to cpio $RDC, reason $rc" && exit 92
fi

mkdir -p /run/extract
for file in $TMP/usr/lib/libcurl.so.4 \
Expand Down Expand Up @@ -240,7 +248,13 @@ MOUNT="$TMP/system"
rm -rf "$MOUNT" && mkdir -p "$MOUNT"

mv "$HDA.tgz" "$HDA.txz"
tar xpfJ "$HDA.txz" --absolute-names -C "$MOUNT/"

if [[ "${DEV}" == [Nn]* ]]; then
# Exclude dev/ from tar extract
tar xpfJ "$HDA.txz" --absolute-names --exclude="dev" -C "$MOUNT/"
else
tar xpfJ "$HDA.txz" --absolute-names -C "$MOUNT/"
fi

[ -d "$PKG" ] && mv "$PKG/" "$MOUNT/.SynoUpgradePackages/"
rm -f "$MOUNT/.SynoUpgradePackages/ActiveInsight-"*
Expand Down

0 comments on commit f0ce992

Please sign in to comment.