Skip to content
Snippets Groups Projects
Commit 5d422d62 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Removed some deprecated scripts

parent 178de835
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 646 deletions
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import utils
def setup(interactive=True):
dir_path = utils.get_dir(__file__)
pwd_path = '/etc/pure-ftpd/pureftpd.passwd'
# Get passwords
ftpincoming = utils.get_conf('FTP_INCOMING_PWD')
ftpmsuploader = utils.get_conf('FTP_MSUPLOADER_PWD')
ftpstorage = utils.get_conf('FTP_STORAGE_PWD')
ftpadmin = utils.get_conf('FTP_ADMIN_PWD')
if not ftpincoming or not ftpmsuploader or not ftpstorage or not ftpadmin:
raise Exception('Some passwords for FTP accounts are missing.\nPlease add them in the configuration file for EnvSetup script.')
# Run commands
cmds = [
'apt-get install --yes pure-ftpd python3-unidecode',
dict(line='adduser --disabled-login --gecos "" --shell /bin/false ftp', cond='id ftp', cond_neg=True, cond_skip=True),
'mkdir -p /home/ftp/storage',
'mkdir -p /home/ftp/storage/incoming',
'mkdir -p /home/ftp/storage/msuploads',
'mkdir -p /home/ftp/storage/www',
'chmod -R 775 /home/ftp/storage/incoming',
'chmod -R 777 /home/ftp/storage/msuploads',
'chmod -R 775 /home/ftp/storage/www',
'chown -R ftp:ftp /home/ftp/storage',
# Config
'echo "no" > /etc/pure-ftpd/conf/AllowDotFiles',
'echo "yes" > /etc/pure-ftpd/conf/CallUploadScript',
'echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone',
'echo "yes" > /etc/pure-ftpd/conf/DontResolve',
'echo "no" > /etc/pure-ftpd/conf/PAMAuthentication',
# Post upload script
'cp "%s/on_ftp_upload.py" /home/ftp/on_ftp_upload.py' % dir_path,
'chown ftp:ftp /home/ftp/on_ftp_upload.py',
'chmod +x /home/ftp/on_ftp_upload.py',
'pure-uploadscript -p /home/ftp/.on_upload.pid -B -g $(id -g ftp) -r /home/ftp/on_ftp_upload.py -u $(id -u ftp)',
'cp "%s/pure-ftpd-common" /etc/default/pure-ftpd-common.tmp' % dir_path,
'sed "s/UPLOADUID=UID/UPLOADUID=$(id -u ftp)/g" /etc/default/pure-ftpd-common.tmp > /etc/default/pure-ftpd-common.tmp2',
'mv -f /etc/default/pure-ftpd-common.tmp2 /etc/default/pure-ftpd-common.tmp',
'sed "s/UPLOADGID=GID/UPLOADGID=$(id -g ftp)/g" /etc/default/pure-ftpd-common.tmp > /etc/default/pure-ftpd-common.tmp2',
'mv -f /etc/default/pure-ftpd-common.tmp2 /etc/default/pure-ftpd-common',
'rm -f /etc/default/pure-ftpd-common.tmp',
'cp "%s/remove_empty_dirs.py" /etc/cron.hourly/remove_empty_dirs.py' % dir_path,
# Create FTP accounts
'([ -f "%s" ] || [ -f "%s" ] && cp "%s" "%s") || true' % (pwd_path + '.back', pwd_path, pwd_path, pwd_path + '.back'),
'([ -f "%s" ] && mv -f "%s" pureftpd.passwd.tmp) || true' % (pwd_path, pwd_path),
'"%s/create_account.sh" ftpincoming "%s" /home/ftp/storage/incoming' % (dir_path, ftpincoming),
'"%s/create_account.sh" ftpmsuploader "%s" /home/ftp/storage/msuploads' % (dir_path, ftpmsuploader),
'"%s/create_account.sh" ftpstorage "%s" /home/ftp/storage/www' % (dir_path, ftpstorage),
'"%s/create_account.sh" ftpadmin "%s" /home/ftp/storage' % (dir_path, ftpadmin),
'rm -f pureftpd.passwd.tmp',
'pure-pw mkdb',
'ln -sfn /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/50puredb',
'/etc/init.d/pure-ftpd force-reload',
]
try:
utils.run_commands(cmds)
except Exception:
raise
finally:
# Restore password conf if required
if os.path.exists('pureftpd.passwd.tmp'):
os.rename('pureftpd.passwd.tmp', pwd_path)
# Web server onfiguration
server_name = utils.get_conf('FTP_SERVER_NAME') or 'videos'
cmds = [
'apt-get remove -y apache2',
'apt-get install -y nginx',
'mkdir -p /var/www',
'ln -sfn /home/ftp/storage/www /var/www/videos',
'cp %s/crossdomain.xml /home/ftp/storage/www/crossdomain.xml' % dir_path,
'cp %s/vhost_videos.conf /etc/nginx/sites-available/videos.conf' % dir_path,
'sed -i "s@server_name videos;@server_name %s;@" "/etc/nginx/sites-available/videos.conf"' % server_name,
'ln -sfn ../sites-available/videos.conf /etc/nginx/sites-enabled/videos.conf',
]
utils.run_commands(cmds)
utils.add_hosts_to_localhost([server_name])
#!/bin/bash
# Usage: create_account.sh username password home
echo -e "$2\n$2" | pure-pw useradd $1 -u ftp -d $3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" secure="false"/>
<site-control permitted-cross-domain-policies="all"/>
</cross-domain-policy>
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import os
import shutil
import sys
import unicodedata
# command line
# pure-uploadscript -p /home/ftp/.on_ftp_upload.pid -B -g 1001 -r /home/ftp/on_ftp_upload.py -u 1001
BASE_DIR = '/home/ftp/storage/'
INCOMING_DIR = BASE_DIR + 'incoming/'
WWW_DIR = BASE_DIR + 'www/'
ALLOWED_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.'
LOG_FILE = '/home/ftp/on_ftp_upload.log'
LOG_LEVEL = 'INFO'
def clean_name(name):
# strip accents and replace non allowed characters
return ''.join((c if c in ALLOWED_CHARS else '_') for c in unicodedata.normalize('NFD', name) if unicodedata.category(c) != 'Mn')
if __name__ == '__main__':
# setup logging
logging.basicConfig(
filename=LOG_FILE,
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
level=getattr(logging, LOG_LEVEL),
)
try:
logging.debug('Starting script')
if len(sys.argv) < 2:
logging.info('Not enough arguments')
sys.exit(1)
src_path = sys.argv[1]
if not src_path.startswith(BASE_DIR):
logging.info('File %s will not be moved because it is not in base dir', src_path)
sys.exit(0)
# remove special characters
name = os.path.basename(src_path)
new_name = clean_name(name)
if name != new_name:
new_path = os.path.join(os.path.dirname(src_path), new_name)
os.rename(src_path, new_path)
logging.info('File %s has been renamed to %s', src_path, new_path)
src_path = new_path
# move file
if not src_path.startswith(INCOMING_DIR):
logging.info('File %s will not be moved because it is not in the incoming dir', src_path)
sys.exit(0)
dest_path = src_path.replace(INCOMING_DIR, WWW_DIR)
if not os.path.exists(os.path.dirname(dest_path)):
os.system('mkdir -p -m 775 "%s"' % os.path.dirname(dest_path))
shutil.move(src_path, dest_path)
logging.info('File moved %s', src_path)
except Exception as e:
logging.error('Failed to move file %s. Error: %s', src_path, e)
sys.exit(1)
else:
sys.exit(0)
# Configuration for pure-ftpd
# (this file is sourced by /bin/sh, edit accordingly)
# STANDALONE_OR_INETD
# valid values are "standalone" and "inetd".
# Any change here overrides the setting in debconf.
STANDALONE_OR_INETD=standalone
# VIRTUALCHROOT:
# whether to use binary with virtualchroot support
# valid values are "true" or "false"
# Any change here overrides the setting in debconf.
VIRTUALCHROOT=false
# UPLOADSCRIPT: if this is set and the daemon is run in standalone mode,
# pure-uploadscript will also be run to spawn the program given below
# for handling uploads. see /usr/share/doc/pure-ftpd/README.gz or
# pure-uploadscript(8)
# example: UPLOADSCRIPT=/usr/local/sbin/uploadhandler.pl
UPLOADSCRIPT=/home/ftp/on_ftp_upload.py
# if set, pure-uploadscript will spawn $UPLOADSCRIPT running as the
# given uid and gid
UPLOADUID=UID
UPLOADGID=GID
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Script to remove empty dirs from FTP incoming dir.
'''
import datetime
import os
import shutil
import sys
import traceback
INCOMING_DIR = '/home/ftp/storage/incoming/'
DAYS_OLD = 1
def _can_be_removed(path):
if not os.path.isdir(path):
return False
for name in os.listdir(path):
subpath = os.path.join(path, name)
if not _can_be_removed(subpath):
return False
mtime = os.path.getmtime(path)
mtime = datetime.datetime.fromtimestamp(mtime)
if mtime < datetime.datetime.now() - datetime.timedelta(days=DAYS_OLD):
return True
return False
if __name__ == '__main__':
script_name = os.path.basename(__file__)
try:
if not os.path.isdir(INCOMING_DIR):
print('%s: The FTP incoming dir does not exist (%s).' % (script_name, INCOMING_DIR))
sys.exit(1)
for name in os.listdir(INCOMING_DIR):
path = os.path.join(INCOMING_DIR, name)
if _can_be_removed(path):
shutil.rmtree(path)
print('%s: Dir "%s" removed.' % (script_name, path))
except Exception:
print('%s: Script crashed:\n%s' % (script_name, traceback.format_exc()))
sys.exit(1)
server {
listen 80;
server_name {{ server_name }};
location /.well-known/acme-challenge {
default_type "text/plain";
root /tmp/letsencrypt;
}
location / {
rewrite ^ https://$host$request_uri? permanent;
}
}
server {
listen 443 ssl;
server_name {{ server_name }};
root /var/www/streaming/;
access_log /var/log/nginx/access_streaming.log;
error_log /var/log/nginx/error_streaming.log;
location /crossdomain {
}
location / {
location ~ \.m3u8$ {
rewrite ^/(.*)$ /$1? break;
proxy_pass http://localhost:1935;
proxy_cache livecache;
proxy_cache_key $scheme$proxy_host$uri;
proxy_cache_lock on;
proxy_cache_min_uses 1;
proxy_cache_use_stale updating;
proxy_cache_valid 200 1s;
}
location ~ \.ts$ {
rewrite ^/(.*)$ /$1? break;
proxy_pass http://localhost:1935;
proxy_cache livecache;
proxy_cache_key $scheme$proxy_host$uri;
proxy_cache_lock on;
proxy_cache_min_uses 1;
proxy_cache_valid 200 10s;
}
# only urls to ts and m3u8 files are allowed, discard any requested path for other urls
rewrite ^/(.*)$ /? break;
proxy_pass http://localhost:1935/;
}
}
server {
listen 80;
listen 443 ssl;
server_name videos;
root /var/www/videos/;
access_log /var/log/nginx/access_videos.log;
error_log /var/log/nginx/error_videos.log;
add_header Access-Control-Allow-Origin "*";
location /.well-known/acme-challenge {
default_type "text/plain";
root /tmp/letsencrypt;
}
}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import utils
def setup(interactive=True):
dir_path = utils.get_dir(__file__)
cmds = []
# http.ini
ftpmsuploader = utils.get_conf('FTP_MSUPLOADER_PWD')
ftpstorage = utils.get_conf('FTP_STORAGE_PWD')
ftpadmin = utils.get_conf('FTP_ADMIN_PWD')
if ftpmsuploader and ftpstorage and ftpadmin:
cmds.append('mkdir -p /etc/hca')
cmds.append(dict(line='write', template='%s/http.ini' % dir_path, target='/etc/hca/http.ini', params=(
('{{ MS_SERVER_NAME }}', utils.get_conf('MS_SERVER_NAME', 'mediaserver')),
('{{ FTP_SERVER_NAME }}', utils.get_conf('FTP_SERVER_NAME', 'videos')),
('{{ FTP_STORAGE_PWD }}', ftpstorage),
('{{ FTP_MSUPLOADER_PWD }}', ftpmsuploader),
('{{ FTP_ADMIN_PWD }}', ftpadmin),
)))
else:
print('Configuration of HCA http.ini file skipped (no FTP passwords in config).')
# rtmp.ini
live_pwd = utils.get_conf('WOWZA_LIVE_PWD')
if live_pwd and os.path.exists('/var/www/streaming'):
cmds.append('mkdir -p /etc/hca')
cmds.append(dict(line='write', template='%s/rtmp.ini' % dir_path, target='/etc/hca/rtmp.ini', params=(
('{{ MS_SERVER_NAME }}', utils.get_conf('MS_SERVER_NAME', 'mediaserver')),
('{{ WOWZA_LIVE_PWD }}', live_pwd),
)))
else:
print('Configuration of HCA rtmp.ini file skipped (no live password in config).')
if cmds:
utils.run_commands(cmds)
[http]
base_url = "https://{{ FTP_SERVER_NAME }}"
pattern = "%(video_path)s"
[storage]
type = "ftp"
host = "{{ FTP_SERVER_NAME }}"
user = "ftpstorage"
password = "{{ FTP_STORAGE_PWD }}"
#[rtmp]
#server = "rtmp://{{ MS_SERVER_NAME }}/vod"
#pattern = "%(video_path)s"
#[hls]
# requires a valid rtmp server that supports dynamic hls fragmenting
#enable = "true"
#pattern = "https://%(rtmp_host)s/_definst_/%(video_path)s/Playlist.m3u8"
[mediaserver]
username = "ftpmsuploader"
password = "{{ FTP_MSUPLOADER_PWD }}"
admin_username = "ftpadmin"
admin_password = "{{ FTP_ADMIN_PWD }}"
base_dir = "/home/ftp/storage/"
www_dir_name = "www"
uploads_dir_name = "msuploads"
is_local = "true"
allow_ftp_upload = "true"
port=1935
server="{{ MS_SERVER_NAME }}"
app="live/_definst_?doPublish={{ WOWZA_LIVE_PWD }}"
enable_hls="yes"
hls_uri_template="https://{{ MS_SERVER_NAME }}/streaming/%(stream_id)s/Playlist.m3u8"
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import utils
def setup(interactive=True):
dir_path = utils.get_dir(__file__)
cmds = [
'DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server mysql-client',
'cp "%s/mysql.cnf" "/etc/mysql/mysql.cnf"' % dir_path,
'[ -L /etc/mysql/my.cnf ] || (mv /etc/mysql/my.cnf /etc/mysql/my.cnf.back && ln -sfn /etc/mysql/mysql.cnf /etc/mysql/my.cnf)', # Compatibility with mysql 5.5
'mkdir -p /etc/systemd/system/mysql.service.d',
'cp "%s/override.conf" "/etc/systemd/system/mysql.service.d/override.conf"' % dir_path,
'/etc/init.d/mysql restart',
]
root_pwd = utils.get_conf('DB_MYSQL_ROOT_PWD')
if root_pwd:
# Set password if any
cmds.append('mysqladmin -u root password "%s"' % root_pwd)
utils.run_commands(cmds)
if not root_pwd:
utils.log('No root password was set in the configuration file.\nUse the following command to change it:\n mysqladmin -u root password <pwd>')
#
# Ubicast MySQL database server configuration file.
#
[client]
default-character-set = utf8
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
log_error = /var/log/mysql/error.log
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 127.0.0.1
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover-options = BACKUP
max_connections = 10000
#table_cache = 64
#thread_concurrency = 10
default-storage-engine = MYISAM
character_set_server = utf8
collation_server = utf8_unicode_ci
query_cache_limit = 1M
query_cache_size = 16M
expire_logs_days = 10
max_binlog_size = 100M
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
syslog
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[isamchk]
key_buffer = 16M
# Default file content:
# ---------------------
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
#!includedir /etc/mysql/conf.d/
#!includedir /etc/mysql/mysql.conf.d/
[Service]
LimitNOFILE=500000
LimitMEMLOCK=infinity
Nice=-1
#!/bin/bash
source /root/envsetup/global-conf.sh
echo "Copying MS_deploy.sh"
cp -v MS_deploy.sh /var/tmp/MS_deploy.sh
#!/bin/bash
# Admin menu : to be deployed on each MediaServer
# Customer should arrive on it after each SSH connexion with login admin
BACKTITLE='MediaServer Deployement'
## Load already set up parameters
MS_IP0=$(grep address /etc/network/interfaces | awk '{print$2}')
MS_NETMASK0=$(grep netmask /etc/network/interfaces | awk '{print$2}')
MS_GATEWAY0=$(grep gateway /etc/network/interfaces | awk '{print$2}')
MS_DNS10=$(grep nameserver /etc/resolv.conf | head -1 | awk '{print$2}')
MS_DNS20=$(grep nameserver /etc/resolv.conf | tail -1 | awk '{print$2}')
MS_NTP0=$(grep ^server /etc/ntp.conf | tail -1 | awk '{print$2}')
MS_VHOST0=$(grep server_name /etc/nginx/sites-available/mediaserver-msuser.conf | head -1 | awk '{print$2}' | awk -F ";" '{print$1}')
MS_CMVHOST0=$(grep server_name /etc/nginx/sites-available/skyreach.conf | head -1 | awk '{print$2}' | awk -F ";" '{print$1}')
MS_MONVHOST0=$(grep server_name /etc/nginx/sites-available/msmonitor.conf | head -1 | awk '{print$2}' | awk -F ";" '{print$1}')
## Screens
dialog --backtitle "${BACKTITLE}" --title "Perform customization" --yesno "Welcome to UbiCast MediaServer customization tool." 8 70
if [ $? != 0 ]
then
dialog --backtitle "${BACKTITLE}" --title "Perform customization" --msgbox "MediaServer deployement cancelled." 8 70
exit
fi
# Network parameters
MS_IP=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "MediaServer IP ?" 8 50 ${MS_IP0} --output-fd 1)
MS_NETMASK=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "Netmask ?" 8 50 ${MS_NETMASK0} --output-fd 1)
MS_GATEWAY=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "Gateway ?" 8 50 ${MS_GATEWAY0} --output-fd 1)
MS_DNS1=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "Main DNS ?" 8 50 ${MS_DNS10} --output-fd 1)
MS_DNS2=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "Secondary DNS ?" 8 50 ${MS_DNS20} --output-fd 1)
MS_NTP=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "NTP server ?" 8 50 ${MS_NTP0} --output-fd 1)
# vhosts
MS_VHOST=$(dialog --backtitle "${BACKTITLE}" --title "Webserver configuration" --inputbox "MS main URL (ie mediaserver.example.com)" 8 50 ${MS_VHOST0} --output-fd 1)
MS_CMVHOST=$(dialog --backtitle "${BACKTITLE}" --title "Webserver configuration" --inputbox "CampusManager URL (ie campusmanager.example.com)" 8 60 ${MS_CMVHOST0} --output-fd 1)
MS_MONVHOST=$(dialog --backtitle "${BACKTITLE}" --title "Webserver configuration" --inputbox "Monitor application URL (ie monitor-mediaserver.example.com)" 8 70 ${MS_MONVHOST0} --output-fd 1)
## Server configuration
# IP
sudo sed -i "s@address .*@address ${MS_IP}@" /etc/network/interfaces
sudo sed -i "s@netmask .*@netmask ${MS_NETMASK}@" /etc/network/interfaces
sudo sed -i "s@gateway .*@gateway ${MS_GATEWAY}@" /etc/network/interfaces
# DNS
sudo chown msinstall:root /etc/resolv.conf
sudo echo "nameserver ${MS_DNS1}" > /etc/resolv.conf
# test DNS2
if ( test -z ${MS_DNS2} )
then
echo "no 2nd DNS"
else
sudo echo "nameserver ${MS_DNS2}" >> /etc/resolv.conf
fi
sudo chown root:root /etc/resolv.conf
# NTP
sudo chown msinstall:root /etc/ntp.conf
sudo sed -i "s@^server .*@@" /etc/ntp.conf
sudo echo ${MS_NTP} >> /etc/ntp.conf
sudo chown root:root /etc/ntp.conf
# webserver
# ms
sudo sed -i "s@server_name .*@server_name ${MS_VHOST};@" /etc/nginx/sites-available/mediaserver-msuser.conf
# cm
sudo sed -i "s@server_name .*@server_name ${MS_CMVHOST};@" /etc/nginx/sites-available/skyreach.conf
# monitor
sudo sed -i "s@server_name .*@server_name ${MS_MONVHOST};@" /etc/nginx/sites-available/msmonitor.conf
## Customization complete
dialog --backtitle "${BACKTITLE}" --title "Customization complete" --msgbox "Congratulations, your MS is now configured.
Press enter to reboot." 8 50
sudo reboot
#!/bin/bash
source /root/envsetup/global-conf.sh
echo -e "${RED}Customer parameters will be applied after rebooting. Note that you won't be able to login to the machine after this operation !${NC}"
# set customer IP (/etc/network/interfaces)
if ( ! test -z ${NETWORK_IP} ); then
sed -i "s@192\.168\.40\.10.*@${NETWORK_IP}@" /etc/network/interfaces
fi
if ( ! test -z ${NETWORK_MASK} ); then
sed -i "s@255\.255\.252\..*@${NETWORK_MASK}@" /etc/network/interfaces
fi
if ( ! test -z ${NETWORK_GATEWAY} ); then
sed -i "s@192\.168\.40\..*@${NETWORK_GATEWAY}@" /etc/network/interfaces
fi
# backup-server specific
if ( test -f /usr/sbin/burp ); then
# changer burp status IP
sed -i "s@^BURP_CLIENT_MAIL_DEST=.*@BURP_CLIENT_MAIL_DEST=${BURP_CLIENT_MAIL_DEST}@" /root/burp-custom.sh
sed -i "s@admin: .*@admin: ${BURP_CLIENT_MAIL_DEST}" /etc/aliases
newaliases
fi
# set customer DNS
if ( ! test -z ${NETWORK_DNS1} ); then
echo "nameserver ${NETWORK_DNS1}" > /etc/resolv.conf
if ( ! test -z ${NETWORK_DNS2} ); then
echo "nameserver ${NETWORK_DNS2}" >> /etc/resolv.conf
fi
fi
# set customer NTP
sed -i "s@^server .*@@" /etc/ntp.conf
echo "" >> /etc/ntp.conf
if ( ! test -z ${NTP_SERVER} ); then
echo "server ${NTP_SERVER}" >> /etc/ntp.conf
fi
service ntp restart
# set email sender
if ( ! test -z ${EMAIL_SENDER} ); then
echo "#DEFAULT_FROM_EMAIL = '${EMAIL_SENDER}'" >> /etc/mediaserver/msconf.py
echo "#DEFAULT_FROM_EMAIL = '${EMAIL_SENDER}'" >> /home/skyreach/htdocs/skyreach_site/settings_override.py
fi
# set locale
echo -e "${CYAN}You will now change the locales.${NC}"
locale-gen en_GB.UTF-8
dpkg-reconfigure locales
update-locale LANG=en_GB.UTF-8 LANGUAGE=en_GB.UTF-8 LC_ALL=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
#dpkg-reconfigure console-data
#dpkg-reconfigure keyboard-configuration
# set TZ
echo -e "${CYAN}You will now change the time zone.${NC}"
dpkg-reconfigure tzdata
#!/bin/bash
source /root/envsetup/global-conf.sh
# set SMTP
if ( ! test -z ${EMAIL_SMTP_SERVER} )
then
sed -i "s@relayhost = .*@relayhost = ${EMAIL_SMTP_SERVER}@" /etc/postfix/main.cf
fi
#!/bin/bash
source /root/envsetup/global-conf.sh
# apply MS default network parameters
sudo sed -i "s@address .*@address 192.168.1.10@" /etc/network/interfaces
sudo sed -i "s@netmask .*@netmask 255.255.255.0@" /etc/network/interfaces
sudo sed -i "s@gateway .*@gateway 192.168.1.1@" /etc/network/interfaces
# add a specific user
useradd -m msinstall
echo -e "msinstall\nmsinstall" | (passwd -q msinstall)
sed -i "s@/home/msinstall:@/home/msinstall:/bin/bash@" /etc/passwd
# sudo
usermod -aG sudo msinstall
echo 'msinstall ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# get MS_deploy
mv /var/tmp/MS_deploy.sh /home/msinstall/MS_deploy.sh
# correct rights
chown msinstall:msinstall /home/msinstall/MS_deploy.sh
echo "bash /home/msinstall/MS_deploy.sh" > /home/msinstall/.bash_profile
#!/bin/bash
source /root/envsetup/global-conf.sh
echo "Insert wowza license key :"
read WOWZA_LICENSE2
echo "${WOWZA_LICENSE2}" > /usr/local/WowzaStreamingEngine/conf/Server.license
service WowzaStreamingEngine restart
service WowzaStreamingEngineManager restart
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment