This avoids the need for prompting for values that can easily be
determined from the project name and the new REPOSTYPE argument.
This could be further improved to call a script to setup the
repository and any mailing lists.
---
As I'm still learning my way around sysadmin-hosted, I thought I'd ask
for some comments before committing a change like this.
In the process of handling requests, I'm hoping to help improve the
documentation and process so that it is easier and less error-prone.
It should probably also use && after each command so that any failures
stop execution, but I haven't tested trac-admin to verify that it sets
the return code or not.
configs/web/applications/hosted-setup.sh | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/configs/web/applications/hosted-setup.sh
b/configs/web/applications/hosted-setup.sh
index 7adf080..42134f6 100644
--- a/configs/web/applications/hosted-setup.sh
+++ b/configs/web/applications/hosted-setup.sh
@@ -1,16 +1,23 @@
#!/bin/bash
-usage="Usage: $0 [PROJECT] [ADMIN]"
+usage="Usage: $0 <PROJECT> <ADMIN> <REPOSTYPE>"
-[ -z "$1" -o -z "$2" ] && {
+[ -z "$1" -o -z "$2" -o -z "$3" ] && {
echo $usage
exit 1
}
-sudo -u apache trac-admin /srv/web/trac/projects/${1} initenv
-sudo -u apache trac-admin /srv/web/trac/projects/${1} permission add ${2} TRAC_ADMIN
-sudo -u apache trac-admin /srv/web/trac/projects/${1} permission add authenticated
WIKI_CREATE TICKET_CREATE TICKET_MODIFY WIKI_MODIFY
-sudo -u apache trac-admin /srv/web/trac/projects/${1} permission remove anonymous
WIKI_CREATE TICKET_CREATE TICKET_MODIFY WIKI_MODIFY
-sudo -u apache chown -R apache.apache /srv/web/trac/projects/${1}
-sudo -u apache sed -i "s,base_url.*,base_url =
https://fedorahosted.org/${1}/,"
/srv/web/trac/projects/${1}/conf/trac.ini
+projectname="$1"
+projectadmin="$2"
+db="sqlite:db/trac.db"
+repostype="$3"
+repospath="/srv/$repostype/$projectname"
+[ "$repostype" = "git" ] &&
repospath="$repospath.git"
+templatepath="$(python -c 'from trac.config import default_dir; print
default_dir("templates")')"
+sudo -u apache trac-admin /srv/web/trac/projects/$projectname initenv $projectname $db
$repostype $repospath $templatepath
+sudo -u apache trac-admin /srv/web/trac/projects/$projectname permission add
$projectadmin TRAC_ADMIN
+sudo -u apache trac-admin /srv/web/trac/projects/$projectname permission add
authenticated WIKI_CREATE TICKET_CREATE TICKET_MODIFY WIKI_MODIFY
+sudo -u apache trac-admin /srv/web/trac/projects/$projectname permission remove anonymous
WIKI_CREATE TICKET_CREATE TICKET_MODIFY WIKI_MODIFY
+sudo -u apache chown -R apache.apache /srv/web/trac/projects/$projectname
+sudo -u apache sed -i "s,base_url.*,base_url =
https://fedorahosted.org/$projectname/,"
/srv/web/trac/projects/$projectname/conf/trac.ini
--
1.5.5.6
--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL:
www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All I really want for Christmas is Santa's list of Naughty Girls.