chore: shfmt, cleanup

This commit is contained in:
2024-12-28 18:59:09 +02:00
parent eb91a43bbd
commit a8a473a46d
26 changed files with 299 additions and 516 deletions

View File

@@ -6,12 +6,12 @@ KEYS_FILE="${AGE_KEYSFILE:-$HOME/.ssh/keys.txt}"
KEYS_SOURCE="${AGE_KEYSSOURCE:-https://github.com/ivuorinen.keys}"
# Check for required commands
if ! command -v age &>/dev/null; then
if ! command -v age &> /dev/null; then
echo "Error: age is not installed. Please install it to continue."
exit 1
fi
if ! command -v curl &>/dev/null; then
if ! command -v curl &> /dev/null; then
echo "Error: curl is not installed. Please install it to continue."
exit 1
fi
@@ -28,7 +28,6 @@ if [[ ! -f "$FILE" ]]; then
exit 1
fi
# Check if keys file exists, otherwise fetch it
if [[ ! -f "$KEYS_FILE" ]]; then
echo "Keys file '$KEYS_FILE' not found. Attempting to fetch from $KEYS_SOURCE..."
@@ -51,7 +50,7 @@ fi
# Decrypt the file
OUTPUT_FILE="${FILE%.age}"
age -d -i "$KEYS_FILE" "$FILE" >"$OUTPUT_FILE"
age -d -i "$KEYS_FILE" "$FILE" > "$OUTPUT_FILE"
if [[ $? -eq 0 ]]; then
echo "File decrypted successfully: $OUTPUT_FILE"
@@ -59,4 +58,3 @@ else
echo "Error: Failed to decrypt file."
exit 1
fi