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 --- .../mayor-installer-orig/install.d/05checkdeb.sh | 86 ++++++++++++++ .../mayor-installer-orig/install.d/10getsource.sh | 76 ++++++++++++ .../install.d/15createconfig.sh | 43 +++++++ .../mayor-installer-orig/install.d/20mysql.sh | 28 +++++ .../mayor-installer-orig/install.d/25apache.sh | 67 +++++++++++ .../mayor-installer-orig/install.d/30php.sh | 29 +++++ .../install.d/35createdatabases.sh | 129 +++++++++++++++++++++ .../mayor-installer-orig/install.d/40binary.sh | 44 +++++++ .../mayor-installer-orig/install.d/45intezmeny.sh | 70 +++++++++++ .../mayor-installer-orig/install.d/50linker.sh | 58 +++++++++ .../mayor-installer-orig/install.d/55tex.sh | 20 ++++ .../mayor-installer-orig/install.d/60portal.sh | 119 +++++++++++++++++++ .../mayor-installer-orig/log/mayor-installer.rev | 1 + mayor-installer/mayor-installer-orig/setup | 34 ++++++ 14 files changed, 804 insertions(+) create mode 100755 mayor-installer/mayor-installer-orig/install.d/05checkdeb.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/10getsource.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/15createconfig.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/20mysql.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/25apache.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/30php.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/35createdatabases.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/40binary.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/45intezmeny.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/50linker.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/55tex.sh create mode 100755 mayor-installer/mayor-installer-orig/install.d/60portal.sh create mode 100644 mayor-installer/mayor-installer-orig/log/mayor-installer.rev create mode 100755 mayor-installer/mayor-installer-orig/setup (limited to 'mayor-installer/mayor-installer-orig') diff --git a/mayor-installer/mayor-installer-orig/install.d/05checkdeb.sh b/mayor-installer/mayor-installer-orig/install.d/05checkdeb.sh new file mode 100755 index 00000000..56c0e55d --- /dev/null +++ b/mayor-installer/mayor-installer-orig/install.d/05checkdeb.sh @@ -0,0 +1,86 @@ +#!/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 + " + fi + exit 255; +fi + +if [[ "x${RELEASE}" =~ ^x9.* ]] +then + PKGS="apache2 php php-json php-mysql php-ldap php-mbstring php-mcrypt php-curl mariadb-server-10.1 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 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 +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-orig/install.d/15createconfig.sh b/mayor-installer/mayor-installer-orig/install.d/15createconfig.sh new file mode 100755 index 00000000..51c512c4 --- /dev/null +++ b/mayor-installer/mayor-installer-orig/install.d/15createconfig.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# + +cat < " + PW=`pwgen -s1` + 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` +PWREAD=`pwgen -s1` +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-orig/install.d/20mysql.sh b/mayor-installer/mayor-installer-orig/install.d/20mysql.sh new file mode 100755 index 00000000..2979f728 --- /dev/null +++ b/mayor-installer/mayor-installer-orig/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-orig/install.d/30php.sh b/mayor-installer/mayor-installer-orig/install.d/30php.sh new file mode 100755 index 00000000..49000c68 --- /dev/null +++ b/mayor-installer/mayor-installer-orig/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-orig/install.d/35createdatabases.sh b/mayor-installer/mayor-installer-orig/install.d/35createdatabases.sh new file mode 100755 index 00000000..d44d28e4 --- /dev/null +++ b/mayor-installer/mayor-installer-orig/install.d/35createdatabases.sh @@ -0,0 +1,129 @@ +#!/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-orig/install.d/40binary.sh b/mayor-installer/mayor-installer-orig/install.d/40binary.sh new file mode 100755 index 00000000..bc2716af --- /dev/null +++ b/mayor-installer/mayor-installer-orig/install.d/40binary.sh @@ -0,0 +1,44 @@ +#!/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-orig/install.d/50linker.sh b/mayor-installer/mayor-installer-orig/install.d/50linker.sh new file mode 100755 index 00000000..3801354c --- /dev/null +++ b/mayor-installer/mayor-installer-orig/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-orig/install.d/55tex.sh b/mayor-installer/mayor-installer-orig/install.d/55tex.sh new file mode 100755 index 00000000..87bcbc5f --- /dev/null +++ b/mayor-installer/mayor-installer-orig/install.d/55tex.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# +cat < " + PW=`pwgen -s1` + 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-orig/log/mayor-installer.rev b/mayor-installer/mayor-installer-orig/log/mayor-installer.rev new file mode 100644 index 00000000..e2ba7ca0 --- /dev/null +++ b/mayor-installer/mayor-installer-orig/log/mayor-installer.rev @@ -0,0 +1 @@ +4423 diff --git a/mayor-installer/mayor-installer-orig/setup b/mayor-installer/mayor-installer-orig/setup new file mode 100755 index 00000000..3c13a155 --- /dev/null +++ b/mayor-installer/mayor-installer-orig/setup @@ -0,0 +1,34 @@ +#!/bin/bash +clear +echo "-------------------------------------------" +echo " MaYoR Setup " +echo "-------------------------------------------" + +MAYORDIR="/var/mayor" +TMPDIR="/tmp" +MYSQLROOTPW="" +VERSION="current" +export MAYORDIR +export TMPDIR +export MYSQLROOTPW +export VERSION + +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.\n" + +read -n 1 -p "Folytatja? (i/N)" -s DO +if [ "$DO" != "i" ]; then echo " ok, kiléptem..."; exit 1; fi +echo -e "\n" + +for f in install.d/* +do + echo -e "\n----------------------------------------------\n$f\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