Constructive feedback is appreciated.

#!/bin/bash

FILE=docker-compose.yml

if [ -f "$FILE" ]; then
	rm $FILE
	wget https://raw.githubusercontent.com/LemmyNet/lemmy/main/docker/prod/docker-compose.yml
else
	echo "$FILE does not exist. Creating $FILE now..."
	wget https://raw.githubusercontent.com/LemmyNet/lemmy/main/docker/prod/docker-compose.yml
fi
  • @ksynwa@lemmy.ml
    link
    fedilink
    52 years ago

    You can download it to a temporary location (using mktemp), then compare the checksums of the existing and downloaded files, and move the file from temporary location to $FILE if the checksum is different. This is not necessary though since docker-compose can tell if the compose file has changed, but it will be helpful to the user to know whether they have downloaded an updated file or not.