Initial commit...
This commit is contained in:
		
							
								
								
									
										195
									
								
								Shell Projects/Lazy-Share/lazyShare-v2.04/resources/bkup/lazyShareScan.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										195
									
								
								Shell Projects/Lazy-Share/lazyShare-v2.04/resources/bkup/lazyShareScan.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,195 @@
 | 
			
		||||
#
 | 
			
		||||
# By Maxim F. Stewart
 | 
			
		||||
# Contact: [maximstewart1@gmail.com]
 | 
			
		||||
#
 | 
			
		||||
# Copyright 2013 Maxim F. Stewart
 | 
			
		||||
#    This program is free software: you can redistribute it and/or modify
 | 
			
		||||
#    it under the terms of the GNU General Public License as published by
 | 
			
		||||
#    the Free Software Foundation, either version 2 of the License, or
 | 
			
		||||
#    (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
#    This program is distributed in the hope that it will be useful,
 | 
			
		||||
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
#    GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
#    You should have received a copy of the GNU General Public License
 | 
			
		||||
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------#
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# adds settings to this run if requested
 | 
			
		||||
 | 
			
		||||
chkr()
 | 
			
		||||
{
 | 
			
		||||
altSrvrName="nanoweb"
 | 
			
		||||
srvrName="Nanoweb"
 | 
			
		||||
absPth="$HOME/LazyShare"
 | 
			
		||||
 | 
			
		||||
plugChkr=`which gnome-mplayer`
 | 
			
		||||
plugChkr2=`ls /etc/${altSrvrName}/${altSrvrName}.conf`
 | 
			
		||||
plugChkr3=`which php5-cgi`
 | 
			
		||||
 | 
			
		||||
if [[ ${plugChkr} == ""  || \
 | 
			
		||||
      ${plugChkr2} == "" || \
 | 
			
		||||
      ${plugChkr3} == "" ]]; then
 | 
			
		||||
Install="Install"
 | 
			
		||||
noInstall="Do Not Install"
 | 
			
		||||
 | 
			
		||||
replyinst=$(zenity --list \
 | 
			
		||||
 --text "We need to install one or more pre-requsit programs or
 | 
			
		||||
    settings are missing. The missing program(s) is/are
 | 
			
		||||
    gecko-mediaplayer, $srvrName, and/or php5-cgi." \
 | 
			
		||||
    --radiolist  --column "Select" \
 | 
			
		||||
 --column "Options" TRUE "Install" FALSE "Do Not Install" \
 | 
			
		||||
 --height 220);
 | 
			
		||||
 | 
			
		||||
    if [[ "${replyinst}" == "${Install}" ]]; then
 | 
			
		||||
		     PASSWD="$(zenity --password --title=Authentication)\n"
 | 
			
		||||
 | 
			
		||||
        echo "# Installing gecko-mediaplayer..." ; sleep 1
 | 
			
		||||
        echo -e $PASSWD | sudo apt-get install gecko-mediaplayer -y
 | 
			
		||||
        echo "# Installing "${altSrvrName}"..." ; sleep 1
 | 
			
		||||
        echo -e $PASSWD | sudo apt-get install "${altSrvrName}" -y
 | 
			
		||||
        echo "# Installing php5-cgi..." ; sleep 1
 | 
			
		||||
        echo -e $PASSWD | sudo apt-get install php5-cgi -y
 | 
			
		||||
        echo "# Killing "${altSrvrName}"..." ; sleep 1
 | 
			
		||||
        echo -e $PASSWD | sudo killall $altSrvrName -y
 | 
			
		||||
        echo "# Finished!" ; sleep 1
 | 
			
		||||
        main;
 | 
			
		||||
    elif [[ "${replyinst}" == "${noInstall}" ]]; then
 | 
			
		||||
        main;
 | 
			
		||||
    fi
 | 
			
		||||
    main;
 | 
			
		||||
else
 | 
			
		||||
    main;
 | 
			
		||||
fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
main()
 | 
			
		||||
{
 | 
			
		||||
declare -A movies=([.mkv]= [.mp4]= [.mpg]= [.avi]= [.mov]= [.MOV]= [.flv]= [.wmv]= [.ogv]= [.webm]= [.m4v]=)
 | 
			
		||||
for i in `ls ./`; do
 | 
			
		||||
fileNm=$(echo "$i" | sed 's/.*\///');
 | 
			
		||||
fileExtnsn=$(echo "$i" | sed 's/^.*\././g');
 | 
			
		||||
outFile=$(echo ${i%.*});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if [[ "${movies[$fileExtnsn]-X}" == "${movies[$fileExtnsn]}" ]]; then
 | 
			
		||||
       if [ -f "${absPth}"/resources/thumbnails/"${outFile}".jpg ]; then
 | 
			
		||||
          echo "Not a video or already present...."
 | 
			
		||||
       else
 | 
			
		||||
            ffmpegthumbnailer -t="00:10:00" -c jpg -i "${fileNm}" -s 310 -o "${absPth}"/resources/thumbnails/"${outFile}".jpg
 | 
			
		||||
       fi
 | 
			
		||||
    fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
IFS=$'\n' bgs=($(ls -L "${absPth}"/resources/backgrounds/))
 | 
			
		||||
numdirs=${#bgs[@]}
 | 
			
		||||
index=$(( (( RANDOM % $numdirs ) - 2) + 1 ))
 | 
			
		||||
 | 
			
		||||
if [ -f ./000.jpg ]; then
 | 
			
		||||
bg="<div id="\"bg"\"><img src="\"./000.jpg"\"/></div>";
 | 
			
		||||
else
 | 
			
		||||
bg="<div id="\"bg"\"><img src="\"/resources/backgrounds/${bgs[index]}"\"/></div>";
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
	echo '<!doctype html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
	<title>LazyShare</title>
 | 
			
		||||
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 | 
			
		||||
	<link rel="stylesheet" href="/resources/settings-notes/css.css" type="text/css">
 | 
			
		||||
    <script type="text/javascript" src="http://www.midijs.net/lib/midi.js"></script>
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
'${bg}'
 | 
			
		||||
<a href="../">
 | 
			
		||||
    <img src="/resources/icons/left.png" class="backbutton" alt="Can Not Display Picture" />
 | 
			
		||||
    </a><br>
 | 
			
		||||
<div class="header">
 | 
			
		||||
<form action="/resources/settings-notes/upload.php" method="post" enctype="multipart/form-data">
 | 
			
		||||
    Select a file to upload:
 | 
			
		||||
    <input type="file" name="fileToUpload" id="fileToUpload"><br>
 | 
			
		||||
    <input type="submit" value="Upload File" name="submit">
 | 
			
		||||
</form>
 | 
			
		||||
</div>' > ./index.php
 | 
			
		||||
dirScan
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dirScan()
 | 
			
		||||
{
 | 
			
		||||
d=`ls -p | grep "/" | sed 's/\/$//'`;
 | 
			
		||||
 | 
			
		||||
for i in $d; do
 | 
			
		||||
fileNm=$(echo "$i" | sed 's/*\///');
 | 
			
		||||
 | 
			
		||||
    if [[ "${fileNm}" == *"resources"* ]]; then
 | 
			
		||||
        echo "In root dir; wont add resources as list option..."
 | 
			
		||||
    else
 | 
			
		||||
        if [ -f "${absPth}"/resources/thumbnails/"${fileNm}".jpg ]; then
 | 
			
		||||
	    echo '
 | 
			
		||||
<div class="lnksNdirs"><a href="'${fileNm}'" style="color:#00E8FF;">
 | 
			
		||||
<img src="/resources/thumbnails/'${fileNm}'.jpg" /><br>'${fileNm}'</a>
 | 
			
		||||
</div>' >> ./index.php ;
 | 
			
		||||
    else
 | 
			
		||||
	    echo '
 | 
			
		||||
<div class="lnksNdirs"><a href="'${fileNm}'" style="color:#00E8FF;">
 | 
			
		||||
<img src="/resources/icons/folder.png" /><br>'${fileNm}'</a>
 | 
			
		||||
</div>' >> ./index.php ;
 | 
			
		||||
 | 
			
		||||
     fi
 | 
			
		||||
fi
 | 
			
		||||
done
 | 
			
		||||
mainScaner
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
mainScaner()
 | 
			
		||||
{
 | 
			
		||||
# Associative Arrays set to compare against the file extension
 | 
			
		||||
declare -A movies=([.mkv]= [.mp4]= [.mpg]= [.avi]= [.mov]= [.MOV]= [.flv]= [.wmv]= [.ogv]= [.webm]= [.m4v]=)
 | 
			
		||||
declare -A music=([.mp2]= [.mp3]= [.ogg]= [.flac]= [.mid]=)
 | 
			
		||||
declare -A docs=([.doc]= [.docx]= [.txt]= [.pdf]= [.odt]=)
 | 
			
		||||
declare -A pics=([.png]= [.jpg]= [.jpeg]= [.gif]=)
 | 
			
		||||
declare -A invis=([.sh]= [index.php]=)
 | 
			
		||||
 | 
			
		||||
for i in `ls ./`; do
 | 
			
		||||
fileNm=$(echo "$i" | sed 's/.*\///') ;
 | 
			
		||||
fileExtnsn=$(echo "$i" | sed 's/^.*\././g') ;
 | 
			
		||||
thbnal=$(echo ${fileNm%.*});
 | 
			
		||||
 | 
			
		||||
    if [[ "${pics[$fileExtnsn]-X}" == "${pics[$fileExtnsn]}" ]]; then
 | 
			
		||||
           echo '<a href="'${fileNm}'" target="frame"><img src="'${fileNm}'" class="imgsStyl" alt="Load Fail" /></a>' >> ./index.php ;
 | 
			
		||||
	  elif [[ "${music[$fileExtnsn]-X}" == "${music[$fileExtnsn]}" ]]; then
 | 
			
		||||
	      if [[ ${fileExtnsn} == *".mid"* ]]; then
 | 
			
		||||
	            echo  '<div class="lnksNdirs">
 | 
			
		||||
	            <a href="#" style="color:#00E8FF;" onClick="MIDIjs.play('\'${fileNm}''\'');">Play '${fileNm}'</a>
 | 
			
		||||
	            </div>' >> ./index.php ;
 | 
			
		||||
	      else
 | 
			
		||||
           echo '<div class="lnksNdirs">
 | 
			
		||||
<a href="'${fileNm}'" target="frame" style="color:#00E8FF;">'${fileNm}'</a></div>' >> ./index.php ;
 | 
			
		||||
          fi
 | 
			
		||||
	  elif [[ "${movies[$fileExtnsn]-X}" == "${movies[$fileExtnsn]}" ]]; then
 | 
			
		||||
               if [ -f "${absPth}"resources/thumbnails/"${thbnal}".jpg ]; then
 | 
			
		||||
		   echo '<div class="lnksNdirs">
 | 
			
		||||
<a href="'${fileNm}'" target="frame" style="color:#00E8FF;">
 | 
			
		||||
<img src="/resources/thumbnails/'${thbnal}'.jpg" /><br>'${fileNm}'</a></div>' >> ./index.php ;
 | 
			
		||||
              else
 | 
			
		||||
                   echo '<div class="lnksNdirs">
 | 
			
		||||
<a href="'${fileNm}'" target="frame" style="color:#00E8FF;">'${fileNm}'</a></div>' >> ./index.php ;
 | 
			
		||||
              fi
 | 
			
		||||
	  elif [[ "${docs[$fileExtnsn]-X}" == "${docs[$fileExtnsn]}" ]]; then
 | 
			
		||||
		   echo '<a class="lnksNdirs" target="frame" href="'${fileNm}'" style="color:#00E8FF;">'${fileNm}'</a><br>' >> ./index.php ;
 | 
			
		||||
	  elif [[ "${invis[$fileExtnsn]-X}" == "${invis[$fileExtnsn]}" ]]; then
 | 
			
		||||
		   echo "File not added to index.php!!" ;
 | 
			
		||||
fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
    echo '<iframe id="frame" name="frame" frameborder="0" class="iframer"></iframe>
 | 
			
		||||
</body>
 | 
			
		||||
</html>' >> ./index.php
 | 
			
		||||
exit
 | 
			
		||||
}
 | 
			
		||||
chkr
 | 
			
		||||
							
								
								
									
										36
									
								
								Shell Projects/Lazy-Share/lazyShare-v2.04/resources/bkup/root-index.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								Shell Projects/Lazy-Share/lazyShare-v2.04/resources/bkup/root-index.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
<!doctype html>  
 | 
			
		||||
<html lang="en">
 | 
			
		||||
<head>
 | 
			
		||||
	<meta http-equiv="Content-Type" content="text/html"; charset=utf-8" />
 | 
			
		||||
	<title>Page List</title>
 | 
			
		||||
	<link rel="stylesheet" href="./resources/settings-notes/css.css" type="text/css">
 | 
			
		||||
</head>
 | 
			
		||||
<body>
 | 
			
		||||
      <div id="bg"><img src="./resources/backgrounds/waterFall.gif"/></div>
 | 
			
		||||
	<div class="section"><header style="font-size:200%;color:green;">LazyShare</header></div>
 | 
			
		||||
	<br>
 | 
			
		||||
 | 
			
		||||
<div style="margin-left:15%;">
 | 
			
		||||
<a href="./Pictures">
 | 
			
		||||
<div class="homeSection">
 | 
			
		||||
<img style="margin-top:2em;" src="./resources/icons/pics.png"/>
 | 
			
		||||
<br>Pictures</div></a>
 | 
			
		||||
 | 
			
		||||
<a href="./Movies-TV-Music">
 | 
			
		||||
<div class="homeSection">
 | 
			
		||||
<img style="margin-top:2em;" src="./resources/icons/video.png"/>
 | 
			
		||||
<img style="margin-top:2em;" src="./resources/icons/music.png"/>
 | 
			
		||||
<br>Movies-TV-Music</div></a>
 | 
			
		||||
 | 
			
		||||
<a href="./Documents">
 | 
			
		||||
<div class="homeSection">
 | 
			
		||||
<img style="margin-top:2em;" src="./resources/icons/docs.png"/>
 | 
			
		||||
<br>Documents</div></a>
 | 
			
		||||
 | 
			
		||||
<a href="./Uploads">
 | 
			
		||||
<div class="homeSection">
 | 
			
		||||
<img style="margin-top:2em;" src="./resources/icons/docs.png"/>
 | 
			
		||||
<br>Uploads</div></a>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										207
									
								
								Shell Projects/Lazy-Share/lazyShare-v2.04/resources/bkup/run.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										207
									
								
								Shell Projects/Lazy-Share/lazyShare-v2.04/resources/bkup/run.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,207 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
main() {
 | 
			
		||||
dir=$(pwd)
 | 
			
		||||
altSrvrName="nanoweb"
 | 
			
		||||
srvrName="Nanoweb"
 | 
			
		||||
 | 
			
		||||
ansr=$(zenity --text "Please chose an option." --radiolist --list \
 | 
			
		||||
              --column "Options" --column "Descriptions" \
 | 
			
		||||
               TRUE "Scan Dirs?" \
 | 
			
		||||
               FALSE "Edit main settings" \
 | 
			
		||||
               FALSE "Start or Stop ${srvrName}")
 | 
			
		||||
    case "$ansr" in
 | 
			
		||||
     "Scan Dirs?" ) dirScan;;
 | 
			
		||||
     "Edit main settings" ) passwdReq;;
 | 
			
		||||
     "Start or Stop ${srvrName}" ) webSrvrStrt;;
 | 
			
		||||
    esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
dirScan() {
 | 
			
		||||
find . -type d > /tmp/lzyDirList.txt
 | 
			
		||||
filename="/tmp/lzyDirList.txt"
 | 
			
		||||
while read -r line ; do
 | 
			
		||||
    pre=\""${line}"
 | 
			
		||||
    name=`echo ${pre} | sed "s|\".|"${dir}"|g" | sed "s|*|*\"|g"`
 | 
			
		||||
    if [[ "${name}" == *"resources"* ]] || \
 | 
			
		||||
       [[ "${name}" == *"Uploads"* ]]; then
 | 
			
		||||
          echo "This is a resources dir..."
 | 
			
		||||
    else
 | 
			
		||||
          if [ -f "${name}"/index.php ]; then
 | 
			
		||||
                echo "Index.php for "${name}" already present..."
 | 
			
		||||
          else
 | 
			
		||||
                work
 | 
			
		||||
         fi
 | 
			
		||||
    fi
 | 
			
		||||
done < "${filename}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
work() {
 | 
			
		||||
    mv lazyShareScan.sh "${name}/"
 | 
			
		||||
    cd "${name}/"
 | 
			
		||||
    bash ./lazyShareScan.sh
 | 
			
		||||
    mv lazyShareScan.sh "${dir}"
 | 
			
		||||
    cd "${dir}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
################## SETTINGS SECTION ##################
 | 
			
		||||
passwdReq()
 | 
			
		||||
{
 | 
			
		||||
	   PASSWD="$(zenity --password --title=Authentication)\n"
 | 
			
		||||
   	srvrEdit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
srvrEdit() {
 | 
			
		||||
auto="Turn psudo auto scan ON or Off"
 | 
			
		||||
theme="Change Theme"
 | 
			
		||||
portng="Set Port"
 | 
			
		||||
polcing="Set User And Group"
 | 
			
		||||
logng="Set Logging Status"
 | 
			
		||||
docdir="Set DocumentRoot"
 | 
			
		||||
nanoSrvr="Open The ServerConf In Nano"
 | 
			
		||||
main="START MENU"
 | 
			
		||||
exit="Exit Script"
 | 
			
		||||
 | 
			
		||||
    selec=$(zenity --list \
 | 
			
		||||
            --text "What would you like to edit in the ServerConf file?" \
 | 
			
		||||
            --radiolist  --column "Select" --column "Options" \
 | 
			
		||||
                       TRUE "Change Theme" \
 | 
			
		||||
                       FALSE "Set Port" \
 | 
			
		||||
                       FALSE "Set User And Group" \
 | 
			
		||||
                       FALSE "Set Logging Status" \
 | 
			
		||||
                       FALSE "Set DocumentRoot" \
 | 
			
		||||
                       FALSE "Open The ServerConf In Nano" \
 | 
			
		||||
                       FALSE "START MENU" FALSE "Exit Script" \
 | 
			
		||||
                       --height 300);
 | 
			
		||||
    case "$selec" in
 | 
			
		||||
        "${theme}" ) theme;;
 | 
			
		||||
        "${portng}" ) port;;
 | 
			
		||||
        "${polcing}" ) policy;;
 | 
			
		||||
        "${logng}" ) logs;;
 | 
			
		||||
        "${docdir}" ) docRoot;;
 | 
			
		||||
        "${nanoSrvr}" ) nanoSrvrConf;;
 | 
			
		||||
        "${main}" ) main;;
 | 
			
		||||
        "${exit}" ) exit;;
 | 
			
		||||
    esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
