0xGA: Check-in [3a3e945478]

Yet another PHP framework, but made for org-mode and geeks.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Reorganize sources
Timelines: family | ancestors | descendants | both | narv
Files: files | file ages | folders
SHA1:3a3e945478d8ad772195c21ccd4567ad03311d25
User & Date: milouse 2014-12-24 23:53:26
Context
2014-12-25
01:02
Big simplification of 0xGA deployment (no more chroot --> use containers like LXC \!) check-in: f1d02a401c user: milouse tags: narv
2014-12-24
23:53
Reorganize sources check-in: 3a3e945478 user: milouse tags: narv
22:53
Add a cleanup chroot feature to narv script check-in: df91c927d3 user: milouse tags: narv
Changes

Changes to create_narv_installer.sh.

1
2
3
4
5
6





7
8
9
10
11
12
13
..
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
44
45
46
47
48
49
50
..
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash

if [ -f "./narv_install.sh" ] ; then
    rm narv_install.sh
fi






gzip --best -k narv narv.py
tar -czf narv.tar.gz narv.gz narv.py.gz

exec 6>&1 # bind fd #6 to stdout (save stdout)
exec > /tmp/narv_tmp_install # redirect stdout to this file

cat <<EOF
................................................................................

PAYLOAD="$(base64 narv.tar.gz)"

EOF

exec 1>&6 6>&- # Restore stdout and close fd #6


sed "1,32d" create_narv_installer.sh >> /tmp/narv_tmp_install
mv /tmp/narv_tmp_install narv_install.sh
chmod u+x narv_install.sh


rm *.gz

exit

####################################################
### INSTALLER SCRIPT
####################################################

if which gpg &> /dev/null; then
  if gpg -k 8C9CEE3D &> /dev/null; then
    echo -n 'Check sig? [Y|n] '
    read check_sign
    if [ "$check_sign" != "n" ]; then
      wget http://projects.depar.is/0xGA/doc/tip/narv_install.sh.asc
      if ! gpg --verify narv_install.sh.asc ; then
        exit 1
      fi
    fi
  fi
fi

WORKINGREP=`realpath ./narvroot`

echo "$PAYLOAD" | base64 -d > narv.tar.gz
tar xzf narv.tar.gz
rm narv.tar.gz
................................................................................
This program will now exit to let you do all the necessary things before."
    exit 1
fi

mkdir $WORKINGREP

echo ":: creating shared necessary directories structure"
install -dm 755 $WORKINGREP/var/db
install -dm 755 $WORKINGREP/var/log
install -dm 777 $WORKINGREP/var/tmp
install -dm 755	$WORKINGREP/usr/bin
install -dm 755	$WORKINGREP/etc

install -Dm 755 narv.py $WORKINGREP/usr/bin
install -Dm 755 narv    $WORKINGREP/usr/bin

rm narv narv.py

echo "General installation finished."
echo "You may now want to create your first app by entering the command:"
echo "$WORKINGREP/usr/bin/narv create [-d $WORKINGREP] <appname>"






>
>
>
>
>







 







>
|


>

<
>







|
|
|
|
|
|
|
|
|
|







 







|
|
|
|
|

|
|






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
..
20
21
22
23
24
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash

if [ -f "./narv_install.sh" ] ; then
    rm narv_install.sh
fi

if [ -f "./narv_install.sh.asc" ] ; then
    rm narv_install.sh.asc
fi

cd src
gzip --best -k narv narv.py
tar -czf narv.tar.gz narv.gz narv.py.gz

exec 6>&1 # bind fd #6 to stdout (save stdout)
exec > /tmp/narv_tmp_install # redirect stdout to this file

cat <<EOF
................................................................................

PAYLOAD="$(base64 narv.tar.gz)"

EOF

exec 1>&6 6>&- # Restore stdout and close fd #6

cd ..
sed "1,39d" create_narv_installer.sh >> /tmp/narv_tmp_install
mv /tmp/narv_tmp_install narv_install.sh
chmod u+x narv_install.sh
gpg -b --armor narv_install.sh


rm src/*.gz
exit

####################################################
### INSTALLER SCRIPT
####################################################

if which gpg &> /dev/null; then
    if gpg -k 8C9CEE3D &> /dev/null; then
        echo -n 'Check sig? [Y|n] '
        read check_sign
        if [ "$check_sign" != "n" ]; then
            wget http://projects.depar.is/0xGA/doc/tip/narv_install.sh.asc
            if ! gpg --verify narv_install.sh.asc ; then
                exit 1
            fi
        fi
    fi
fi

WORKINGREP=`realpath ./narvroot`

echo "$PAYLOAD" | base64 -d > narv.tar.gz
tar xzf narv.tar.gz
rm narv.tar.gz
................................................................................
This program will now exit to let you do all the necessary things before."
    exit 1
fi

mkdir $WORKINGREP

echo ":: creating shared necessary directories structure"
install -d -m755 $WORKINGREP/var/db
install -d -m755 $WORKINGREP/var/log
install -d -m777 $WORKINGREP/var/tmp
install -d -m755 $WORKINGREP/usr/bin
install -d -m755 $WORKINGREP/etc

install -D -m755 narv.py $WORKINGREP/bin
install -D -m755 narv    $WORKINGREP/bin

rm narv narv.py

echo "General installation finished."
echo "You may now want to create your first app by entering the command:"
echo "$WORKINGREP/usr/bin/narv create [-d $WORKINGREP] <appname>"

Name change from narv to src/narv.

Name change from narv.py to src/narv.py.

566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581



582
583
584
585
586
587
588
    """Main threaded server"""
    should_interrupt = False


class Narv:
    def __init__(self, server_infos=('', 8000), request_handler=IcanDoThat):

        config = ConfigParser()
        config.read('etc/rc.conf')

        log_level = 'info'
        drop_priviledges = True
        narv_root_path = os.path.normpath(os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            '../../'))




        if 'general' in config:
            if 'debug' in config['general']:
                log_level = config['general']['debug']

            if 'drop_priviledges' in config['general']:
                drop_priviledges = config['general'].getboolean('drop_priviledges')








<
<
<






>
>
>







566
567
568
569
570
571
572



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
    """Main threaded server"""
    should_interrupt = False


class Narv:
    def __init__(self, server_infos=('', 8000), request_handler=IcanDoThat):




        log_level = 'info'
        drop_priviledges = True
        narv_root_path = os.path.normpath(os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            '../../'))

        config = ConfigParser()
        config.read(os.path.join(narv_root_path, 'etc/rc.conf'))

        if 'general' in config:
            if 'debug' in config['general']:
                log_level = config['general']['debug']

            if 'drop_priviledges' in config['general']:
                drop_priviledges = config['general'].getboolean('drop_priviledges')