From a6f05a0979ce4c18bb1690678964171501c7c0fe Mon Sep 17 00:00:00 2001 From: yomguy Date: Mon, 9 Jan 2012 14:27:00 +0100 Subject: [PATCH] rewrite install script --- .../apache2/sites-available/telecaster.conf | 4 +- conf/home/fluxbox/tc_video_start.sh | 21 +- .../telecaster/ffmpeg_dv_jack_fifo_shout | 0 .../telecaster/ffmpeg_usb_jack_fifo_shout | 0 .../fluxbox}/telecaster/gst_dv_jack_shout | 0 .../telecaster/gst_video_double_shout | 0 .../telecaster/gst_video_jack_fifo_shout | 0 .../fluxbox}/telecaster/gst_video_jack_shout | 0 .../fluxbox}/telecaster/gst_video_simple_ogg | 0 .../telecaster/gst_video_simple_ogg_jack | 0 .../telecaster/gst_video_triple_shout | 0 .../telecaster/tc_video_simple_file.sh | 0 .../telecaster/tc_video_simple_file_webm.sh | 0 .../telecaster/tc_video_simple_start.sh | 0 .../telecaster/tc_video_simple_webm_stream.sh | 0 .../applications}/rotate_desktop.desktop | 0 .../apps/preferences-desktop-rotate.png | Bin .../16x16/apps/preferences-desktop-rotate.png | Bin .../22x22/apps/preferences-desktop-rotate.png | Bin .../32x32/apps/preferences-desktop-rotate.png | Bin .../48x48/apps/preferences-desktop-rotate.png | Bin .../64x64/apps/preferences-desktop-rotate.png | Bin .../8x8/apps/preferences-desktop-rotate.png | Bin install.py | 244 ++++++++++-------- 24 files changed, 147 insertions(+), 122 deletions(-) rename {scripts => conf/home/fluxbox}/telecaster/ffmpeg_dv_jack_fifo_shout (100%) rename {scripts => conf/home/fluxbox}/telecaster/ffmpeg_usb_jack_fifo_shout (100%) rename {scripts => conf/home/fluxbox}/telecaster/gst_dv_jack_shout (100%) rename {scripts => conf/home/fluxbox}/telecaster/gst_video_double_shout (100%) rename {scripts => conf/home/fluxbox}/telecaster/gst_video_jack_fifo_shout (100%) rename {scripts => conf/home/fluxbox}/telecaster/gst_video_jack_shout (100%) rename {scripts => conf/home/fluxbox}/telecaster/gst_video_simple_ogg (100%) rename {scripts => conf/home/fluxbox}/telecaster/gst_video_simple_ogg_jack (100%) rename {scripts => conf/home/fluxbox}/telecaster/gst_video_triple_shout (100%) rename {scripts => conf/home/fluxbox}/telecaster/tc_video_simple_file.sh (100%) rename {scripts => conf/home/fluxbox}/telecaster/tc_video_simple_file_webm.sh (100%) rename {scripts => conf/home/fluxbox}/telecaster/tc_video_simple_start.sh (100%) rename {scripts => conf/home/fluxbox}/telecaster/tc_video_simple_webm_stream.sh (100%) rename {img => conf/usr/share/applications}/rotate_desktop.desktop (100%) rename {img/desktop => conf/usr/share/icons/oxygen}/128x128/apps/preferences-desktop-rotate.png (100%) rename {img/desktop => conf/usr/share/icons/oxygen}/16x16/apps/preferences-desktop-rotate.png (100%) rename {img/desktop => conf/usr/share/icons/oxygen}/22x22/apps/preferences-desktop-rotate.png (100%) rename {img/desktop => conf/usr/share/icons/oxygen}/32x32/apps/preferences-desktop-rotate.png (100%) rename {img/desktop => conf/usr/share/icons/oxygen}/48x48/apps/preferences-desktop-rotate.png (100%) rename {img/desktop => conf/usr/share/icons/oxygen}/64x64/apps/preferences-desktop-rotate.png (100%) rename {img/desktop => conf/usr/share/icons/oxygen}/8x8/apps/preferences-desktop-rotate.png (100%) diff --git a/conf/etc/apache2/sites-available/telecaster.conf b/conf/etc/apache2/sites-available/telecaster.conf index 4859b3e..0a1c6fc 100644 --- a/conf/etc/apache2/sites-available/telecaster.conf +++ b/conf/etc/apache2/sites-available/telecaster.conf @@ -4,13 +4,13 @@ SuexecUserGroup telecaster telecaster - ErrorLog /var/log/apache2/error.log + ErrorLog /var/log/apache2/telecaster_error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn - CustomLog /var/log/apache2/access.log combined + CustomLog /var/log/apache2/telecaster_access.log combined ServerSignature On diff --git a/conf/home/fluxbox/tc_video_start.sh b/conf/home/fluxbox/tc_video_start.sh index cd25b51..08be3fb 100755 --- a/conf/home/fluxbox/tc_video_start.sh +++ b/conf/home/fluxbox/tc_video_start.sh @@ -2,22 +2,5 @@ # Start TeleCaster video channel -WIDTH=480 -HEIGHT=270 - -gst-launch v4l2src device=/dev/video0 ! queue ! videoscale ! video/x-raw-yuv, width=160, height=120 \ - ! queue ! videorate ! video/x-raw-yuv,framerate=25/1 \ - ! queue ! videomixer name=mix sink_1::xpos=0 sink_1::ypos=0 sink_1::alpha=0.9 \ - ! queue ! ffmpegcolorspace ! queue ! theoraenc quality=25 ! muxout. \ - jackaudiosrc connect=1 ! audioconvert ! audio/x-raw-int,rate=44100,channels=1,width=16 \ - ! queue ! audioconvert ! vorbisenc ! queue ! muxout. \ - oggmux name=muxout ! queue ! shout2send mount=/telecaster_live_video.ogg port=8000 password=source2parisson ip=127.0.0.1 \ - v4l2src device=/dev/video1 ! queue ! videoscale ! video/x-raw-yuv, width=$WIDTH, height=$HEIGHT \ - ! queue ! videorate ! video/x-raw-yuv,framerate=25/1 ! mix. \ - > /dev/null & - -sleep 2 - -jack_disconnect system:capture_1 gst-launch-0.10:in_jackaudiosrc0_1 -jack_connect jack_rack:out_1 gst-launch-0.10:in_jackaudiosrc0_1 - +telecaster/tc_video_simple_webm_stream.sh + diff --git a/scripts/telecaster/ffmpeg_dv_jack_fifo_shout b/conf/home/fluxbox/telecaster/ffmpeg_dv_jack_fifo_shout similarity index 100% rename from scripts/telecaster/ffmpeg_dv_jack_fifo_shout rename to conf/home/fluxbox/telecaster/ffmpeg_dv_jack_fifo_shout diff --git a/scripts/telecaster/ffmpeg_usb_jack_fifo_shout b/conf/home/fluxbox/telecaster/ffmpeg_usb_jack_fifo_shout similarity index 100% rename from scripts/telecaster/ffmpeg_usb_jack_fifo_shout rename to conf/home/fluxbox/telecaster/ffmpeg_usb_jack_fifo_shout diff --git a/scripts/telecaster/gst_dv_jack_shout b/conf/home/fluxbox/telecaster/gst_dv_jack_shout similarity index 100% rename from scripts/telecaster/gst_dv_jack_shout rename to conf/home/fluxbox/telecaster/gst_dv_jack_shout diff --git a/scripts/telecaster/gst_video_double_shout b/conf/home/fluxbox/telecaster/gst_video_double_shout similarity index 100% rename from scripts/telecaster/gst_video_double_shout rename to conf/home/fluxbox/telecaster/gst_video_double_shout diff --git a/scripts/telecaster/gst_video_jack_fifo_shout b/conf/home/fluxbox/telecaster/gst_video_jack_fifo_shout similarity index 100% rename from scripts/telecaster/gst_video_jack_fifo_shout rename to conf/home/fluxbox/telecaster/gst_video_jack_fifo_shout diff --git a/scripts/telecaster/gst_video_jack_shout b/conf/home/fluxbox/telecaster/gst_video_jack_shout similarity index 100% rename from scripts/telecaster/gst_video_jack_shout rename to conf/home/fluxbox/telecaster/gst_video_jack_shout diff --git a/scripts/telecaster/gst_video_simple_ogg b/conf/home/fluxbox/telecaster/gst_video_simple_ogg similarity index 100% rename from scripts/telecaster/gst_video_simple_ogg rename to conf/home/fluxbox/telecaster/gst_video_simple_ogg diff --git a/scripts/telecaster/gst_video_simple_ogg_jack b/conf/home/fluxbox/telecaster/gst_video_simple_ogg_jack similarity index 100% rename from scripts/telecaster/gst_video_simple_ogg_jack rename to conf/home/fluxbox/telecaster/gst_video_simple_ogg_jack diff --git a/scripts/telecaster/gst_video_triple_shout b/conf/home/fluxbox/telecaster/gst_video_triple_shout similarity index 100% rename from scripts/telecaster/gst_video_triple_shout rename to conf/home/fluxbox/telecaster/gst_video_triple_shout diff --git a/scripts/telecaster/tc_video_simple_file.sh b/conf/home/fluxbox/telecaster/tc_video_simple_file.sh similarity index 100% rename from scripts/telecaster/tc_video_simple_file.sh rename to conf/home/fluxbox/telecaster/tc_video_simple_file.sh diff --git a/scripts/telecaster/tc_video_simple_file_webm.sh b/conf/home/fluxbox/telecaster/tc_video_simple_file_webm.sh similarity index 100% rename from scripts/telecaster/tc_video_simple_file_webm.sh rename to conf/home/fluxbox/telecaster/tc_video_simple_file_webm.sh diff --git a/scripts/telecaster/tc_video_simple_start.sh b/conf/home/fluxbox/telecaster/tc_video_simple_start.sh similarity index 100% rename from scripts/telecaster/tc_video_simple_start.sh rename to conf/home/fluxbox/telecaster/tc_video_simple_start.sh diff --git a/scripts/telecaster/tc_video_simple_webm_stream.sh b/conf/home/fluxbox/telecaster/tc_video_simple_webm_stream.sh similarity index 100% rename from scripts/telecaster/tc_video_simple_webm_stream.sh rename to conf/home/fluxbox/telecaster/tc_video_simple_webm_stream.sh diff --git a/img/rotate_desktop.desktop b/conf/usr/share/applications/rotate_desktop.desktop similarity index 100% rename from img/rotate_desktop.desktop rename to conf/usr/share/applications/rotate_desktop.desktop diff --git a/img/desktop/128x128/apps/preferences-desktop-rotate.png b/conf/usr/share/icons/oxygen/128x128/apps/preferences-desktop-rotate.png similarity index 100% rename from img/desktop/128x128/apps/preferences-desktop-rotate.png rename to conf/usr/share/icons/oxygen/128x128/apps/preferences-desktop-rotate.png diff --git a/img/desktop/16x16/apps/preferences-desktop-rotate.png b/conf/usr/share/icons/oxygen/16x16/apps/preferences-desktop-rotate.png similarity index 100% rename from img/desktop/16x16/apps/preferences-desktop-rotate.png rename to conf/usr/share/icons/oxygen/16x16/apps/preferences-desktop-rotate.png diff --git a/img/desktop/22x22/apps/preferences-desktop-rotate.png b/conf/usr/share/icons/oxygen/22x22/apps/preferences-desktop-rotate.png similarity index 100% rename from img/desktop/22x22/apps/preferences-desktop-rotate.png rename to conf/usr/share/icons/oxygen/22x22/apps/preferences-desktop-rotate.png diff --git a/img/desktop/32x32/apps/preferences-desktop-rotate.png b/conf/usr/share/icons/oxygen/32x32/apps/preferences-desktop-rotate.png similarity index 100% rename from img/desktop/32x32/apps/preferences-desktop-rotate.png rename to conf/usr/share/icons/oxygen/32x32/apps/preferences-desktop-rotate.png diff --git a/img/desktop/48x48/apps/preferences-desktop-rotate.png b/conf/usr/share/icons/oxygen/48x48/apps/preferences-desktop-rotate.png similarity index 100% rename from img/desktop/48x48/apps/preferences-desktop-rotate.png rename to conf/usr/share/icons/oxygen/48x48/apps/preferences-desktop-rotate.png diff --git a/img/desktop/64x64/apps/preferences-desktop-rotate.png b/conf/usr/share/icons/oxygen/64x64/apps/preferences-desktop-rotate.png similarity index 100% rename from img/desktop/64x64/apps/preferences-desktop-rotate.png rename to conf/usr/share/icons/oxygen/64x64/apps/preferences-desktop-rotate.png diff --git a/img/desktop/8x8/apps/preferences-desktop-rotate.png b/conf/usr/share/icons/oxygen/8x8/apps/preferences-desktop-rotate.png similarity index 100% rename from img/desktop/8x8/apps/preferences-desktop-rotate.png rename to conf/usr/share/icons/oxygen/8x8/apps/preferences-desktop-rotate.png diff --git a/install.py b/install.py index 1144612..41d276b 100644 --- a/install.py +++ b/install.py @@ -41,110 +41,152 @@ import os, sys import platform import shutil +from optparse import OptionParser -def remove_svn(path): + +def cleanup(path): for root, dirs, files in os.walk(path): for dir in dirs: - if '.svn' in dir: + if '.svn' in dir or '.git' in dir: shutil.rmtree(root + os.sep + dir) -app_dir = os.getcwd() - -user = 'telecaster' -home = '/home/' + user -if not os.path.exists(home): - print 'Please give some informations for the new "telecaster" user :' - os.system('adduser ' + user) - os.system('adduser ' + user + ' audio') - -# compiling edcast-jack -os.chdir(app_dir + '/vendor/edcast-jack') -os.system('./configure; make; sudo make install') - -# Install DeeFuzzer -os.system('sudo pip install deefuzzer') - -os.chdir(app_dir) -install_dir = '/var/www/telecaster' -if os.path.exists(install_dir): - shutil.rmtree(install_dir) -shutil.copytree(app_dir, install_dir,ignore=shutil.ignore_patterns('edcast-jack*', 'deefuzzer*', '*.svn*', '*.bzr*')) -os.system('chown -R ' + user + ':' + user + ' ' + install_dir) -os.system('chmod 755 ' + install_dir + '/telecaster.py') - -dir = '/var/www/rss' -if not os.path.exists(dir): - os.mkdir(dir) -os.system('chown -R ' + user + ':' + user + ' ' + dir) - -dir = '/var/www/m3u' -if not os.path.exists(dir): - os.mkdir(dir) -os.system('chown -R ' + user + ':' + user + ' ' + dir) - -conf_dir = '/etc/telecaster' -if not os.path.exists(conf_dir): - os.mkdir(conf_dir) - os.system('sudo chown '+user+ ':'+user+' '+conf_dir) -in_files = os.listdir('conf'+conf_dir) -for file in in_files: - if not os.path.exists(conf_dir+os.sep+file) and not '.svn' in file: - shutil.copy('conf'+conf_dir+os.sep+file, conf_dir+os.sep+file) - -daemons = ['jackd', 'vncserver'] -dir = '/etc/init.d/' -for daemon in daemons: - path = dir + daemon - shutil.copy('conf'+path, dir) - os.system('sudo chmod 755 '+path) - -dir = '/etc/default/' -for daemon in daemons: - path = dir + daemon - if not os.path.exists(path): - shutil.copy('conf'+path, dir) - -init_link = '/etc/rc2.d/S97jackd' -if not os.path.islink(init_link): - os.system('ln -s /etc/init.d/jackd '+init_link) - -init_link = '/etc/rc2.d/S99vncserver' -if not os.path.islink(init_link): - os.system('ln -s /etc/init.d/vncserver '+init_link) - -home_dirs = ['fluxbox', 'vnc'] -for dir in home_dirs: - home_dir = home + '/.' + dir - if not os.path.exists(home_dir): - shutil.copytree('conf/home/'+dir, home_dir, ignore=shutil.ignore_patterns('*.svn*')) - os.system('chown -R ' + user + ':' + user + ' ' + home_dir) - -dir = 'media' -home_dir = home + os.sep + dir -if not os.path.exists(home_dir): - shutil.copytree('conf/home/'+dir, home_dir, ignore=shutil.ignore_patterns('*.svn*')) - os.system('chown -R ' + user + ':' + user + ' ' + home_dir) - -apache_conf = '/etc/apache2/sites-available/telecaster.conf' -if not os.path.exists(apache_conf): - shutil.copy('conf'+apache_conf, apache_conf) -os.system('/etc/init.d/apache2 reload') - -log_dirs = ['/var/log/telecaster', '/var/log/deefuzzer'] -for dir in log_dirs: - if not os.path.exists(dir): - os.mkdir(dir) - os.system('chown -R ' + user + ':' + user + ' ' + dir) - -print """ - Installation successfull ! - - Now, please : - - configure your telecaster editing /etc/telecaster/telecaster.xml and /etc/telecaster/deefuzzer.xml - - configure your apache VirtualHost editing /etc/apache2/sites-available/telecaster.conf - - And use the TeleCaster system browsing http://localhost/telecaster/telecaster.py - - See README for more infos. - """ +class Install(object): + + def __init__(self, options): + self.options = options + self.app_dir = os.getcwd() + self.user = 'telecaster' + self.home = '/home/' + self.user + + self.install_dir = '/var/www/telecaster' + self.rss_dir = '/var/www/rss' + self.m3u_dir = '/var/www/m3u' + self.log_dir = '/var/log/telecaster' + self.deefuzzer_log_dir = '/var/log/deefuzzer' + self.conf_dir = '/etc/telecaster' + self.init_dirs = ['/etc/init.d/', '/etc/default/'] + self.home_dirs = ['fluxbox', 'vnc'] + self.media_dir = self.home + os.sep + 'media' + + self.daemons = ['jackd', 'vncserver'] + self.apache_conf = '/etc/apache2/sites-available/telecaster.conf' + + def create_user(self): + if not os.path.exists(self.home): + print 'Please give some informations for the new "telecaster" user :' + os.system('adduser ' + self.user) + os.system('adduser ' + self.user + ' audio') + + def chown(self, dir): + os.system('chown -R ' + self.user + ':' + self.user + ' ' + dir) + + def install_deps(self): + # compiling edcast-jack + os.chdir(self.app_dir + '/vendor/edcast-jack') + os.system('./configure; make; make install') + + # Install DeeFuzzer + os.system('pip install deefuzzer') + + def install_app(self): + os.chdir(self.app_dir) + + if os.path.exists(self.install_dir): + shutil.rmtree(self.install_dir) + + shutil.copytree(self.app_dir, self.install_dir,ignore=shutil.ignore_patterns('edcast-jack*', 'deefuzzer*', '*.svn*', '*.bzr*', '*.git')) + os.system('chown -R ' + self.user + ':' + self.user + ' ' + self.install_dir) + os.system('chmod 755 ' + self.install_dir + '/telecaster.py') + + def install_conf(self): + os.chdir(self.app_dir) + + in_files = os.listdir('conf'+self.conf_dir) + if not os.path.exists(self.conf_dir): + os.makedirs(self.conf_dir) + + for file in in_files: + shutil.copy('conf'+self.conf_dir+os.sep+file, self.conf_dir+os.sep+file) + + for dir in self.home_dirs: + home_dir = self.home + '/.' + dir + if not os.path.exists(home_dir): + shutil.copytree('conf/home/'+dir, home_dir, ignore=shutil.ignore_patterns('*.svn*')) + self.chown(dir) + + dir = 'media' + if not os.path.exists(self.home+os.sep+dir): + shutil.copytree('conf/home/'+dir, self.home+os.sep+dir) + + shutil.copy('conf'+self.apache_conf, self.apache_conf) + os.system('a2ensite telecaster.conf') + os.system('/etc/init.d/apache2 reload') + + def install_init(self): + os.chdir(self.app_dir) + + dirs = [self.rss_dir, self.m3u_dir, self.log_dir, self.deefuzzer_log_dir, self.conf_dir, self.media_dir] + for dir in dirs: + if not os.path.exists(dir): + os.makedirs(dir) + self.chown(dir) + + for init_dir in self.init_dirs: + for daemon in self.daemons: + path = init_dir + daemon + shutil.copy('conf'+path, dir) + os.system('sudo chmod 755 '+path) + + init_link = '/etc/rc2.d/S97jackd' + if not os.path.islink(init_link): + os.system('ln -s /etc/init.d/jackd '+init_link) + + init_link = '/etc/rc2.d/S99vncserver' + if not os.path.islink(init_link): + os.system('ln -s /etc/init.d/vncserver '+init_link) + + def run(self): + if self.options['keepinit'] == False: + print 'Installing init files...' + self.install_init() + if self.options['keepmods'] == False: + print 'Installing dependencies...' + self.install_deps() + if self.options['keepconf'] == False: + print 'Installing config files...' + self.install_conf() + print 'Installing application...' + self.install_app() + + +def main(): + parser = OptionParser() + parser.add_option("-c", "--keepconf", dest="keepconf", default=False, action="store_true", + help="do NOT overwrite config files") + parser.add_option("-i", "--keepinit", dest="keepinit", default=False, action="store_true", + help="do NOT overwrite init files") + parser.add_option("-m", "--keepmods", dest="keepmods", default=False, action="store_true", + help="do NOT overwrite or install modules") + + (options, args) = parser.parse_args() + install = Install(vars(options)) + install.run() + + print """ + Installation successfull ! + + Now, please : + - configure your telecaster editing /etc/telecaster/telecaster.xml and /etc/telecaster/deefuzzer.xml + - configure your apache VirtualHost editing /etc/apache2/sites-available/telecaster.conf + + And use the TeleCaster system browsing http://127.0.0.1/telecaster/telecaster.py + + See README for more infos. + """ + + +if __name__ == '__main__': + main() + + -- 2.39.5