0xGA: Artifact Content

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

Artifact 760675edcab55624055961b050aee7bb154a6525:


#!/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
#!/usr/bin/env bash

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
####################################################

WORKINGREP=`realpath ./narvroot`

echo "$PAYLOAD" | base64 -d > narv.tar.gz
tar xzf narv.tar.gz
rm narv.tar.gz
gzip -d narv.gz narv.py.gz
chmod u+x narv

echo ":: will init Narv in $WORKINGREP"

if [ -e "$WORKINGREP" ] ; then
    echo
    echo "ERROR: $WORKINGREP already exists on your system."
    echo
    echo "If you really wants to do a fresh install at this place, remove it first.
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>"