autoOnNOff() {
 | 
			
		||||
x=$(zenity --entry --text "Turn On/Off psudo auto scanning?
 | 
			
		||||
Default is : off .
 | 
			
		||||
" --entry-text "off");
 | 
			
		||||
	   sed -i 1s/"auto=*.*;"/"auto=${x};"/g $HOME/.config/lazyShareSettings/config.txt
 | 
			
		||||
	   srvrEdit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
theme() {
 | 
			
		||||
    theme=$(zenity --list \
 | 
			
		||||
            --text "What would you like to edit in the ServerConf file?" \
 | 
			
		||||
            --radiolist  --column "Select" --column "Options" \
 | 
			
		||||
                       TRUE "List On The Left" \
 | 
			
		||||
                       FALSE "List Centered" \
 | 
			
		||||
                       FALSE "Horizontal List" \
 | 
			
		||||
                       FALSE "Grid List" \
 | 
			
		||||
                       --height 175);
 | 
			
		||||
case "${theme}" in
 | 
			
		||||
    "List On The Left" )   echo "" > ./resources/settings-notes/css.css
 | 
			
		||||
                        cat ./resources/themes/"List On The Left.css" > ./resources/settings-notes/css.css;;
 | 
			
		||||
    "List Centered" )      echo "" > ./resources/settings-notes/css.css
 | 
			
		||||
                           cat ./resources/themes/"List Centered.css" > ./resources/settings-notes/css.css;;
 | 
			
		||||
    "Horizontal List" )    echo "" > ./resources/settings-notes/css.css
 | 
			
		||||
                           cat ./resources/themes/"Horizontal List.css" > ./resources/settings-notes/css.css;;
 | 
			
		||||
    "Grid List" )          echo "" > ./resources/settings-notes/css.css
 | 
			
		||||
                           cat ./resources/themes/"Grid List.css" > ./resources/settings-notes/css.css;;
 | 
			
		||||
