#!/bin/bash if [ $# -eq 0 ]; then echo "Usage: $0 " exit 1 fi profile="$1" while IFS=, read -r version backingversion url do file=$(basename "$url") vhd=$(basename "$url" | sed -E "s/.app/.vhd/") if [ -f images/app/$file ]; then echo "Found $file" if [ -f images/vhd/$vhd ]; then echo "Found $vhd" else echo "Decrypting $file" fsdecrypt images/app/$file mv images/app/*.vhd images/vhd fi else if [ ! -f images/vhd/$vhd ]; then echo "Downloading $file" aria2c -x 8 -j 8 -o images/app/$file $url echo "Decrypting $file" fsdecrypt images/app/$file mv images/app/*.vhd images/vhd fi fi done < profiles/$profile/apps.csv