Kleines Script zum setzen der Rechte

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
arminius
Posts: 6
Joined: Fri 18. May 2007, 13:59

Kleines Script zum setzen der Rechte

Post by arminius »

hallo Leute,
hab mir ein kleines Shell-Script geschrieben, da mir das manuelle Setzen der Rechte bei Neuinstallation oder Update zu mühsam war. Hier der Code:

#!/bin/sh
if [ -z "$1" ]; then
echo "Usage: $0 Phpwcms-Verz.";
else
chmod 777 $1/upload
chmod 777 $1/filearchive
chmod 777 $1/filearchive/can_be_deleted
chmod 777 $1/template
chmod 777 $1/content
chmod 777 $1/content/images
chmod 777 $1/content/gt
chmod 777 $1/content/form
chmod 777 $1/content/rss
chmod 777 $1/content/tmp
chmod 777 $1/content/pages

chmod 666 $1/setup/setup.conf.inc.php
chmod 666 $1/template/inc_css/frontend.css
chmod 666 $1/config/phpwcms/conf.indexpage.inc.php
chmod 666 $1/template/inc_default/startup.php
fi


das funktioniert ab Version 1.3 aufwärts unter Linux und Unix, läßt sich natürlich auch leicht für vorherige Versionen anpassen. Einfach das Script unter einem Namen speichern z.B. "set_rights". Ausführbar machen (chmod +x set_rights) und auf das entsprechende Verzeichnis anwenden z.B. ./set_rights phpwcms
Vielleicht finden das auch noch andere User nützlich.
Gruß
Armin
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Re: (Shell) Script: Installation in under 10 seconds :)

Post by phalancs »

Wow, vielen Dank. Ich bin jetzt auch endlich in der wunderbaren Welt der Shell angekommen. Habe Dein Skript glatt zum Anlass genommen mal etwas ausgefeilteres für eine schnelle shell-phpwcms-installation zu basteln... :)

Hi there,
since I was recently introduced into all the benefits from shell access, I wrote a little shell script that sets up a fresh phpwcms v 1.4.1 within seconds :)
Of course you still need to run the online-setup routine afterwards since it creates the admin user and sets some basic variables. But if you have shell access, this script might spare you approx. 20 minutes!! :) :) :)

This what the script does in detail:
1. It asks in which subfolder the installation should go
2. It automatically downloads the (latest) phpwcms 1.4.1 version from google code
3. It unpacks phpwcms into the subfolder
4. It sets all the necessary file and folder rights
5. It deletes the downloaded package

This is the code:

Code: Select all

#!/bin/sh 

clear
echo "================================================="
echo "THIS WILL INSTALL PHPWCMS V.1.4.1"
echo ""
echo "Be sure to have the p7zip package installed"
echo "Otherwise use this command as root: apt-get install p7zip"
echo "================================================="
echo ""
echo "press any key to continue"
read
echo ""
echo "TYPE SUBFOLDER NAME (no quotes or slashes):"
echo "Installation will start immediately afterwards"
echo "=============================================="
read SUBF

clear
echo "======================================"
echo "DOWNLOADING PHPWCMS VERSION 1.4.1 r307"
echo "======================================"
echo ""

mkdir $SUBF
cd $SUBF
wget http://phpwcms.googlecode.com/files/phpwcms_r307.7z
p7zip -d phpwcms_r307.7z
mv phpwcms_r307/* .
rm phpwcms_r307 -r

clear
echo "==============================="
echo "SETTING FILE- AND FOLDER-RIGHTS"
echo "==============================="
echo ""
echo "This might take a moment..."

find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;

cd ..

chmod 777 $SUBF/upload 
chmod 777 $SUBF/filearchive 
chmod 777 $SUBF/filearchive/can_be_deleted 
chmod 777 $SUBF/template 
chmod 777 $SUBF/content 
chmod 777 $SUBF/content/images 
chmod 777 $SUBF/content/gt 
chmod 777 $SUBF/content/form 
chmod 777 $SUBF/content/rss 
chmod 777 $SUBF/content/tmp 
chmod 777 $SUBF/content/pages 
chmod 777 $SUBF/template/template_lang
chmod 666 $SUBF/setup/setup.conf.inc.php 
chmod 666 $SUBF/template/inc_css/frontend.css 
chmod 666 $SUBF/config/phpwcms/conf.indexpage.inc.php 
chmod 666 $SUBF/template/inc_default/startup.php

clear
echo "==================================="
echo "SUCCESS! SETUP DONE!"
echo ""
echo "NOW CONTINUE USING THE WEBINSTALLER:"
echo "yourdomain.tld/$SUBF/setup/setup.php"
echo "==================================="
echo ""
How to use:
1. Copy script to a file called phpwcms_install.sh
2. Upload to the users root
3. Set the script to 777 and execute via shell using this command "./phpwcms_install.sh" (without quotes)

Note: Since there might issues if you upload a shell script edited
on a windows system to a linux server you might sometimes get the following error:
bad interpreter: No such file or directory
See this hint for a quick remedy :) http://www.devdaily.com/blog/post/linux ... such-file/

Note 2: You need a 7zip extractor to extract the package, use this command as root to get one:
apt-get install p7zip
2008
User avatar
Heiko H.
Posts: 868
Joined: Thu 27. Oct 2005, 11:41
Location: Dresden
Contact:

Re: Kleines Script zum setzen der Rechte

Post by Heiko H. »

arminius wrote:hallo Leute,
hab mir ein kleines Shell-Script geschrieben
Gar keine so schlechte Idee...
ABER!!! Welcher "Normal"-Webhostingkunde hat schon Shellzugriff - bei mir keiner... :mrgreen:

Wie gesagt, keine schlechte Idee!

Grüße Heiko...
Not longer here - sorry...

Haubner-IT GbR Dresden
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Re: Kleines Script zum setzen der Rechte

Post by flip-flop »

I think it is a good idea to turn this script into the wiki.

Done: http://phpwcms-howto.de/wiki/doku.php/e ... tallation/

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Re: Kleines Script zum setzen der Rechte

Post by phalancs »

Juhu flipflop danke :-P :(
2008
Post Reply