esac
 | 
			
		||||
srvrEdit
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
port() {
 | 
			
		||||
x=$(zenity --entry --text "What will be the port that the server runs on?
 | 
			
		||||
Anything bellow 1024 means the server must run as root.
 | 
			
		||||
Default is port: 80 .
 | 
			
		||||
" --entry-text "80");
 | 
			
		||||
	   echo -e $PASSWD | sudo -S sed -i 13s/"ListenPort        = *.*"/"ListenPort        = ${x}"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
   	srvrEdit;
 | 
			
		||||
}
 | 
			
		||||
policy() {
 | 
			
		||||
	User=$(zenity --entry --text "What will be the User for the server?
 | 
			
		||||
(::-WARNING-::) Please leave as default unless you know EXACTLY
 | 
			
		||||
what you are doing! Changing user and group policies can
 | 
			
		||||
affect security of the system!
 | 
			
		||||
The default is : www-data ." --entry-text "www-data");
 | 
			
		||||
   	echo -e $PASSWD | sudo -S sed -i 187s/"User              = *.*"/"User              = ${User}"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
 | 
			
		||||
	Group=$(zenity --entry --text "What will be the Group for the server?
 | 
			
		||||
(::-WARNING-::) Please leave as default unless you know EXACTLY
 | 
			
		||||
what you are doing! Changing user and group policies can
 | 
			
		||||
affect security of the system!
 | 
			
		||||
The default is : www-data." --entry-text "www-data");
 | 
			
		||||
	   echo -e $PASSWD | sudo -S sed -i 188s/"Group             = *.*"/"Group             = ${Group}"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
   	srvrEdit;
 | 
			
		||||
}
 | 
			
		||||
logs() {
 | 
			
		||||
	logs=$(zenity --list --text "Do you wish to have AccessLog and ErrorLog enabled?
 | 
			
		||||
If this server isn't running 24/7 nor a production server then it can be OK to keep
 | 
			
		||||
logging off. It may also lessen the system resource load and speed up the server.
 | 
			
		||||
If this server runs 24/7 or is a production server then we advise keeping logging on
 | 
			
		||||
as added security. Respectively, it may add more resource demands and slow down the server.
 | 
			
		||||
Frankly, the effects are negligible in both instances so it's up to you.
 | 
			
		||||
The default is : Enabled .
 | 
			
		||||
" --radiolist  --column "Select" --column "Options" TRUE Enable FALSE Disable  --height 280);
 | 
			
		||||
yes="Enable"
 | 
			
		||||
no="Disable"
 | 
			
		||||
 | 
			
		||||
    if [[ "${logs}" == "${yes}" ]]; then
 | 
			
		||||
        echo -e $PASSWD | sudo -S sed -i 194s/"#LoggerProcess      = *.*"/"LoggerProcess      = 2"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
        echo -e $PASSWD | sudo -S sed -i 197s/"#LoggerUser"/"LoggerUser"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
        echo -e $PASSWD | sudo -S sed -i 198s/"#LoggerGroup"/"LoggerGroup"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
      		echo -e $PASSWD | sudo -S sed -i 201s/"#LogDir"/"LogDir"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
		      echo -e $PASSWD | sudo -S sed -i 207s/"#Log"/"Log"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
    elif [[ "${logs}" == "${no}" ]]; then
 | 
			
		||||
      		echo -e $PASSWD | sudo -S sed -i 194s/"LoggerProcess      = *.*"/"#LoggerProcess      = 0"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
      		echo -e $PASSWD | sudo -S sed -i 197s/"LoggerUser"/"#LoggerUser"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
      		echo -e $PASSWD | sudo -S sed -i 198s/"LoggerGroup"/"#LoggerGroup"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
      		echo -e $PASSWD | sudo -S sed -i 201s/"LogDir"/"#LogDir"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
      		echo -e $PASSWD | sudo -S sed -i 207s/"Log"/"#Log"/g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
    fi
 | 
			
		||||
srvrEdit;
 | 
			
		||||
}
 | 
			
		||||
nanoSrvrConf() {
 | 
			
		||||
   	echo -e $PASSWD | sudo -S xterm -e nano /etc/nanoweb/nanoweb.conf
 | 
			
		||||
	   srvrEdit;
 | 
			
		||||
}
 | 
			
		||||
docRoot() {
 | 
			
		||||
	docDir=$(zenity --entry \
 | 
			
		||||
--text "What do you wish to set as DocumentRoot?
 | 
			
		||||
Document root is what the server defines as the directory in which files will
 | 
			
		||||
be served from. Group permissions must allow for the directory to be used so
 | 
			
		||||
please be aware of that.
 | 
			
		||||
The default is : /var/www/nanoweb ." --entry-text "/var/www/nanoweb");
 | 
			
		||||
    echo -e $PASSWD | sudo -S sed -i 204s,"DocumentRoot      = *.*","DocumentRoot      = ${docDir}",g /etc/nanoweb/nanoweb.conf
 | 
			
		||||
	   srvrEdit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
webSrvrStrt() {
 | 
			
		||||
noRtStrt="Start $srvrName No Root?" ; noRtStp="Stop $srvrName No Root?" ;
 | 
			
		||||
rtStrt="Start $srvrName Root?" ; rtStp="Stop $srvrName Root?";
 | 
			
		||||
main="START MENU" ; exit="Exit Script" ;
 | 
			
		||||
ansr=$(zenity --list  --text "Please select an option bellow to apply!!
 | 
			
		||||
" --radiolist  --column "Select" --column "Options
 | 
			
		||||
" TRUE "Start $srvrName No Root?" FALSE "Stop $srvrName No Root?
 | 
			
		||||
" FALSE "Start $srvrName Root?" FALSE "Stop $srvrName Root?
 | 
			
		||||
" FALSE "START MENU" FALSE "Exit Script" --height 330);
 | 
			
		||||
 | 
			
		||||
case "${ansr}" in
 | 
			
		||||
    "${noRtStrt}" ) $altSrvrName & main;;
 | 
			
		||||
    "${noRtStp}" ) 	pkill $altSrvrName & main;;
 | 
			
		||||
    "${rtStrt}" ) 		PASSWD="$(zenity --password --title=Authentication)\n"
 | 
			
		||||
                  		echo -e $PASSWD | sudo -S $altSrvrName &		main;;
 | 
			
		||||
    "${rtStp}" ) 		 PASSWD="$(zenity --password --title=Authentication)\n"
 | 
			
		||||
                  		echo -e $PASSWD | sudo -S pkill $altSrvrName &	main;;
 | 
			
		||||
    "${main}" ) 		  main;;
 | 
			
		||||
    "${exit}" )     exit;;
 | 
			
		||||
esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
main
 | 
			
		||||
		Reference in New Issue
	
	Block a user