File: phpix-create-new-instance

package info (click to toggle)
phpix 2.0.2-7
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 268 kB
  • ctags: 85
  • sloc: php: 555; makefile: 45; sh: 36
file content (43 lines) | stat: -rwxr-xr-x 1,003 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh

# phpix-create-new-instance 
# Little script to create a new phpix instance by copying from or creating 
# symlinks to the master files in /var/www/phpix/
# Written by Felix Berger <bflat1@gmx.net> and Yven Leist <leist@debian.org>

show_help ()
{
    echo -e "$1
 usage: phpix-symlink-instance [option] directory
   -s    symlink files instead of copying.
   -h    show this usage info\n"
    exit 0
}

symlink_instance () 
{
    cp -i /etc/phpix/config.inc $1
    ln -s /var/www/phpix/index.php $1/index.php
    mkdir $1/albums
    mkdir $1/generated && chmod 777 $1/generated
}

copy_instance () 
{
    cp -i /etc/phpix/config.inc $1
    cp -i /var/www/phpix/index.php $1
    mkdir $1/albums
    mkdir $1/generated && chmod 777 $1/generated
}

test "$1" = -h && show_help

test -d "$1" -o -d "$2" || show_help "no valid directory given!"

if [ "$1" = "-s" ]; then
    echo "symlinking instance to $2"
    symlink_instance $2
else
    echo "copying instance to $1"
    copy_instance $1
fi