CC-1728 Remove unused files

Removed a bunch of unused files in the install folder.
Also removed the top-level index.php.
This commit is contained in:
Paul Baranowski 2010-12-22 16:46:31 -05:00
parent b1a4cb5bd4
commit d90e440c8c
8 changed files with 0 additions and 1389 deletions

View File

@ -1,12 +0,0 @@
<?php
//require_once(dirname(__FILE__)."/htmlUI/ui_browser.php");
if (strpos($_SERVER['PHP_SELF'], '~') !== false) {
list(, $user, ) = explode('/', $_SERVER['PHP_SELF']);
$base = "/$user/campcaster";
} else {
$base = "/campcaster";
}
header("LOCATION: $base/htmlUI/ui_browser.php");
?>

View File

@ -1,253 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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; either version 2 of the License, or
# (at your option) any later version.
#
# Campcaster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script creates Debian packages from Campcaster tarballs.
# To create the tarballs first, see the dist.sh script.
#
# Invoke as:
# ./bin/createDebianPackages.sh
#
# To get usage help, try the -h option
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
docdir=$basedir/doc
tmpdir=$basedir/tmp
usrdir=`cd $basedir/usr; pwd;`
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster debian source package creation script";
echo "parameters";
echo "";
echo " -d, --directory Place to look for the campcaster source";
echo " tarballs [default: current directory]";
echo " -m, --maintainer The name and e-mail address of the package";
echo " maintainer.";
echo " -o, --output-directory the output directory for the files";
echo " [default: current directory]";
echo " -v, --version The version number of the created packages.";
echo " From package_x.y-z_i386.deb, this is x.y";
echo " -h, --help Print this message and exit.";
echo "";
}
#-------------------------------------------------------------------------------
# Process command line parameters
#-------------------------------------------------------------------------------
CMD=${0##*/}
opts=$(getopt -o d:hm:o:v: -l directory:,help,maintainer:,output-directory,version: -n $CMD -- "$@") || exit 1
eval set -- "$opts"
while true; do
case "$1" in
-d|--directory)
directory=$2;
shift; shift;;
-h|--help)
printUsage;
exit 0;;
-m|--maintainer)
maintainer=$2;
shift; shift;;
-o|--output-directory)
outdir=$2;
shift; shift;;
-v|--version)
version=$2;
shift; shift;;
--)
shift;
break;;
*)
echo "Unrecognized option $1.";
printUsage;
exit 1;
esac
done
if [ "x$maintainer" == "x" ]; then
echo "Required parameter maintainer not specified.";
printUsage;
exit 1;
fi
if [ "x$version" == "x" ]; then
echo "Required parameter version not specified.";
printUsage;
exit 1;
fi
if [ "x$directory" == "x" ]; then
directory=`pwd`;
else
directory=`cd $directory; pwd;`
fi
if [ "x$outdir" == "x" ]; then
outdir=`pwd`;
else
outdir=`cd $outdir; pwd;`
fi
echo "Creating Debian source packages for Campcaster.";
echo "";
echo "Using the following parameters:";
echo "";
echo " tarball directory: $directory";
echo " maintainer: $maintainer";
echo " package version: $version";
echo " output directory: $outdir";
echo ""
#-------------------------------------------------------------------------------
# Function to check for the existence of an executable on the PATH
#
# @param $1 the name of the exectuable
# @return 0 if the executable exists on the PATH, non-0 otherwise
#-------------------------------------------------------------------------------
check_exe() {
if [ -x "`which $1 2> /dev/null`" ]; then
echo "Executable $1 found...";
return 0;
else
echo "Executable $1 not found...";
return 1;
fi
}
#-------------------------------------------------------------------------------
# Check for executables needed by this script
#-------------------------------------------------------------------------------
echo "Checking for tools used by this script...";
check_exe "tar" || exit 1;
check_exe "dpkg-source" || exit 1;
check_exe "sed" || exit 1;
#-------------------------------------------------------------------------------
# More definitions
#-------------------------------------------------------------------------------
tarball=$directory/campcaster-$version.tar.bz2
tarball_libs=$directory/campcaster-libraries-$version.tar.bz2
if [ ! -f $tarball ]; then
echo "source tarball $tarball not found in directory $directory";
exit 1;
fi
if [ ! -f $tarball_libs ]; then
echo "source tarball $tarball_libs not found in directory $directory";
exit 1;
fi
packageName=campcaster-$version
packageNameOrig=$packageName.orig
workdir=$tmpdir/debianize
replace_sed_string="s/ls_maintainer/$maintainer/;"
#-------------------------------------------------------------------------------
# Create the environment
#-------------------------------------------------------------------------------
rm -rf $workdir
mkdir -p $workdir
cd $workdir
#-------------------------------------------------------------------------------
# Untar the source tarballs
#-------------------------------------------------------------------------------
echo "Extracting source tarballs...";
# untar first, and rename as campcaster-$version.orig
tar xfj $tarball
tar xfj $tarball_libs
mv $packageName $packageNameOrig
# untar again, and leave it as campcaster-$version
tar xfj $tarball
tar xfj $tarball_libs
#-------------------------------------------------------------------------------
# Debianize the campcaster-$version sources
#-------------------------------------------------------------------------------
echo "Debianizing sources...";
cp -pPR $etcdir/debian $packageName
# customize the control file, with the maintainer name
cat $etcdir/debian/control | sed -e "$replace_sed_string" \
> $packageName/debian/control
# get rid of the remnants of the subversion system
rm -rf `find $packageName -name .svn -type d`
#-------------------------------------------------------------------------------
# Create a debianized source package.
#-------------------------------------------------------------------------------
echo "Creating debian source package...";
dpkg-source -b $packageName $packageNameOrig
#-------------------------------------------------------------------------------
# Copy the resulting files to the target directory
#-------------------------------------------------------------------------------
echo "Moving debian source package files to target directory...";
mv -f campcaster_$version* $outdir
#-------------------------------------------------------------------------------
# Clean up
#-------------------------------------------------------------------------------
echo "Cleaning up...";
cd $basedir
rm -rf $workdir
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."

