summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-06-22 12:43:09 -0400
committerDessalines <tyhou13@gmx.com>2020-06-22 12:43:09 -0400
commitb161cad982327c8511fb7396654a42c529fb22c0 (patch)
treeb5ff6c886cd5f9fa8317778b92aabfd0b0ff65e6 /docker
parent4332828dd7b721697829de7bf4875e4a0ed00620 (diff)
Fixing up the migration script some more.
Diffstat (limited to 'docker')
-rw-r--r--docker/prod/migrate-pictshare-to-pictrs.bash30
1 files changed, 6 insertions, 24 deletions
diff --git a/docker/prod/migrate-pictshare-to-pictrs.bash b/docker/prod/migrate-pictshare-to-pictrs.bash
index f4294e13..8229eb28 100644
--- a/docker/prod/migrate-pictshare-to-pictrs.bash
+++ b/docker/prod/migrate-pictshare-to-pictrs.bash
@@ -23,41 +23,23 @@ if [[ -z $(docker-compose ps | grep pictrs) ]]; then
exit
fi
-if [[ -z $(type -P convert) ]]; then
- echo "Installing imagemagick to convert .webp images to .jpg"
- apt install imagemagick -y
-else
- echo "Imagemagick already installed."
-fi
-
# echo "Stopping Lemmy so that users dont upload new images during the migration"
# docker-compose stop lemmy
-echo "Importing pictshare images to pict-rs"
pushd volumes/pictshare/
+echo "Importing pictshare images to pict-rs..."
IMAGE_NAMES=*
for image in $IMAGE_NAMES; do
IMAGE_PATH="$(pwd)/$image/$image"
if [[ ! -f $IMAGE_PATH ]]; then
continue
fi
- if [ ${IMAGE_PATH: -5} == ".webp" ]; then
- NEW_IMAGE_PATH=$(echo "$IMAGE_PATH" | sed "s/\.webp$/\.jpg/g")
- convert "$IMAGE_PATH" "$NEW_IMAGE_PATH"
- IMAGE_PATH="$NEW_IMAGE_PATH"
- continue
- fi
echo -e "\nImporting $IMAGE_PATH"
ret=0
- curl --fail -F "images[]=@$IMAGE_PATH" http://127.0.0.1:8537/import || ret=$?
- # if [[ $ret != 0 ]]; then
- # read -p "Failed to import $IMAGE_PATH, continue? " yn
- # case $yn in
- # [Yy]* ) ;;
- # [Nn]* ) exit;;
- # * ) exit;;
- # esac
- # fi
+ curl --silent --fail -F "images[]=@$IMAGE_PATH" http://127.0.0.1:8537/import || ret=$?
+ if [[ $ret != 0 ]]; then
+ echo "Error for $IMAGE_PATH : $ret"
+ fi
done
echo "Fixing permissions on pictshare folder"
@@ -74,5 +56,5 @@ echo "Moving pictshare data folder to pictshare_backup"
mv volumes/pictshare volumes/pictshare_backup
echo "Migration done, starting Lemmy again"
-echo "If everything went well, you can delete ./volumes/pictshare_backup/ and uninstall imagemagick"
+echo "If everything went well, you can delete ./volumes/pictshare_backup/"
docker-compose start lemmy