mirror of
https://github.com/YunoHost/install_script.git
synced 2024-09-03 20:06:25 +02:00
add check DOMAIN and ROOT
This commit is contained in:
parent
ad76357778
commit
56442e33e4
1 changed files with 35 additions and 30 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash -x
|
||||||
|
|
||||||
SUCCESS=0
|
SUCCESS=0
|
||||||
ERR_FAIL_RESTORE=1
|
ERR_FAIL_RESTORE=1
|
||||||
|
@ -20,15 +20,18 @@ function rst {
|
||||||
[[ $? -ne 0 ]] && echo >&2 "Rollback failed" && exit $ERR_FAIL_RESTORE
|
[[ $? -ne 0 ]] && echo >&2 "Rollback failed" && exit $ERR_FAIL_RESTORE
|
||||||
}
|
}
|
||||||
|
|
||||||
# TODO : test if the script is executed as root
|
|
||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
echo "======== Check rights ========"
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "======== YunoHost Installation ========"
|
echo "======== YunoHost Installation ========"
|
||||||
echo "======== Check dependences ========"
|
echo "======== Check dependences ========"
|
||||||
|
|
||||||
dpkg -l | grep -q lsb-release
|
dpkg -l | grep -q lsb-release
|
||||||
# @abeudin : Using double brackets is more "secure" (kind of) => http://tldp.org/LDP/abs/html/testconstructs.html#DBLBRACKETS
|
|
||||||
if [[ $? -eq 1 ]]
|
if [[ $? -eq 1 ]]
|
||||||
then
|
then
|
||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
|
@ -58,6 +61,13 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "======== Checking domain ========"
|
echo "======== Checking domain ========"
|
||||||
|
if [[ "${DOMAIN:-1}" = 1 ]]
|
||||||
|
then
|
||||||
|
echo "======== Installation failed ========"
|
||||||
|
echo "Configure your domain name please"
|
||||||
|
exit $ERR_IMPOSSIBLE
|
||||||
|
fi
|
||||||
|
|
||||||
whiptail --title "Yunohost Domain" --yesno "Your domain is $DOMAIN\nDo you want to change this?" 8 78
|
whiptail --title "Yunohost Domain" --yesno "Your domain is $DOMAIN\nDo you want to change this?" 8 78
|
||||||
YESNO=$?
|
YESNO=$?
|
||||||
|
|
||||||
|
@ -95,14 +105,14 @@ then
|
||||||
wget -O- http://lemonldap-ng.org/_media/rpm-gpg-key-ow2 -q | apt-key add - -qq
|
wget -O- http://lemonldap-ng.org/_media/rpm-gpg-key-ow2 -q | apt-key add - -qq
|
||||||
wget -O- http://repo.yunohost.org/yunohost.asc -q | apt-key add - -qq
|
wget -O- http://repo.yunohost.org/yunohost.asc -q | apt-key add - -qq
|
||||||
|
|
||||||
CUSTOMAPT=/etc/apt/sources.list.d/yunohost.list
|
CUSTOMAPT=/etc/apt/sources.list
|
||||||
grep -qri "lemonldap-ng.org" /etc/apt/sources.list*
|
grep -qri "lemonldap-ng.org" $CUSTOMAPT
|
||||||
if [[ $? -eq 1 ]]
|
if [[ $? -eq 1 ]]
|
||||||
then
|
then
|
||||||
echo "deb http://lemonldap-ng.org/deb squeeze main" >> $CUSTOMAPT
|
echo "deb http://lemonldap-ng.org/deb squeeze main" >> $CUSTOMAPT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
grep -qri "yunohost" /etc/apt/sources.list*
|
grep -qri "yunohost" $CUSTOMAPT
|
||||||
if [[ $? -eq 1 ]]
|
if [[ $? -eq 1 ]]
|
||||||
then
|
then
|
||||||
case "$(lsb_release -is)" in
|
case "$(lsb_release -is)" in
|
||||||
|
@ -131,10 +141,6 @@ then
|
||||||
debconf-set-selections debconf
|
debconf-set-selections debconf
|
||||||
|
|
||||||
#Install yunohost packages
|
#Install yunohost packages
|
||||||
<<<<<<< HEAD
|
|
||||||
debconf-apt-progress --logstderr /var/log/yunohost.log -- apt-get -y install yunohost yunohost-config yunohost-config-postfix postfix postfix-ldap postfix-policyd-spf-perl
|
|
||||||
if [ $? != 0 ] ;
|
|
||||||
=======
|
|
||||||
debconf-apt-progress \
|
debconf-apt-progress \
|
||||||
--logfile /var/log/yunohost.log \
|
--logfile /var/log/yunohost.log \
|
||||||
--logstderr /var/log/yunohost.error \
|
--logstderr /var/log/yunohost.error \
|
||||||
|
@ -147,7 +153,6 @@ then
|
||||||
postfix-policyd-spf-perl
|
postfix-policyd-spf-perl
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]
|
if [[ $? -ne 0 ]]
|
||||||
>>>>>>> 307fa4b0a8fd8391ae5be4caffd1252d9397b012
|
|
||||||
then
|
then
|
||||||
echo "======== Installation failed ========"
|
echo "======== Installation failed ========"
|
||||||
echo "Rolling back have to be done manually !"
|
echo "Rolling back have to be done manually !"
|
||||||
|
|
Loading…
Add table
Reference in a new issue