Skip to content

Commit

Permalink
install scripts for alfresco on centos7
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalyik committed Dec 14, 2017
0 parents commit f179ecc
Show file tree
Hide file tree
Showing 13 changed files with 3,063 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# provisioning

Bash scripts for provisioning a working Alfresco 5.2g with Share 5.2f on CentOs7.x from zero.

The scripts are re-runnable, they could continue there where they failed for any reason.
62 changes: 62 additions & 0 deletions jboss_for_alfresco/add_datasource.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
usage()
{
echo 'Usage:'
echo 'You must specify:'
echo ' 1, standalone.xml full path e.g.: /usr/share/jboss-as/standalone/configuration/standalone.xml'
echo ' 2, datasource template xml, e.g.: datasource_template.xml'
echo ' 3, datasource name, e.g.: AlfrescoDS'
echo ' 4, database host'
echo ' 5, database port, in case of PostgreSQL, the default is 5432'
echo ' 6, database name'
echo ' 7, database user'
echo ' 8, database password'
exit 1
}

# args:
# - target file
# - descriptor template
# - datasource name
# - db host
# - db port
# - db name
# - db user
# - db port
replace_datasource_descriptor()
{
cp $2 /tmp/$1
sed -i -e 's/$DATASOURCENAME/'"$3"'/g' /tmp/$1
sed -i -e 's/$DBHOST/'"$4"'/g' /tmp/$1
sed -i -e 's/$DBPORT/'"$5"'/g' /tmp/$1
sed -i -e 's/$DBNAME/'"$6"'/g' /tmp/$1
sed -i -e 's/$DBUSER/'"$7"'/g' /tmp/$1
sed -i -e 's/$DBPASSWORD/'"$8"'/g' /tmp/$1
}

runinstallation()
{
if [[ $(grep $3 $1 | wc -l) == 0 ]] ; then
echo "Appending $3 datasource to $1"
replace_datasource_descriptor datasource.xml "${@:2}"
fulllength=$(cat $1 | wc -l)
position=$(awk '/<\/datasource>/{print NR;exit}' $1)
head -n $position $1 > /tmp/standalone.xml
cat /tmp/datasource.xml >> /tmp/standalone.xml
lastpart=$(($fulllength - $position))
tail -n $lastpart $1 >> /tmp/standalone.xml
cp $1 $1.before.$3
mv /tmp/standalone.xml $1
else
echo "DataSource $3 has already been added to $1"
fi
}

#
# MAIN
#

if [[ $# != 8 ]] ; then
usage
else
runinstallation "$@"
fi
Loading

0 comments on commit f179ecc

Please sign in to comment.