forked from services/mlmmj-light-web-ecg
init.sh now works
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
lists_path = /var/spool/mlmmj
|
lists_path = /var/spool/mlmmj
|
||||||
web_path = /var/www/html
|
web_path = /var/www/html
|
||||||
web_url = http://mlmmj.tk/
|
language = en
|
||||||
language = ru
|
web_url = http://example.com/
|
||||||
|
|||||||
107
misc/init.sh
107
misc/init.sh
@@ -1,16 +1,107 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$#" -ne 0 ]; then
|
if [ "$#" -ne 0 ]; then
|
||||||
echo "This script prepaire system for mlmmj-light-web installation."
|
echo "This script install mlmmj-light-web with necessary dependencies."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install mlmmj, apg, apache2, exim, php_mod, altermime
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "This script must be run as root."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "I strongly recommend to run this sctipt only on a clean Debian with only standard system utilities installed (netinst iso)."
|
||||||
|
read -p "Are you sure to install mlmmj-light-web? [Y/n]: " reply
|
||||||
|
reply=${reply:-y}
|
||||||
|
if [[ ! $reply =~ ^[yY][eE][sS]|[yY]$ ]]
|
||||||
|
then
|
||||||
|
echo "Aborted."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -p "What language are you want mlmmj-light-web to use? [EN/ru]: " reply
|
||||||
|
reply=${reply:-en}
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
case "${reply}" in
|
||||||
|
[eE][nN] )
|
||||||
|
lang="en"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
[rR][uU] )
|
||||||
|
lang="ru"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
read -p "Please, write, 'en' or 'ru': " reply
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
sed -i '/language/d' config.txt
|
||||||
|
echo "language = ${lang}" >> config.txt
|
||||||
|
|
||||||
|
read -p "Please enter URL which you will use for mlmmj-light-web. [http://example.com/] : " url
|
||||||
|
url=${url:-http://example.com/}
|
||||||
|
|
||||||
|
sed -i '/web_url/d' config.txt
|
||||||
|
echo "web_url = ${url}" >> config.txt
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Updating package list..."
|
||||||
|
echo
|
||||||
|
apt-get update
|
||||||
|
echo
|
||||||
|
echo "Installing software..."
|
||||||
|
echo
|
||||||
|
apt-get install -y mlmmj apg apache2 libapache2-mod-php5 gcc make
|
||||||
|
echo
|
||||||
|
echo "Creating mlmmj user..."
|
||||||
|
echo
|
||||||
useradd -r -s /bin/false mlmmj
|
useradd -r -s /bin/false mlmmj
|
||||||
|
echo "Replacing apache user..."
|
||||||
|
echo
|
||||||
|
sed -i 's/www-data/mlmmj/g' /etc/apache2/envvars
|
||||||
|
echo "Replacing cron task..."
|
||||||
|
echo '0 */2 * * * /usr/bin/find /var/spool/mlmmj/ -maxdepth 1 -mindepth 1 -type d -exec /usr/bin/mlmmj-maintd -F -d "{}" \' > /etc/cron.d/mlmmj
|
||||||
|
echo
|
||||||
|
echo "Updating apache.conf..."
|
||||||
|
echo
|
||||||
|
# Replace the third occurence of "AllowOverride None" with "AllowOverride All"
|
||||||
|
awk '/AllowOverride None/{c++;if(c==3){sub("AllowOverride None","AllowOverride All");c=0}}1' /etc/apache2/apache2.conf > /etc/apache2/apache2_.conf
|
||||||
|
mv /etc/apache2/apache2_.conf /etc/apache2/apache2.conf
|
||||||
|
echo "Restarting apache..."
|
||||||
|
echo
|
||||||
|
/etc/init.d/apache2 restart
|
||||||
|
echo
|
||||||
|
echo "Moving files..."
|
||||||
|
echo
|
||||||
|
mv move/exim4.conf /etc/exim4/
|
||||||
|
mv move/exim4.filter /etc/exim4/
|
||||||
|
mv move/mlmmj-footer-receive /usr/bin/
|
||||||
|
cd move/foot_filter
|
||||||
|
echo "Compiling foot_filter..."
|
||||||
|
echo
|
||||||
|
make
|
||||||
|
echo
|
||||||
|
echo "Moving files..."
|
||||||
|
echo
|
||||||
|
mv foot_filter /usr/bin/
|
||||||
|
cd ../..
|
||||||
|
rm -rf move
|
||||||
|
cd ..
|
||||||
|
rm -rf /var/www/html/*
|
||||||
|
cp -rp * /var/www/html/
|
||||||
|
cd ..
|
||||||
|
echo "Removing installation files..."
|
||||||
|
echo
|
||||||
|
rm -rf mlmmj-light-web
|
||||||
|
echo "Setting ownership of files..."
|
||||||
|
echo
|
||||||
|
chown mlmmj:mlmmj -R /var/www/html
|
||||||
chown mlmmj:mlmmj -R /var/spool/mlmmj
|
chown mlmmj:mlmmj -R /var/spool/mlmmj
|
||||||
chmod -R g+s /var/spool/mlmmj
|
echo "Installation of mlmmj-light-web completed. Please, specify the fully qualified domain name (FQDN) in /etc/hostname and /etc/mailname if you have not done this already. Currently these files contain:"
|
||||||
chmod -R g+w /var/spool/mlmmj
|
echo "/etc/hostname: " $(cat /etc/hostname)
|
||||||
#change apache user in /etc/apache2/envvars
|
echo "/etc/mailname: " $(cat /etc/mailname)
|
||||||
#exim config and filter
|
echo
|
||||||
#/usr/bin/mlmmj-amime-receive
|
echo "Now visit ${url} in your browser."
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ operation=$1
|
|||||||
domain=$2
|
domain=$2
|
||||||
|
|
||||||
if [ "${operation}" = "add" ]; then
|
if [ "${operation}" = "add" ]; then
|
||||||
# password=$(apg -MCLN -m 12 -a 1 -n 1)
|
password=$(apg -MCLN -m 12 -a 1 -n 1)
|
||||||
password="123"
|
|
||||||
hash=$(echo -n $password | sha256sum | head -c 64)
|
hash=$(echo -n $password | sha256sum | head -c 64)
|
||||||
mkdir -p $lists_path/$domain
|
mkdir -p $lists_path/$domain
|
||||||
echo $domain:$hash >> $lists_path/passwords.txt
|
echo $domain:$hash >> $lists_path/passwords.txt
|
||||||
|
|||||||
Binary file not shown.
@@ -187,7 +187,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id="save_btn">
|
<div id="save_btn">
|
||||||
<input type="submit" name="submit" value="Сохранить">
|
<input type="submit" name="submit" value="Save">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user