head	1.5;
access;
symbols
	start:1.1.1.1
	oops:1.1.1;
locks; strict;
comment	@# @;


1.5
date	2009.11.17.14.45.06;	author oops;	state Exp;
branches;
next	1.4;

1.4
date	2009.11.17.13.47.44;	author oops;	state Exp;
branches;
next	1.3;

1.3
date	2009.11.16.21.52.48;	author oops;	state Exp;
branches;
next	1.2;

1.2
date	2005.08.11.08.09.51;	author siche;	state Exp;
branches;
next	1.1;

1.1
date	2005.06.24.20.46.54;	author oops;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2005.06.24.20.46.54;	author oops;	state Exp;
branches;
next	;


desc
@@


1.5
log
@support case that database/user settings are already complete
@
text
@#!/bin/sh
# $Id: permission,v 1.3 2009/11/16 21:52:48 oops Exp $

source ./lib/install-config
source ./lib/commonlib
queryReturn="./queryRet.$$"
sedTemp="./sedTmp.$$"
t=

en="usascii"
ko="euc-kr"

clear
echo -n $yellow
echo "###############################################################################"
echo "# JSBoard Installer v2.1                                                      #"
echo "# Scripted By JSBoard Open Project <http://jsboard.kldp.net>                  #"
echo "###############################################################################"
echo -n $end
echo

printStep "STEP 1. Language Check"
echo "----------------------"
echo
echo "Select your installation language : "
echo "  1. English"
echo "  2. Korean"
echo -n "Choise (Default : 1) : "
read language

[ -z "${language}" ] && language=1

_lang=
while [ -z "${_lang}" ]
do
	case "${language}" in
		1) _lang="en" ;;
		2) _lang="ko" ;;
	esac

	if [ -z "${_lang}" ]; then
		echo -n "Choise (Default : 1) : "
		read language
	fi
done

# include language pack
echo $LANG | grep -i "utf[-]\?8";
if [ $? -eq 0 ]; then
	eval "c_lang=\$${_lang}"
	if [ ! -f "./lib/lang/installation-${_lang}.conf.utf8" ]; then
		cat ./lib/lang/installation-${_lang}.conf | iconv -f ${c_lang} -t utf-8 > \
			./lib/lang/installation-${_lang}.conf.utf8
	fi
	source ./lib/lang/installation-${_lang}.conf.utf8
else
	source ./lib/lang/installation-${_lang}.conf
fi

source ./lib/lang/installation-${_lang}.conf

me=$(whoami)

if [ "${me}" != "root" ]; then
	echo
	printf "${S1_MSG_1}" $me
	read priv

	case "${priv}" in
		Y|y) priv=y;;
		N|n) priv=n;;	
		*) priv=y
	esac

	if [ "${priv}" = "y" ]; then
		echo
		echo "${S1_MSG_2}"
		exit 0
	fi
fi
echo


#
# STEP 2. Directory Creating
#


printStep "${S2_MSG_1}"
printColor_n "${S2_LIN_1}" "white"
echo

res=0
echo -n "${S2_MSG_2}${mvcol}"
printDot 3
[ -z "${t}" ] && createDir "../data"
res=$?
[ -n "${t}" ] && res=0
[ $res -eq 0 ] && onsuccess || onfailure

res=0
echo -n "${S2_MSG_3}${mvcol}"
printDot 3
[ -z "${t}" ] && createDir "../config"
res=$?
[ -n "${t}" ] && res=0
[ $res -eq 0 ] && onsuccess || onfailure

res=0
echo -n "${S2_MSG_4}${mvcol}"
printDot 3
[ -z "${t}" ] && createDir "../config/jsSessTMP"
res=$?
[ -n "${t}" ] && res=0
[ $res -eq 0 ] && onsuccess || onfailure
echo


#
# STEP 5. Permission setting
#
printStep "${S5_MSG_1}"
printColor_n "${S5_LIN_1}" "white"
echo

apache_user=$(ps aux | grep -E "apache|httpd" | grep -v "\(^root\|grep\)" | awk '{print $1}'| uniq)
echo -n "${S5_MSG_2} "
printf "${MSG_CHOISE}" "${apache_user}"
read _auser

[ -n "${_auser}" ] && apache_user="${_auser}"

pwds=$(pwd | sed 's!/utils.*!!g')