View File

@ -1,14 +0,0 @@
<?php
/*------------------------------------------------------------------------------
* This (web-callable) script returns group running httpd
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
$egid = posix_getegid();
$info = posix_getgrgid($egid);
if ( (isset($_SERVER["REMOTE_ADDR"]) && ($_SERVER["REMOTE_ADDR"] == "127.0.0.1"))
|| (isset($_SERVER["HTTP_HOST"]) && ($_SERVER["HTTP_HOST"] == "localhost"))
|| (isset($_SERVER["SHELL"])) ) {
echo $info['name'];
}
?>

View File

@ -1,13 +0,0 @@
<?php
/*------------------------------------------------------------------------------
* This script returns real dir of php scipts for debugging purposes
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
//var_dump($_SERVER);
if ( (isset($_SERVER["REMOTE_ADDR"]) && ($_SERVER["REMOTE_ADDR"] == "127.0.0.1"))
|| (isset($_SERVER["HTTP_HOST"]) && ($_SERVER["HTTP_HOST"] == "localhost"))
|| (isset($_SERVER["SHELL"])) ) {
echo `pwd`;
}
?>

View File

@ -1,10 +0,0 @@
<?php
/*------------------------------------------------------------------------------
* This script returns storage root URL
*----------------------------------------------------------------------------*/
header("Content-type: text/plain");
require("../conf.php");
echo "http://{$CC_CONFIG['storageUrlHost']}:{$CC_CONFIG['storageUrlPort']}".
"{$CC_CONFIG['storageUrlPath']}";
?>

View File

