Last change
on this file since 928 was
905,
checked in by ramonb, 10 years ago
|
jobarchived/job_dbase.sql:
- changed to CREATE user and ALTER password: so that create may fail (if user exists) and password upate still succeeds
pkg/rpm/jobmonarch.spec.in, debian/jobmonarch.postinst:
|
-
Property svn:executable set to
*
|
File size:
868 bytes
|
Rev | Line | |
---|
[871] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | PATH=/bin:/sbin:/usr/bin:/usr/sbin |
---|
| 4 | |
---|
| 5 | set -e |
---|
| 6 | |
---|
[896] | 7 | if [ -z "$2" ] |
---|
| 8 | then |
---|
| 9 | # Only on install (not during upgrade) |
---|
| 10 | echo "Generating random password and updating apropriate files" |
---|
| 11 | # Generate a 8 char password for the database: |
---|
| 12 | export DB_PASSWD=$(tr -dc A-Za-z0-9_< /dev/urandom |head -c 8 | xargs) |
---|
| 13 | # Set the password in the SQL script |
---|
[905] | 14 | sed -i -e '/^.*modify me:.*$/d' -e 's/^-- ALTER/ALTER/g' -e "s/'';/'$DB_PASSWD';/g" %{_datadir}/jobarchived/job_dbase.sql |
---|
[896] | 15 | # Set the password in the jobarchived config. |
---|
| 16 | sed -i -e "s/^#JOB_SQL_PASSWORD.*$/JOB_SQL_PASSWORD\t\t: $DB_PASSWD/g" %{_sysconfdir}/jobarchived.conf |
---|
| 17 | # Set the password in the ganglia conf.php |
---|
| 18 | sed -i -e "s|^//\$JOB_ARCHIVE_SQL_PASSWORD.*|\$JOB_ARCHIVE_SQL_PASSWORD = \"$DB_PASSWD\"|g" %{gangliaaddonsdir}/job_monarch/conf.php |
---|
| 19 | else |
---|
| 20 | # this is a upgrade |
---|
| 21 | : |
---|
| 22 | fi |
---|
[871] | 23 | |
---|
| 24 | exit 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.