diff options
Diffstat (limited to 'www/amphetadesk/files')
-rw-r--r-- | www/amphetadesk/files/AmphetaDesk | 34 | ||||
-rw-r--r-- | www/amphetadesk/files/amphetadesk.in | 64 | ||||
-rw-r--r-- | www/amphetadesk/files/amphetadesk.sh | 64 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-AM_DIR | 21 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-defaults | 12 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-lib::AmphetaDesk.pm | 10 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-lib::AmphetaDesk::ChannelsList.pm | 23 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-lib::AmphetaDesk::MyChannels.pm | 97 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-lib::AmphetaDesk::OS::Linux.pm | 71 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-lib::AmphetaDesk::Settings.pm | 23 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-lib::AmphetaDesk::Utilities.pm | 29 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-lib::AmphetaDesk::WWW.pm | 22 | ||||
-rw-r--r-- | www/amphetadesk/files/patch-lib::XML::Simple.pm | 36 | ||||
-rw-r--r-- | www/amphetadesk/files/wrapper.sh | 61 |
14 files changed, 500 insertions, 67 deletions
diff --git a/www/amphetadesk/files/AmphetaDesk b/www/amphetadesk/files/AmphetaDesk deleted file mode 100644 index 28fe5aea8e1d..000000000000 --- a/www/amphetadesk/files/AmphetaDesk +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh - -if [ `id -un` = root ]; then - echo Running AmphetaDesk as root is not recommended. - echo Aborting. - exit 1 -fi - -export AM_DIR=$HOME/.AmphetaDesk - -if [ ! -d $AM_DIR ]; then - if [ -e $AM_DIR ]; then - echo Cannot make $AM_DIR directory for something is in the way. - echo Aborting. - exit 1 - else - mkdir $AM_DIR - if [ ! -d $AM_DIR ]; then - echo Cannot make $AM_DIR directory. - echo Aborting. - exit 1 - fi - fi -fi - -echo Diagnostic output goes to $AM_DIR/AmphetaDesk.log - -cd %%ADESK%% - -if [ ! -f ${AM_DIR}/data/lists/services-channels-recent.xml ] ; then - find data -depth -print | cpio -pdum ${AM_DIR} -fi - -exec ./AmphetaDesk.pl diff --git a/www/amphetadesk/files/amphetadesk.in b/www/amphetadesk/files/amphetadesk.in new file mode 100644 index 000000000000..330554953316 --- /dev/null +++ b/www/amphetadesk/files/amphetadesk.in @@ -0,0 +1,64 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Under a BSDL license. Copyright 2005. Mario S F Ferreira <lioux@FreeBSD.org> + +# PROVIDE: amphetadesk +# REQUIRE: LOGIN +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable amphetadesk: +# +#amphetadesk_enable="YES" +#amphetadesk_user="" +#amphetadesk_pidfile="" +# + +. /etc/rc.subr + +name="amphetadesk" +rcvar=`set_rcvar` +command="%%PREFIX%%/bin/AmphetaDesk" +procname="%%PERL%%" + +load_rc_config "${name}" +: ${amphetadesk_enable="NO"} +: ${amphetadesk_user=""} + +if [ -n "${amphetadesk_user}" ]; then + eval realpath ~${amphetadesk_user} >/dev/null 2>&1 && + amphetadesk_homedir="$(eval realpath ~${amphetadesk_user})" +fi + +if [ -n "${amphetadesk_user}" -a -z "${amphetadesk_pidfile}" -a -n "${amphetadesk_homedir}" ]; then + amphetadesk_pidfile="${amphetadesk_homedir}/.${name}/AmphetaDesk.pid" +fi + +pidfile="${amphetadesk_pidfile:-${HOME}/.${name}/AmphetaDesk.pid}" + +start_cmd="start_cmd" + +start_precmd="amphetadesk_check_vars" +stop_precmd="amphetadesk_check_vars" +status_precmd="amphetadesk_check_vars" + +amphetadesk_check_vars() +{ + if [ -z "${amphetadesk_user}" ]; then + amphetadesk_user=$(whoami) + fi + + if [ "x${amphetadesk_user}" = "xroot" ]; then + err 1 "You have to set amphetadesk_user to a non-root user for security reasons" + fi +} + +start_cmd() +{ + su -l ${amphetadesk_user} \ + -c "env PIDFILE=${pidfile} ${command} &" +} + +run_rc_command "$1" diff --git a/www/amphetadesk/files/amphetadesk.sh b/www/amphetadesk/files/amphetadesk.sh new file mode 100644 index 000000000000..330554953316 --- /dev/null +++ b/www/amphetadesk/files/amphetadesk.sh @@ -0,0 +1,64 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Under a BSDL license. Copyright 2005. Mario S F Ferreira <lioux@FreeBSD.org> + +# PROVIDE: amphetadesk +# REQUIRE: LOGIN +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable amphetadesk: +# +#amphetadesk_enable="YES" +#amphetadesk_user="" +#amphetadesk_pidfile="" +# + +. /etc/rc.subr + +name="amphetadesk" +rcvar=`set_rcvar` +command="%%PREFIX%%/bin/AmphetaDesk" +procname="%%PERL%%" + +load_rc_config "${name}" +: ${amphetadesk_enable="NO"} +: ${amphetadesk_user=""} + +if [ -n "${amphetadesk_user}" ]; then + eval realpath ~${amphetadesk_user} >/dev/null 2>&1 && + amphetadesk_homedir="$(eval realpath ~${amphetadesk_user})" +fi + +if [ -n "${amphetadesk_user}" -a -z "${amphetadesk_pidfile}" -a -n "${amphetadesk_homedir}" ]; then + amphetadesk_pidfile="${amphetadesk_homedir}/.${name}/AmphetaDesk.pid" +fi + +pidfile="${amphetadesk_pidfile:-${HOME}/.${name}/AmphetaDesk.pid}" + +start_cmd="start_cmd" + +start_precmd="amphetadesk_check_vars" +stop_precmd="amphetadesk_check_vars" +status_precmd="amphetadesk_check_vars" + +amphetadesk_check_vars() +{ + if [ -z "${amphetadesk_user}" ]; then + amphetadesk_user=$(whoami) + fi + + if [ "x${amphetadesk_user}" = "xroot" ]; then + err 1 "You have to set amphetadesk_user to a non-root user for security reasons" + fi +} + +start_cmd() +{ + su -l ${amphetadesk_user} \ + -c "env PIDFILE=${pidfile} ${command} &" +} + +run_rc_command "$1" diff --git a/www/amphetadesk/files/patch-AM_DIR b/www/amphetadesk/files/patch-AM_DIR deleted file mode 100644 index b0fd613c5c82..000000000000 --- a/www/amphetadesk/files/patch-AM_DIR +++ /dev/null @@ -1,21 +0,0 @@ ---- lib/AmphetaDesk.pm.DIST Tue Nov 5 06:06:05 2002 -+++ lib/AmphetaDesk.pm Thu Apr 8 23:17:19 2004 -@@ -71,7 +71,8 @@ - - # delete the logfile if it's over 250k, - # then reopen it and try to redir STDERR. -- my $logfile = catfile($Bin, "AmphetaDesk.log"); -+ my $envtmp = $ENV{AM_DIR}; -+ my $logfile = catfile($envtmp, "AmphetaDesk.log"); - if (-e $logfile) { unlink $logfile if -s $logfile > 250000; } - open (LOG, ">>$logfile") or die "AmphetaDesk couldn't open the logfile for logging: $!"; - open(STDERR,">&LOG") or die "AmphetaDesk couldn't redirect errors to the logfile: $!"; -@@ -81,7 +82,7 @@ - # load our settings. this routine is located in Settings.pm - # and takes care of determining the OS, finding all the paths - # to the relevant files, as well as making sure everything exists. -- load_my_settings( catfile($Bin, "data", "mySettings.xml") ); -+ load_my_settings( catfile($envtmp, "data", "mySettings.xml") ); - - # load our os specific libraries. if we don't know, use the Linux - # libraries, which currently default to STDOUT for all gui processing. diff --git a/www/amphetadesk/files/patch-defaults b/www/amphetadesk/files/patch-defaults deleted file mode 100644 index 75c5c66b670b..000000000000 --- a/www/amphetadesk/files/patch-defaults +++ /dev/null @@ -1,12 +0,0 @@ ---- lib/AmphetaDesk/Settings.pm.DIST Mon Oct 28 12:40:41 2002 -+++ lib/AmphetaDesk/Settings.pm Thu Apr 8 23:29:33 2004 -@@ -105,7 +105,8 @@ - $SETTINGS{app_contact} = "Morbus Iff"; - $SETTINGS{app_email} = "morbus\@disobey.com"; - $SETTINGS{app_os} = $^O; -- $SETTINGS{dir_data} = catdir($Bin, "data"); -+ my $envtmp = $ENV{AM_DIR}; -+ $SETTINGS{dir_data} = catdir($envtmp, "data"); - $SETTINGS{dir_docs} = catdir($Bin, "docs"); - $SETTINGS{dir_templates} = catdir($Bin, "templates", "default"); - $SETTINGS{dir_gui} = catdir($SETTINGS{dir_templates}, "gui"); diff --git a/www/amphetadesk/files/patch-lib::AmphetaDesk.pm b/www/amphetadesk/files/patch-lib::AmphetaDesk.pm new file mode 100644 index 000000000000..fb7a9aba60a9 --- /dev/null +++ b/www/amphetadesk/files/patch-lib::AmphetaDesk.pm @@ -0,0 +1,10 @@ +--- lib/AmphetaDesk.pm.orig Mon Oct 10 17:02:41 2005 ++++ lib/AmphetaDesk.pm Mon Oct 10 17:02:45 2005 +@@ -40,7 +40,6 @@ + + # where are we? + use FindBin qw($Bin); +-BEGIN { unshift(@INC, catdir($Bin, "lib")); } + + ############################################################################### + # init - creates the environment and sets up the queue based loop. # diff --git a/www/amphetadesk/files/patch-lib::AmphetaDesk::ChannelsList.pm b/www/amphetadesk/files/patch-lib::AmphetaDesk::ChannelsList.pm new file mode 100644 index 000000000000..7ac4b6817145 --- /dev/null +++ b/www/amphetadesk/files/patch-lib::AmphetaDesk::ChannelsList.pm @@ -0,0 +1,23 @@ +--- lib/AmphetaDesk/ChannelsList.pm.orig Tue Oct 11 01:12:48 2005 ++++ lib/AmphetaDesk/ChannelsList.pm Tue Oct 11 01:35:03 2005 +@@ -18,6 +18,7 @@ + use strict; $|++; + use AmphetaDesk::Settings; + use AmphetaDesk::Utilities; ++use AmphetaDesk::WWW; + use XML::Parser; + require Exporter; + use vars qw( @ISA @EXPORT ); +@@ -103,6 +104,12 @@ + # my logfile is aroused. + note("Loading our channel list from " . + get_setting("names_file_services_channels") . "."); ++ ++ # fetch updated version if none exists locally ++ if (! -e (get_setting("files_services_channels")) ) { ++ my $l = new AmphetaDesk::WWW; ++ $l->getstore( "http://www.disobey.com/amphetadesk/lists/services-channels-recent.xml", (get_setting("files_services_channels")) ); ++ } + + # get an new instance of the parser, + # register handlers, then parse. diff --git a/www/amphetadesk/files/patch-lib::AmphetaDesk::MyChannels.pm b/www/amphetadesk/files/patch-lib::AmphetaDesk::MyChannels.pm new file mode 100644 index 000000000000..0ba21e58c8e3 --- /dev/null +++ b/www/amphetadesk/files/patch-lib::AmphetaDesk::MyChannels.pm @@ -0,0 +1,97 @@ +--- lib/AmphetaDesk/MyChannels.pm.orig Tue Oct 29 03:17:50 2002 ++++ lib/AmphetaDesk/MyChannels.pm Tue Oct 11 18:41:38 2005 +@@ -359,9 +359,11 @@ + + # count 'em. + my $total_count = count_my_channels; ++ if ($total_count) { + note("There was a total of $total_count subscribed channels."); + note("We dance a drunken jig of epic proportions! " . + "<shake> <jiggle> <keRAASH!>...") if $total_count > 100; ++ } + + # resave the channels list + # with the latest dates. +@@ -558,50 +560,41 @@ + title => "Disobey.com's AmphetaDesk - News and Updates", + xmlurl => "http://www.disobey.com/amphetadesk/news.xml" + }, +- "http://www.moreover.com/cgi-local/page?index_naturalhealth+rss" => { +- date_added => "2002-03-01 00:00:00", +- date_downloaded => "2002-03-01 00:00:00", +- description => "Consumer: top stories - news headlines from around the web, refreshed every 15 minutes.", +- filename => "consumernaturalhealt.xml", +- htmlurl => "http://www.moreover.com/", +- title => "Consumer: natural health news", +- xmlurl => "http://www.moreover.com/cgi-local/page?index_naturalhealth+rss" +- }, +- "http://www.gamegrene.com/rss/gamegrene.xml" => { +- date_added => "2002-03-01 00:00:00", +- date_downloaded => "2002-03-01 00:00:00", +- description => "Filled with unique and interesting computer, tabletop, card, and roleplaying game columns, as well as daily news from the gaming community, Gamegrene.com is the perfect choice for the gamer who's sick of the typical.", +- filename => "gamegrenecom.xml", +- htmlurl => "http://www.gamegrene.com/", +- title => "Game Green? Games Phobia? Gamegrene.com!", +- xmlurl => "http://www.gamegrene.com/rss/gamegrene.xml" ++ "http://www.freebsd.org/news/news.rdf" => { ++ date_added => "2005-10-11 00:00:00", ++ date_downloaded => "2005-10-11 00:00:00", ++ description => "News from the FreeBSD Project", ++ filename => "freebsdprojectnews.xml", ++ htmlurl => "http://www.FreeBSD.org/news/", ++ title => "FreeBSD Project News", ++ xmlurl => "http://www.freebsd.org/news/news.rdf" + }, +- "http://www.lockergnome.com/lockergnome.xml" => { +- date_added => "2002-03-01 00:00:00", +- date_downloaded => "2002-03-01 00:00:00", +- description => "Free Technology E-mail Newsletters - Packed with 32-bit downloads (freeware / shareware), MP3s, multimedia, fonts, updates, tips, tricks, computer news, and more! We cater to curious users.", +- filename => "lockergnome.xml", +- htmlurl => "http://www.lockergnome.com/", +- title => "Lockergnome", +- xmlurl => "http://www.lockergnome.com/lockergnome.xml" ++ "http://www.freshports.org/news.php" => { ++ date_added => "2005-10-11 00:00:00", ++ date_downloaded => "2005-10-11 00:00:00", ++ description => "he easiest place to find ports", ++ filename => "freshportstheplacefo.xml", ++ htmlurl => "http://www.FreshPorts.org/", ++ title => "FreshPorts -- The Place For Ports", ++ xmlurl => "http://www.freshports.org/news.php" + }, +- "http://www.researchbuzz.com/researchbuzz.rss" => { +- date_added => "2002-03-01 00:00:00", +- date_downloaded => "2002-03-01 00:00:00", +- description => "News and information on search engines and other Internet research resources.", +- filename => "researchbuzz.xml", +- htmlurl => "http://www.researchbuzz.com/", +- title => "ResearchBuzz", +- xmlurl => "http://www.researchbuzz.com/researchbuzz.rss" ++ "http://www.oreillynet.com/feeds/author/?x-au=73&x-mimetype=application/rdf+xm" => { ++ date_added => "2005-10-11 00:00:00", ++ date_downloaded => "2005-10-11 00:00:00", ++ description => "Dru Lavigne's O'Reilly Network Items: Weblogs, Articles, Hacks and Books", ++ filename => "drulavigneoreillynet.xml", ++ htmlurl => "http://www.oreillynet.com/pub/au/73", ++ title => "Dru Lavigne, O'Reilly Network", ++ xmlurl => "http://www.oreillynet.com/feeds/author/?x-au=73&x-mimetype=application/rdf+xm" + }, +- "http://www.reutershealth.com/eline.rss" => { +- date_added => "2002-03-01 00:00:00", +- date_downloaded => "2002-03-01 00:00:00", +- description => "A daily look at the top consumer-oriented health-related news stories.", +- filename => "reutershealtheline.xml", +- htmlurl => "http://www.reutershealth.com/", +- title => "Reuters Health eLine", +- xmlurl => "http://www.reutershealth.com/eline.rss" ++ "http://daily.daemonnews.org/ddn.rdf.php3" => { ++ date_added => "2005-10-11 00:00:00", ++ date_downloaded => "2005-10-11 00:00:00", ++ description => "Daemon News PHP News System", ++ filename => "bsdnews.xml", ++ htmlurl => "http://bsdnews.com", ++ title => "BSD News", ++ xmlurl => "http://daily.daemonnews.org/ddn.rdf.php3" + } + ); + diff --git a/www/amphetadesk/files/patch-lib::AmphetaDesk::OS::Linux.pm b/www/amphetadesk/files/patch-lib::AmphetaDesk::OS::Linux.pm new file mode 100644 index 000000000000..0c5d3c670b76 --- /dev/null +++ b/www/amphetadesk/files/patch-lib::AmphetaDesk::OS::Linux.pm @@ -0,0 +1,71 @@ +--- lib/AmphetaDesk/OS/Linux.pm.orig Thu May 23 23:35:38 2002 ++++ lib/AmphetaDesk/OS/Linux.pm Tue Oct 11 18:46:17 2005 +@@ -15,11 +15,26 @@ + use strict; + use AmphetaDesk::Settings; + use AmphetaDesk::Utilities; ++use POSIX ":sys_wait_h"; ++use POSIX ":unistd_h"; + require Exporter; + use vars qw( @ISA @EXPORT ); + @ISA = qw( Exporter ); + @EXPORT = qw( gui_init gui_listen gui_note open_url ); + ++# taken from perlipc man page ++sub sigchild { ++ my $child; ++ ++ # If a second child dies while in the signal handler caused by the ++ # first death, we won't get another signal. So must loop here else ++ # we will leave the unreaped child as a zombie. And the next time ++ # two children die we get another zombie. And so on. ++ while (($child = waitpid(-1,WNOHANG)) > 0) {} ++ ++ $SIG{CHLD} = \&sigchild; ++} ++ + ############################################################################### + # gui_init - start the gui and display the window. # + ############################################################################### +@@ -105,8 +120,41 @@ + # construct our url. + my $url = "http://127.0.0.1:" . get_setting("urls_port") . "/index.html"; + ++ # default browser ++ my $browser; ++ + # we spit out our suggestion just to catch all instances. + note("If your browser doesn't load, go to <$url>.", 1); ++ ++ # what browser? ++ if ($ENV{'BROWSER'}) { ++ $browser = $ENV{'BROWSER'}; ++ } else { ++ if (get_setting("user_browser_path")) { ++ $browser = get_setting("user_browser_path"); ++ } ++ } ++ ++ if ( ($browser) && ( (-x $browser) || (-X $browser) ) ) { ++ note("Your environment states that $browser is your default program."); ++ ++ $SIG{CHLD} = \&sigchild; ++ ++ if (fork() == 0) { ++ my @args = ("$browser", "$url"); ++ ++ setsid(); ++ close(STDIN); ++ close(STDOUT); ++ close(STDERR); ++ ++ exec(@args) == 0 ++ or note("The browser <$browser> does not exist. Please select another."); ++ ++ exit 1; ++ } ++ ++ } + + return 1; + diff --git a/www/amphetadesk/files/patch-lib::AmphetaDesk::Settings.pm b/www/amphetadesk/files/patch-lib::AmphetaDesk::Settings.pm new file mode 100644 index 000000000000..abf0a19ec287 --- /dev/null +++ b/www/amphetadesk/files/patch-lib::AmphetaDesk::Settings.pm @@ -0,0 +1,23 @@ +--- lib/AmphetaDesk/Settings.pm.orig Mon Oct 28 14:40:19 2002 ++++ lib/AmphetaDesk/Settings.pm Mon Oct 10 17:05:56 2005 +@@ -33,7 +33,6 @@ + + # where are we? + use FindBin qw($Bin); +-BEGIN { unshift(@INC, catdir($Bin, "lib")); } + + # where we store our + # in-memory settings. +@@ -105,9 +104,9 @@ + $SETTINGS{app_contact} = "Morbus Iff"; + $SETTINGS{app_email} = "morbus\@disobey.com"; + $SETTINGS{app_os} = $^O; +- $SETTINGS{dir_data} = catdir($Bin, "data"); +- $SETTINGS{dir_docs} = catdir($Bin, "docs"); +- $SETTINGS{dir_templates} = catdir($Bin, "templates", "default"); ++ $SETTINGS{dir_data} = catdir($ENV{'HOME'}, ".amphetadesk", "data"); ++ $SETTINGS{dir_docs} = "%%DOCSDIR%%"; ++ $SETTINGS{dir_templates} = catdir("%%DATADIR%%", "templates", "default"); + $SETTINGS{dir_gui} = catdir($SETTINGS{dir_templates}, "gui"); + $SETTINGS{dir_data_channels} = catdir($SETTINGS{dir_data}, "channels"); + $SETTINGS{dir_data_lists} = catdir($SETTINGS{dir_data}, "lists"); diff --git a/www/amphetadesk/files/patch-lib::AmphetaDesk::Utilities.pm b/www/amphetadesk/files/patch-lib::AmphetaDesk::Utilities.pm new file mode 100644 index 000000000000..efa3380c5d85 --- /dev/null +++ b/www/amphetadesk/files/patch-lib::AmphetaDesk::Utilities.pm @@ -0,0 +1,29 @@ +--- lib/AmphetaDesk/Utilities.pm.orig Sun Oct 9 19:45:59 2005 ++++ lib/AmphetaDesk/Utilities.pm Sun Oct 9 19:51:44 2005 +@@ -112,7 +112,7 @@ + $hour = sprintf "%02.0d", $hour; + + # print the entry to our log file. +- print LOG "[$hour:$min:$sec] $message\n"; ++ print LOG "[$hour:$min:$sec] $message\n" if fileno LOG; + + # and save the message in our response log + # if the message is also being sent to the gui. +@@ -127,7 +127,7 @@ + $os = "MacOS" if $^O =~ /Mac/; + $os = "Windows" if $^O =~ /Win/; + $os = "Linux" unless defined $os; +- my $packname = "AmphetaDesk::OS::"; ++ my $packname = "AmphetaDesk::AmphetaDesk::OS::"; + my $funcname = "::gui_note"; + &{ $packname. $os . $funcname }($message) if $gui; + } +@@ -151,7 +151,7 @@ + $os = "MacOS" if $^O =~ /Mac/; + $os = "Windows" if $^O =~ /Win/; + $os = "Linux" unless defined $os; +- my $packname = "AmphetaDesk::OS::"; ++ my $packname = "AmphetaDesk::AmphetaDesk::OS::"; + my $funcname = "::gui_note"; + &{ $packname. $os . $funcname }($message); + } diff --git a/www/amphetadesk/files/patch-lib::AmphetaDesk::WWW.pm b/www/amphetadesk/files/patch-lib::AmphetaDesk::WWW.pm new file mode 100644 index 000000000000..c6c78d128b9f --- /dev/null +++ b/www/amphetadesk/files/patch-lib::AmphetaDesk::WWW.pm @@ -0,0 +1,22 @@ +--- lib/AmphetaDesk/WWW.pm.orig Tue Oct 29 03:30:40 2002 ++++ lib/AmphetaDesk/WWW.pm Mon Oct 10 14:16:59 2005 +@@ -103,7 +103,9 @@ + $req->proxy_authorization_basic($un, $pw); } + + # set our referer and grab our URL. ++ if (get_setting("user_http_referer")) { + $req->referer( get_setting("user_http_referer") ); ++ } + my $res = $ua->request($req); + + # did things go happily or sadly? +@@ -171,7 +173,9 @@ + $req->proxy_authorization_basic($un, $pw); } + + # set our referer and grab our URL. ++ if (get_setting("user_http_referer")) { + $req->referer( get_setting("user_http_referer") ); ++ } + my $res = $ua->request($req); + + # did things go happily or sadly? diff --git a/www/amphetadesk/files/patch-lib::XML::Simple.pm b/www/amphetadesk/files/patch-lib::XML::Simple.pm new file mode 100644 index 000000000000..16b92d8f0192 --- /dev/null +++ b/www/amphetadesk/files/patch-lib::XML::Simple.pm @@ -0,0 +1,36 @@ +--- lib/XML/Simple.pm.orig Sun Oct 9 20:08:35 2005 ++++ lib/XML/Simple.pm Sun Oct 9 20:22:07 2005 +@@ -880,7 +880,7 @@ + $encoded->{$ref} = $ref; + } + else { +- if($named) { ++ if(($named) && ($ref) && ($self) && ($self->escape_value($ref))) { + return(join('', + $indent, '<', $name, '>', + ($self->{opt}->{noescape} ? $ref : $self->escape_value($ref)), +@@ -888,7 +888,11 @@ + )); + } + else { ++ if ($ref) { + return("$ref$nl"); ++ } else { ++ return("$nl"); ++ } + } + } + +@@ -1013,10 +1017,12 @@ + + my($data) = @_; + ++ if (defined($data)) { + $data =~ s/&/&/sg; + $data =~ s/</</sg; + $data =~ s/>/>/sg; + $data =~ s/"/"/sg; ++ } + + return($data); + } diff --git a/www/amphetadesk/files/wrapper.sh b/www/amphetadesk/files/wrapper.sh new file mode 100644 index 000000000000..e3533cafcef1 --- /dev/null +++ b/www/amphetadesk/files/wrapper.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Under a BSDL license. Copyright 2005. Mario S F Ferreira <lioux@FreeBSD.org> + +PREFIX="%%PREFIX%%/bin" +PROGRAM="${0}" +DIRNAME="${HOME}/.amphetadesk" +PERL="%%PERL%%" +DATADIR="%%DATADIR%%" + +PROGRAM_PIDFILE="${PIDFILE:-${DIRNAME}/${PROGRAM##*/}.pid}" + +if [ `id -un` = root ]; then + echo "PROBLEM. Running AmphetaDesk as root is not recommended." + exit 1 +fi + +if [ -z "${HOME}" -o ! -d "${HOME}" ] +then + echo "PROBLEM. User does not have a valid home directory [${HOME}]" + exit 1 +fi + +if [ ! -d "${DIRNAME}/data/lists" ] +then + mkdir -p "${DIRNAME}/data/lists" +fi + +if [ ! -d "${DIRNAME}/data/lists" ] +then + echo "PROBLEM. Cannot create directory ${DIRNAME}." + echo "Make sure you have the proper permissions to create it and try again." + exit 1 +else + ln -sf "${PREFIX}/${PROGRAM##*/}-real" "${DIRNAME}/${PROGRAM##*/}" +fi + +#if [ -d "${DATADIR}/lists" ]; then +# cp -n "${DATADIR}/lists/"* "${DIRNAME}/data/lists" +#fi + +echo " ${*} " | grep " \-createdironly " || +{ + echo "Running under ${DIRNAME}" + cd "${DIRNAME}" && + { + { + env \ + DIRNAME="${DIRNAME}" \ + ${PERL} "./${PROGRAM##*/}" "${@}" ; + } & + } && + echo $! > "${PROGRAM_PIDFILE}" && + exit 0 || + { + echo "PROBLEM starting the application." + exit 1 + } +} |