#! /usr/bin/env nix-shell #! nix-shell -i bash -p coreutils findutils gnused nix wget set -x # The trailing slash at the end is necessary! WGET_ARGS='http://download.kde.org/stable/applications/15.08.2/ http://download.kde.org/stable/applications/15.04.3/src/oxygen-icons-15.04.3.tar.xz -A *.tar.xz' mkdir tmp; cd tmp rm -f ../srcs.csv wget -nH -r -c --no-parent $WGET_ARGS find . | while read src; do if [[ -f "${src}" ]]; then # Sanitize file name filename=$(basename "$src" | tr '@' '_') nameVersion="${filename%.tar.*}" name=$(echo "$nameVersion" | sed -e 's,-[[:digit:]].*,,' | sed -e 's,-opensource-src$,,') version=$(echo "$nameVersion" | sed -e 's,^\([[:alpha:]][[:alnum:]]*-\)\+,,') echo "$name,$version,$src,$filename" >>../srcs.csv fi done cat >../srcs.nix <>../srcs.nix <>../srcs.nix rm -f ../srcs.csv cd ..