diff options
| -rwxr-xr-x | install/ishtar-install | 11 | ||||
| -rwxr-xr-x | install/ishtar-prepare-instance | 4 | ||||
| -rw-r--r-- | install/post_install_script.py | 26 | 
3 files changed, 36 insertions, 5 deletions
| diff --git a/install/ishtar-install b/install/ishtar-install index 0d1b6d096..c376e05f2 100755 --- a/install/ishtar-install +++ b/install/ishtar-install @@ -250,7 +250,7 @@ EOF          fi      done -    full_install_path=$install_path'/ishtar/'$version +    full_install_path=$install_path'/ishtar/'      if [ -d "$full_install_path" ]; then          echo ""          echo "ERROR: it seems that "$full_install_path" already exists. If this is a " @@ -369,8 +369,7 @@ EOF      echo "Installing Ishtar sources"      echo ""; -    mkdir -p $full_install_path -    cd $full_install_path +    cd $install_path      if [ "$dist_version" == "wheezy" ]; then          ( set -x; git clone https://nimn@gitlab.com/iggdrasil/oook_replace.git 2> /dev/null )      fi @@ -380,7 +379,7 @@ EOF      git checkout $version 2> /dev/null      mkdir -p $etc_path -    echo "ISHTAR_PATH="$full_install_path'/ishtar/' > $etc_path"config" +    echo "ISHTAR_PATH="$full_install_path > $etc_path"config"      echo "ISHTAR_DB="$default_db >> $etc_path"config"      echo "ISHTAR_WEBSERVER="$webserver >> $etc_path"config"      echo "# settings added to all instances" >> $etc_path"extra_settings.py" @@ -388,7 +387,9 @@ EOF      echo "*******************************************************************************";      echo "";      echo "Installation done. Base configuration stored in "$etc_path"config file." -    echo "Next you'll have to create an instance." +    echo "You can edit "$etc_path"extra_settings.py to add settings to all new instances." +    echo ""; +    echo "Next you'll have to create an instance with ishtar-prepare-instance script."      echo "";  } diff --git a/install/ishtar-prepare-instance b/install/ishtar-prepare-instance index f0956b36b..aadb2ce76 100755 --- a/install/ishtar-prepare-instance +++ b/install/ishtar-prepare-instance @@ -287,6 +287,10 @@ EOF      echo "   - create superuser"      ./manage.py createsuperuser +    echo "   - post install script" +    cd .. +    python install/post_install_script.py +      cat >&2 <<-'EOF'  ------------------------------------------------------------------------------- diff --git a/install/post_install_script.py b/install/post_install_script.py new file mode 100644 index 000000000..a4a5aaf0c --- /dev/null +++ b/install/post_install_script.py @@ -0,0 +1,26 @@ +import sys +import os +import django + +app_name, url = sys.argv[1], sys.argv[2] +os.environ.setdefault("DJANGO_SETTINGS_MODULE", app_name + ".settings") +django.setup() + +from django.contrib.sites.models import Site +from ishtar_common.models import IshtarSiteProfile + +q = Site.objects.filter(domain='example.com') + +if q.count(): +    site = q.get() +    site.domain = url +    site.name = url +    site.save() + +q = IshtarSiteProfile.objects.filter(slug='default') + +if q.count(): +    profile = q.get() +    profile.label = app_name +    profile.slug = app_name +    profile.save() | 
