|
|
@ -0,0 +1,78 @@ |
|
|
|
#!/bin/sh |
|
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
|
|
# |
|
|
|
# Filename: lib/sde-package/.../freshmeat2 |
|
|
|
# Copyright (C) 2009 The OpenSDE Project |
|
|
|
# |
|
|
|
# More information can be found in the files COPYING and README. |
|
|
|
# |
|
|
|
# This program is free software; you can redistribute it and/or modify |
|
|
|
# it under the terms of the GNU General Public License as published by |
|
|
|
# the Free Software Foundation; version 2 of the License. A copy of the |
|
|
|
# GNU General Public License can be found in the file COPYING. |
|
|
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
|
|
|
|
|
|
|
|
#Description: Generates .desc files from the data in freshmeat |
|
|
|
#Alias: fm2 |
|
|
|
|
|
|
|
[ -n "$SDEROOT" ] || |
|
|
|
export SDEROOT=$(cd "${0%/*}/../../../"; pwd -P) |
|
|
|
|
|
|
|
. "$SDEROOT/lib/libsde.in" |
|
|
|
|
|
|
|
new_usage() { |
|
|
|
cat <<EOT >&2 |
|
|
|
Usage: $0 [-u <auth_code>] <name> |
|
|
|
|
|
|
|
get your personal auth_code from <http://freshmeat.net/account/edit> |
|
|
|
EOT |
|
|
|
exit 2 |
|
|
|
} |
|
|
|
|
|
|
|
fm_exists() { |
|
|
|
local uri="http://freshmeat.net/projects/$name" |
|
|
|
local response="$(curl -s -I "$uri" | tr -d '\r' | head -n 1)" |
|
|
|
|
|
|
|
if [ "$response" = "" ]; then |
|
|
|
echo_error "freshmeat.net unreachable." |
|
|
|
elif [ "$response" = "HTTP/1.1 200 OK" ]; then |
|
|
|
return 0 |
|
|
|
elif [ "$response" = "HTTP/1.1 404 Not Found" ]; then |
|
|
|
: |
|
|
|
else |
|
|
|
echo_error "$uri -> $response" |
|
|
|
fi |
|
|
|
return 1 |
|
|
|
} |
|
|
|
|
|
|
|
shortopts='u:' |
|
|
|
longopts= |
|
|
|
options=$(getopt -o "$shortopts" -l "$longopts" -- "$@") |
|
|
|
if [ $? -ne 0 ]; then |
|
|
|
new_usage |
|
|
|
fi |
|
|
|
eval set -- "$options" |
|
|
|
|
|
|
|
authcode= |
|
|
|
# load global settings |
|
|
|
eval $("$SDEROOT/bin/sde-config-ini" "--file=$SDESETTINGS" freshmeat) |
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do |
|
|
|
case "$1" in |
|
|
|
--) shift; break ;; |
|
|
|
|
|
|
|
-u) authcode="$2"; shift ;; |
|
|
|
esac |
|
|
|
shift |
|
|
|
done |
|
|
|
|
|
|
|
[ $# -eq 1 -a -n "$authcode" ] || new_usage |
|
|
|
name="$1" |
|
|
|
|
|
|
|
if fm_exists "$name"; then |
|
|
|
echo "$name: OK" |
|
|
|
else |
|
|
|
echo "$name: NOT FOUND" |
|
|
|
fi |