OSDN Git Service

fix installer.
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Fri, 25 Dec 2009 03:01:19 +0000 (03:01 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Fri, 25 Dec 2009 03:01:19 +0000 (03:01 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@357 4e526526-5e11-4fc0-8910-f8fd03428081

rec10/trunk/src/Makefile
rec10/trunk/src/configwriter.py [new file with mode: 0644]
rec10/trunk/src/install.py
rec10/trunk/src/install.sh [new file with mode: 0644]
rec10/trunk/src/rec10.conf

index f6d89d8..c5c94f1 100644 (file)
@@ -7,11 +7,13 @@ VER = $(MAJOR).$(MINOR).$(REVISION)
 DEST = $(PREFIX)/rec10
 
 install:
-       if ! [ -d $(PREFIX)/rec10 ]; then;mkdir -p $(PREFIX)/rec10 ;fi
+       if ! [ -d $(PREFIX)/rec10 ]; then mkdir -p $(PREFIX)/rec10 ;fi
        cp ./*.py $(DEST)/
        install -m755 ./rec10 $(DEST)/
        ln $(DEST)/rec10 /usr/local/bin
        chmod 755 /usr/local/bin/rec10
-       if ! [ -f /etc/rec10.conf ]; then ;cp ./rec10.conf /etc/rec10.conf;fi
+       if ! [ -f /etc/rec10.conf ]; then cp ./rec10.conf /etc/rec10.conf;fi
+       if ! [ -d /tmp/rec10 ]; then mkdir -p /tmp/rec10 ;fi
+       chmod 777 /tmp/rec10
 uninstall:
        rm -r $(DEST)
diff --git a/rec10/trunk/src/configwriter.py b/rec10/trunk/src/configwriter.py
new file mode 100644 (file)
index 0000000..5e4c9c9
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+# coding: UTF-8
+# Rec10 TS Recording Tools
+# Copyright (C) 2009 Yukikaze
+import ConfigParser
+import os
+import os.path
+mypath = str(os.path.dirname(os.path.abspath(__file__)))
+confp = ConfigParser.SafeConfigParser()
+Conf = 'rec10.conf'
+confpath=""
+
+confp.read(confpath)
+def getpath(string):
+    global confp
+    return confp.get('path', string)
+def getdbpath(string):
+    global confp
+    return confp.get('db', string)
+def getenv(string):
+    global confp
+    return confp.get('env', string)
+def setpath(option,value):
+    global confp
+    return confp.set('path',option,value)
+def setdbpath(option,value):
+    global confp
+    return confp.set('db',option,value)
+def setenv(option,value):
+    global confp
+    return confp.set('env',option,value)
+def writeconf():
+    confp.write(confpath)
index 1f1e9ce..ea96dcd 100644 (file)
@@ -1,4 +1,3 @@
-import commands
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
@@ -7,6 +6,9 @@ import time
 import os.path
 import ConfigParser
 import sys
+import commands
+import configwriter
+import shutil
 
 import recdblist
 def install():
@@ -49,7 +51,7 @@ def install():
         recdblist.printutf8(u"チャンネルリストが見つかりました。||chlist.xml")
     else:
         recdblist.printutf8(u"チャンネルリストが見つかりません。"+os.path.join(path,"chlist.xml")+u"を作成してください。")
-        recdblist.printutf8(u"東京/名古屋のサンプルがchlist_sample_*.xmlにあるため、参考にしてください。")
+        recdblist.printutf8(u"東京/名古屋/神戸のサンプルがchlist_sample_*.xmlにあるため、参考にしてください。")
         sys.exit(1)
     recdblist.printutf8(u"BS放送は受信可能ですか?")
     bsok=raw_input("y/N:")
@@ -73,11 +75,70 @@ def install():
     import timerec
     timerec.task()
 def getpath(cmd):
-    ""
+    recdblist.printutf8(cmd+u"の場所を確認中")
+    txt=commands.getoutput(u"which "+cmd)
+    if len(txt.splitlines())>2:
+        recdblist.printutf8(cmd+u"の場所を確認できませんでした。終了します")
+        sys.exit(1)
+    else:
+        recdblist.printutf8(cmd+u" : "+txt)
+        return txt.strip()
 def move():
+    path = str(os.path.dirname(os.path.abspath(__file__)))
     recdblist.printutf8(u"rec10 ver 0.9.1 installer.")
     recdblist.printutf8(u"rec10のインストールを開始します。")
-    recdblist.printutf8(u"wineの場所を確認中")
-    commands.getoutput(u"which wine")
+    
+    configwriter.setpath(u"wine", getpath(u"wine"))
+    configwriter.setpath(u"recpt1", getpath(u"recpt1"))
+    configwriter.setpath(u"xvfb-run", getpath(u"xvfb-run"))
+    configwriter.setpath(u"mkvmerge", getpath(u"mkvmerge"))
+    configwriter.setpath(u"b25", getpath(u"b25"))
+    recdblist.printutf8(u"必須環境の設定が完了しました")
+    recdblist.printutf8(u"個人設定に入ります")
+    recdblist.printutf8(u"rec10の録画ファイルが置かれる場所を入力してください(1/)")
+    recdblist.printutf8(u"100GB程度は確保されている必要があります")
+    recpath=raw_input("path : ")
+    configwriter.setpath(u"recpath",recpath)
+    recdblist.printutf8(u"DBの設定に入ります。")
+    recdblist.printutf8(u"rec10が使用するMySQLのユーザーを設定してください。(2/)")
+    mysql_user=raw_input("mysql_user : ")
+    configwriter.setdbpath("mysql_user", mysql_user)
+    recdblist.printutf8(u"パスワードを設定してください(3/)")
+    mysql_passwd=raw_input("mysql_passwd : ")
+    configwriter.setdbpath("mysql_passwd", mysql_passwd)
+    recdblist.printutf8(u"同時録画可能数の設定に入ります")
+    recdblist.printutf8(u"TE(地デジ)録画可能数(PT*だと2 白Friioだと1)(4/)")
+    te_max=raw_input("te_max : ")
+    te_max=str(int(te_max))
+    configwriter.setenv("te_max", te_max)
+    recdblist.printutf8(u"BS/CS110録画可能数(PT*だと2 黒Friioだと1)(5/)")
+    bscs_max=raw_input("bscs_max : ")
+    bscs_max=str(int(bscs_max))
+    configwriter.setenv("bscs_max", bscs_max)
+    recdblist.printutf8(u"同時エンコード最大数を設定してください(6/)")
+    recdblist.printutf8(u"CPUのコア数が目安です")
+    enc_max=raw_input("[2]:")
+    if enc_max=="":
+        enc_max="2"
+    else:
+        enc_max=str(int(enc_max))
+    configwriter.setenv("enc_max", enc_max)
+    recdblist.printutf8(u"チャンネルの設定に入ります(7/)")
+    recdblist.printutf8(u"rec10を設置する地域を選んでください。")
+    recdblist.printutf8(u"1:東京 2:神戸 3:名古屋 4:その他")
+    ch=raw_input()
+    ch=int(ch)
+    if ch==1:
+        shutil.copy(os.path.join(path,"chlist_sample_tokyo.xml"),os.path.join(path,"chlist.xml"))
+    elif ch==2:
+        shutil.copy(os.path.join(path,"chlist_sample_kobe.xml"),os.path.join(path,"chlist.xml"))
+    elif ch==3:
+        shutil.copy(os.path.join(path,"chlist_sample_nagoya.xml"),os.path.join(path,"chlist.xml"))
+    elif ch==4:
+        recdblist.printutf8(u"チャンネルの設定が必要です。")
+        recdblist.printutf8(u"chlist_sample_*を参考にchlist.xmlを作成した後に次のステップに進んでください。")
+        time.sleep(5)
+    recdblist.printutf8(u"初期設定が終了しました。")
+    recdblist.printutf8(u"makeを実行した後にrootにてmake installを実行するとインストールされます。")
 if __name__ == "__main__":
-    install()
\ No newline at end of file
+    move()
\ No newline at end of file
diff --git a/rec10/trunk/src/install.sh b/rec10/trunk/src/install.sh
new file mode 100644 (file)
index 0000000..0151c36
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+SELF_DIR=`dirname $0`
+cd ${SELF_DIR}
+export LANG="ja_JP.UTF-8" && python2.6 ./install.py
\ No newline at end of file
index 3b5f28b..320daac 100644 (file)
@@ -15,7 +15,7 @@ recorded = /path of /recordedpath
 move_destpath =
 
 #一時キャッシュに使用するフォルダです。 指定しない場合rec10本体と同じフォルダが使われます。
-tmp = 
+tmp = /tmp/rec10
 epgdump = /usr/local/bin/epgdump
 tssplitter = /usr/bin/java -jar /etc/rec10/tstools/jTsSplitter.jar
 bontsdemux = /usr/local/share/rec10/tstools/BonTsDemux.exe