@ -1,670 +0,0 @@
<?php
/**
* @package Campcaster
* @subpackage StorageServer
* @copyright 2010 Sourcefabric O.P.S.
* @license http://www.gnu.org/licenses/gpl.txt
*/
// Do not allow remote execution
$arr = array_diff_assoc($_SERVER, $_ENV);
if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) {
header("HTTP/1.1 400");
header("Content-type: text/plain; charset=UTF-8");
echo "400 Not executable\r\n";
exit(1);
}
echo "**********************\n";
echo "* Campcaster Install *\n";
echo "**********************\n";
require_once(dirname(__FILE__).'/../conf.php');
require_once(dirname(__FILE__).'/../backend/GreenBox.php');
require_once(dirname(__FILE__).'/../backend/cron/Cron.php');
require_once(dirname(__FILE__)."/installInit.php");
// Need to check that we are superuser before running this.
echo " *** Database Installation ***\n";
//sudo -u postgres createuser --no-superuser --no-createdb --no-createrole -A -P myuser
// Create the database user
$command = "sudo -u postgres psql postgres --command \"CREATE USER {$CC_CONFIG['dsn']['username']} "
." ENCRYPTED PASSWORD '{$CC_CONFIG['dsn']['password']}' LOGIN CREATEDB NOCREATEUSER;\" 2>/dev/null";
//echo $command."\n";
@exec($command, $output, $results);
if ($results == 0) {
echo " * User {$CC_CONFIG['dsn']['username']} created.\n";
} else {
echo " * User {$CC_CONFIG['dsn']['username']} already exists.\n";
}
$command = "sudo -u postgres createdb {$CC_CONFIG['dsn']['database']} --owner {$CC_CONFIG['dsn']['username']} 2> /dev/null";
//echo $command."\n";
@exec($command, $output, $results);
if ($results == 0) {
echo " * Database '{$CC_CONFIG['dsn']['database']}' created.\n";
} else {
echo " * Database '{$CC_CONFIG['dsn']['database']}' already exists.\n";
}
// Connect to DB
campcaster_db_connect(true);
// Install postgres scripting language
$langIsInstalled = $CC_DBC->GetOne('SELECT COUNT(*) FROM pg_language WHERE lanname = \'plpgsql\'');
if ($langIsInstalled == '0') {
echo " * Installing Postgres scripting language...\n";
$sql = "CREATE LANGUAGE 'plpgsql'";
camp_install_query($sql, false);
} else {
echo " * Postgres scripting language already installed\n";
}
//------------------------------------------------------------------------------
// Install database tables
//------------------------------------------------------------------------------
if (!camp_db_table_exists($CC_CONFIG['subjTable'])) {
echo " * Creating database table ".$CC_CONFIG['subjTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['subjTable']." (
id int not null PRIMARY KEY,
login varchar(255) not null default'',
pass varchar(255) not null default'',
type char(1) not null default 'U',
realname varchar(255) not null default'',
lastlogin timestamp,
lastfail timestamp
)";
camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['subjTable']."_id_idx
ON ".$CC_CONFIG['subjTable']." (id)";
camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['subjTable']."_login_idx
ON ".$CC_CONFIG['subjTable']." (login)";
camp_install_query($sql, false);
$CC_DBC->createSequence($CC_CONFIG['subjSequence']);
echo "done.\n";
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['subjTable']."\n";
}
if (!camp_db_table_exists($CC_CONFIG['smembTable'])) {
echo " * Creating database table ".$CC_CONFIG['smembTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['smembTable']." (
id int not null PRIMARY KEY,
uid int not null default 0,
gid int not null default 0,
level int not null default 0,
mid int)";
camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['smembTable']."_id_idx
ON ".$CC_CONFIG['smembTable']." (id)";
camp_install_query($sql, false);
//$CC_DBC->createSequence($CC_CONFIG['smembSequence']);
echo "done.\n";
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['smembTable']."\n";
}
if (!camp_db_table_exists($CC_CONFIG['permTable'])) {
echo " * Creating database table ".$CC_CONFIG['permTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['permTable']." (
permid int not null PRIMARY KEY,
subj int REFERENCES ".$CC_CONFIG['subjTable']." ON DELETE CASCADE,
action varchar(20),
obj int,
type char(1))";
camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['permTable']."_permid_idx
ON ".$CC_CONFIG['permTable']." (permid)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['permTable']."_subj_obj_idx
ON ".$CC_CONFIG['permTable']." (subj, obj)";
camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['permTable']."_all_idx
ON ".$CC_CONFIG['permTable']." (subj, action, obj)";
camp_install_query($sql, false);
//$CC_DBC->createSequence($CC_CONFIG['permSequence']);
echo "done.\n";
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['permTable']."\n";
}
if (!camp_db_table_exists($CC_CONFIG['sessTable'])) {
echo " * Creating database table ".$CC_CONFIG['sessTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['sessTable']." (
sessid char(32) not null PRIMARY KEY,
userid int REFERENCES ".$CC_CONFIG['subjTable']." ON DELETE CASCADE,
login varchar(255),
ts timestamp)";
camp_install_query($sql, false);
// $sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['sessTable']."_sessid_idx
// ON ".$CC_CONFIG['sessTable']." (sessid)";
// camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['sessTable']."_userid_idx
ON ".$CC_CONFIG['sessTable']." (userid)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['sessTable']."_login_idx
ON ".$CC_CONFIG['sessTable']." (login)";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['sessTable']."\n";
}
/**
* file states:
* empty
* incomplete
* ready
* edited
* deleted
*
* file types:
* audioclip
* playlist
* webstream
*
* access types:
* access
* download
*
*/
if (!camp_db_table_exists($CC_CONFIG['filesTable'])) {
echo " * Creating database table ".$CC_CONFIG['filesTable']."...";
$sql =
"CREATE TABLE ".$CC_CONFIG['filesTable']."
(
id serial NOT NULL,
gunid bigint NOT NULL,
\"name\" character varying(255) NOT NULL DEFAULT ''::character varying,
mime character varying(255) NOT NULL DEFAULT ''::character varying,
ftype character varying(128) NOT NULL DEFAULT ''::character varying,
state character varying(128) NOT NULL DEFAULT 'empty'::character varying,
currentlyaccessing integer NOT NULL DEFAULT 0,
editedby integer,
mtime timestamp(6) with time zone,
md5 character(32),
track_title character varying(512),
artist_name character varying(512),
bit_rate character varying(32),
sample_rate character varying(32),
format character varying(128),
length time without time zone,
album_title character varying(512),
genre character varying(64),
comments text,
\"year\" character varying(16),
track_number integer,
channels integer,
url character varying(1024),
bpm character varying(8),
rating character varying(8),
encoded_by character varying(255),
disc_number character varying(8),
mood character varying(64),
label character varying(512),
composer character varying(512),
encoder character varying(64),
checksum character varying(256),
lyrics text,
orchestra character varying(512),
conductor character varying(512),
lyricist character varying(512),
original_lyricist character varying(512),
radio_station_name character varying(512),
info_url character varying(512),
artist_url character varying(512),
audio_source_url character varying(512),
radio_station_url character varying(512),
buy_this_url character varying(512),
isrc_number character varying(512),
catalog_number character varying(512),
original_artist character varying(512),
copyright character varying(512),
report_datetime character varying(32),
report_location character varying(512),
report_organization character varying(512),
subject character varying(512),
contributor character varying(512),
\"language\" character varying(512),
CONSTRAINT cc_files_pkey PRIMARY KEY (id),
CONSTRAINT cc_files_editedby_fkey FOREIGN KEY (editedby)
REFERENCES cc_subjs (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)";
camp_install_query($sql, false);
// $sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['filesTable']."_id_idx
// ON ".$CC_CONFIG['filesTable']." (id)";
// camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['filesTable']."_gunid_idx
ON ".$CC_CONFIG['filesTable']." (gunid)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['filesTable']."_name_idx
ON ".$CC_CONFIG['filesTable']." (name)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['filesTable']."_md5_idx
ON ".$CC_CONFIG['filesTable']." (md5)";
camp_install_query($sql);
//$CC_DBC->createSequence($CC_CONFIG['filesSequence']);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['filesTable']."\n";
}
if (!camp_db_table_exists($CC_CONFIG['playListTable'])) {
echo " * Creating database table ".$CC_CONFIG['playListTable']."...";
$sql =
"CREATE TABLE ".$CC_CONFIG['playListTable']."
(
id serial NOT NULL,
\"name\" character varying(255) NOT NULL DEFAULT ''::character varying,
state character varying(128) NOT NULL DEFAULT 'empty'::character varying,
currentlyaccessing integer NOT NULL DEFAULT 0,
editedby integer,
mtime timestamp(6) with time zone,
creator character varying(32),
description character varying(512),
CONSTRAINT cc_playlist_pkey PRIMARY KEY (id),
CONSTRAINT cc_playlist_editedby_fkey FOREIGN KEY (editedby)
REFERENCES cc_subjs (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['playListTable']."\n";
}
if (!camp_db_table_exists($CC_CONFIG['playListContentsTable'])) {
echo " * Creating database table ".$CC_CONFIG['playListContentsTable']."...";
$sql =
"CREATE TABLE ".$CC_CONFIG['playListContentsTable']."
(
id serial NOT NULL,
playlist_id integer,
file_id integer,
position integer,
cliplength time without time zone DEFAULT '00:00:00.000',
cuein time without time zone DEFAULT '00:00:00.000',
cueout time without time zone DEFAULT '00:00:00.000',
fadein time without time zone DEFAULT '00:00:00.000',
fadeout time without time zone DEFAULT '00:00:00.000',
CONSTRAINT cc_playlistcontents_pkey PRIMARY KEY (id),
CONSTRAINT cc_playlistcontents_playlist_id_fkey FOREIGN KEY (playlist_id)
REFERENCES ".$CC_CONFIG['playListTable']." (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE,
CONSTRAINT cc_playlistcontents_file_id_fkey FOREIGN KEY (file_id)
REFERENCES ".$CC_CONFIG['filesTable']." (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE CASCADE
);
CREATE OR REPLACE FUNCTION calculate_position() RETURNS trigger AS
\$calc_pos\$
BEGIN
IF(TG_OP='INSERT') THEN
UPDATE ".$CC_CONFIG['playListContentsTable']." SET position = (position + 1) WHERE (playlist_id = new.playlist_id AND position >= new.position AND id != new.id);
END IF;
IF(TG_OP='DELETE') THEN
UPDATE ".$CC_CONFIG['playListContentsTable']." SET position = (position - 1) WHERE (playlist_id = old.playlist_id AND position > old.position);
END IF;
RETURN NULL;
END;
\$calc_pos\$
LANGUAGE 'plpgsql';
CREATE TRIGGER calculate_position AFTER INSERT OR DELETE ON ".$CC_CONFIG['playListContentsTable']."
FOR EACH ROW EXECUTE PROCEDURE calculate_position();
CREATE OR REPLACE VIEW cc_playlisttimes AS (
SELECT PL.id, COALESCE(T.length, '00:00:00') AS length
from ".$CC_CONFIG['playListTable']." AS PL LEFT JOIN
(SELECT playlist_id AS id, text(SUM(cliplength)) AS length
FROM ".$CC_CONFIG['playListContentsTable']." GROUP BY playlist_id) AS T
ON PL.id = T.id
);
";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['playListContentsTable']."\n";
}
//if (!camp_db_sequence_exists($CC_CONFIG["filesSequence"])) {
// echo " * Creating database sequence for ".$CC_CONFIG['filesTable']."...\n";
// $CC_DBC->createSequence($CC_CONFIG['filesSequence']);
//// $sql = "CREATE SEQUENCE ".$CC_CONFIG["filesSequence"]
//// ." INCREMENT 1
//// MINVALUE 1
//// MAXVALUE 9223372036854775807
//// START 1000000
//// CACHE 1";
//// camp_install_query($sql);
//} else {
// echo " * Skipping: database sequence already exists: ".$CC_CONFIG['filesSequence']."\n";
//}
if (!camp_db_table_exists($CC_CONFIG['accessTable'])) {
echo " * Creating database table ".$CC_CONFIG['accessTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['accessTable']." (
gunid bigint, -- global unique id
token bigint, -- access token
chsum char(32) not null default'', -- md5 checksum
ext varchar(128) not null default'', -- extension
type varchar(20) not null default'', -- access type
parent bigint, -- parent token
owner int REFERENCES ".$CC_CONFIG['subjTable'].", -- subject have started it
ts timestamp
)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['accessTable']."_token_idx
ON ".$CC_CONFIG['accessTable']." (token)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['accessTable']."_gunid_idx
ON ".$CC_CONFIG['accessTable']." (gunid)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['accessTable']."_parent_idx
ON ".$CC_CONFIG['accessTable']." (parent)";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['accessTable']."\n";
}
if (!camp_db_table_exists($CC_CONFIG['transTable'])) {
echo " * Creating database table ".$CC_CONFIG['transTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['transTable']." (
id int not null, -- primary key
trtok char(16) not null, -- transport token
direction varchar(128) not null, -- direction: up|down
state varchar(128) not null, -- state
trtype varchar(128) not null, -- transport type
lock char(1) not null default 'N',-- running lock
target varchar(255) default NULL, -- target system,
-- if NULL => predefined set
rtrtok char(16) default NULL, -- remote hub's transport token
mdtrtok char(16), -- metadata transport token
gunid bigint, -- global unique id
pdtoken bigint, -- put/download token from archive
url varchar(255), -- url on remote side
localfile varchar(255), -- pathname of local part
fname varchar(255), -- mnemonic filename
title varchar(255), -- dc:title mdata value (or filename ...)
expectedsum char(32), -- expected file checksum
realsum char(32), -- checksum of transported part
expectedsize int, -- expected filesize in bytes
realsize int, -- filesize of transported part
uid int, -- local user id of transport owner
errmsg varchar(255), -- error message string for failed tr.
jobpid int, -- pid of transport job
start timestamp, -- starttime
ts timestamp -- mtime
)";
camp_install_query($sql, false);
$CC_DBC->createSequence($CC_CONFIG['transSequence']);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['transTable']."_id_idx
ON ".$CC_CONFIG['transTable']." (id)";
camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['transTable']."_trtok_idx
ON ".$CC_CONFIG['transTable']." (trtok)";
camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['transTable']."_token_idx
ON ".$CC_CONFIG['transTable']." (pdtoken)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['transTable']."_gunid_idx
ON ".$CC_CONFIG['transTable']." (gunid)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['transTable']."_state_idx
ON ".$CC_CONFIG['transTable']." (state)";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['transTable']."\n";
}
/**
* Scheduler tables.
*/
if (!camp_db_table_exists($CC_CONFIG['scheduleTable'])) {
echo " * Creating database table ".$CC_CONFIG['scheduleTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['scheduleTable']."("
." id bigint NOT NULL,"
." playlist_id integer NOT NULL,"
." starts timestamp without time zone NOT NULL,"
." ends timestamp without time zone NOT NULL,"
." group_id integer,"
." file_id integer,"
." clip_length time without time zone DEFAULT '00:00:00'::time without time zone,"
." fade_in time without time zone DEFAULT '00:00:00'::time without time zone,"
." fade_out time without time zone DEFAULT '00:00:00'::time without time zone,"
." cue_in time without time zone DEFAULT '00:00:00'::time without time zone,"
." cue_out time without time zone DEFAULT '00:00:00'::time without time zone,"
." CONSTRAINT cc_schedule_pkey PRIMARY KEY (id),"
." CONSTRAINT unique_id UNIQUE (id))";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['scheduleTable']."\n";
}
if (!camp_db_sequence_exists("schedule_group_id_seq")) {
echo " * Creating sequence 'schedule_group_id_seq'...";
$sql = "CREATE SEQUENCE schedule_group_id_seq";
camp_install_query($sql);
} else {
echo " * Skipping: sequence already exists 'schedule_group_id_seq'.\n";
}
if (!camp_db_table_exists($CC_CONFIG['backupTable'])) {
echo " * Creating database table ".$CC_CONFIG['backupTable']."...";
$sql = "CREATE TABLE ".$CC_CONFIG['backupTable']." ("
." token VARCHAR(64) NOT NULL,"
." sessionId VARCHAR(64) NOT NULL,"
." status VARCHAR(32) NOT NULL,"
." fromTime TIMESTAMP NOT NULL,"
." toTime TIMESTAMP NOT NULL,"
." PRIMARY KEY(token))";
camp_install_query($sql);
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['backupTable']."\n";
}
if (!camp_db_table_exists($CC_CONFIG['prefTable'])) {
echo " * Creating database table ".$CC_CONFIG['prefTable']."...";
//$CC_DBC->createSequence($CC_CONFIG['prefSequence']);
$sql = "CREATE TABLE ".$CC_CONFIG['prefTable']." (
id int not null,
subjid int REFERENCES ".$CC_CONFIG['subjTable']." ON DELETE CASCADE,
keystr varchar(255),
valstr text
)";
camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['prefTable']."_id_idx
ON ".$CC_CONFIG['prefTable']." (id)";
camp_install_query($sql, false);
$sql = "CREATE UNIQUE INDEX ".$CC_CONFIG['prefTable']."_subj_key_idx
ON ".$CC_CONFIG['prefTable']." (subjid, keystr)";
camp_install_query($sql, false);
$sql = "CREATE INDEX ".$CC_CONFIG['prefTable']."_subjid_idx
ON ".$CC_CONFIG['prefTable']." (subjid)";
camp_install_query($sql);
echo " * Inserting starting data into table ".$CC_CONFIG['prefTable']."...";
$stPrefGr = Subjects::GetSubjId($CC_CONFIG['StationPrefsGr']);
Prefs::Insert($CC_CONFIG["systemPrefId"], 'stationName', "Radio Station 1");
// $genres = file_get_contents( dirname(__FILE__).'/../genres.xml');
// Prefs::Insert($CC_CONFIG["systemPrefId"], 'genres', $genres);
echo "done.\n";
} else {
echo " * Skipping: database table already exists: ".$CC_CONFIG['prefTable']."\n";
}
//------------------------------------------------------------------------
// Install default data
//------------------------------------------------------------------------
echo " *** Inserting Default Data ***\n";
// Add the "Station Preferences" group
if (!empty($CC_CONFIG['StationPrefsGr'])) {
if (!Subjects::GetSubjId('scheduler')) {
echo " * Creating group '".$CC_CONFIG['StationPrefsGr']."'...";
$stPrefGr = Subjects::AddSubj($CC_CONFIG['StationPrefsGr']);
Subjects::AddSubjectToGroup('root', $CC_CONFIG['StationPrefsGr']);
echo "done.\n";
} else {
echo " * Skipping: group already exists: '".$CC_CONFIG['StationPrefsGr']."'\n";
}
}
// Add the root user if it doesnt exist yet.
$rootUid = Subjects::GetSubjId('root');
if (!$rootUid) {
echo " * Creating user 'root'...";
$rootUid = BasicStor::addSubj("root", $CC_CONFIG['tmpRootPass']);
// Add root user to the admin group
//$r = Subjects::AddSubjectToGroup('root', $CC_CONFIG['AdminsGr']);
//if (PEAR::isError($r)) {
//return $r;
//}
echo "done.\n";
} else {
echo " * Skipping: user already exists: 'root'\n";
}
// Create the user named 'scheduler'.
if (!Subjects::GetSubjId('scheduler')) {
echo " * Creating user 'scheduler'...";
$subid = Subjects::AddSubj('scheduler', $CC_CONFIG['schedulerPass']);
$res = Alib::AddPerm($subid, 'read', '0', 'A');
//$r = Subjects::AddSubjectToGroup('scheduler', $CC_CONFIG['AllGr']);
echo "done.\n";
} else {
echo " * Skipping: user already exists: 'scheduler'\n";
}
// Need to add 'scheduler' to group StationPrefs
Subjects::AddSubjectToGroup('scheduler', $CC_CONFIG['StationPrefsGr']);
//------------------------------------------------------------------------
// Install storage directories
//------------------------------------------------------------------------
echo " *** Directory Setup ***\n";
foreach (array('storageDir', 'bufferDir', 'transDir', 'accessDir', 'cronDir') as $d) {
$test = file_exists($CC_CONFIG[$d]);
if ( $test === FALSE ) {
@mkdir($CC_CONFIG[$d], 02775);
if (file_exists($CC_CONFIG[$d])) {
$rp = realpath($CC_CONFIG[$d]);
echo " * Directory $rp created\n";
} else {
echo " * Failed creating {$CC_CONFIG[$d]}\n";
exit(1);
}
} elseif (is_writable($CC_CONFIG[$d])) {
$rp = realpath($CC_CONFIG[$d]);
echo " * Skipping directory already exists: $rp\n";
} else {
$rp = realpath($CC_CONFIG[$d]);
echo " * WARNING: Directory already exists, but is not writable: $rp\n";
//exit(1);
}
$CC_CONFIG[$d] = $rp;
}
//------------------------------------------------------------------------
// Storage directory writability test
//------------------------------------------------------------------------
//echo " * Testing writability of ".$CC_CONFIG['storageDir']."...";
//if (!($fp = @fopen($CC_CONFIG['storageDir']."/_writeTest", 'w'))) {
// echo "\nPlease make directory {$CC_CONFIG['storageDir']} writeable by your webserver".
// "\nand run install again\n\n";
// exit(1);
//} else {
// fclose($fp);
// unlink($CC_CONFIG['storageDir']."/_writeTest");
//}
//echo "done.\n";
//
// Make sure the Smarty Templates Compiled directory has the right perms
//
echo " * Setting dir permissions...\n";
install_setDirPermissions($CC_CONFIG["smartyTemplateCompiled"]);
install_setDirPermissions($CC_CONFIG["storageDir"]);
install_setDirPermissions($CC_CONFIG["bufferDir"]);
install_setDirPermissions($CC_CONFIG["transDir"]);
install_setDirPermissions($CC_CONFIG["accessDir"]);
//------------------------------------------------------------------------
// Install Cron job
//------------------------------------------------------------------------
$m = '*/2';
$h ='*';
$dom = '*';
$mon = '*';
$dow = '*';
$command = realpath("{$CC_CONFIG['cronDir']}/transportCron.php");
$old_regex = '/transportCron\.php/';
echo " * Install storageServer cron job...\n";
$cron = new Cron();
$access = $cron->openCrontab('write');
if ($access != 'write') {
do {
$r = $cron->forceWriteable();
} while ($r);
}
foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) {
if (preg_match($old_regex, $line['command'])) {
echo " * Removing old entry: ".$line['command']."\n";
$cron->ct->delEntry($id);
}
}
echo " * Adding new entry: ".$command."\n";
$cron->ct->addCron($m, $h, $dom, $mon, $dow, $command);
$cron->closeCrontab();
echo " Done.\n";
echo "*******************************\n";
echo "* Campcaster Install Complete *\n";
echo "*******************************\n";
?>

View File

@ -1,268 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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; either version 2 of the License, or
# (at your option) any later version.
#
# Campcaster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script makes post-uninstallation steps for Campcaster.
#
# Invoke as:
# ./bin/postUninstall.sh
#
# To get usage help, try the -h option
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
docdir=$basedir/doc
tmpdir=$basedir/tmp
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster post-uninstall script.";
echo "parameters";
echo "";
echo " -d, --directory The installation directory, required.";
echo " -D, --database The name of the Campcaster database.";
echo " [default: Campcaster]";
echo " -r, --www-root The root directory for web documents served";
echo " by apache [default: /var/www]";
echo " -s, --dbserver The name of the database server host.";
echo " [default: localhost]";
echo " -u, --dbuser The name of the database user to access the"
echo " database. [default: campcaster]";
echo " -h, --help Print this message and exit.";
echo "";
}
#-------------------------------------------------------------------------------
# Process command line parameters
#-------------------------------------------------------------------------------
CMD=${0##*/}
opts=$(getopt -o d:D:hr:s:u: -l database:,dbserver:,dbuser:,directory:,help,www-root: -n $CMD -- "$@") || exit 1
eval set -- "$opts"
while true; do
case "$1" in
-d|--directory)
installdir=$2;
shift; shift;;
-D|--database)
database=$2;
shift; shift;;
-h|--help)
printUsage;
exit 0;;
-r|--www-root)
www_root=$2;
shift; shift;;
-s|--dbserver)
dbserver=$2;
shift; shift;;
-u|--dbuser)
dbuser=$2;
shift; shift;;
--)
shift;
break;;
*)
echo "Unrecognized option $1.";
printUsage;
exit 1;
esac
done
if [ "x$installdir" == "x" ]; then
echo "Required parameter install directory not specified.";
printUsage;
exit 1;
fi
if [ "x$dbserver" == "x" ]; then
dbserver=localhost;
fi
if [ "x$database" == "x" ]; then
database=Campcaster;
fi
if [ "x$dbuser" == "x" ]; then
dbuser=campcaster;
fi
if [ "x$www_root" == "x" ]; then
www_root=/var/www
fi
echo "Making post-uninstall steps for Campcaster.";
echo "";
echo "Using the following installation parameters:";
echo "";
echo " installation directory: $installdir";
echo " database server: $dbserver";
echo " database: $database";
echo " database user: $dbuser";
echo " apache document root: $www_root";
echo ""
#-------------------------------------------------------------------------------
# The details of installation
#-------------------------------------------------------------------------------
ls_dbserver=$dbserver
ls_dbuser=$dbuser
ls_database=$database
postgres_user=postgres
install_bin=$installdir/bin
install_etc=$installdir/etc
install_lib=$installdir/lib
install_tmp=$installdir/tmp
install_var=$installdir/var
#-------------------------------------------------------------------------------
# Function to check for the existence of an executable on the PATH
#
# @param $1 the name of the exectuable
# @return 0 if the executable exists on the PATH, non-0 otherwise
#-------------------------------------------------------------------------------
check_exe() {
if [ -x "`which $1 2> /dev/null`" ]; then
echo "Executable $1 found...";
return 0;
else
echo "Executable $1 not found...";
return 1;
fi
}
#-------------------------------------------------------------------------------
# Check to see if this script is being run as root
#-------------------------------------------------------------------------------
if [ `whoami` != "root" ]; then
echo "Please run this script as root.";
exit ;
fi
#-------------------------------------------------------------------------------
# Check for required tools
#-------------------------------------------------------------------------------
echo "Checking for required tools..."
check_exe "psql" || exit 1;
check_exe "odbcinst" || exit 1;
#-------------------------------------------------------------------------------
# Remove symlinks
#-------------------------------------------------------------------------------
echo "Removing symlinks...";
# remove symlink for the PHP pages in apache's document root
rm -f $www_root/campcaster
#-------------------------------------------------------------------------------
# Check whether the storage server directory has been replaced with a mount
# point for an NFS share.
#-------------------------------------------------------------------------------
storagedir=$installdir/var/storageServer
storage_is_local=yes
if [ "`mount | grep -o \"on $storagedir \"`" = "on $storagedir " ]; then
storage_is_local=no
fi
#-------------------------------------------------------------------------------
# Delete data files
#-------------------------------------------------------------------------------
echo "Deleting data files...";
rm -rf $installdir/var/htmlUI/var/html/img/*
rm -rf $installdir/var/htmlUI/var/templates_c/*
if [ "$storage_is_local" = "yes" ]; then
rm -rf $installdir/var/storageServer/var/stor/*
rm -rf $installdir/var/storageServer/var/access/*
rm -rf $installdir/var/storageServer/var/trans/*
fi
#-------------------------------------------------------------------------------
# Remove the ODBC data source and driver
#-------------------------------------------------------------------------------
echo "Removing ODBC data source and driver...";
echo "Removing Campcaster ODBC data source...";
odbcinst -u -s -l -n $ls_database || exit 1;
echo "De-registering ODBC PostgreSQL driver...";
odbcinst -u -d -v -n PostgreSQL || exit 1;
#-------------------------------------------------------------------------------
# Remove the database user and the database itself
#-------------------------------------------------------------------------------
echo "Removing database and database user...";
if [ "x$ls_dbserver" == "xlocalhost" ]; then
su - $postgres_user -c "echo \"DROP DATABASE \\\"$ls_database\\\" \"\
| psql template1" \
|| echo "Couldn't drop database $ls_database.";
su - $postgres_user -c "echo \"DROP USER $ls_dbuser \"\
| psql template1" \
|| echo "Couldn't drop database user $ls_dbuser.";
else
echo "Unable to automatically drop database user and table for";
echo "remote database $ls_dbserver.";
echo "Make sure to drop database user $ls_dbuser on database server";
echo "at $ls_dbserver.";
echo "Also drop the database called $ld_database, owned by this user.";
echo "";
echo "The easiest way to achieve this is by issuing the following SQL";
echo "commands to PostgreSQL:";
echo "DROP DATABASE \"$ls_database\";";
echo "DROP USER $ls_dbuser;";
fi
# TODO: check for the success of these operations somehow
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."

View File

@ -1,149 +0,0 @@
#!/bin/bash
#-------------------------------------------------------------------------------
# Copyright (c) 2010 Sourcefabric O.P.S.
#
# This file is part of the Campcaster project.
# http://campcaster.sourcefabric.org/
# To report bugs, send an e-mail to bugs@campware.org
#
# Campcaster 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; either version 2 of the License, or
# (at your option) any later version.
#
# Campcaster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Campcaster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#-------------------------------------------------------------------------------
# This script makes pre-install steps and checks for Campcaster.
#
# Invoke as:
# ./bin/preInstall.sh
#
# To get usage help, try the -h option
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Determine directories, files
#-------------------------------------------------------------------------------
reldir=`dirname $0`/..
basedir=`cd $reldir; pwd;`
bindir=$basedir/bin
etcdir=$basedir/etc
docdir=$basedir/doc
srcdir=$basedir/src
tmpdir=$basedir/tmp
toolsdir=$srcdir/tools
modules_dir=$srcdir/modules
products_dir=$srcdir/products
usrdir=`cd $basedir/usr; pwd;`
#-------------------------------------------------------------------------------
# Print the usage information for this script.
#-------------------------------------------------------------------------------
printUsage()
{
echo "Campcaster pre-install script.";
echo "parameters";
echo "";
echo " -g, --apache-group The group the apache daemon runs as.";
echo " [default: apache]";
echo " -h, --help Print this message and exit.";
echo "";
}
#-------------------------------------------------------------------------------
# Process command line parameters
#-------------------------------------------------------------------------------
CMD=${0##*/}
opts=$(getopt -o g:h -l apache-group:,help -n $CMD -- "$@") || exit 1
eval set -- "$opts"
while true; do
case "$1" in
-g|--apache-group)
apache_group=$2;
shift; shift;;
-h|--help)
printUsage;
exit 0;;
--)
shift;
break;;
*)
echo "Unrecognized option $1.";
printUsage;
exit 1;
esac
done
if [ "x$apache_group" == "x" ]; then
apache_group=apache;
fi
echo "Making pre-install steps for Campcaster.";
echo "";
echo "Using the following installation parameters:";
echo "";
echo " apache daemon group: $apache_group";
echo ""
#-------------------------------------------------------------------------------
# Check for the apache group to be a real group
#-------------------------------------------------------------------------------
group_tmp_file=/tmp/ls_group_check.$$
touch $group_tmp_file
test_result=`chgrp $apache_group $group_tmp_file 2> /dev/null`
if [ $? != 0 ]; then
rm -f $group_tmp_file;
echo "Unable to use apache deamon group $apache_group.";
echo "Please check if $apache_group is a correct user group.";
exit 1;
fi
rm -f $group_tmp_file;
#-------------------------------------------------------------------------------
# Function to check for the existence of an executable on the PATH
#
# @param $1 the name of the exectuable
# @return 0 if the executable exists on the PATH, non-0 otherwise
#-------------------------------------------------------------------------------
check_exe() {
if [ -x "`which $1 2> /dev/null`" ]; then
echo "Executable $1 found...";
return 0;
else
echo "Executable $1 not found...";
return 1;
fi
}
#-------------------------------------------------------------------------------
# Check for required tools
#-------------------------------------------------------------------------------
echo "Checking for required tools..."
check_exe "sed" || exit 1;
check_exe "psql" || exit 1;
check_exe "php" || exit 1;
check_exe "odbcinst" || exit 1;
#-------------------------------------------------------------------------------
# Say goodbye
#-------------------------------------------------------------------------------
echo "Done."