Skip to content

Commit

Permalink
More unquoted strings
Browse files Browse the repository at this point in the history
  • Loading branch information
rmetrich committed Jun 12, 2024
1 parent a543e9d commit 744a171
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if [ -n "$BACKUP_DUPLICITY_NETFS_URL" -o -n "$BACKUP_DUPLICITY_NETFS_MOUNTCMD" ]
BACKUP_DUPLICITY_NETFS_URL="var://BACKUP_DUPLICITY_NETFS_MOUNTCMD"
fi

mount_url $BACKUP_DUPLICITY_NETFS_URL $BUILD_DIR/outputfs $BACKUP_DUPLICITY_NETFS_OPTIONS
mount_url "$BACKUP_DUPLICITY_NETFS_URL" "$BUILD_DIR/outputfs" $BACKUP_DUPLICITY_NETFS_OPTIONS

BACKUP_DUPLICITY_URL="file://$BUILD_DIR/outputfs"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ if [ -n "$BACKUP_DUPLICITY_NETFS_URL" -o -n "$BACKUP_DUPLICITY_NETFS_UMOUNTCMD"
BACKUP_DUPLICITY_NETFS_URL="var://BACKUP_DUPLICITY_NETFS_UMOUNTCMD"
fi

umount_url "$BACKUP_DUPLICITY_NETFS_URL" $BUILD_DIR/outputfs
umount_url "$BACKUP_DUPLICITY_NETFS_URL" "$BUILD_DIR/outputfs"
fi
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ if [[ "$BACKUP_MOUNTCMD" ]] ; then
BACKUP_URL="var://BACKUP_MOUNTCMD"
fi

mount_url "$BACKUP_URL" $BUILD_DIR/outputfs $BACKUP_OPTIONS
mount_url "$BACKUP_URL" "$BUILD_DIR/outputfs" $BACKUP_OPTIONS
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if [[ "$BACKUP_UMOUNTCMD" ]] ; then
BACKUP_URL="var://BACKUP_UMOUNTCMD"
fi

umount_url "$BACKUP_URL" $BUILD_DIR/outputfs
umount_url "$BACKUP_URL" "$BUILD_DIR/outputfs"
2 changes: 1 addition & 1 deletion usr/share/rear/lib/_input-output-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ function cleanup_build_area_and_end_program () {
sleep 2
# umount_mountpoint_lazy is in lib/global-functions.sh
# which is not yet sourced in case of early Error() in usr/sbin/rear
has_binary umount_mountpoint_lazy && umount_mountpoint_lazy $BUILD_DIR/outputfs
has_binary umount_mountpoint_lazy && umount_mountpoint_lazy "$BUILD_DIR/outputfs"
fi
# remove_temporary_mountpoint is in lib/global-functions.sh
# which is not yet sourced in case of early Error() in usr/sbin/rear
Expand Down
26 changes: 13 additions & 13 deletions usr/share/rear/output/PXE/default/800_copy_to_tftp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ if [[ "$PXE_TFTP_UPLOAD_URL" ]] ; then
# We need filesystem access to the destination (schemes like ftp:// are not supported)
scheme_supports_filesystem $scheme || Error "Scheme $scheme for PXE output not supported, use a scheme that supports mounting (like nfs: )"

mount_url "$PXE_TFTP_UPLOAD_URL" $BUILD_DIR/tftpbootfs $BACKUP_OPTIONS
mount_url "$PXE_TFTP_UPLOAD_URL" "$BUILD_DIR/tftpbootfs" $BACKUP_OPTIONS
# However, we copy under $OUTPUT_PREFIX_PXE directory (usually HOSTNAME) to have different clients on one pxe server
pxe_tftp_local_path=$BUILD_DIR/tftpbootfs
pxe_tftp_local_path="$BUILD_DIR/tftpbootfs"
# mode must readable for others for pxe and we copy under the client HOSTNAME (=OUTPUT_PREFIX_PXE)
mkdir $v -m 755 -p "$BUILD_DIR/tftpbootfs/$OUTPUT_PREFIX_PXE" || Error "Could not mkdir '$BUILD_DIR/tftpbootfs/$OUTPUT_PREFIX_PXE'"
PXE_KERNEL="$OUTPUT_PREFIX_PXE/${PXE_TFTP_PREFIX}kernel"
Expand Down Expand Up @@ -51,21 +51,21 @@ if [[ "$PXE_TFTP_UPLOAD_URL" ]] && [[ "$PXE_RECOVER_MODE" = "unattended" ]] ; th
[[ -f /usr/lib/PXELINUX/pxelinux.0 ]] && PXELINUX_BIN=/usr/lib/PXELINUX/pxelinux.0
fi
if [[ "$PXELINUX_BIN" ]] ; then
cp $v "$PXELINUX_BIN" $BUILD_DIR/tftpbootfs >&2
cp $v "$PXELINUX_BIN" "$BUILD_DIR/tftpbootfs" >&2
fi
syslinux_modules_dir="$( find_syslinux_modules_dir menu.c32 )"
[[ -z "$syslinux_modules_dir" ]] && syslinux_modules_dir="$(dirname $PXELINUX_BIN)"
cp $v $syslinux_modules_dir/ldlinux.c32 $BUILD_DIR/tftpbootfs >&2
cp $v $syslinux_modules_dir/libcom32.c32 $BUILD_DIR/tftpbootfs >&2
cp $v $syslinux_modules_dir/libutil.c32 $BUILD_DIR/tftpbootfs >&2
cp $v $syslinux_modules_dir/menu.c32 $BUILD_DIR/tftpbootfs >&2
cp $v $syslinux_modules_dir/chain.c32 $BUILD_DIR/tftpbootfs >&2
cp $v $syslinux_modules_dir/hdt.c32 $BUILD_DIR/tftpbootfs >&2
cp $v $syslinux_modules_dir/reboot.c32 $BUILD_DIR/tftpbootfs >&2
cp $v $syslinux_modules_dir/ldlinux.c32 "$BUILD_DIR/tftpbootfs" >&2
cp $v $syslinux_modules_dir/libcom32.c32 "$BUILD_DIR/tftpbootfs" >&2
cp $v $syslinux_modules_dir/libutil.c32 "$BUILD_DIR/tftpbootfs" >&2
cp $v $syslinux_modules_dir/menu.c32 "$BUILD_DIR/tftpbootfs" >&2
cp $v $syslinux_modules_dir/chain.c32 "$BUILD_DIR/tftpbootfs" >&2
cp $v $syslinux_modules_dir/hdt.c32 "$BUILD_DIR/tftpbootfs" >&2
cp $v $syslinux_modules_dir/reboot.c32 "$BUILD_DIR/tftpbootfs" >&2
if [[ -r "$syslinux_modules_dir/poweroff.com" ]] ; then
cp $v $syslinux_modules_dir/poweroff.com $BUILD_DIR/tftpbootfs >&2
cp $v $syslinux_modules_dir/poweroff.com "$BUILD_DIR/tftpbootfs" >&2
elif [[ -r "$syslinux_modules_dir/poweroff.c32" ]] ; then
cp $v $syslinux_modules_dir/poweroff.c32 $BUILD_DIR/tftpbootfs >&2
cp $v $syslinux_modules_dir/poweroff.c32 "$BUILD_DIR/tftpbootfs" >&2
fi
chmod 644 $BUILD_DIR/tftpbootfs/*.c32
chmod 644 $BUILD_DIR/tftpbootfs/*.0
Expand All @@ -74,7 +74,7 @@ fi

if [[ "$PXE_TFTP_UPLOAD_URL" ]] ; then
LogPrint "Copied kernel+initrd $( du -shc $KERNEL_FILE "$TMP_DIR/$REAR_INITRD_FILENAME" | tail -n 1 | tr -s "\t " " " | cut -d " " -f 1 ) to $PXE_TFTP_UPLOAD_URL/$OUTPUT_PREFIX_PXE"
umount_url "$PXE_TFTP_UPLOAD_URL" $BUILD_DIR/tftpbootfs
umount_url "$PXE_TFTP_UPLOAD_URL" "$BUILD_DIR/tftpbootfs"
else
# legacy way PXE_TFTP_PATH
LogPrint "Copied kernel+initrd $( du -shc $KERNEL_FILE "$TMP_DIR/$REAR_INITRD_FILENAME" | tail -n 1 | tr -s "\t " " " | cut -d " " -f 1 ) to $PXE_TFTP_PATH"
Expand Down
4 changes: 2 additions & 2 deletions usr/share/rear/output/PXE/default/801_copy_to_http.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ local scheme="$( url_scheme "$PXE_HTTP_UPLOAD_URL" )"
# We need filesystem access to the destination (schemes like ftp:// are not supported)
scheme_supports_filesystem $scheme || Error "Scheme $scheme from PXE_HTTP_UPLOAD_URL not supported, use a scheme that supports mounting (like nfs: )"

mount_url "$PXE_HTTP_UPLOAD_URL" $BUILD_DIR/httpbootfs $BACKUP_OPTIONS
mount_url "$PXE_HTTP_UPLOAD_URL" "$BUILD_DIR/httpbootfs" $BACKUP_OPTIONS
# However, we copy under $OUTPUT_PREFIX_PXE directory (usually HOSTNAME) to have different clients on one pxe server
pxe_http_local_path=$BUILD_DIR/httpbootfs
# mode must readable for others for pxe and we copy under the client HOSTNAME (=OUTPUT_PREFIX_PXE)
Expand All @@ -41,6 +41,6 @@ echo "$VERSION_INFO" >"$pxe_http_local_path/$PXE_MESSAGE"
chmod 644 "$pxe_http_local_path/$PXE_KERNEL" "$pxe_http_local_path/$PXE_INITRD" "$pxe_http_local_path/$PXE_MESSAGE"

LogPrint "Copied kernel+initrd $( du -shc $KERNEL_FILE "$TMP_DIR/$REAR_INITRD_FILENAME" | tail -n 1 | tr -s "\t " " " | cut -d " " -f 1 ) to $PXE_HTTP_UPLOAD_URL/$OUTPUT_PREFIX_PXE"
umount_url "$PXE_HTTP_UPLOAD_URL" $BUILD_DIR/httpbootfs
umount_url "$PXE_HTTP_UPLOAD_URL" "$BUILD_DIR/httpbootfs"

# vim: set et ts=4 sw=4
8 changes: 4 additions & 4 deletions usr/share/rear/output/PXE/default/810_create_pxelinux_cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ if test "$PXE_CONFIG_URL" ; then
if ! scheme_supports_filesystem $scheme ; then
Error "Scheme $scheme for PXE output not supported, use a scheme that supports mounting (like nfs: )"
fi
mount_url $PXE_CONFIG_URL $BUILD_DIR/tftpbootfs $BACKUP_OPTIONS
pxe_local_path=$BUILD_DIR/tftpbootfs
mount_url "$PXE_CONFIG_URL" "$BUILD_DIR/tftpbootfs" $BACKUP_OPTIONS
pxe_local_path="$BUILD_DIR/tftpbootfs"
else
# legacy way using pxe_local_path default
pxe_local_path=$PXE_CONFIG_PATH
pxe_local_path="$PXE_CONFIG_PATH"
fi

# PXE_CONFIG_PREFIX is by default 'rear-' (see default.conf).
Expand Down Expand Up @@ -102,7 +102,7 @@ popd >/dev/null

if test "$PXE_CONFIG_URL" ; then
LogPrint "Created PXELINUX config '$pxe_config_file' and symlinks for $PXE_CREATE_LINKS adresses in $PXE_CONFIG_URL"
umount_url "$PXE_TFTP_UPLOAD_URL" $BUILD_DIR/tftpbootfs
umount_url "$PXE_TFTP_UPLOAD_URL" "$BUILD_DIR/tftpbootfs"
else
LogPrint "Created PXELINUX config '$pxe_config_file' and symlinks for $PXE_CREATE_LINKS adresses in $PXE_CONFIG_PATH"
RESULT_FILES+=( "$pxe_local_path/$pxe_config_file" )
Expand Down
4 changes: 2 additions & 2 deletions usr/share/rear/output/USB/Linux-i386/105_check_mounted_usb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local scheme

scheme="$( url_scheme $OUTPUT_URL )"

if ! mountpoint $BUILD_DIR/outputfs ; then
if ! mountpoint "$BUILD_DIR/outputfs" ; then
# It should be possible to support OUTPUT_URL=file://...,
# the user whould have to mount the USB manually.
# For this to work, one would need to eliminate all the hardcoded
Expand All @@ -27,7 +27,7 @@ if ! mountpoint $BUILD_DIR/outputfs ; then
Error "OUTPUT_URL '$OUTPUT_URL' is not mounted at $BUILD_DIR/outputfs"
fi

if usbdev="$(findmnt -funo SOURCE --target $BUILD_DIR/outputfs)" ; then
if usbdev="$(findmnt -funo SOURCE --target "$BUILD_DIR/outputfs")" ; then
if [ -z "$usbdev" ] ; then
LogPrintError "'findmnt -funo SOURCE --target $BUILD_DIR/outputfs' returned an empty string"
Error "Could not check that OUTPUT_URL '$OUTPUT_URL' refers to a block device mounted at $BUILD_DIR/outputfs"
Expand Down
2 changes: 1 addition & 1 deletion usr/share/rear/output/default/980_umount_output_dir.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ if [[ -z "$OUTPUT_URL" ]] ; then
return
fi

umount_url "$OUTPUT_URL" $BUILD_DIR/outputfs
umount_url "$OUTPUT_URL" "$BUILD_DIR/outputfs"
2 changes: 1 addition & 1 deletion usr/share/rear/prep/USB/default/060_set_usb_device.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test "$USB_PREFIX" || USB_PREFIX="rear/$HOSTNAME/$(date +%Y%m%d.%H%M)"

### Change NETFS_PREFIX to USB_PREFIX if our backup URL is on USB
if [[ "$BACKUP_URL" ]] ; then
local scheme="$( url_scheme "$BACKUP_URL") "
local scheme="$( url_scheme "$BACKUP_URL" )"
case "$scheme" in
(usb)
NETFS_PREFIX="$USB_PREFIX"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# check if NFS user is nobody - for rsync restore this is a NOGO
nfs_uid=$(ls -l $BUILD_DIR/outputfs | tail -1 | awk '{print $3}')
nfs_uid=$(ls -l "$BUILD_DIR/outputfs" | tail -1 | awk '{print $3}')
case "$nfs_uid" in
"nobody"|"-1"|"-2"|"4294967294")
Error "RBME rsync restore will result in a broken system (owner=$nfs_uid).
Expand Down

0 comments on commit 744a171

Please sign in to comment.