mirror of
https://github.com/YunoHost-Apps/phpmyadmin_ynh.git
synced 2024-09-03 19:56:46 +02:00
Merge pull request #53 from polytan02/master
Update to respect latest YEP
This commit is contained in:
commit
91c90dd955
13 changed files with 587 additions and 93 deletions
132
LICENSE
Normal file
132
LICENSE
Normal file
|
@ -0,0 +1,132 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
|
||||
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
|
||||
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
|
||||
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the program's name and an idea of what it does.
|
||||
Copyright (C) yyyy name of author
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
|
||||
type `show w'. This is free software, and you are welcome
|
||||
to redistribute it under certain conditions; type `show c'
|
||||
for details.
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright
|
||||
interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written
|
||||
by James Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ $cfg['Servers'][$i]['controluser'] = 'YNH_PMA_USER';
|
|||
$cfg['Servers'][$i]['controlpass'] = 'YNH_PMA_PASSWORD';
|
||||
|
||||
/* Storage database and tables */
|
||||
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
|
||||
$cfg['Servers'][$i]['pmadb'] = 'YNH_PMA_USER';
|
||||
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
|
||||
$cfg['Servers'][$i]['relation'] = 'pma__relation';
|
||||
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
DROP DATABASE `phpmyadmin`;
|
||||
DROP DATABASE `YNH_PMA_USER`;
|
||||
|
||||
--
|
||||
-- Database : `phpmyadmin`
|
||||
-- Database : `YNH_PMA_USER`
|
||||
--
|
||||
CREATE DATABASE IF NOT EXISTS `phpmyadmin`
|
||||
CREATE DATABASE IF NOT EXISTS `YNH_PMA_USER`
|
||||
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
|
||||
USE phpmyadmin;
|
||||
USE YNH_PMA_USER;
|
||||
|
||||
GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO
|
||||
GRANT SELECT, INSERT, DELETE, UPDATE ON `YNH_PMA_USER`.* TO
|
||||
'YNH_PMA_USER'@localhost;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
location YNH_WWW_PATH {
|
||||
alias YNH_WWW_ALIAS ;
|
||||
alias YNH_WWW_ALIAS/ ;
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
4.6.5.2
|
|
@ -11,7 +11,11 @@
|
|||
"name": "julien",
|
||||
"email": "julien.malik@paraiso.me"
|
||||
},
|
||||
"multi_instance": "false",
|
||||
"requirements": {
|
||||
"yunohost": ">= 2.4"
|
||||
},
|
||||
"license": "free",
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php5-fpm",
|
||||
|
|
227
scripts/.fonctions
Executable file
227
scripts/.fonctions
Executable file
|
@ -0,0 +1,227 @@
|
|||
#!/bin/bash
|
||||
|
||||
CHECK_VAR () { # Vérifie que la variable n'est pas vide.
|
||||
# $1 = Variable à vérifier
|
||||
# $2 = Texte à afficher en cas d'erreur
|
||||
test -n "$1" || (echo "$2" >&2 && false)
|
||||
}
|
||||
|
||||
EXIT_PROPERLY () { # Provoque l'arrêt du script en cas d'erreur. Et nettoye les résidus.
|
||||
exit_code=$?
|
||||
if [ "$exit_code" -eq 0 ]; then
|
||||
exit 0 # Quitte sans erreur si le script se termine correctement.
|
||||
fi
|
||||
trap '' EXIT
|
||||
set +eu
|
||||
echo -e "\e[91m \e[1m" # Shell in light red bold
|
||||
echo -e "!!\n $app install's script has encountered an error. Installation was cancelled.\n!!" >&2
|
||||
|
||||
if type -t CLEAN_SETUP > /dev/null; then # Vérifie l'existance de la fonction avant de l'exécuter.
|
||||
CLEAN_SETUP # Appel la fonction de nettoyage spécifique du script install.
|
||||
fi
|
||||
|
||||
# Compense le bug de ssowat qui ne supprime pas l'entrée de l'app en cas d'erreur d'installation.
|
||||
sudo sed -i "\@\"$domain$path/\":@d" /etc/ssowat/conf.json
|
||||
|
||||
ynh_die
|
||||
}
|
||||
|
||||
TRAP_ON () { # Activate signal capture
|
||||
set -eu # Exit if a command fail, and if a variable is used unset.
|
||||
trap EXIT_PROPERLY EXIT # Capturing exit signals on shell script
|
||||
}
|
||||
|
||||
# Ignore the yunohost-cli log to prevent errors with conditionals commands
|
||||
# usage: NO_LOG COMMAND
|
||||
# Simply duplicate the log, execute the yunohost command and replace the log without the result of this command
|
||||
# It's a very badly hack...
|
||||
# Petite copie perso à mon usage ;)
|
||||
NO_LOG() {
|
||||
ynh_cli_log=/var/log/yunohost/yunohost-cli.log
|
||||
sudo cp -a ${ynh_cli_log} ${ynh_cli_log}-move
|
||||
eval $@
|
||||
exit_code=$?
|
||||
sudo mv ${ynh_cli_log}-move ${ynh_cli_log}
|
||||
return $?
|
||||
}
|
||||
|
||||
CHECK_USER () { # Vérifie la validité de l'user admin
|
||||
# $1 = Variable de l'user admin.
|
||||
ynh_user_exists "$1" || (echo "Wrong admin" >&2 && false)
|
||||
}
|
||||
|
||||
CHECK_PATH () { # Vérifie la présence du / en début de path. Et son absence à la fin.
|
||||
if [ "${path:0:1}" != "/" ]; then # Si le premier caractère n'est pas un /
|
||||
path="/$path" # Ajoute un / en début de path
|
||||
fi
|
||||
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then # Si le dernier caractère est un / et que ce n'est pas le seul caractère.
|
||||
path="${path:0:${#path}-1}" # Supprime le dernier caractère
|
||||
fi
|
||||
}
|
||||
|
||||
CHECK_DOMAINPATH () { # Vérifie la disponibilité du path et du domaine.
|
||||
sudo yunohost app checkurl $domain$path -a $app
|
||||
}
|
||||
|
||||
CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||
final_path=/var/www/$app
|
||||
if [ -e "$final_path" ]
|
||||
then
|
||||
echo "This path already contains a folder" >&2
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
GENERATE_DB () { # Créer une base de données et un utilisateur dédié au nom de l'app.
|
||||
# $1 = Nom de la base de donnée
|
||||
db_user=$1
|
||||
db_user=${db_user//-/_} # mariadb ne supporte pas les - dans les noms de base de données. Ils sont donc remplacé par des _
|
||||
# Génère un mot de passe aléatoire.
|
||||
# db_pwd=$(head -n20 /dev/urandom | tr -c -d 'A-Za-z0-9' | head -c20)
|
||||
db_pwd=$(ynh_string_random)
|
||||
CHECK_VAR "$db_pwd" "db_pwd empty"
|
||||
# Utilise '$app' comme nom d'utilisateur et de base de donnée
|
||||
# Initialise la base de donnée et stocke le mot de passe mysql.
|
||||
ynh_mysql_create_db "$db_user" "$db_user" $db_pwd
|
||||
ynh_app_setting_set $app mysqlpwd $db_pwd
|
||||
}
|
||||
|
||||
SETUP_SOURCE () { # Télécharge la source, décompresse et copie dans $final_path
|
||||
# $1 = Nom de l'archive téléchargée.
|
||||
wget -nv -i ../sources/source_url -O $1
|
||||
# Vérifie la somme de contrôle de la source téléchargée.
|
||||
md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false)
|
||||
# Décompresse la source
|
||||
if [ "$(echo ${1##*.})" == "gz" ]; then
|
||||
tar -x -f $1
|
||||
elif [ "$(echo ${1##*.})" == "zip" ]; then
|
||||
unzip -q $1
|
||||
else
|
||||
false # Format d'archive non pris en charge.
|
||||
fi
|
||||
# Copie les fichiers sources
|
||||
sudo cp -a $(cat ../sources/source_dir)/. "$final_path"
|
||||
# Copie les fichiers additionnels ou modifiés.
|
||||
if test -e "../sources/ajouts"; then
|
||||
sudo cp -a ../sources/ajouts/. "$final_path"
|
||||
fi
|
||||
}
|
||||
|
||||
ADD_SYS_USER () { # Créer un utilisateur système dédié à l'app
|
||||
if ! ynh_system_user_exists "$app" # Test l'existence de l'utilisateur
|
||||
then
|
||||
sudo useradd -d /var/www/$app --system --user-group $app --shell /usr/sbin/nologin || (echo "Unable to create $app system account" >&2 && false)
|
||||
fi
|
||||
}
|
||||
|
||||
POOL_FPM () { # Créer le fichier de configuration du pool php-fpm et le configure.
|
||||
sed -i "s@__NAMETOCHANGE__@$app@g" ../conf/php-fpm.conf
|
||||
sed -i "s@__FINALPATH__@$final_path@g" ../conf/php-fpm.conf
|
||||
sed -i "s@__USER__@$app@g" ../conf/php-fpm.conf
|
||||
finalphpconf=/etc/php5/fpm/pool.d/$app.conf
|
||||
sudo cp ../conf/php-fpm.conf $finalphpconf
|
||||
sudo chown root: $finalphpconf
|
||||
finalphpini=/etc/php5/fpm/conf.d/20-$app.ini
|
||||
sudo cp ../conf/php-fpm.ini $finalphpini
|
||||
sudo chown root: $finalphpini
|
||||
sudo service php5-fpm reload
|
||||
}
|
||||
|
||||
STORE_MD5_CONFIG () { # Enregistre la somme de contrôle du fichier de config
|
||||
# $1 = Nom du fichier de conf pour le stockage dans settings.yml
|
||||
# $2 = Nom complet et chemin du fichier de conf.
|
||||
ynh_app_setting_set $app $1_file_md5 $(sudo md5sum "$2" | cut -d' ' -f1)
|
||||
}
|
||||
|
||||
CHECK_MD5_CONFIG () { # Créé un backup du fichier de config si il a été modifié.
|
||||
# $1 = Nom du fichier de conf pour le stockage dans settings.yml
|
||||
# $2 = Nom complet et chemin du fichier de conf.
|
||||
if [ "$(ynh_app_setting_get $app $1_file_md5)" != $(sudo md5sum "$2" | cut -d' ' -f1) ]; then
|
||||
sudo cp -a "$2" "$2.backup.$(date '+%d.%m.%y_%Hh%M,%Ss')" # Si le fichier de config a été modifié, créer un backup.
|
||||
fi
|
||||
}
|
||||
|
||||
FIND_PORT () { # Cherche un port libre.
|
||||
# $1 = Numéro de port pour débuter la recherche.
|
||||
port=$1
|
||||
while ! sudo yunohost app checkport $port ; do
|
||||
port=$((port+1))
|
||||
done
|
||||
CHECK_VAR "$port" "port empty"
|
||||
}
|
||||
|
||||
|
||||
### REMOVE SCRIPT
|
||||
|
||||
REMOVE_NGINX_CONF () { # Suppression de la configuration nginx
|
||||
if [ -e "/etc/nginx/conf.d/$domain.d/$app.conf" ]; then # Delete nginx config
|
||||
echo "Delete nginx config"
|
||||
sudo rm "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
# sudo service nginx reload
|
||||
fi
|
||||
}
|
||||
|
||||
REMOVE_FPM_CONF () { # Suppression de la configuration du pool php-fpm
|
||||
if [ -e "/etc/php5/fpm/pool.d/$app.conf" ]; then # Delete fpm config
|
||||
echo "Delete fpm config"
|
||||
sudo rm "/etc/php5/fpm/pool.d/$app.conf"
|
||||
fi
|
||||
if [ -e "/etc/php5/fpm/conf.d/20-$app.ini" ]; then # Delete php config
|
||||
echo "Delete php config"
|
||||
sudo rm "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||
fi
|
||||
# sudo service php5-fpm reload
|
||||
}
|
||||
|
||||
REMOVE_LOGROTATE_CONF () { # Suppression de la configuration de logrotate
|
||||
if [ -e "/etc/logrotate.d/$app" ]; then
|
||||
echo "Delete logrotate config"
|
||||
sudo rm "/etc/logrotate.d/$app"
|
||||
fi
|
||||
}
|
||||
|
||||
SECURE_REMOVE () { # Suppression de dossier avec vérification des variables
|
||||
chaine="$1" # L'argument doit être donné entre quotes simple '', pour éviter d'interpréter les variables.
|
||||
no_var=0
|
||||
while (echo "$chaine" | grep -q '\$') # Boucle tant qu'il y a des $ dans la chaine
|
||||
do
|
||||
no_var=1
|
||||
global_var=$(echo "$chaine" | cut -d '$' -f 2) # Isole la première variable trouvée.
|
||||
only_var=\$$(expr "$global_var" : '\([A-Za-z0-9_]*\)') # Isole complètement la variable en ajoutant le $ au début et en gardant uniquement le nom de la variable. Se débarrasse surtout du / et d'un éventuel chemin derrière.
|
||||
real_var=$(eval "echo ${only_var}") # `eval "echo ${var}` permet d'interpréter une variable contenue dans une variable.
|
||||
if test -z "$real_var" || [ "$real_var" = "/" ]; then
|
||||
echo "Variable $only_var is empty, suppression of $chaine cancelled." >&2
|
||||
return 1
|
||||
fi
|
||||
chaine=$(echo "$chaine" | sed "s@$only_var@$real_var@") # remplace la variable par sa valeur dans la chaine.
|
||||
done
|
||||
if [ "$no_var" -eq 1 ]
|
||||
then
|
||||
if [ -e "$chaine" ]; then
|
||||
echo "Delete directory $chaine"
|
||||
sudo rm -r "$chaine"
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
echo "No detected variable." >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
REMOVE_BDD () { # Suppression de la base de donnée et de l'utilisateur associé.
|
||||
# $1 = Nom de la base de donnée
|
||||
# Utilise '$app' comme nom d'utilisateur et de base de donnée
|
||||
db_user=$1
|
||||
if mysqlshow -u root -p$(sudo cat $MYSQL_ROOT_PWD_FILE) | grep -q "^| $db_user"; then
|
||||
echo "Delete db"
|
||||
ynh_mysql_drop_db $db_user
|
||||
ynh_mysql_drop_user $db_user
|
||||
fi
|
||||
}
|
||||
|
||||
REMOVE_SYS_USER () { # Supprime l'utilisateur système dédié à l'app
|
||||
if ynh_system_user_exists "$app" # Test l'existence de l'utilisateur
|
||||
then
|
||||
sudo userdel $app
|
||||
fi
|
||||
}
|
30
scripts/backup
Normal file
30
scripts/backup
Normal file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Récupère les infos de l'application.
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
db_user=$(ynh_app_setting_get $app db_user)
|
||||
|
||||
# The parameter $1 is the backup directory location
|
||||
# which will be compressed afterward
|
||||
|
||||
# Backup sources & data
|
||||
ynh_backup "$final_path" "sources"
|
||||
|
||||
# Copy Nginx and YunoHost parameters to make the script "standalone"
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "nginx.conf"
|
||||
|
||||
ynh_backup "/etc/yunohost/apps/$app/" "yunohost"
|
||||
|
||||
# Copy dedicated php-fpm process to backup folder
|
||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf" "php-fpm.conf"
|
||||
|
||||
# Backup db
|
||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||
sudo mysqldump -u root -p$root_pwd --no-create-db $db_user --result-file="db.sql"
|
||||
ynh_backup "db.sql" "backupdb.sql"
|
|
@ -1,43 +1,58 @@
|
|||
#!/bin/bash
|
||||
|
||||
source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script
|
||||
|
||||
TRAP_ON # Active trap pour arrêter le script si une erreur est détectée.
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$1
|
||||
path=$2
|
||||
admin=$3
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a phpmyadmin
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check that admin user is an existing account
|
||||
sudo yunohost user list --json | grep -q "\"username\": \"$admin\""
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
echo "Error : the chosen admin user does not exist"
|
||||
exit 1
|
||||
fi
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Vérifie que les variables ne sont pas vides.
|
||||
CHECK_VAR "$app" "app name not set"
|
||||
|
||||
CHECK_USER "$admin" # Vérifie la validité de l'user admin
|
||||
|
||||
CHECK_PATH # Vérifie et corrige la syntaxe du path.
|
||||
CHECK_DOMAINPATH # Vérifie la disponibilité du path et du domaine.
|
||||
|
||||
# Créer le repertoire de destination et stocke son emplacement.
|
||||
CHECK_FINALPATH # Vérifie que le dossier de destination n'est pas déjà utilisé.
|
||||
sudo mkdir "$final_path"
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
|
||||
# Enregistre les infos dans la config YunoHost
|
||||
ynh_app_setting_set $app domain $domain
|
||||
ynh_app_setting_set $app path $path
|
||||
ynh_app_setting_set $app admin $admin
|
||||
|
||||
# Copy files to the right place
|
||||
version=$(cat ../conf/upstream_version)
|
||||
final_path=/var/www/phpmyadmin
|
||||
sudo rm -rf $final_path
|
||||
sudo mkdir -p $final_path
|
||||
echo "Downloading phpMyAdmin $version..."
|
||||
sudo wget -O ../phpMyAdmin.tar.gz https://files.phpmyadmin.net/phpMyAdmin/$version/phpMyAdmin-$version-all-languages.tar.gz > /dev/null 2>&1
|
||||
echo "Extracting to $final_path..."
|
||||
sudo tar xvzf ../phpMyAdmin.tar.gz -C .. > /dev/null 2>&1
|
||||
sudo cp -r ../phpMyAdmin-$version-all-languages/* $final_path
|
||||
version=$(cat ../sources/upstream_version)
|
||||
sudo wget -nv https://files.phpmyadmin.net/phpMyAdmin/$version/phpMyAdmin-$version-all-languages.tar.gz -O phpMyAdmin-$version-all-languages.tar.gz
|
||||
sudo wget -nv https://files.phpmyadmin.net/phpMyAdmin/$version/phpMyAdmin-$version-all-languages.tar.gz.sha256 -O phpMyAdmin-$version-all-languages.tar.gz.sha256
|
||||
sudo sha256sum -c phpMyAdmin-$version-all-languages.tar.gz.sha256 --status || (echo "Corrupt source" >&2 && false)
|
||||
sudo tar xzf phpMyAdmin-$version-all-languages.tar.gz -C ../sources/ > /dev/null 2>&1
|
||||
sudo cp -a ../sources/phpMyAdmin-$version-all-languages/. "$final_path"
|
||||
|
||||
# Create db
|
||||
echo "Setting up database..."
|
||||
db_user=phpmyadmin
|
||||
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||
db_user=$app
|
||||
db_user=${db_user//-/_} # mariadb ne supporte pas les - dans les noms de base de données. Ils sont donc remplacé par des _
|
||||
# Génère un mot de passe aléatoire.
|
||||
db_pwd=$(ynh_string_random)
|
||||
CHECK_VAR "$db_pwd" "db_pwd empty"
|
||||
ynh_mysql_create_db "$db_user" "$db_user" $db_pwd
|
||||
ynh_app_setting_set $app mysqlpwd $db_pwd
|
||||
ynh_app_setting_set $app db_user $db_user
|
||||
sed -i "s@YNH_PMA_USER@$db_user@g" ../conf/create_db.sql
|
||||
sudo yunohost app initdb $db_user -p $db_pwd
|
||||
mysql -u root -p$(sudo cat /etc/yunohost/mysql) < ../conf/create_db.sql
|
||||
mysql -u $db_user -p$db_pwd < $final_path/sql/create_tables.sql
|
||||
sudo yunohost app setting phpmyadmin mysqlpwd -v $db_pwd
|
||||
sudo mysql -u root -p$(sudo cat /etc/yunohost/mysql) < ../conf/create_db.sql
|
||||
sudo sed -i "s@phpmyadmin@$db_user@g" $final_path/sql/create_tables.sql
|
||||
sudo mysql -u $db_user -p$db_pwd < $final_path/sql/create_tables.sql
|
||||
|
||||
# Configuration
|
||||
echo "Configuring application..."
|
||||
|
@ -47,9 +62,6 @@ sed -i "s@YNH_PMA_PASSWORD@$db_pwd@g" ../conf/config.inc.php
|
|||
sed -i "s@YNH_MYSQL_ROOT_PASSWORD@$(sudo cat /etc/yunohost/mysql)@g" ../conf/config.inc.php
|
||||
sudo cp ../conf/config.inc.php $final_path
|
||||
|
||||
sudo yunohost app addaccess phpmyadmin -u $admin
|
||||
sudo yunohost app setting phpmyadmin admin -v $admin
|
||||
|
||||
# Files owned by root, www-data can just read
|
||||
echo "Setting permission..."
|
||||
sudo chown -R root: $final_path
|
||||
|
@ -62,20 +74,23 @@ sudo chmod 640 $final_path/config.inc.php
|
|||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
echo "Setting up nginx configuration..."
|
||||
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
||||
sed -i "s@NAMETOCHANGE@phpmyadmin@g" ../conf/nginx.conf
|
||||
nginxconf=/etc/nginx/conf.d/$domain.d/phpmyadmin.conf
|
||||
sed -i "s@YNH_WWW_ALIAS@$final_path@g" ../conf/nginx.conf
|
||||
sed -i "s@NAMETOCHANGE@$app@g" ../conf/nginx.conf
|
||||
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo cp ../conf/nginx.conf $nginxconf
|
||||
sudo chown root: $nginxconf
|
||||
sudo chmod 600 $nginxconf
|
||||
sudo chmod 644 $nginxconf
|
||||
|
||||
# Add dedicated php-fpm to be able to upload bigger database
|
||||
sed -i "s@NAMETOCHANGE@phpmyadmin@g" ../conf/php-fpm.conf
|
||||
phpfpmconf=/etc/php5/fpm/pool.d/phpmyadmin.conf
|
||||
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
|
||||
phpfpmconf=/etc/php5/fpm/pool.d/$app.conf
|
||||
sudo cp ../conf/php-fpm.conf $phpfpmconf
|
||||
sudo chown root: $phpfpmconf
|
||||
sudo chmod 644 $phpfpmconf
|
||||
|
||||
sudo service php5-fpm restart
|
||||
# We grant access to admin only
|
||||
sudo yunohost app addaccess --users=$admin $app
|
||||
|
||||
sudo service php5-fpm reload
|
||||
sudo service nginx reload
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
|
@ -1,15 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
domain=$(sudo yunohost app setting phpmyadmin domain)
|
||||
source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script
|
||||
|
||||
sudo rm -rf /var/www/phpmyadmin
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/phpmyadmin.conf
|
||||
sudo rm -f /etc/php5/fpm/pool.d/phpmyadmin.conf
|
||||
# Récupère les infos de l'application.
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
sudo service php5-fpm restart
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
db_user=$(ynh_app_setting_get $app db_user)
|
||||
|
||||
REMOVE_BDD $db_user # Suppression de la base de donnée et de l'utilisateur associé.
|
||||
|
||||
SECURE_REMOVE '/var/www/$app' # Suppression du dossier de l'application
|
||||
|
||||
REMOVE_NGINX_CONF # Suppression de la configuration nginx
|
||||
|
||||
REMOVE_FPM_CONF # Suppression de la configuration du pool php-fpm
|
||||
|
||||
# Reload services after cleaning
|
||||
sudo service php5-fpm reload
|
||||
sudo service nginx reload
|
||||
|
||||
db_user=phpmyadmin
|
||||
db_name=phpmyadmin
|
||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
||||
# Régénère la configuration de SSOwat
|
||||
sudo yunohost app ssowatconf
|
||||
|
||||
echo -e "\e[0m" # Restore normal color
|
||||
|
|
50
scripts/restore
Normal file
50
scripts/restore
Normal file
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Récupère les infos de l'application.
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
path=$(ynh_app_setting_get $app path)
|
||||
admin=$(ynh_app_setting_get $app admin)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
db_user=$(ynh_app_setting_get $app db_user)
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
|
||||
if [ -d $final_path ]; then
|
||||
echo "There is already a directory: $final_path " >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Restore Nginx
|
||||
conf=/etc/nginx/conf.d/$domain.d/$app.conf
|
||||
if [ -f $conf ]; then
|
||||
echo "There is already a nginx conf file at this path: $conf " >&2
|
||||
exit 1
|
||||
fi
|
||||
sudo cp -a ./nginx.conf $conf
|
||||
|
||||
# Restore YunoHost parameters
|
||||
sudo cp -a ./yunohost/. /etc/yunohost/apps/$app/
|
||||
|
||||
# Restore sources & data
|
||||
sudo mkdir -p $final_path
|
||||
sudo cp -a ./sources/* $final_path/
|
||||
|
||||
ynh_mysql_create_db $db_user $db_user $db_pwd
|
||||
mysql --debug-check -u $db_user -p$db_pwd $db_user < ./backupdb.sql
|
||||
|
||||
# Copy dedicated php-fpm process from backup folder to the right location
|
||||
sudo cp -a ./php-fpm.conf /etc/php5/fpm/pool.d/$app.conf
|
||||
|
||||
# We grant access to admin only
|
||||
sudo yunohost app addaccess --users=$admin $app
|
||||
|
||||
# And Reload services
|
||||
sudo service php5-fpm reload
|
||||
sudo service nginx reload
|
||||
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
@ -1,39 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$(sudo yunohost app setting phpmyadmin domain)
|
||||
path=$(sudo yunohost app setting phpmyadmin path)
|
||||
admin=$(sudo yunohost app setting phpmyadmin admin)
|
||||
source .fonctions # Charge les fonctions génériques habituellement utilisées dans le script
|
||||
|
||||
# Remove trailing "/" for next commands
|
||||
path=${path%/}
|
||||
# Récupère les infos de l'application.
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Source app helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
domain=$(ynh_app_setting_get $app domain)
|
||||
path=$(ynh_app_setting_get $app path)
|
||||
admin=$(ynh_app_setting_get $app admin)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
db_user=$(ynh_app_setting_get $app db_user)
|
||||
|
||||
CHECK_PATH # Vérifie et corrige la syntaxe du path.
|
||||
|
||||
# We make the app retro-compatible with previous versions
|
||||
if [[ -z "$final_path" ]];
|
||||
then
|
||||
final_path="/var/www/$app"
|
||||
ynh_app_setting_set "$app" final_path "$final_path"
|
||||
else
|
||||
echo "${final_path} exists, we don't create it."
|
||||
fi
|
||||
|
||||
# In older version, db_user was always phpmyadmin
|
||||
if [[ -z "$db_user" ]];
|
||||
then
|
||||
db_user="phpmyadmin"
|
||||
ynh_app_setting_set "$app" db_user "$db_user"
|
||||
else
|
||||
echo "${db_user} exists, we don't create it."
|
||||
fi
|
||||
|
||||
# In older version, the admin setting was admin_user
|
||||
if [[ -z "$admin" ]]; then
|
||||
admin=$(sudo yunohost app setting phpmyadmin admin_user)
|
||||
sudo yunohost app setting phpmyadmin admin_user -d
|
||||
sudo yunohost app setting phpmyadmin admin -v $admin
|
||||
admin=$(ynh_app_setting_get $app admin_user)
|
||||
ynh_app_setting_set "$app" admin "$admin"
|
||||
ynh_app_setting_delete $app admin_user
|
||||
fi
|
||||
|
||||
# Copy files to the right place
|
||||
final_path=/var/www/phpmyadmin
|
||||
version=$(cat ../conf/upstream_version)
|
||||
sudo rm -rf $final_path
|
||||
sudo mkdir -p $final_path
|
||||
echo "Downloading phpMyAdmin $version..."
|
||||
sudo wget -O ../phpMyAdmin.tar.gz https://files.phpmyadmin.net/phpMyAdmin/$version/phpMyAdmin-$version-all-languages.tar.gz > /dev/null 2>&1
|
||||
echo "Extracting to $final_path..."
|
||||
sudo tar xvzf ../phpMyAdmin.tar.gz -C .. > /dev/null 2>&1
|
||||
sudo cp -r ../phpMyAdmin-$version-all-languages/* $final_path
|
||||
|
||||
# Database settings
|
||||
echo "Setting up database..."
|
||||
db_user=phpmyadmin
|
||||
db_pwd=$(sudo yunohost app setting phpmyadmin mysqlpwd)
|
||||
# Copy files to the right place
|
||||
version=$(cat ../sources/upstream_version)
|
||||
sudo wget -nv https://files.phpmyadmin.net/phpMyAdmin/$version/phpMyAdmin-$version-all-languages.tar.gz -O phpMyAdmin-$version-all-languages.tar.gz
|
||||
sudo wget -nv https://files.phpmyadmin.net/phpMyAdmin/$version/phpMyAdmin-$version-all-languages.tar.gz.sha256 -O phpMyAdmin-$version-all-languages.tar.gz.sha256
|
||||
sudo sha256sum -c phpMyAdmin-$version-all-languages.tar.gz.sha256 --status || (echo "Corrupt source" >&2 && false)
|
||||
sudo tar xzf phpMyAdmin-$version-all-languages.tar.gz -C ../sources/ > /dev/null 2>&1
|
||||
sudo cp -r ../sources/phpMyAdmin-$version-all-languages/. "$final_path"
|
||||
|
||||
# Update tables
|
||||
mysql -u $db_user -p$db_pwd < $final_path/sql/upgrade_column_info_4_3_0+.sql
|
||||
mysql -u $db_user -p$db_pwd < $final_path/sql/create_tables.sql
|
||||
sudo sed -i "s@phpmyadmin@$db_user@g" $final_path/sql/upgrade_column_info_4_3_0+.sql
|
||||
sudo mysql -u $db_user -p$db_pwd < $final_path/sql/upgrade_column_info_4_3_0+.sql
|
||||
sudo sed -i "s@phpmyadmin@$db_user@g" $final_path/sql/create_tables.sql
|
||||
sudo mysql -u $db_user -p$db_pwd < $final_path/sql/create_tables.sql
|
||||
|
||||
# Configuration
|
||||
echo "Configuring application..."
|
||||
|
@ -43,9 +65,6 @@ sed -i "s@YNH_PMA_PASSWORD@$db_pwd@g" ../conf/config.inc.php
|
|||
sed -i "s@YNH_MYSQL_ROOT_PASSWORD@$(sudo cat /etc/yunohost/mysql)@g" ../conf/config.inc.php
|
||||
sudo cp ../conf/config.inc.php $final_path
|
||||
|
||||
sudo yunohost app addaccess phpmyadmin -u $admin
|
||||
sudo yunohost app setting phpmyadmin admin -v $admin
|
||||
|
||||
# Files owned by root, www-data can just read
|
||||
echo "Setting permission..."
|
||||
sudo chown -R root: $final_path
|
||||
|
@ -58,20 +77,23 @@ sudo chmod 640 $final_path/config.inc.php
|
|||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||
echo "Setting up nginx configuration..."
|
||||
sed -i "s@YNH_WWW_PATH@$path@g" ../conf/nginx.conf
|
||||
sed -i "s@YNH_WWW_ALIAS@$final_path/@g" ../conf/nginx.conf
|
||||
sed -i "s@NAMETOCHANGE@phpmyadmin@g" ../conf/nginx.conf
|
||||
nginxconf=/etc/nginx/conf.d/$domain.d/phpmyadmin.conf
|
||||
sed -i "s@YNH_WWW_ALIAS@$final_path@g" ../conf/nginx.conf
|
||||
sed -i "s@NAMETOCHANGE@$app@g" ../conf/nginx.conf
|
||||
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
|
||||
sudo cp ../conf/nginx.conf $nginxconf
|
||||
sudo chown root: $nginxconf
|
||||
sudo chmod 600 $nginxconf
|
||||
sudo chmod 644 $nginxconf
|
||||
|
||||
# Add dedicated php-fpm to be able to upload bigger database
|
||||
sed -i "s@NAMETOCHANGE@phpmyadmin@g" ../conf/php-fpm.conf
|
||||
phpfpmconf=/etc/php5/fpm/pool.d/phpmyadmin.conf
|
||||
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
|
||||
phpfpmconf=/etc/php5/fpm/pool.d/$app.conf
|
||||
sudo cp ../conf/php-fpm.conf $phpfpmconf
|
||||
sudo chown root: $phpfpmconf
|
||||
sudo chmod 644 $phpfpmconf
|
||||
|
||||
sudo service php5-fpm restart
|
||||
# We grant access to admin only
|
||||
sudo yunohost app addaccess --users=$admin $app
|
||||
|
||||
sudo service php5-fpm reload
|
||||
sudo service nginx reload
|
||||
sudo yunohost app ssowatconf
|
||||
|
|
1
sources/upstream_version
Normal file
1
sources/upstream_version
Normal file
|
@ -0,0 +1 @@
|
|||
4.6.6
|
Loading…
Add table
Reference in a new issue