Skip to content

Commit 4c5e05a

Browse files
*/*: unify options for the copy command
In general we want to preserve everything and always follow symlinks. Signed-off-by: Nowa Ammerlaan <[email protected]>
1 parent 04f43c7 commit 4c5e05a

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

hooks/91-grub-mkconfig.install

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ main() {
3838

3939
if [[ -f ${GRUB_CFG} ]]; then
4040
einfo "Backing up existing grub config as ${GRUB_CFG}~..."
41-
cp -v "${GRUB_CFG}"{,~} || die "Failed to save existing config"
41+
cp --dereference --preserve=all "${GRUB_CFG}"{,~} || die "Failed to save existing config"
4242
fi
4343

4444
if [[ -f /etc/os-release ]]; then

hooks/95-refind-copy-icon.install

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ main() {
4848
if [[ -f ${icon} ]]; then
4949
mv "${icon}" "${icon_old}" || die
5050
fi
51-
cp "${REFIND_ICON}" "${icon}" || die "Failed to copy icon file"
51+
cp --dereference --preserve=all "${REFIND_ICON}" "${icon}" || die "Failed to copy icon file"
5252

5353
# If there is a version-less image, install an icon for it
5454
local icon_nover=${icon//-${ver}/}
@@ -67,11 +67,11 @@ main() {
6767
ln -sf "$(basename "${icon}")" "${icon_nover}" || die
6868
elif [[ -f ${icon_nover} ]]; then
6969
mv "${icon_nover}" "${icon_nover_old}" || die
70-
cp "${icon}" "${icon_nover}" || die
70+
cp --dereference --preserve=all "${icon}" "${icon_nover}" || die
7171
elif [[ -L ${img//-${ver}/} ]]; then
7272
ln -sf "$(basename "${icon}")" "${icon_nover}" || die
7373
elif [[ -f ${img//-${ver}/} ]]; then
74-
cp "${icon}" "${icon_nover}" || die
74+
cp --dereference --preserve=all "${icon}" "${icon_nover}" || die
7575
fi
7676
}
7777

hooks/systemd/90-zz-update-static.install

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ if [[ -L ${KERNEL_INSTALL_ROOT}/${STATIC_KERNEL_NAME}${SUFFIX} ]]; then
7979
fi
8080
elif [[ -f ${KERNEL_INSTALL_ROOT}/${STATIC_KERNEL_NAME}${SUFFIX} ]]; then
8181
[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo "Updating static file for ${KERNEL_VERSION}..."
82-
cp "${KERNEL_INSTALL_ROOT}/${STATIC_KERNEL_NAME}-${KERNEL_VERSION}${TRIES}${SUFFIX}" \
82+
cp --dereference --preserve=all "${KERNEL_INSTALL_ROOT}/${STATIC_KERNEL_NAME}-${KERNEL_VERSION}${TRIES}${SUFFIX}" \
8383
"${KERNEL_INSTALL_ROOT}/${STATIC_KERNEL_NAME}${SUFFIX}" || exit 1
8484
if [[ -f ${KERNEL_INSTALL_ROOT}/initramfs-${KERNEL_VERSION}.img ]]; then
85-
cp "${KERNEL_INSTALL_ROOT}/initramfs-${KERNEL_VERSION}.img" \
85+
cp --dereference --preserve=all "${KERNEL_INSTALL_ROOT}/initramfs-${KERNEL_VERSION}.img" \
8686
"${KERNEL_INSTALL_ROOT}/initramfs.img" || exit 1
8787
fi
8888
fi

hooks/systemd/91-grub-mkconfig.install

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ if [[ ${COMMAND} == add || ${COMMAND} == remove ]]; then
7373
if [[ -f ${GRUB_CFG} ]]; then
7474
[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
7575
"Backing up existing grub config as ${GRUB_CFG}~"
76-
cp "${GRUB_CFG}"{,~} || { echo "Failed to save existing config" && exit 1; }
76+
cp --dereference --preserve=all "${GRUB_CFG}"{,~} || { echo "Failed to save existing config" && exit 1; }
7777
fi
7878

7979
[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \

hooks/systemd/95-refind-copy-icon.install

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ if [[ ${KERNEL_INSTALL_LAYOUT} == "compat" || ${KERNEL_INSTALL_LAYOUT} == "grub"
4040
KERNEL_INSTALL_BOOT_ROOT="/boot"
4141
if [[ ${COMMAND} == add ]]; then
4242
[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo "Copying rEFInd icon file..."
43-
cp "${REFIND_ICON}" "${KERNEL_INSTALL_BOOT_ROOT}/kernel-${KERNEL_VERSION}.png" || exit 1
43+
cp --dereference --preserve=all "${REFIND_ICON}" "${KERNEL_INSTALL_BOOT_ROOT}/kernel-${KERNEL_VERSION}.png" || exit 1
4444
if [[ -L ${KERNEL_INSTALL_BOOT_ROOT}/kernel ]]; then
4545
ln -sf "kernel-${KERNEL_VERSION}.png" \
4646
"${KERNEL_INSTALL_BOOT_ROOT}/kernel.png" || exit 1
4747
elif [[ -f ${KERNEL_INSTALL_BOOT_ROOT}/kernel ]]; then
48-
cp "${KERNEL_INSTALL_BOOT_ROOT}/kernel-${KERNEL_VERSION}.png" \
48+
cp --dereference --preserve=all "${KERNEL_INSTALL_BOOT_ROOT}/kernel-${KERNEL_VERSION}.png" \
4949
"${KERNEL_INSTALL_BOOT_ROOT}/kernel.png" || exit 1
5050
fi
5151
elif [[ ${COMMAND} == remove ]]; then
@@ -60,12 +60,12 @@ elif [[ ${KERNEL_INSTALL_LAYOUT} == "uki" ]]; then
6060
exit 1
6161
fi
6262
[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo "Copying rEFInd icon file..."
63-
cp "${REFIND_ICON}" "${UKI_DIR}/${KERNEL_INSTALL_ENTRY_TOKEN}-${KERNEL_VERSION}.png" || exit 1
63+
cp --dereference --preserve=all "${REFIND_ICON}" "${UKI_DIR}/${KERNEL_INSTALL_ENTRY_TOKEN}-${KERNEL_VERSION}.png" || exit 1
6464
if [[ -L ${UKI_DIR}/${KERNEL_INSTALL_ENTRY_TOKEN}.efi ]]; then
6565
ln -sf "${KERNEL_INSTALL_ENTRY_TOKEN}-${KERNEL_VERSION}.png" \
6666
"${UKI_DIR}/${KERNEL_INSTALL_ENTRY_TOKEN}.png" || exit 1
6767
elif [[ -f ${UKI_DIR}/${KERNEL_INSTALL_ENTRY_TOKEN}.efi ]]; then
68-
cp "${UKI_DIR}/${KERNEL_INSTALL_ENTRY_TOKEN}-${KERNEL_VERSION}.png" \
68+
cp --dereference --preserve=all "${UKI_DIR}/${KERNEL_INSTALL_ENTRY_TOKEN}-${KERNEL_VERSION}.png" \
6969
"${UKI_DIR}/${KERNEL_INSTALL_ENTRY_TOKEN}.png" || exit 1
7070
fi
7171
elif [[ ${COMMAND} == remove ]]; then
@@ -76,12 +76,12 @@ elif [[ ${KERNEL_INSTALL_LAYOUT} == "efistub" ]]; then
7676
EFISTUB_DIR="${KERNEL_INSTALL_BOOT_ROOT}/EFI/${NAME}"
7777
if [[ ${COMMAND} == add ]]; then
7878
[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo "Copying rEFInd icon file..."
79-
cp "${REFIND_ICON}" "${EFISTUB_DIR}/kernel-${KERNEL_VERSION}.png" || exit 1
79+
cp --dereference --preserve=all "${REFIND_ICON}" "${EFISTUB_DIR}/kernel-${KERNEL_VERSION}.png" || exit 1
8080
if [[ -L ${EFISTUB_DIR}/kernel.efi ]]; then
8181
ln -sf "kernel-${KERNEL_VERSION}.png" \
8282
"${EFISTUB_DIR}/kernel.png" || exit 1
8383
elif [[ -f ${EFISTUB_DIR}/kernel.efi ]]; then
84-
cp "${EFISTUB_DIR}/kernel-${KERNEL_VERSION}.png" \
84+
cp --dereference --preserve=all "${EFISTUB_DIR}/kernel-${KERNEL_VERSION}.png" \
8585
"${EFISTUB_DIR}/kernel.png" || exit 1
8686
fi
8787
elif [[ ${COMMAND} == remove ]]; then

installkernel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ main() {
210210
suffix=.efi
211211
# backwards compatibility
212212
if [ -f "/boot/intel-uc.img" ]; then
213-
cp "/boot/intel-uc.img" "${dir}/intel-uc.img"
213+
cp --dereference --preserve=all "/boot/intel-uc.img" "${dir}/intel-uc.img"
214214
fi
215215
if [ -f "/boot/amd-uc.img" ]; then
216-
cp "/boot/amd-uc.img" "${dir}/amd-uc.img"
216+
cp --dereference --preserve=all "/boot/amd-uc.img" "${dir}/amd-uc.img"
217217
fi
218218
else
219219
continue

0 commit comments

Comments
 (0)