mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
29e5110627
Because curl and wget do not let use a hashed password as parameter, YaCy shell scripts which require authentication are now interactive by default when HTTP Digest is the only available authentication method. Batch mode can still be available trough the use of an environment variable : YACY_ADMIN_PASSWORD. Other improvements : - added backward compatibility for Basic Authentication - fixed curl/wget presence detection - do not return with exit code 0 when an API call failed, and print an error message when the case occurs - documented available authentication options for API calls
34 lines
962 B
Bash
Executable File
34 lines
962 B
Bash
Executable File
#!/usr/bin/env sh
|
|
cd "`dirname $0`"
|
|
if which curl > /dev/null; then
|
|
while getopts "ys" opt; do
|
|
case $opt in
|
|
y)
|
|
shift;
|
|
curl -sSf "http://$1/yacysearch.rss?query=$2" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
|
|
;;
|
|
s)
|
|
shift;
|
|
curl -sSf "http://$1/solr/select?q=text_t:$2&start=0&rows=100&fl=sku&wt=rss" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
|
|
;;
|
|
esac
|
|
done
|
|
elif which wget > /dev/null; then
|
|
while getopts "ys" opt; do
|
|
case $opt in
|
|
y)
|
|
shift;
|
|
wget -q -O - "http://$1/yacysearch.rss?query=$2" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
|
|
;;
|
|
s)
|
|
shift;
|
|
wget -q -O - "http://$1/solr/select?q=text_t:$2&start=0&rows=100&fl=sku&wt=rss" | awk '/^<link>/{ gsub("<link>","" );gsub("<\/link>","" ); print $0 }'
|
|
;;
|
|
esac
|
|
done
|
|
else
|
|
echo "Neither curl nor wget installed!"
|
|
exit 1
|
|
fi
|
|
|