From 3dab26c6797b32926287f22a041380080551060b Mon Sep 17 00:00:00 2001 From: M.Gergo Date: Fri, 8 Mar 2019 20:50:48 +0100 Subject: pici rendrakás --- .../fcgi_install.d/01createhome.sh | 73 ++++++ .../fcgi_install.d/05checkdeb.sh | 106 +++++++++ .../fcgi_install.d/10getsource.sh | 79 +++++++ .../fcgi_install.d/15createconfig.sh | 46 ++++ .../fcgi_install.d/20mysql.sh | 34 +++ .../fcgi_install.d/25apache.sh | 254 +++++++++++++++++++++ .../fcgi_install.d/30php.sh | 35 +++ .../fcgi_install.d/35createdatabases.sh | 129 +++++++++++ .../fcgi_install.d/40binary.sh | 52 +++++ .../fcgi_install.d/45intezmeny.sh | 70 ++++++ .../fcgi_install.d/50linker.sh | 59 +++++ .../fcgi_install.d/55tex.sh | 20 ++ .../fcgi_install.d/60portal.sh | 119 ++++++++++ .../fcgi_install.d/90chown.sh | 30 +++ .../fcgi_install.d/99end.sh | 7 + .../install.d/05checkdeb.sh | 106 +++++++++ .../install.d/10getsource.sh | 79 +++++++ .../install.d/15createconfig.sh | 43 ++++ .../mayor-installer-for-fcgi/install.d/20mysql.sh | 28 +++ .../mayor-installer-for-fcgi/install.d/25apache.sh | 67 ++++++ .../mayor-installer-for-fcgi/install.d/30php.sh | 29 +++ .../install.d/35createdatabases.sh | 132 +++++++++++ .../mayor-installer-for-fcgi/install.d/40binary.sh | 49 ++++ .../install.d/45intezmeny.sh | 70 ++++++ .../mayor-installer-for-fcgi/install.d/50linker.sh | 58 +++++ .../mayor-installer-for-fcgi/install.d/55tex.sh | 20 ++ .../mayor-installer-for-fcgi/install.d/60portal.sh | 119 ++++++++++ .../log/mayor-installer.rev | 1 + mayor-installer/mayor-installer-for-fcgi/setup | 48 ++++ 29 files changed, 1962 insertions(+) create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/01createhome.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/05checkdeb.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/10getsource.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/15createconfig.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/20mysql.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/25apache.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/30php.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/35createdatabases.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/40binary.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/45intezmeny.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/50linker.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/55tex.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/60portal.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/90chown.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/99end.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/05checkdeb.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/10getsource.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/15createconfig.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/20mysql.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/25apache.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/30php.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/35createdatabases.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/40binary.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/45intezmeny.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/50linker.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/55tex.sh create mode 100755 mayor-installer/mayor-installer-for-fcgi/install.d/60portal.sh create mode 100644 mayor-installer/mayor-installer-for-fcgi/log/mayor-installer.rev create mode 100755 mayor-installer/mayor-installer-for-fcgi/setup (limited to 'mayor-installer/mayor-installer-for-fcgi') diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/01createhome.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/01createhome.sh new file mode 100755 index 00000000..bdb7398a --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/01createhome.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# + +cat < (apache2=fcgid): <==IPC==> :php-értelmező_apache_gyermekprocesszként_külön_userként + + +FONTOS!! +A napló is ebből a könyvtárból fog futni, a /var/mayor/ egy symlink lesz +erre a könyvtárra. de ugyanúgy használható továbbra is, mint eddig. + +Például: + A felhasználó neve: mayor-web + A home könyvtára : /home/mayor-web/ + A mayor könyvtára : /home/mayor-web/mayor/ + A mayor mantés(pl): /home/mayor-web/mayor_backup/ + (Megj: a /var/mayor/ továbbra is használható.) + (/var/mayor/ --> /home/mayor-web/mayor/) + +A telepítés végén pedig mindez a >> ps auxf parancs kiadásával személetesebben is látszódik. +EOF + + +echo -e "A php értelmező felhasználója: $MAYORUSER" +read -n 1 -p "Létrehozhatom? (i/N) " -s DO +if [ "$DO" != "i" ]; then echo -e "\nA $MAYORUSER létrehozását kihagytam.\n"; exit 1; fi + +useradd -p "*" -m --home "/home/$MAYORUSER" --shell "/bin/false" --system "$MAYORUSER" +chage --mindays 0 --maxdays 99999 --warndays 7 "$MAYORUSER" +chfn --full-name "$MAYORUSER" "$MAYORUSER" +echo -e "A $MAYORUSER (rendszer)felhasználó hozzáadva.\n" + +echo -e "/home/$MAYORUSER/mayor és mayor_backup mappák létrehozása.\n" +mkdir -p "/home/$MAYORUSER/mayor_backup" +mkdir -p "/home/$MAYORUSER/mayor" + +echo -e "linkelés a /var/mayor könyvtárra.\n" +ln -s "/home/$MAYORUSER/mayor" "/var/mayor" + +echo -e "kész.\n\n" + + diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/05checkdeb.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/05checkdeb.sh new file mode 100755 index 00000000..5b5e1828 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/05checkdeb.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# +DEBIAN=false; +UBUNTU=false; +if [ $(which lsb_release || echo "notinstalled") == "notinstalled" ] +then + ISSUE=$(cat /etc/issue | cut -d " " -f 1) + if [ "x${ISSUE}" == "xDebian" ]; then + DEBIAN=true; + RELEASE=$(cat /etc/issue | cut -d " " -f 3) + elif [ "x${ISSUE}" == "xUbuntu" ]; then + UBUNTU=true; + RELEASE=$(cat /etc/issue | cut -d " " -f 2) + fi +else + DISTRIBUTOR=$(lsb_release -i -s) + RELEASE=$(lsb_release -r -s) + if [ "x${DISTRIBUTOR}" == "xDebian" ]; then + DEBIAN=true; + elif [ "x${DISTRIBUTOR}" == "xUbuntu" ]; then + UBUNTU=true; + fi +fi +echo "Debian:" ${DEBIAN} +echo "Ubuntu:" ${UBUNTU} +echo "Version:" ${RELEASE} + +TEST=$(grep contrib /etc/apt/sources.list) +if [ "$TEST" == "" ] +then + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "Az apt sources.list módosítása szükséges!" + if [ DEBIAN ]; then + echo "Debian Jessie (8) esetén például: + deb http://ftp.hu.debian.org/debian/ jessie main contrib non-free + deb http://security.debian.org/ jessie/updates main contrib non-free + deb http://ftp.hu.debian.org/debian/ jessie-updates main contrib non-free + +Debian 9 esetén például: + deb http://ftp.hu.debian.org/debian/ stretch main contrib non-free + deb http://security.debian.org/debian-security stretch/updates main contrib non-free + deb http://ftp.hu.debian.org/debian/ stretch-updates main contrib non-free + \n" + + read -n 1 -p "Hozzáadhatom? (egyelőre csak Debian9 esetén működik) (i/N)" -s DO + if [ "$DO" != "i" ]; then echo -e "\nA hozzáadást kihagytam.\n"; exit 255; fi + + if [[ "x${RELEASE}" =~ ^x9.* ]]; then + echo -e "#mayor miatt is: +deb http://ftp.hu.debian.org/debian/ stretch contrib non-free +deb http://security.debian.org/debian-security stretch/updates contrib non-free +deb http://ftp.hu.debian.org/debian/ stretch-updates contrib non-free" >> /etc/apt/sources.list + + fi + echo -e "\n ---- csomaglista frissítése ---- \n" + apt update ## frisítés + echo -e "\n ------------- kész ------------- \n" + + fi +# exit 255; +fi + +if [[ "x${RELEASE}" =~ ^x9.* ]] +then + PKGS="apache2 apache2-suexec-custom libapache2-mod-fcgid php-cgi php php-json php-mysql php-ldap php-mbstring php-mcrypt php-curl mariadb-server recode texlive texlive-fonts-extra texlive-latex-extra texlive-binaries texlive-xetex ntp wget ssl-cert ssh pwgen texlive-lang-european" +else + PKGS="apache2 apache2-suexec-custom libapache2-mod-fcgid php5-cgi php5 php5-json php5-mysqlnd php5-ldap php5-mcrypt php5-curl mysql-server recode texlive texlive-fonts-extra texlive-latex-extra texlive-binaries texlive-xetex ttf-mscorefonts-installer ntp wget ssl-cert ssh pwgen texlive-lang-european texlive-lang-hungarian" +fi + +if [ "$1" == "--no-deb" ]; then + exit 1 +fi + +cat </dev/null | sed 's/.*-\([^-]*\)\.tgz$/\1/' ) + +DO=n +if [ "$MENU" == '' ]; then + DO=i +else + echo " 0 Letöltés mindenképpen" + echo "${MENU}" | sed 's/.*-\([^-]*\)\.tgz$/\1/' | nl + read -n1 -p 'Melyiket telepítsem? ' SEL; echo + + if [ "$SEL" == 0 ]; then + DO=i + else + SELECT=$( echo "${MENU}" | sed -n ${SEL}p ) + + MAYORBASE="$TMPDIR/mayor-base-$SELECT.tgz" + MAYORNAPLO="$TMPDIR/mayor-naplo-$SELECT.tgz" + fi +fi + +if [ "$DO" == "i" ]; then + MAYORBASE="$TMPDIR/mayor-base-current.tgz" + MAYORNAPLO="$TMPDIR/mayor-naplo-current.tgz" + + echo -e "\nForrások letöltése:" + cd $TMPDIR + rm -f mayor-base-current.tgz + rm -f mayor-naplo-current.tgz + wget "http://www.mayor.hu/download/$VERSION/mayor-base-current.tgz" + wget "http://www.mayor.hu/download/$VERSION/mayor-naplo-current.tgz" +else + echo -e "\nA forráscsomagok letöltését kihagytam.\n" +fi + +read -n 1 -p "Telepítsem a forrás csomagokat? (i/N)" -s DO +if [ "$DO" != "i" ]; then echo -e "\nA forráscsomagok telepítését kihagytam.\n"; exit 1; fi + +echo -n -e "\nRendszer könyvtár: " +if [ ! -e $MAYORDIR ]; then + mkdir -p $MAYORDIR +fi +if [ ! -e "/var/mayor" ]; then + ln -s $MAYORDIR /var/mayor +fi +echo $MAYORDIR + +echo -e -n "Források kicsomagolása... " +cd $MAYORDIR +tar xfz "$MAYORBASE" +tar xfz "$MAYORNAPLO" +echo "ok." + diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/15createconfig.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/15createconfig.sh new file mode 100755 index 00000000..74156932 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/15createconfig.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# + +cat < " + PW=$(pwgen -s1 32) + cat "$MAYORDIR/config/$file.example" | sed s/%SQLPW%/$PW/ > "$MAYORDIR/config/$file" + echo $file + fi +done + +echo -n " module-naplo/config.php.example --> " +PW=$(pwgen -s1 32) +PWREAD=$(pwgen -s1 32) +if [ -e "$MAYORDIR/config/module-naplo/config.php" ]; then echo " module-naplo/config.php létezik."; else + cat "$MAYORDIR/config/module-naplo/config.php.example" | sed -e s/%SQLPW%/$PW/ -e s/%SQLPWREAD%/$PWREAD/ > "$MAYORDIR/config/module-naplo/config.php" + echo "module-naplo/config.php" +fi + +if [ -e "$MAYORDIR/config/skin-classic/naplo-config.php" ]; then echo " skin-classic/naplo-config.php létezik."; else + echo -n " skin-classic/naplo-config.php.example --> " + cp $MAYORDIR/config/skin-classic/naplo-config.php.example $MAYORDIR/config/skin-classic/naplo-config.php + echo "config/skin-classic/naplo-config.php" +fi + + +sed -e "s/\/var\/mayor/\/home\/$MAYORUSER\/mayor/g" -i "$MAYORDIR/config/main-config.php" diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/20mysql.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/20mysql.sh new file mode 100755 index 00000000..7ae70bfb --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/20mysql.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# + +cat < /etc/mysql/conf.d/utf8.cnf + +#cp -f $MAYORDIR/install/base/mysql/utf8.cnf /etc/mysql/conf.d +echo ok +/etc/init.d/mysql restart + +if [ "x${RELEASE}" == "x9" ] +then + echo -e "\nMariaDB/MySQL beállítások" + echo -n " futtatom a mysql_Secure_installation scriptet: " + mysql_secure_installation +fi diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/25apache.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/25apache.sh new file mode 100755 index 00000000..d2aa12c7 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/25apache.sh @@ -0,0 +1,254 @@ +#!/bin/bash +# + +cat < /dev/null + echo ok +else + echo "már engedélyezett" +fi + echo -n " - ModReWrite engedélyezése ... " +if [ ! -e /etc/apache2/mods-enabled/rewrite.load ]; then + a2enmod rewrite > /dev/null + echo ok +else + echo "már engedélyezett" +fi + +echo -n " - mod_suexec engedélyezése ... " +if [ ! -e /etc/apache2/mods-enabled/suexec.load ]; then + a2enmod suexec > /dev/null + echo ok +else + echo "már engedélyezett" +fi + +echo -n " - mod_fcgid engedélyezése ... " +if [ ! -e /etc/apache2/mods-enabled/fcgid.load ]; then + a2enmod fcgid > /dev/null + echo ok +else + echo "már engedélyezett" +fi + +echo -n " - mod_actions engedélyezése ... " +if [ ! -e /etc/apache2/mods-enabled/actions.load ]; then + a2enmod actions > /dev/null + echo ok +else + echo "már engedélyezett" +fi + + +echo -n " - mod_php kikapcsolása (a www-data php értelmezője)" +if [ -e /etc/apache2/mods-enabled/php7.0.load ]; then + a2dismod php7.0 > /dev/null + echo ok +else + echo "nincs bekapcsolava" +fi + +echo -n " - mod_headers engedélyezése" +if [ ! -e /etc/apache2/mods-enabled/headers.load ]; then + a2enmod headers > /dev/null + echo ok +else + echo "nincs bekapcsolava" +fi + + +echo -n " - Apache2 mod_worker és mod_event, amíg a php nem lesz thread-safe. " +if [ -e /etc/apache2/mods-enabled/mpm_event.load ] || [ -e /etc/apache2/mods-enabled/mpm_worker.load ]; then + a2dismod mpm_event > /dev/null + a2dismod mpm_worker > /dev/null + a2enmod mpm_prefork > /dev/null + echo ok +else + echo "nincs bekapcsolava" +fi + +echo "ok." + + +echo -e " Apache2 konfiguráció létrehozása\n" +cat > /etc/apache2/sites-available/mayor_naplo.conf < + ServerName your.mayor.server.hu +# ServerAlias your.mayor.server.hu your.mayor.server.iskola.sulinet.hu + + + ServerAdmin webmaster@localhost + + SuexecUserGroup mayor-user mayor-user + DocumentRoot mayor-docroot + ScriptAlias /wbin/ mayor-web-bin + + AddHandler php-fcgi .php + Action php-fcgi /wbin/php7.fcgi + AddType application/x-httpd-php .php + + + FcgidProcessLifeTime 3600 + FcgidIOTimeout 320 + FcgidMaxRequestInMem 16777216 + FcgidMaxRequestLen 33554432 + FcgidBusyTimeout 600 +## FcgidOutputBufferSize 0 + FcgidIdleTimeout 400 + + +# Részletesebben: +# FcgidProcessLifeTime 3600 ##(seconds) A php max futási ideje (a (hagyományos) mod_php-nál is ennyi) +# FcgidIOTimeout 320 ##(seconds) A php generál valamit, elkldi a böngészőnek, vagy a böngésző küld adatot a php-nak, ennyi ideig tarthat. (pl: 120sec) +# FcgidMaxRequestInMem 16777216 ##(bytes) Amikor a böngésző küld adatokat a php-nak, ennyi megy a pufferbe. (16MB elég) +# FcgidMaxRequestLen 33554432 ##(bytes) Amikor a böngésző küld adatot a php-nak, az adat max hossza bájtokabn. (32MB elég) +# FcgidBusyTimeout 600 ##(seconds) A php max ennyi ideig gondolkozhat egy futáson/kérésen, ha túllépi, ki lesz lőve. +# FcgidOutputBufferSize 0 ##(bytes) Pufer, amikor a php generál valami adatot, és azt elküldené a böngészőnek. {ezt még át kéne nézni} +# FcgidIdleTimeout 400 ##(seconds) A php-értelmező ennyi pihenés után le lesz állítva.(**) +# ##(**) Figyelem! Itt a "php-értelmező" külön gyermekprocesszként fut, ami az oldal meglátogatásakor indul automatikusan, +# ## és FcgidIdleTimeout-nyi pihenés után magától leáll. + + IndexIgnore * + + + ## A php-csomagoló, és php.ini fájlok közvetlen elérésének tiltása + + Require all granted + + Require env REDIRECT_STATUS + + + Require all denied + + + Require all denied + + + + DirectoryIndex index.php index.html index.htm + + + Options FollowSymLinks + AllowOverride None + + + + Options -Indexes +FollowSymLinks +MultiViews + AllowOverride None + # Apache 2.2 # Order allow,deny + # Apache 2.2 # allow from all + # Apache 2.4 # Require all granted + = 2.3> + Require all granted + + + order allow,deny + allow from all + + RewriteEngine on + RewriteBase / + RewriteCond %{SERVER_PORT} ^80$ + RewriteCond %{THE_REQUEST} .*(policy=private|page=auth|page=password).* + RewriteRule (.*)$ https://%{HTTP_HOST}/$1 [L] + + + + SSLEngine On +# ## A gyenge titkosítások tiltása + SSLProtocol all -SSLv2 -SSLv3 -TLSv1 + SSLCertificateFile /etc/apache2/ssl/apache_mayor.pem +# # SSLCertificateFile /etc/apache2/ssl/crt/name-cert.pem +# # SSLCertificateKeyFile /etc/apache2/ssl/key/name-key.pem + + + + Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains" + + + + ErrorLog \${APACHE_LOG_DIR}/mayor_error.log + + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel info ssl:warn fcgid:debug + + CustomLog \${APACHE_LOG_DIR}/mayor_access.log combined + ServerSignature On + + +EOT + + + +SERVERNAME="" +while [ "$SERVERNAME" = "" ] +do + read -p " A web szerver teljes domain neve (pl: mayor.tesztsuli.hu): " SERVERNAME +done + +#cat $MAYORDIR/install/base/apache2/mayor.conf | sed "s/ServerName your.mayor.server.hu/ServerName $SERVERNAME/" > /etc/apache2/sites-available/mayor.conf + +# A 2.4-es apache esetén módosítani kell a konfig állományt! +APACHE_VERSION=$(dpkg -l apache2 | grep apache2 | tr -s ' ' | cut -d ' ' -f 3 | cut -d '-' -f 1 | sed 's/\..$//') + +echo -e " Apache2 finomhangolása\n" + +sed -e "s/ServerName your.mayor.server.hu/ServerName $SERVERNAME/g" -i /etc/apache2/sites-available/mayor_naplo.conf +sed -e "s/SuexecUserGroup mayor-user mayor-user/SuexecUserGroup $MAYORUSER $MAYORUSER/g" -i /etc/apache2/sites-available/mayor_naplo.conf +sed -e "s/DocumentRoot mayor-docroot/DocumentRoot \/home\/$MAYORUSER\/mayor\/www\/ /g" -i /etc/apache2/sites-available/mayor_naplo.conf +sed -e "s/ScriptAlias \/wbin\/ mayor-web-bin/ScriptAlias \/wbin\/ \/home\/$MAYORUSER\/mayor\/www-bin\/ /g" -i /etc/apache2/sites-available/mayor_naplo.conf +sed -e "s// /g" -i /etc/apache2/sites-available/mayor_naplo.conf +sed -e "s// /g" -i /etc/apache2/sites-available/mayor_naplo.conf + +echo -e " a suexec beállítása\n" +sed -e 's/\/var\/www/\/home\n\/var\/www/g' -i /etc/apache2/suexec/www-data + +echo " A php-csomagoló elkészítése" +mkdir -p "/home/$MAYORUSER/mayor/www-bin/" + +csomagolo="#!/bin/sh \n exec /usr/bin/php-cgi7.0 " +echo -e $csomagolo > "/home/$MAYORUSER/mayor/www-bin/php7.fcgi" +chmod +x "/home/$MAYORUSER/mayor/www-bin/php7.fcgi" + +echo " A php.ini beszerzése" +cp "/etc/php/7.0/cgi/php.ini" "/home/$MAYORUSER/mayor/www-bin/php.ini" +chown -R "$MAYORUSER:$MAYORUSER" "/home/$MAYORUSER/mayor/www-bin" + + +if [ ! -e /etc/apache2/sites-enabled/mayor_naplo.conf ]; then + echo " A mayor site engedélyezése" + a2ensite mayor_naplo.conf > /dev/null +fi + +echo " A web-szerver újraindítása" +/etc/init.d/apache2 restart diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/30php.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/30php.sh new file mode 100755 index 00000000..3e4545a2 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/30php.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# + +cat < mayor-login.sql +DB=$(grep db $MAYORDIR/config/parent-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +USER=$(grep user $MAYORDIR/config/parent-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +PW=$(grep pw $MAYORDIR/config/parent-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +cat $MAYORDIR/install/base/mysql/mayor-auth.sql | sed -e "s/%MYSQL_AUTH_DB%/$DB/g" -e "s/%MYSQL_AUTH_USER%/$USER/g" \ + -e "s/%MYSQL_AUTH_PW%/$PW/g" > mayor-parent.sql +DB=$(grep db $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +USER=$(grep 'mysql user' $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +PW=$(grep pw $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +cat $MAYORDIR/install/base/mysql/mayor-auth.sql | sed -e "s/%MYSQL_AUTH_DB%/$DB/g" -e "s/%MYSQL_AUTH_USER%/$USER/g" \ + -e "s/%MYSQL_AUTH_PW%/$PW/g" > mayor-private.sql +DB=$(grep db $MAYORDIR/config/module-naplo/config.php | grep naplo_base | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +USER=$(egrep 'userWrite.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +USERREAD=$(egrep 'userRead.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +PW=$(egrep 'pwWrite.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +PWREAD=$(egrep 'pwRead.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +cat $MAYORDIR/install/module-naplo/mysql/base.sql | sed -e "s/%MYSQL_NAPLO_DB%/$DB/g" -e "s/%MYSQL_NAPLO_USER%/$USER/g" \ + -e "s/%MYSQL_NAPLO_PW%/$PW/g" -e "s/%MYSQL_NAPLO_USER_READ%/$USERREAD/g" \ + -e "s/%MYSQL_NAPLO_PW_READ%/$PWREAD/g" > base.sql +DB=$(grep db $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") + +cat $MAYORDIR/install/base/mysql/private-users.sql | sed -e "s/%MYSQL_PRIVATE_DB%/$DB/g" > private-users.sql +cat $MAYORDIR/install/module-naplo/mysql/naplo-users.sql | sed -e "s/%MYSQL_PRIVATE_DB%/$DB/g" > naplo-users.sql + +echo " A létrejött sql fileok:" +FILES=$(ls *.sql) +for f in $FILES +do + echo " * ${f}"; +done; +read -n 1 -p "Telepíthetem? (i/N)" -s DO +if [ "$DO" != "i" ]; then echo " ok, kiléptem..."; exit 1; fi +echo -e "\n" + +read -p " A mysql root jelszó (a begépelt szöveg nem látszik!): " -s MYSQLROOTPW + +if [ ! -e $MAYORDIR/config/main.conf ]; then + cat $MAYORDIR/config/main.conf.example | sed s/%SQLPW%/$MYSQLROOTPW/ > $MAYORDIR/config/main.conf + chmod 600 $MAYORDIR/config/main.conf +fi + +if [ "$MYSQLROOTPW" = "" ]; +then + MYSQLROOTPWSTR=""; +else + MYSQLROOTPWSTR="-p$MYSQLROOTPW --user=root" +fi + +cat /tmp/mysql/mayor-login.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/mayor-parent.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/mayor-private.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/base.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/private-users.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/naplo-users.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 + +echo -e "\n" +echo "A telepítés végeztével beléphetsz a webes felületen! +========================================================= + user: mayoradmin +========================================================= + jelszó: jelszo +========================================================= +" diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/40binary.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/40binary.sh new file mode 100755 index 00000000..33acc60d --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/40binary.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# + +cat < $TMPDIR/mysql/intezmeny.sql + +insert into $DB.intezmeny (OMKod, rovidNev, nev, alapertelmezett) VALUES ('$OMKOD','$ROVID','$INTEZMENYNEV',1); +create database intezmeny_$ROVID character set utf8 collate utf8_hungarian_ci; +grant select,execute on intezmeny_$ROVID.* to '$USERREAD'@'localhost'; +grant all on intezmeny_$ROVID.* to '$USER'@'localhost'; +use intezmeny_$ROVID; + +EOF + +if [ "$MYSQLROOTPW" == "" ]; then + read -p " A mysql root jelszó -ha van!- (a begépelt szöveg nem látszik!): " -s MYSQLROOTPW +fi +#Ezt miért is akarom kiírni? +#echo $MYSQLROOTPW - a jelszó +if [ "$MYSQLROOTPW" = "" ]; +then + MYSQLROOTPWSTR=""; +else + MYSQLROOTPWSTR="-p$MYSQLROOTPW --user=root" +fi + +cat $TMPDIR/mysql/intezmeny.sql $MAYORDIR/install/module-naplo/mysql/intezmeny.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 $INTEZMENYDB diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/50linker.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/50linker.sh new file mode 100755 index 00000000..bd4910a9 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/50linker.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# +cat < $MAYORDIR/www/policy/$POLICY/$file" + ln -s $MAYORDIR/www/policy/private/$file $MAYORDIR/www/policy/$POLICY/$file + else + echo " Hiányzó file: $MAYORDIR/www/policy/private/$file" + fi + else + echo " [OK] A file már létezik: " $file + fi + done + done +done diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/55tex.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/55tex.sh new file mode 100755 index 00000000..87bcbc5f --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/55tex.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +cat < " + PW=$(pwgen -s1 32) + if [ "$ROVID" = "" ]; then + ROVID="demo" + fi + cat "$MAYORDIR/config/$file.example" | sed -e "s/%SQLPW%/$PW/" -e "s/demo/${ROVID}/" > "$MAYORDIR/config/$file" + echo $file +fi + +echo -e "\n SQL file létrehozása... " +if [ ! -d $TMPDIR/mysql ]; then + mkdir -p $TMPDIR/mysql +fi +cd $TMPDIR/mysql +PDB=$(grep db $MAYORDIR/config/$file | sed -e "s/.*=\ *['\"]//g" -e "s/['\"];//g") +USER=$(grep user $MAYORDIR/config/$file | sed -e "s/.*=\ *['\"]//g" -e "s/['\"];//g") +PW=$(grep pw $MAYORDIR/config/$file | sed -e "s/.*=\ *['\"]//g" -e "s/['\"];//g") + +cat $MAYORDIR/install/mayor-portal/mysql/mayor-portal.sql | sed \ + -e "s/%MYSQL_PORTAL_DB%/$PDB/g" \ + -e "s/%MYSQL_PORTAL_USER%/$USER/g" \ + -e "s/%MYSQL_PORTAL_PW%/$PW/g" > mayor-portal.sql + +DB=$(grep db $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +cat $MAYORDIR/install/mayor-portal/mysql/portal-init.sql | sed \ + -e "s/%MYSQL_PRIVATE_DB%/$DB/g" \ + -e "s/%MYSQL_PORTAL_DB%/$PDB/g" > portal-init.sql + +read -n 1 -p "Telepíthetem? (i/N)" -s DO +if [ "$DO" != "i" ]; then echo " ok, kiléptem..."; exit 1; fi +echo -e "\n" + +if [ "$MYSQLROOTPW" == "" ]; then + read -p " A mysql root jelszó -ha van- (a begépelt szöveg nem látszik!): " -s MYSQLROOTPW +fi + +if [ "$MYSQLROOTPW" = "" ]; +then + MYSQLROOTPWSTR=""; +else + MYSQLROOTPWSTR="-p$MYSQLROOTPW --user=root" +fi + + +cat /tmp/mysql/mayor-portal.sql /tmp/mysql/portal-init.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 + +read -n 1 -p "Tegyük a portál oldalt a rendszer kezdőlapjává minden hozzáférési szinten? (i/N)" -s DO +if [ "$DO" != "i" ]; then + echo -e "\nA portál oldalt nem teszem kezdőlappá.\n"; + cat <'portal', 'sub' => 'portal', 'f' => 'portal');/" $MAYORDIR/config/$file + echo ok + done +fi + +if [ "$ROVID" != "demo" ]; then + echo -e "\nEgyedi kezdőoldalak létrehozása:" + for policy in private public parent; do + echo -n " $policy " + for skin in classic pda; do + cp $MAYORDIR/www/policy/$policy/portal/portal/portal_demo.$skin.php $MAYORDIR/www/policy/$policy/portal/portal/portal_$ROVID.$skin.php + echo -n "... " + done + echo "ok" + done +fi + diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/90chown.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/90chown.sh new file mode 100755 index 00000000..1e090128 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/90chown.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +echo -e "A könyvtárak jogosultságainak beállítása\n\n" +read -n 1 -p "beállíthatom? (i/N)" -s DO +if [ "$DO" != "i" ]; then echo -e "\nNem.\n"; exit 1; fi + + +if [ $MAYORUSER == "" ] || [ $MAYORDIR == "" ]; then echo -e "A MAYOR(DIR/USER) változó üres! .....kilépek\n" ; exit 1 ; fi + +chown -R "$MAYORUSER:$MAYORUSER" /home/$MAYORUSER/ ## Ez esetben a MAYORDIR a /home/xxx/mayor-ra mutat + +find /home/$MAYORUSER/ -type f -print0 | xargs -0 chmod 0644 +find /home/$MAYORUSER/ -type d -print0 | xargs -0 chmod 0751 +find /home/$MAYORUSER/ -name '*.php' -print0 | xargs -0 chmod 0640 +find /home/$MAYORUSER/mayor/ -name '*.sh' -print0 | xargs -0 chmod 0600 +find /home/$MAYORUSER/mayor/bin/ -name '*.sh' -print0 | xargs -0 chown root:root +find /home/$MAYORUSER/mayor/ -name '*.conf' -print0 | xargs -0 chmod 0600 + +# a csomagoló jogainak visszaállítása +chmod -R 600 "/home/$MAYORUSER/mayor/www-bin/" +chmod +x "/home/$MAYORUSER/mayor/www-bin/php7.fcgi" + +## de azért idemásolom az eredetit is, biztos-ami-biztos +chmod 700 $MAYORDIR/config/ +# A main.conf védelme +chown root:root $MAYORDIR/config/main.conf +chmod 600 $MAYORDIR/config/main.conf + + +echo -e "...kész.\n" \ No newline at end of file diff --git a/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/99end.sh b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/99end.sh new file mode 100755 index 00000000..fab52dc8 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/fcgi_install.d/99end.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo -e "-------------------------------------------------\n" +echo -e "Telepítés vége. \n\n" + + + diff --git a/mayor-installer/mayor-installer-for-fcgi/install.d/05checkdeb.sh b/mayor-installer/mayor-installer-for-fcgi/install.d/05checkdeb.sh new file mode 100755 index 00000000..2488d60a --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/install.d/05checkdeb.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# +DEBIAN=false; +UBUNTU=false; +if [ $(which lsb_release || echo "notinstalled") == "notinstalled" ] +then + ISSUE=$(cat /etc/issue | cut -d " " -f 1) + if [ "x${ISSUE}" == "xDebian" ]; then + DEBIAN=true; + RELEASE=$(cat /etc/issue | cut -d " " -f 3) + elif [ "x${ISSUE}" == "xUbuntu" ]; then + UBUNTU=true; + RELEASE=$(cat /etc/issue | cut -d " " -f 2) + fi +else + DISTRIBUTOR=$(lsb_release -i -s) + RELEASE=$(lsb_release -r -s) + if [ "x${DISTRIBUTOR}" == "xDebian" ]; then + DEBIAN=true; + elif [ "x${DISTRIBUTOR}" == "xUbuntu" ]; then + UBUNTU=true; + fi +fi +echo "Debian:" ${DEBIAN} +echo "Ubuntu:" ${UBUNTU} +echo "Version:" ${RELEASE} + +TEST=$(grep contrib /etc/apt/sources.list) +if [ "$TEST" == "" ] +then + echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + echo "Az apt sources.list módosítása szükséges!" + if [ DEBIAN ]; then + echo "Debian Jessie (8) esetén például: + deb http://ftp.hu.debian.org/debian/ jessie main contrib non-free + deb http://security.debian.org/ jessie/updates main contrib non-free + deb http://ftp.hu.debian.org/debian/ jessie-updates main contrib non-free + +Debian 9 esetén például: + deb http://ftp.hu.debian.org/debian/ stretch main contrib non-free + deb http://security.debian.org/debian-security stretch/updates main contrib non-free + deb http://ftp.hu.debian.org/debian/ stretch-updates main contrib non-free + \n" + + read -n 1 -p "Hozzáadhatom? (egyelőre csak Debian9 esetén működik) (i/N)" -s DO + if [ "$DO" != "i" ]; then echo -e "\nA hozzáadást kihagytam.\n"; exit 255; fi + + if [[ "x${RELEASE}" =~ ^x9.* ]]; then + echo -e "#mayor miatt is: +deb http://ftp.hu.debian.org/debian/ stretch contrib non-free +deb http://security.debian.org/debian-security stretch/updates contrib non-free +deb http://ftp.hu.debian.org/debian/ stretch-updates contrib non-free" >> /etc/apt/sources.list + + fi + echo -e "\n ---- csomaglista frissítése ---- \n" + apt update ## frisítés + echo -e "\n ------------- kész ------------- \n" + + fi +# exit 255; +fi + +if [[ "x${RELEASE}" =~ ^x9.* ]] +then + PKGS="apache2 php libapache2-mod-php php-json php-mysql php-ldap php-mbstring php-mcrypt php-curl mariadb-server recode texlive texlive-fonts-extra texlive-latex-extra texlive-binaries texlive-xetex ntp wget ssl-cert ssh pwgen texlive-lang-european" +else + PKGS="apache2 php5 libapache2-mod-php5 php5-json php5-mysqlnd php5-ldap php5-mcrypt php5-curl mysql-server recode texlive texlive-fonts-extra texlive-latex-extra texlive-binaries texlive-xetex ttf-mscorefonts-installer ntp wget ssl-cert ssh pwgen texlive-lang-european texlive-lang-hungarian" +fi + +if [ "$1" == "--no-deb" ]; then + exit 1 +fi + +cat </dev/null | sed 's/.*-\([^-]*\)\.tgz$/\1/' ) + +DO=n +if [ "$MENU" == '' ]; then + DO=i +else + echo " 0 Letöltés mindenképpen" + echo "${MENU}" | sed 's/.*-\([^-]*\)\.tgz$/\1/' | nl + read -n1 -p 'Melyiket telepítsem? ' SEL; echo + + if [ "$SEL" == 0 ]; then + DO=i + else + SELECT=$( echo "${MENU}" | sed -n ${SEL}p ) + + MAYORBASE="$TMPDIR/mayor-base-$SELECT.tgz" + MAYORNAPLO="$TMPDIR/mayor-naplo-$SELECT.tgz" + fi +fi + +if [ "$DO" == "i" ]; then + MAYORBASE="$TMPDIR/mayor-base-current.tgz" + MAYORNAPLO="$TMPDIR/mayor-naplo-current.tgz" + + echo -e "\nForrások letöltése:" + cd $TMPDIR + rm -f mayor-base-current.tgz + rm -f mayor-naplo-current.tgz + wget "http://www.mayor.hu/download/$VERSION/mayor-base-current.tgz" + wget "http://www.mayor.hu/download/$VERSION/mayor-naplo-current.tgz" +else + echo -e "\nA forráscsomagok letöltését kihagytam.\n" +fi + +read -n 1 -p "Telepítsem a forrás csomagokat? (i/N)" -s DO +if [ "$DO" != "i" ]; then echo -e "\nA forráscsomagok telepítését kihagytam.\n"; exit 1; fi + +echo -n -e "\nRendszer könyvtár: " +if [ ! -e $MAYORDIR ]; then + mkdir -p $MAYORDIR +fi +if [ ! -e "/var/mayor" ]; then + ln -s $MAYORDIR /var/mayor +fi +echo $MAYORDIR + +echo -e -n "Források kicsomagolása... " +cd $MAYORDIR +tar xfz "$MAYORBASE" +tar xfz "$MAYORNAPLO" +echo "ok." + diff --git a/mayor-installer/mayor-installer-for-fcgi/install.d/15createconfig.sh b/mayor-installer/mayor-installer-for-fcgi/install.d/15createconfig.sh new file mode 100755 index 00000000..8d035fe1 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/install.d/15createconfig.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# + +cat < " + PW=(pwgen -s1 32) + cat "$MAYORDIR/config/$file.example" | sed s/%SQLPW%/$PW/ > "$MAYORDIR/config/$file" + echo $file + fi +done + +echo -n " module-naplo/config.php.example --> " +PW=$(pwgen -s1 32) +PWREAD=$(pwgen -s1 32) +if [ -e "$MAYORDIR/config/module-naplo/config.php" ]; then echo " module-naplo/config.php létezik."; else + cat "$MAYORDIR/config/module-naplo/config.php.example" | sed -e s/%SQLPW%/$PW/ -e s/%SQLPWREAD%/$PWREAD/ > "$MAYORDIR/config/module-naplo/config.php" + echo "module-naplo/config.php" +fi + +if [ -e "$MAYORDIR/config/skin-classic/naplo-config.php" ]; then echo " skin-classic/naplo-config.php létezik."; else + echo -n " skin-classic/naplo-config.php.example --> " + cp $MAYORDIR/config/skin-classic/naplo-config.php.example $MAYORDIR/config/skin-classic/naplo-config.php + echo "config/skin-classic/naplo-config.php" +fi diff --git a/mayor-installer/mayor-installer-for-fcgi/install.d/20mysql.sh b/mayor-installer/mayor-installer-for-fcgi/install.d/20mysql.sh new file mode 100755 index 00000000..2979f728 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/install.d/20mysql.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# + +cat < /dev/null + echo ok +else + echo "már engedélyezett" +fi + echo -n " - ModReWrite engedélyezése ... " +if [ ! -e /etc/apache2/mods-enabled/rewrite.load ]; then + a2enmod rewrite > /dev/null + echo ok +else + echo "már engedélyezett" +fi +echo "ok." + +SERVERNAME="" +while [ "$SERVERNAME" = "" ] +do + read -p " A web szerver teljes domain neve (pl: mayor.tesztsuli.hu): " SERVERNAME +done + +#cat $MAYORDIR/install/base/apache2/mayor.conf | sed "s/ServerName your.mayor.server.hu/ServerName $SERVERNAME/" > /etc/apache2/sites-available/mayor.conf + +# A 2.4-es apache esetén módosítani kell a konfig állományt! +APACHE_VERSION=$(dpkg -l apache2 | grep apache2 | tr -s ' ' | cut -d ' ' -f 3 | cut -d '-' -f 1 | sed 's/\..$//') +cat $MAYORDIR/install/base/apache2/mayor.conf | sed \ + -e "s/ServerName your.mayor.server.hu/ServerName $SERVERNAME/" > /etc/apache2/sites-available/mayor.conf + + +if [ ! -e /etc/apache2/sites-enabled/mayor.conf ]; then + echo " A mayor site engedélyezése" + a2ensite mayor.conf > /dev/null +fi + +echo " A web-szerver újraindítása" +/etc/init.d/apache2 restart diff --git a/mayor-installer/mayor-installer-for-fcgi/install.d/30php.sh b/mayor-installer/mayor-installer-for-fcgi/install.d/30php.sh new file mode 100755 index 00000000..49000c68 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/install.d/30php.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# + +cat < /etc/php5/apache2/php.ini +echo 256M + +echo " Az web szerver újraindítása" +/etc/init.d/apache2 restart + diff --git a/mayor-installer/mayor-installer-for-fcgi/install.d/35createdatabases.sh b/mayor-installer/mayor-installer-for-fcgi/install.d/35createdatabases.sh new file mode 100755 index 00000000..718ca3c2 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/install.d/35createdatabases.sh @@ -0,0 +1,132 @@ +#!/bin/bash +# + +cat < mayor-login.sql +DB=$(grep db $MAYORDIR/config/parent-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +USER=$(grep user $MAYORDIR/config/parent-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +PW=$(grep pw $MAYORDIR/config/parent-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +cat $MAYORDIR/install/base/mysql/mayor-auth.sql | sed -e "s/%MYSQL_AUTH_DB%/$DB/g" -e "s/%MYSQL_AUTH_USER%/$USER/g" \ + -e "s/%MYSQL_AUTH_PW%/$PW/g" > mayor-parent.sql +DB=$(grep db $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +USER=$(grep 'mysql user' $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +PW=$(grep pw $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +cat $MAYORDIR/install/base/mysql/mayor-auth.sql | sed -e "s/%MYSQL_AUTH_DB%/$DB/g" -e "s/%MYSQL_AUTH_USER%/$USER/g" \ + -e "s/%MYSQL_AUTH_PW%/$PW/g" > mayor-private.sql +DB=$(grep db $MAYORDIR/config/module-naplo/config.php | grep naplo_base | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +USER=$(egrep 'userWrite.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +USERREAD=$(egrep 'userRead.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +PW=$(egrep 'pwWrite.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +PWREAD=$(egrep 'pwRead.*=' $MAYORDIR/config/module-naplo/config.php | sed -e "s/^.*=\ *['|\"]//g" -e "s/['|\"];//g") +cat $MAYORDIR/install/module-naplo/mysql/base.sql | sed -e "s/%MYSQL_NAPLO_DB%/$DB/g" -e "s/%MYSQL_NAPLO_USER%/$USER/g" \ + -e "s/%MYSQL_NAPLO_PW%/$PW/g" -e "s/%MYSQL_NAPLO_USER_READ%/$USERREAD/g" \ + -e "s/%MYSQL_NAPLO_PW_READ%/$PWREAD/g" > base.sql +DB=$(grep db $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") + +cat $MAYORDIR/install/base/mysql/private-users.sql | sed -e "s/%MYSQL_PRIVATE_DB%/$DB/g" > private-users.sql +cat $MAYORDIR/install/module-naplo/mysql/naplo-users.sql | sed -e "s/%MYSQL_PRIVATE_DB%/$DB/g" > naplo-users.sql + +echo " A létrejött sql fileok:" +FILES=$(ls *.sql) +for f in $FILES +do + echo " * ${f}"; +done; +read -n 1 -p "Telepíthetem? (i/N)" -s DO +if [ "$DO" != "i" ]; then echo " ok, kiléptem..."; exit 1; fi +echo -e "\n" + +read -p " A mysql root jelszó (a begépelt szöveg nem látszik!): " -s MYSQLROOTPW + + +if [ ! -e $MAYORDIR/config/main.conf ]; then + cat $MAYORDIR/config/main.conf.example | sed s/%SQLPW%/$MYSQLROOTPW/ > $MAYORDIR/config/main.conf +# BDIR=$(echo $MAYORDIR | sed -e 's:\/:\\\/:g') +# sed -e "s/BASEDIR=\"\/var\/mayor\"/BASEDIR=\"$BDIR\"/g" -i $MAYORDIR/config/main.conf + chmod 600 $MAYORDIR/config/main.conf +fi + +if [ "$MYSQLROOTPW" = "" ]; +then + MYSQLROOTPWSTR=""; +else + MYSQLROOTPWSTR="-p$MYSQLROOTPW --user=root" +fi + +cat /tmp/mysql/mayor-login.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/mayor-parent.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/mayor-private.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/base.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/private-users.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 +cat /tmp/mysql/naplo-users.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 + +echo -e "\n" +echo "A telepítés végeztével beléphetsz a webes felületen! +========================================================= + user: mayoradmin +========================================================= + jelszó: jelszo +========================================================= +" diff --git a/mayor-installer/mayor-installer-for-fcgi/install.d/40binary.sh b/mayor-installer/mayor-installer-for-fcgi/install.d/40binary.sh new file mode 100755 index 00000000..e0f0598b --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/install.d/40binary.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# + +cat < $TMPDIR/mysql/intezmeny.sql + +insert into $DB.intezmeny (OMKod, rovidNev, nev, alapertelmezett) VALUES ('$OMKOD','$ROVID','$INTEZMENYNEV',1); +create database intezmeny_$ROVID character set utf8 collate utf8_hungarian_ci; +grant select,execute on intezmeny_$ROVID.* to '$USERREAD'@'localhost'; +grant all on intezmeny_$ROVID.* to '$USER'@'localhost'; +use intezmeny_$ROVID; + +EOF + +if [ "$MYSQLROOTPW" == "" ]; then + read -p " A mysql root jelszó -ha van!- (a begépelt szöveg nem látszik!): " -s MYSQLROOTPW +fi +#Ezt miért is akarom kiírni? +#echo $MYSQLROOTPW - a jelszó +if [ "$MYSQLROOTPW" = "" ]; +then + MYSQLROOTPWSTR=""; +else + MYSQLROOTPWSTR="-p$MYSQLROOTPW --user=root" +fi + +cat $TMPDIR/mysql/intezmeny.sql $MAYORDIR/install/module-naplo/mysql/intezmeny.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 $INTEZMENYDB diff --git a/mayor-installer/mayor-installer-for-fcgi/install.d/50linker.sh b/mayor-installer/mayor-installer-for-fcgi/install.d/50linker.sh new file mode 100755 index 00000000..73887902 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/install.d/50linker.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# +cat < $MAYORDIR/www/policy/$POLICY/$file" + ln -s $MAYORDIR/www/policy/private/$file $MAYORDIR/www/policy/$POLICY/$file + else + echo " Hiányzó file: $MAYORDIR/www/policy/private/$file" + fi + else + echo " [OK] A file már létezik: " $file + fi + done + done +done diff --git a/mayor-installer/mayor-installer-for-fcgi/install.d/55tex.sh b/mayor-installer/mayor-installer-for-fcgi/install.d/55tex.sh new file mode 100755 index 00000000..87bcbc5f --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/install.d/55tex.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +cat < " + PW=$(pwgen -s1 32) + if [ "$ROVID" = "" ]; then + ROVID="demo" + fi + cat "$MAYORDIR/config/$file.example" | sed -e "s/%SQLPW%/$PW/" -e "s/demo/${ROVID}/" > "$MAYORDIR/config/$file" + echo $file +fi + +echo -e "\n SQL file létrehozása... " +if [ ! -d $TMPDIR/mysql ]; then + mkdir -p $TMPDIR/mysql +fi +cd $TMPDIR/mysql +PDB=$(grep db $MAYORDIR/config/$file | sed -e "s/.*=\ *['\"]//g" -e "s/['\"];//g") +USER=$(grep user $MAYORDIR/config/$file | sed -e "s/.*=\ *['\"]//g" -e "s/['\"];//g") +PW=$(grep pw $MAYORDIR/config/$file | sed -e "s/.*=\ *['\"]//g" -e "s/['\"];//g") + +cat $MAYORDIR/install/mayor-portal/mysql/mayor-portal.sql | sed \ + -e "s/%MYSQL_PORTAL_DB%/$PDB/g" \ + -e "s/%MYSQL_PORTAL_USER%/$USER/g" \ + -e "s/%MYSQL_PORTAL_PW%/$PW/g" > mayor-portal.sql + +DB=$(grep db $MAYORDIR/config/private-conf.php | sed -e "s/^.*>\ *['|\"]//g" -e "s/['|\"],//g") +cat $MAYORDIR/install/mayor-portal/mysql/portal-init.sql | sed \ + -e "s/%MYSQL_PRIVATE_DB%/$DB/g" \ + -e "s/%MYSQL_PORTAL_DB%/$PDB/g" > portal-init.sql + +read -n 1 -p "Telepíthetem? (i/N)" -s DO +if [ "$DO" != "i" ]; then echo " ok, kiléptem..."; exit 1; fi +echo -e "\n" + +if [ "$MYSQLROOTPW" == "" ]; then + read -p " A mysql root jelszó -ha van- (a begépelt szöveg nem látszik!): " -s MYSQLROOTPW +fi + +if [ "$MYSQLROOTPW" = "" ]; +then + MYSQLROOTPWSTR=""; +else + MYSQLROOTPWSTR="-p$MYSQLROOTPW --user=root" +fi + + +cat /tmp/mysql/mayor-portal.sql /tmp/mysql/portal-init.sql | mysql $MYSQLROOTPWSTR --default-character-set=utf8 + +read -n 1 -p "Tegyük a portál oldalt a rendszer kezdőlapjává minden hozzáférési szinten? (i/N)" -s DO +if [ "$DO" != "i" ]; then + echo -e "\nA portál oldalt nem teszem kezdőlappá.\n"; + cat <'portal', 'sub' => 'portal', 'f' => 'portal');/" $MAYORDIR/config/$file + echo ok + done +fi + +if [ "$ROVID" != "demo" ]; then + echo -e "\nEgyedi kezdőoldalak létrehozása:" + for policy in private public parent; do + echo -n " $policy " + for skin in classic pda; do + cp $MAYORDIR/www/policy/$policy/portal/portal/portal_demo.$skin.php $MAYORDIR/www/policy/$policy/portal/portal/portal_$ROVID.$skin.php + echo -n "... " + done + echo "ok" + done +fi + diff --git a/mayor-installer/mayor-installer-for-fcgi/log/mayor-installer.rev b/mayor-installer/mayor-installer-for-fcgi/log/mayor-installer.rev new file mode 100644 index 00000000..87ca4f07 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/log/mayor-installer.rev @@ -0,0 +1 @@ +4284 diff --git a/mayor-installer/mayor-installer-for-fcgi/setup b/mayor-installer/mayor-installer-for-fcgi/setup new file mode 100755 index 00000000..0c523a89 --- /dev/null +++ b/mayor-installer/mayor-installer-for-fcgi/setup @@ -0,0 +1,48 @@ +#!/bin/bash +clear +echo "-------------------------------------------" +echo " MaYoR Setup " +echo "-------------------------------------------" + +MAYORDIR="/var/mayor" +TMPDIR="/tmp" +MYSQLROOTPW="" +VERSION="current" +export MAYORDIR +export TMPDIR +export MYSQLROOTPW +export VERSION +export MAYORUSER="mayor-web" + +echo -e "A MaYoR keretrendszer és elektronikus napló telepítője a továbbiakban +több lépésben, az egyes lépésekre jóváhagyást kérve fogja végrehajtani a +telepítés és konfigurálás lépéseit. + +A telepítő egy tipikus telepítés esetén alkalmazható, speciális igények esetén +célszerűbb az egyes lépéseket a telepítési útmutató alapján manuálisan végezni. + +Lehetőség van a Mayor, az apache2 úgynevezett mod_uexec/mod_fcgi alá történő telepítésére is.\n" + +read -n 1 -p "Folytatja? (i/N)" -s DO +if [ "$DO" != "i" ]; then echo " ok, kiléptem..."; exit 1; fi +echo -e "\n" + +read -n 1 -p "Telepítés: (H)agyományos vagy (F)cgi/suexec-módban? (s/H)" -s DO +if [ "$DO" != "h" ]; then echo " ok, mod_Suexec/mod_fcgid használata." + installer="fcgi_install.d" + export MAYORDIR="/home/$MAYORUSER/mayor" +else + installer="install.d" + echo " ok, Hagyományos módon."; fi + echo -e "\n" + + + +for f in $installer/* +do + echo -e "\n----------------------------------------------\n$f\nMAYORDIR:$MAYORDIR\nMAYORUSER:$MAYORUSER\n----------------------------------------------\n" + ./$f $@ + if [ "$?" == 255 ]; then echo "Fatális hiba! A telepítő kilép."; exit 255; fi; +done + +echo -e "MaYoR (c) setup\n" -- cgit v1.2.3