echo
if [ "${me}" = "root" ]; then
	echo -n "${S5_MSG_3}${mvcol}"
	printDot 3

	[ -z "${t}" ] && chown ${apache_user} ../config &> /dev/null
	res=$?
	[ -n "${t}" ] && res=0

	if [ $res -eq 0 ]; then
		[ -z "${t}" ] && chmod 370 ../config &> /dev/null
		res=$?
		[ -n "${t}" ] && res=0
	fi
	[ $res -eq 0 ] && onsuccess || onfailure

	echo -n "${S5_MSG_4}${mvcol}"
	printDot 3
	[ -z "${t}" ] && chown ${apache_user} ../data &> /dev/null
	res=$?
	[ -n "${t}" ] && res=0

	if [ $res -eq 0 ]; then
		[ -z "${t}" ] && chmod 370 ../data &> /dev/null
		res=$?
		[ -n "${t}" ] && res=0
	fi
	[ $res -eq 0 ] && onsuccess || onfailure

	echo -n "${S5_MSG_5}${mvcol}"
	printDot 3
    [ -z "${t}" ] && chown ${apache_user} ../config/jsSessTMP &> /dev/null
    res=$?
    [ -n "${t}" ] && res=0

    if [ $res -eq 0 ]; then
        [ -z "${t}" ] && chmod 370 ../config/jsSessTMP &> /dev/null
        res=$?
        [ -n "${t}" ] && res=0
    fi
    [ $res -eq 0 ] && onsuccess || onfailure

	echo -n "${S5_MSG_6}${mvcol}"
	printDot 3
	[ -z "${t}" ] && chown ${apache_user} ../config/global.php &> /dev/null
	res=$?
	[ -n "${t}" ] && res=0

	if [ $res -eq 0 ]; then
		[ -z "${t}" ] && chmod 660 ../config/global.php &> /dev/null
		res=$?
		[ -n "${t}" ] && res=0
	fi
	[ $res -eq 0 ] && onsuccess || onfailure

	echo -n "${S5_MSG_7}${mvcol}"
	printDot 3
	[ -z "${t}" ] && chown ${apache_user} ../config/spam_list.txt &> /dev/null
	res=$?
	[ -n "${t}" ] && res=0

	if [ $res -eq 0 ]; then
		[ -z "${t}" ] && chmod 660 ../config/spam_list.txt &> /dev/null
		res=$?
		[ -n "${t}" ] && res=0
	fi
	[ $res -eq 0 ] && onsuccess || onfailure

	if [ -f "../config/jsboard.db" ]; then
		[ -z "${t}" ] && chown ${apache_user} ../config/jsboard.db &> /dev/null
		[ -z "${t}" ] && chmod 660 ../config/jsboard.db &> /dev/null
	fi
else
	echo -n "${S5_MSG_3}${mvcol}"
	printDot 3

	[ -z "${t}" ] && chmod 707 ../config &> /dev/null
	res=$?
	[ -n "${t}" ] && res=0
	[ $res -eq 0 ] && onsuccess || onfailure

	echo -n "${S5_MSG_4}${mvcol}"
	printDot 3
	[ -z "${t}" ] && chmod 707 ../data &> /dev/null
	res=$?
	[ -n "${t}" ] && res=0
	[ $res -eq 0 ] && onsuccess || onfailure

    echo -n "${S5_MSG_5}${mvcol}"
    printDot 3
    [ -z "${t}" ] && chmod 707 ../config/jsSessTMP &> /dev/null
    res=$?
    [ -n "${t}" ] && res=0
    [ $res -eq 0 ] && onsuccess || onfailure

	echo -n "${S5_MSG_6}${mvcol}"
	printDot 3
	[ -z "${t}" ] && chmod 606 ../config/global.php &> /dev/null
	res=$?
	[ -n "${t}" ] && res=0
	[ $res -eq 0 ] && onsuccess || onfailure

	echo -n "${S5_MSG_7}${mvcol}"
	printDot 3
	[ -z "${t}" ] && chmod 606 ../config/spam_list.txt &> /dev/null
	res=$?
	[ -n "${t}" ] && res=0
	[ $res -eq 0 ] && onsuccess || onfailure

	if [ -f "../config/jsboard.db" ]; then
		[ -z "${t}" ] && chmod 606 ../config/jsboard.db &> /dev/null
	fi
fi


echo
printStep "Setup completly"
echo
echo

exit 0
@


1.4
log
@Support UTF-8 console
@
text
@@


1.3
log
@add cvs id
@
text
@d2 1
a2 1
# $Id: $
d10 3
d48 12
@


1.2
log
@add jsSessTMP dir
@
text
@d2 1
@


1.1
log
@Initial revision
@
text
@d92 8
d150 13
d174 1
a174 1
	echo -n "${S5_MSG_6}${mvcol}"
d207 8
a214 1
	echo -n "${S5_MSG_5}${mvcol}"
d221 1
a221 1
	echo -n "${S5_MSG_6}${mvcol}"
@


1.1.1.1
log
@2.1 Tree start
@
text
@@
