Skip to content

Commit 0ad401d

Browse files
kernel-install/90-loaderentry: use install(1) instead of cp/chown/chmod chains
Also fix typo in error message
1 parent 07c0e5e commit 0ad401d

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/kernel-install/90-loaderentry.install

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,10 @@ else
9292
LOADER_ENTRY="$BOOT_ROOT/loader/entries/$MACHINE_ID-$KERNEL_VERSION.conf"
9393
fi
9494

95-
cp "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" &&
96-
chown root:root "$ENTRY_DIR_ABS/linux" &&
97-
chmod 0644 "$ENTRY_DIR_ABS/linux" || {
98-
echo "Could not copy '$KERNEL_IMAGE to '$ENTRY_DIR_ABS/linux'." >&2
99-
exit 1
100-
}
95+
install -g root -o root -m 0644 "$KERNEL_IMAGE" "$ENTRY_DIR_ABS/linux" || {
96+
echo "Could not copy '$KERNEL_IMAGE' to '$ENTRY_DIR_ABS/linux'." >&2
97+
exit 1
98+
}
10199

102100
INITRD_OPTIONS=( "${@:${INITRD_OPTIONS_START}}" )
103101

@@ -106,12 +104,10 @@ for initrd in "${INITRD_OPTIONS[@]}"; do
106104
initrd_basename="$(basename ${initrd})"
107105
[ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] && \
108106
echo "Installing $ENTRY_DIR_ABS/${initrd_basename}"
109-
cp "${initrd}" "$ENTRY_DIR_ABS/${initrd_basename}" &&
110-
chown root:root "$ENTRY_DIR_ABS/${initrd_basename}" &&
111-
chmod 0644 "$ENTRY_DIR_ABS/${initrd_basename}" || {
112-
echo "Could not copy '${initrd}' to '$ENTRY_DIR_ABS/${initrd_basename}'." >&2
113-
exit 1
114-
}
107+
install -g root -o root -m 0644 "${initrd}" "$ENTRY_DIR_ABS/${initrd_basename}" || {
108+
echo "Could not copy '${initrd}' to '$ENTRY_DIR_ABS/${initrd_basename}'." >&2
109+
exit 1
110+
}
115111
fi
116112
done
117113

0 commit comments

Comments
 (0)