Remove zip extension in target
This commit is contained in:
parent
c1c8a0b4a2
commit
198e6c944f
12
pishrink.sh
12
pishrink.sh
|
@ -160,15 +160,19 @@ done
|
||||||
|
|
||||||
#Copy to new file if requested
|
#Copy to new file if requested
|
||||||
if [ -n "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
info "Copying $1 to $2..."
|
f="$2"
|
||||||
cp --reflink=auto --sparse=always "$1" "$2"
|
if [[ -n $ziptool && "${f##*.}" == ${ZIPEXTENSIONS[$ziptool]} ]]; then # remove zip extension if zip requested because zip tool will complain about extension
|
||||||
|
f="${f%.*}"
|
||||||
|
fi
|
||||||
|
info "Copying $1 to $f..."
|
||||||
|
cp --reflink=auto --sparse=always "$1" "$f"
|
||||||
if (( $? != 0 )); then
|
if (( $? != 0 )); then
|
||||||
error $LINENO "Could not copy file..."
|
error $LINENO "Could not copy file..."
|
||||||
exit -5
|
exit -5
|
||||||
fi
|
fi
|
||||||
old_owner=$(stat -c %u:%g "$1")
|
old_owner=$(stat -c %u:%g "$1")
|
||||||
chown "$old_owner" "$2"
|
chown "$old_owner" "$f"
|
||||||
img="$2"
|
img="$f"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# cleanup at script exit
|
# cleanup at script exit
|
||||||
|
|
Loading…
Reference in New Issue