0xGA: Check-in [df91c927d3]

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

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

Overview
Comment:Add a cleanup chroot feature to narv script
Timelines: family | ancestors | descendants | both | narv
Files: files | file ages | folders
SHA1:df91c927d3e289055aeecbddd152752179633596
User & Date: milouse 2014-12-24 22:53:32
Context
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
2014-10-13
23:59
Fix typos in README.md check-in: edf4ffbb31 user: milouse tags: narv
Changes

Changes to narv.

192
193
194
195
196
197
198













199
200
201
202
203
204
205
...
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
...
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
        cd $WORKINGREP
        ln -s usr/bin
    fi

    echo "Chroot created"
}















APPNAME=$USER
FOSSILFILE=/dev/null
COMMAND="help"
WORKINGREP=`pwd`
DOMAINNAME='localhost'

................................................................................
                shift
                FOSSILFILE=`realpath $1`
                ;;
            --host|-H)
                shift
                DOMAINNAME=$1
                ;;
            create|init-chroot|update-chroot|poke|restart|start|stop|-h|'help')
                COMMAND=$1
                ;;
            *)
                APPNAME=$1
                ;;
        esac
        shift
................................................................................
        install -dm 755 $WORKINGREP/dev
        mknod $WORKINGREP/dev/null c 1 3

        # Creating urandom
        mknod -m 0444 $WORKINGREP/dev/random c 1 8
        mknod -m 0444 $WORKINGREP/dev/urandom c 1 9
        ;;
    update-chroot)
        echo ":: Deleting old chroot files"
        find $WORKINGREP/usr ! -name milouse\.py -a ! -name narv -a ! -name narv\.py -delete
        find $WORKINGREP/etc ! -name rc\.conf -a ! -name routes\.conf -delete
        if [ -d "$WORKINGREP/lib64" ]; then
          rm -r $WORKINGREP/lib64
        fi
        if [ -d "$WORKINGREP/usr/bin/__pycache__" ]; then
          rm -r $WORKINGREP/usr/bin/__pycache__/
        fi
        rm $WORKINGREP/bin

        init_chroot
        ;;
    poke)
        pkill -10 -f $APPNAME.py
        ;;
    *)
        echo "There's something strange
in your neighborhood.
Who ya gonna call?"
        ;;
esac







>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







|
|
|
|
|
|
|
|
|
|
|
<











192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
...
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
...
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557

558
559
560
561
562
563
564
565
566
567
568
        cd $WORKINGREP
        ln -s usr/bin
    fi

    echo "Chroot created"
}

function cleanup_chroot {
    echo ":: Deleting old chroot files"
    find $WORKINGREP/usr ! -name $APPNAME\.py -a ! -name narv -a ! -name narv\.py -delete
    find $WORKINGREP/etc ! -name rc\.conf -a ! -name routes\.conf -delete
    if [ -d "$WORKINGREP/lib64" ]; then
        rm -r $WORKINGREP/lib64
    fi
    if [ -d "$WORKINGREP/usr/bin/__pycache__" ]; then
        rm -r $WORKINGREP/usr/bin/__pycache__/
    fi
    rm $WORKINGREP/bin
}


APPNAME=$USER
FOSSILFILE=/dev/null
COMMAND="help"
WORKINGREP=`pwd`
DOMAINNAME='localhost'

................................................................................
                shift
                FOSSILFILE=`realpath $1`
                ;;
            --host|-H)
                shift
                DOMAINNAME=$1
                ;;
            create|cleanup-chroot|init-chroot|update-chroot|poke|restart|start|stop|-h|'help')
                COMMAND=$1
                ;;
            *)
                APPNAME=$1
                ;;
        esac
        shift
................................................................................
        install -dm 755 $WORKINGREP/dev
        mknod $WORKINGREP/dev/null c 1 3

        # Creating urandom
        mknod -m 0444 $WORKINGREP/dev/random c 1 8
        mknod -m 0444 $WORKINGREP/dev/urandom c 1 9
        ;;
    cleanup-chroot)
        cleanup_chroot

        echo ":: Removing false dev mount points"
        rm $WORKINGREP/dev/null
        rm $WORKINGREP/dev/random
        rm $WORKINGREP/dev/urandom
        rmdir $WORKINGREP/dev
        ;;
    update-chroot)
        cleanup_chroot

        init_chroot
        ;;
    poke)
        pkill -10 -f $APPNAME.py
        ;;
    *)
        echo "There's something strange
in your neighborhood.
Who ya gonna call?"
        ;;
esac