aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-04-11 17:32:53 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-04-11 17:32:53 -0300
commit347d7a6eaf0449c477047db1b225c0fc9ab88a72 (patch)
treef5784cff47c8ced4cba2c6061f488eb16e185794
parent87fb97266e35bb832389cc9b0dee6fbf159c2145 (diff)
downloadpuppet-ikiwiki-347d7a6eaf0449c477047db1b225c0fc9ab88a72.tar.gz
puppet-ikiwiki-347d7a6eaf0449c477047db1b225c0fc9ab88a72.tar.bz2
Refactor scripts to run as root
-rw-r--r--manifests/instance.pp2
-rw-r--r--templates/deploy.sh.erb15
2 files changed, 9 insertions, 8 deletions
diff --git a/manifests/instance.pp b/manifests/instance.pp
index e563b97..06f3cc8 100644
--- a/manifests/instance.pp
+++ b/manifests/instance.pp
@@ -21,7 +21,7 @@ define ikiwiki::instance($base_url = $domain, $ensure = 'present', $description
exec { "ikiwiki_refresh_${name}_${instance}":
command => "/usr/local/sbin/ikiwiki-refresh $name $instance $owner $group",
- user => $owner,
+ user => root,
refreshonly => true,
}
diff --git a/templates/deploy.sh.erb b/templates/deploy.sh.erb
index 7fa4103..34064d7 100644
--- a/templates/deploy.sh.erb
+++ b/templates/deploy.sh.erb
@@ -5,7 +5,8 @@ INSTANCE="$2"
BASE="<%= scope.lookupvar('ikiwiki::sites_folder') %>"
SITE=$BASE/$NAME
CONF="/etc/ikiwiki"
-REPO="/var/git/repositories/$NAME.git"
+REPO_OWNER="<%= scope.lookupvar('ikiwiki::git_implementation') %>"
+REPO="$REPO_OWNER@localhost:$NAME"
if [ -z "$INSTANCE" ]; then
echo "Usage:`basename $0` <site> <instance>"
@@ -18,11 +19,11 @@ if [ ! -e "$CONF/$NAME.setup" ]; then
fi
# Setup source folder
-mkdir -p $SITE/"$INSTANCE"_src/
+mkdir -p $SITE/"$INSTANCE"_src/ $SITE/"$INSTANCE"_src_tmp/
# Create initial page
-if [ ! -e $SITE/"$INSTANCE"_src/index.mdwn ]; then
- echo > $SITE/"$INSTANCE"_src/index.mdwn <<EOF
+if [ ! -e $SITE/"$INSTANCE"_src_tmp/index.mdwn ]; then
+ echo > $SITE/"$INSTANCE"_src_tmp/index.mdwn <<EOF
Welcome to your new wiki.
All wikis are supposed to have a [[SandBox]], so this one does too.
@@ -35,8 +36,8 @@ fi
# Create ikiwiki instance
if [ ! -d "$REPO" ]; then
- ikiwiki-makerepo git $SITE/"$INSTANCE"_src/ $REPO
- touch $REPO/git-daemon-export-ok
+ ikiwiki-makerepo git $SITE/"$INSTANCE"_src_tmp $SITE/"$INSTANCE"_src
+ rm -rf $SITE/"$INSTANCE"_src_tmp
( cd $REPO/$NAME.git && git --bare update-server-info )
- ( cd $SITE/"$INSTANCE"_src && git remote rm origin && git remote add origin gitolite@localhost:$INSTANCE )
+ ( cd $SITE/"$INSTANCE"_src && git remote rm origin && git remote add origin $REPO)
fi