diff --git a/src b/src index 29a5172..facdeab 100755 --- a/src +++ b/src @@ -28,8 +28,7 @@ add_item() { } rm_item() { - ## Remove this entry from the srcfile - ## and delete the source files afterwards + ## Remove this entry from the srcfile and delete the source files afterwards tmp="$srcfile.tmp" awk "\$3 != \"$1\" { print }" "$srcfile" > "$tmp" @@ -52,8 +51,7 @@ update_gitrepo() { } update_tarfile() { - ## Download and extract this tarfile if it - ## doesn't exist yet + ## Download and extract this tarfile if it doesn't exist yet if ! [ -d "$2" ] ; then wget "$1" tar -xf "$1" -C "$2" @@ -64,8 +62,7 @@ update_tarfile() { } update_zipfile() { - ## Download and extract this tarfile if it - ## doesn't exist yet + ## Download and extract this zipfile if it doesn't exist yet if ! [ -d "$2" ] ; then wget "$1" unzip "$1" -d "$2" @@ -150,6 +147,30 @@ list_all() { cleanup } +diff_all() { + ## Show the difference of the sourcefile and the actual content of the + ## directory + preproc + + want=".src_want" + actual=".src_actual" + + true > "$want" + true > "$actual" + + # Set up want + cut -d' ' -f3 < "$tmp" | sort > "$want" + + # Set up actual + find . -maxdepth 1 -type d | tail -n +2 | sed 's|^./||' | sort > "$actual" + + # Diff + diff -u0 "$want" "$actual" + + rm "$want" "$actual" + cleanup +} + case "$1" in "u"|"update") update_all @@ -164,6 +185,9 @@ case "$1" in "ls"|"list") list_all ;; + "d"|"diff") + diff_all + ;; "--help"|"-h") usage exit 1