Browse Source

fix versionize zip collecting

master
poikilos 6 years ago
committed by Jacob Gustafson
parent
commit
ca8b54e40b
  1. 19
      webapp/versionize.sh

19
webapp/versionize.sh

@ -1,5 +1,6 @@
#!/usr/bin/bash #!/usr/bin/bash
echo
echo "Collecting version..."
if [ -z "$original_src_path" ]; then if [ -z "$original_src_path" ]; then
original_src_path="$1" original_src_path="$1"
fi fi
@ -46,17 +47,18 @@ if [ -d versionize ]; then
fi fi
mkdir versionize || customDie "cannot create /tmp/versionize" mkdir versionize || customDie "cannot create /tmp/versionize"
cd /tmp/versionize || customDie "cannot cd /tmp/versionize" cd /tmp/versionize || customDie "cannot cd /tmp/versionize"
src_archive=
if [ -f "$original_src_path" ]; then if [ -f "$original_src_path" ]; then
echo "* detected full path..." echo "* detected archive file full path..."
try_path="$original_src_path" try_path="$original_src_path"
src_archive="$original_src_path"
elif [ -d "$original_src_path" ]; then elif [ -d "$original_src_path" ]; then
echo "* detected full path..." echo "* detected directory full path..."
try_path="$original_src_path" try_path="$original_src_path"
fi fi
src_archive=
if [ -f "$try_path" ]; then if [ -f "$try_path" ]; then
src_archive="$try_path"
echo "* set src_archive to '$try_path'"
unzip "$try_path" unzip "$try_path"
src_name="`ls`" src_name="`ls`"
if [ ! -d "$src_name" ]; then if [ ! -d "$src_name" ]; then
@ -93,10 +95,11 @@ dest_path="$versions_path/linux-minetest-kit-$version"
echo "dest_path=$dest_path" echo "dest_path=$dest_path"
if [ ! -z "$src_archive" ]; then if [ ! -z "$src_archive" ]; then
echo "* Collecting src_archive '$src_archive'"
# The effectiveness of any bash extension extraction is debatable-- # The effectiveness of any bash extension extraction is debatable--
# see # see
# <https://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash> # <https://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash>
filename=$(basename -- "$fullfile") filename=$(basename -- "$src_archive")
extension="${filename##*.}" extension="${filename##*.}"
filename="${filename%.*}" filename="${filename%.*}"
dst_archive="$versions_path/$filename-$version.$extension" dst_archive="$versions_path/$filename-$version.$extension"
@ -112,6 +115,8 @@ if [ ! -z "$src_archive" ]; then
echo echo
echo echo
fi fi
else
echo "* There is no src_archive to collect."
fi fi
if [ -d "$dest_path" ]; then if [ -d "$dest_path" ]; then
echo echo
@ -123,6 +128,6 @@ if [ -d "$dest_path" ]; then
fi fi
mv "$src_path" "$dest_path" || customDie "Failed to move to 'dest_path'" mv "$src_path" "$dest_path" || customDie "Failed to move to 'dest_path'"
echo echo
echo "Done." echo "Done $0."
echo echo
echo echo

Loading…
Cancel
Save