Advertisement
Guest User

BiptoN

a guest
Nov 23rd, 2009
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 17.54 KB | None | 0 0
  1. #!/bin/bash -v
  2. #------------------------------------------------------------------------------------------------------------
  3. # setupXBMC Version 0.7a - 18/11/2009
  4. # XBMC Installation script - by VirtualDanny.net
  5. # This script will provide an automatic installation of Xbox Media Center
  6. #
  7. # REQUIREMENTS:
  8. # * Clean Ubuntu Jaunty Server Installation https://help.ubuntu.com/community/Installation/MinimalCD
  9. # * XBMC Compatible Hardware http://xbmc.org/wiki/?title=XBMC_for_Linux_specific_FAQ
  10. # * Internet access
  11. # * Username must be set to 'XBMC' under Ubuntu installation
  12. #
  13. # TO-DO LIST:
  14. # * Menu to choose from Stable Release or Bleeding Edge Release
  15. # * Automatic adjustments of all volume channels in Alsamixer
  16. # * Additional tweaks
  17. # * Setup common folders and setup simple smbd
  18. # *  Give option for ATI/Nvidia Driver setup
  19. #
  20. # KNOWN BUGS:
  21. # * Installation will fail if you uncomment SVN Repositories during first time installation.
  22. #
  23. # Remember to run this script with: sudo ./setupXBMC.sh
  24. #------------------------------------------------------------------------------------------------------------
  25.  
  26. ## --[ Miscellaneous variables ]------------------------------------------------
  27.  
  28. RELEASE=`cat /etc/lsb-release | grep CODENAME | cut -d = -f2`
  29.  
  30. cd /
  31.  
  32.  
  33. ##--[ ADDING REPOSITORIES TO SOURCE LIST ]-------------------------------------------------------------------
  34. ##    Repositories make it easier to download and stay up-to-date with current releases of Linux applications
  35.  
  36. echo '#' XBMC Repositories >> /etc/apt/sources.list.d/xbmc.org.list
  37. echo '#' SVN builds are commented out. Remove comment '#' to enable.  >> /etc/apt/sources.list.d/xbmc.org.list
  38. echo '#' Please DO NOT use the SVN builds during first time installation  >> /etc/apt/sources.list.d/xbmc.org.list
  39. echo deb http://ppa.launchpad.net/team-xbmc/ppa/ubuntu/ $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list
  40. echo deb-src http://ppa.launchpad.net/team-xbmc/ppa/ubuntu/ $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list
  41. #echo '#'deb http://ppa.launchpad.net/xbmc-addons/ppa/ubuntu $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list ### Test for Karmic, if so then comment out ###
  42.  
  43. echo '#'deb http://ppa.launchpad.net/team-xbmc-svn/ppa/ubuntu $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list
  44. echo '#'deb-src http://ppa.launchpad.net/team-xbmc-svn/ppa/ubuntu $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list
  45.  
  46.  
  47.  
  48. ##--[ ADDING NVIDIA REPOISOTIRES TO SOURCE LIST ]------------------------------------------------------------
  49.  
  50. echo   >> etc/apt/sources.list
  51. echo '#' NVIDIA Repositories >> etc/apt/sources.list
  52. echo deb http://ppa.launchpad.net/nvidia-vdpau/ppa/ubuntu $RELEASE main >> etc/apt/sources.list
  53.  
  54.  
  55.  
  56. ##--[ ADDING PGP KEYS TO VERFIY VALID SOURCES ]--------------------------------------------------------------
  57.  
  58. apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 318C7509 64234534 CEC06767 0x6D975C4791E7EE5E
  59.  
  60.  
  61.  
  62. ##--[ RUNNING A SYSTEM UPDATE ]------------------------------------------------------------------------------
  63.  
  64. apt-get update
  65.  
  66.  
  67.  
  68. ##--[ INSTALL GENERIC NVIDIA GRAPHIC DRIVERS ]---------------------------------------------------------------
  69.  
  70. apt-get install linux-headers-generic nvidia-glx-185 -y
  71.  
  72.  
  73.  
  74. ##--[ INSTALLS XBMC Media Center ]---------------------------------------------------------------------------
  75.  
  76. apt-get install xbmc -y
  77. apt-get install xbmc-skin-* -y
  78. apt-get install xbmc-eventclients-* -y
  79. apt-get install xbmc-scripts-* -y
  80.  
  81.  
  82.  
  83. ##--[ INSTALL XBMC SVN Repo Installer ]----------------------------------------------------------------------
  84.  
  85. apt-get install unzip -y
  86. cd /
  87. cd /home/xbmc/.xbmc/plugins/programs
  88. wget http://xbmc-addons.googlecode.com/svn/packages/plugins/programs/SVN_Repo_Installer.zip
  89. unzip -o SVN_Repo_Installer.zip
  90. rm SVN_Repo_Installer.zip
  91. chown -R xbmc:xbmc "SVN Repo Installer"
  92.  
  93.  
  94.  
  95. ##--[ INSTALL Additional software ]--------------------------------------------------------------------------
  96.  
  97. apt-get install openbox xterm xinit x11-xserver-utils -y
  98.  
  99.  
  100.  
  101.  
  102. ## --[ INSTALL AND CONFIGURE ALSA SOUND ]--------------------------------------------------------------------
  103.  
  104. apt-get install linux-sound-base alsa-base alsa-utils -y
  105. usermod -a -G audio xbmc
  106.  
  107. echo
  108. echo AlsaMixer will now start so that you can configre your volum levels.
  109. echo
  110. echo Press 'M' to activate/deactive, Arrows to adjust volume, and ESC to save/quit.
  111. echo Press any Key to contiue, or wait 20 seconds to continue
  112. read -n1 -t20 any_key
  113.  
  114. alsamixer
  115. alsactl store 0
  116.  
  117.  
  118.  
  119. ## --[ INSTALL XBMC Bootscreen ]-----------------------------------------------------------------------------
  120.  
  121. apt-get install usplash-theme-xbmc-* -y
  122. update-alternatives --set usplash-artwork.so /usr/lib/usplash/xbmc-splash-spinner-black.so
  123. echo xres=1024 >> /etc/usplash.conf
  124. echo yres=768 >> /etc/usplash.conf
  125.  
  126. update-initramfs -u
  127.  
  128.  
  129.  
  130. ## --[ INSTALL Linux IR Remote Control Support]--------------------------------------------------------------
  131.  
  132. #apt-get install lirc -y
  133.  
  134.  
  135.  
  136. ## --[ FINAL SYSTEM UPGRADE ]--------------------------------------------------------------------------------
  137.  
  138. apt-get update
  139. apt-get upgrade -y
  140.  
  141.  
  142.  
  143. ## --[ GENERATE XORG.CONF ]----------------------------------------------------------------------------------
  144.  
  145. nvidia-xconfig -s --no-logo --force-generate
  146.  
  147.  
  148.  
  149. ## --[ ADDING HWcursor fix ]---------------------------------------------------------------------------------
  150.  
  151. sed -i '40i\    Option         "HWCursor" "False"' /etc/X11/xorg.conf
  152.  
  153.  
  154.  
  155. ## --[ ENABLE 1080p 24Hz]------------------------------------------------------------------------------------
  156.  
  157. sed -i '50i\    Option         "DynamicTwinView" "False"' /etc/X11/xorg.conf
  158.  
  159.  
  160.  
  161. ## --[ Disable Composite for better H264 acceleration ]------------------------------------------------------
  162. sed -i '30i\Section "Extensions"' /etc/X11/xorg.conf
  163. sed -i '31i\    Option         "Composite" "Disable"' /etc/X11/xorg.conf
  164. sed -i '32i\EndSection' /etc/X11/xorg.conf
  165.  
  166.  
  167.  
  168. ## --[ INSTALLING XBMC HELPERS ]-----------------------------------------------------------------------------
  169. apt-get install xbmc-live python-apt -y
  170.  
  171. ## --[ Setup autologin for user "xbmc" ]-----------------------------------------------------------------------------------
  172.  
  173. if [[ "$RELEASE" == "hardy" || "$RELEASE" == "intrepid" || "$RELEASE" == "jaunty" ]]
  174.     then
  175.         echo '# tty1 - getty' > /etc/event.d/tty1
  176.         echo '#' >> /etc/event.d/tty1
  177.         echo '# This service maintains a getty on tty1 from the point the system is' >> /etc/event.d/tty1
  178.         echo '# started until it is shut down again.' >> /etc/event.d/tty1
  179.         echo >> /etc/event.d/tty1
  180.         echo 'start on stopped rc2' >> /etc/event.d/tty1
  181.         echo 'start on stopped rc3' >> /etc/event.d/tty1
  182.         echo 'start on stopped rc4' >> /etc/event.d/tty1
  183.         echo 'start on stopped rc5' >> /etc/event.d/tty1
  184.         echo >> /etc/event.d/tty1
  185.         echo 'stop on runlevel 0' >> /etc/event.d/tty1
  186.         echo 'stop on runlevel 1' >> /etc/event.d/tty1
  187.         echo 'stop on runlevel 6' >> /etc/event.d/tty1
  188.         echo >> /etc/event.d/tty1
  189.         echo 'respawn' >> /etc/event.d/tty1
  190.         echo 'exec /bin/login -f xbmc </dev/tty1 > /dev/tty1 2>&1' >> /etc/event.d/tty1
  191. elif [ "$RELEASE" == "karmic" ]
  192.     then
  193.         echo '# tty1 - getty' > /etc/init/tty1.conf
  194.         echo '#' >> /etc/init/tty1.conf
  195.         echo '# This service maintains a getty on tty1 from the point the system is' >> /etc/init/tty1.conf
  196.         echo '# started until it is shut down again.' >> /etc/init/tty1.conf
  197.         echo >> /etc/init/tty1.conf
  198.         echo 'start on stopped rc RUNLEVEL=[2345]' >> /etc/init/tty1.conf
  199.         echo 'stop on runlevel [!2345]' >> /etc/init/tty1.conf
  200.         echo >> /etc/init/tty1.conf
  201.         echo 'respawn' >> /etc/init/tty1.conf
  202.         echo 'exec /bin/login -f xbmc </dev/tty1 > /dev/tty1 2>&1' >> /etc/init/tty1.conf
  203. fi
  204.  
  205. echo 'case "`tty`" in' > /home/xbmc/.bash_profile
  206. echo '/dev/tty1) clear && startx &>/dev/null;;' >> /home/xbmc/.bash_profile
  207. echo 'esac' >> /home/xbmc/.bash_profile
  208.  
  209. echo exec openbox-session > /home/xbmc/.xinitrc
  210.  
  211. mkdir -p /home/xbmc/.config/openbox
  212.  
  213. echo '#!/bin/bash' > /usr/local/bin/xbmc-session
  214. echo >> /usr/local/bin/xbmc-session
  215. echo 'until xbmc --standalone; do' >> /usr/local/bin/xbmc-session
  216. echo    'echo "uh oh xbmc crashed with code $?... restarting it" >$2' >> /usr/local/bin/xbmc-session
  217. echo    'sleep 5' >> /usr/local/bin/xbmc-session
  218. echo 'done' >> /usr/local/bin/xbmc-session
  219.  
  220. chmod +x /usr/local/bin/xbmc-session
  221.  
  222. echo xbmc-session > /home/xbmc/.config/openbox/autostart.sh
  223.  
  224. chown -R xbmc:xbmc /home/xbmc
  225.        
  226.    
  227.    
  228. #SYSTEM Reboot
  229. sync
  230. /sbin/reboot[/CODE]
  231.  
  232. [B]NOTES[/B]
  233. I have tested this with Karmic minimal on an Acer Revo R1600. It needs to be tested with other versions, there are still some nice little options for ATI or NVIDIA, stable or bleeding edge also to do. I (or someone elase) has to add the extras repo back in for the supported versions.
  234.  
  235. [B]ADDITIONS[/B]
  236. I've added autologin features, so once it reboots you'll be dropped right into XBMC, I would like to fix that part so if for some reason xbmc segfaults it will automatically be re-launched. The script now determines the version of ubuntu running and adds the correct repos.[CODE]#!/bin/bash -v
  237. #------------------------------------------------------------------------------------------------------------
  238. # setupXBMC Version 0.7a - 18/11/2009
  239. # XBMC Installation script - by VirtualDanny.net
  240. # This script will provide an automatic installation of Xbox Media Center
  241. #
  242. # REQUIREMENTS:
  243. # * Clean Ubuntu Jaunty Server Installation https://help.ubuntu.com/community/Installation/MinimalCD
  244. # * XBMC Compatible Hardware http://xbmc.org/wiki/?title=XBMC_for_Linux_specific_FAQ
  245. # * Internet access
  246. # * Username must be set to 'XBMC' under Ubuntu installation
  247. #
  248. # TO-DO LIST:
  249. # * Menu to choose from Stable Release or Bleeding Edge Release
  250. # * Automatic adjustments of all volume channels in Alsamixer
  251. # * Additional tweaks
  252. # * Setup common folders and setup simple smbd
  253. # *  Give option for ATI/Nvidia Driver setup
  254. #
  255. # KNOWN BUGS:
  256. # * Installation will fail if you uncomment SVN Repositories during first time installation.
  257. #
  258. # Remember to run this script with: sudo ./setupXBMC.sh
  259. #------------------------------------------------------------------------------------------------------------
  260.  
  261. ## --[ Miscellaneous variables ]------------------------------------------------
  262.  
  263. RELEASE=`cat /etc/lsb-release | grep CODENAME | cut -d = -f2`
  264.  
  265. cd /
  266.  
  267.  
  268. ##--[ ADDING REPOSITORIES TO SOURCE LIST ]-------------------------------------------------------------------
  269. ##    Repositories make it easier to download and stay up-to-date with current releases of Linux applications
  270.  
  271. echo '#' XBMC Repositories >> /etc/apt/sources.list.d/xbmc.org.list
  272. echo '#' SVN builds are commented out. Remove comment '#' to enable.  >> /etc/apt/sources.list.d/xbmc.org.list
  273. echo '#' Please DO NOT use the SVN builds during first time installation  >> /etc/apt/sources.list.d/xbmc.org.list
  274. echo deb http://ppa.launchpad.net/team-xbmc/ppa/ubuntu/ $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list
  275. echo deb-src http://ppa.launchpad.net/team-xbmc/ppa/ubuntu/ $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list
  276. #echo '#'deb http://ppa.launchpad.net/xbmc-addons/ppa/ubuntu $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list ### Test for Karmic, if so then comment out ###
  277.  
  278. echo '#'deb http://ppa.launchpad.net/team-xbmc-svn/ppa/ubuntu $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list
  279. echo '#'deb-src http://ppa.launchpad.net/team-xbmc-svn/ppa/ubuntu $RELEASE main >> /etc/apt/sources.list.d/xbmc.org.list
  280.  
  281.  
  282.  
  283. ##--[ ADDING NVIDIA REPOISOTIRES TO SOURCE LIST ]------------------------------------------------------------
  284.  
  285. echo   >> etc/apt/sources.list
  286. echo '#' NVIDIA Repositories >> etc/apt/sources.list
  287. echo deb http://ppa.launchpad.net/nvidia-vdpau/ppa/ubuntu $RELEASE main >> etc/apt/sources.list
  288.  
  289.  
  290.  
  291. ##--[ ADDING PGP KEYS TO VERFIY VALID SOURCES ]--------------------------------------------------------------
  292.  
  293. apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 318C7509 64234534 CEC06767 0x6D975C4791E7EE5E
  294.  
  295.  
  296.  
  297. ##--[ RUNNING A SYSTEM UPDATE ]------------------------------------------------------------------------------
  298.  
  299. apt-get update
  300.  
  301.  
  302.  
  303. ##--[ INSTALL GENERIC NVIDIA GRAPHIC DRIVERS ]---------------------------------------------------------------
  304.  
  305. apt-get install linux-headers-generic nvidia-glx-185 -y
  306.  
  307.  
  308.  
  309. ##--[ INSTALLS XBMC Media Center ]---------------------------------------------------------------------------
  310.  
  311. apt-get install xbmc -y
  312. apt-get install xbmc-skin-* -y
  313. apt-get install xbmc-eventclients-* -y
  314. apt-get install xbmc-scripts-* -y
  315.  
  316.  
  317.  
  318. ##--[ INSTALL XBMC SVN Repo Installer ]----------------------------------------------------------------------
  319.  
  320. apt-get install unzip -y
  321. cd /
  322. cd /home/xbmc/.xbmc/plugins/programs
  323. wget http://xbmc-addons.googlecode.com/svn/packages/plugins/programs/SVN_Repo_Installer.zip
  324. unzip -o SVN_Repo_Installer.zip
  325. rm SVN_Repo_Installer.zip
  326. chown -R xbmc:xbmc "SVN Repo Installer"
  327.  
  328.  
  329.  
  330. ##--[ INSTALL Additional software ]--------------------------------------------------------------------------
  331.  
  332. apt-get install openbox xterm xinit x11-xserver-utils -y
  333.  
  334.  
  335.  
  336.  
  337. ## --[ INSTALL AND CONFIGURE ALSA SOUND ]--------------------------------------------------------------------
  338.  
  339. apt-get install linux-sound-base alsa-base alsa-utils -y
  340. usermod -a -G audio xbmc
  341.  
  342. echo
  343. echo AlsaMixer will now start so that you can configre your volum levels.
  344. echo
  345. echo Press 'M' to activate/deactive, Arrows to adjust volume, and ESC to save/quit.
  346. echo Press any Key to contiue, or wait 20 seconds to continue
  347. read -n1 -t20 any_key
  348.  
  349. alsamixer
  350. alsactl store 0
  351.  
  352.  
  353.  
  354. ## --[ INSTALL XBMC Bootscreen ]-----------------------------------------------------------------------------
  355.  
  356. apt-get install usplash-theme-xbmc-* -y
  357. update-alternatives --set usplash-artwork.so /usr/lib/usplash/xbmc-splash-spinner-black.so
  358. echo xres=1024 >> /etc/usplash.conf
  359. echo yres=768 >> /etc/usplash.conf
  360.  
  361. update-initramfs -u
  362.  
  363.  
  364.  
  365. ## --[ INSTALL Linux IR Remote Control Support]--------------------------------------------------------------
  366.  
  367. #apt-get install lirc -y
  368.  
  369.  
  370.  
  371. ## --[ FINAL SYSTEM UPGRADE ]--------------------------------------------------------------------------------
  372.  
  373. apt-get update
  374. apt-get upgrade -y
  375.  
  376.  
  377.  
  378. ## --[ GENERATE XORG.CONF ]----------------------------------------------------------------------------------
  379.  
  380. nvidia-xconfig -s --no-logo --force-generate
  381.  
  382.  
  383.  
  384. ## --[ ADDING HWcursor fix ]---------------------------------------------------------------------------------
  385.  
  386. sed -i '40i\    Option         "HWCursor" "False"' /etc/X11/xorg.conf
  387.  
  388.  
  389.  
  390. ## --[ ENABLE 1080p 24Hz]------------------------------------------------------------------------------------
  391.  
  392. sed -i '50i\    Option         "DynamicTwinView" "False"' /etc/X11/xorg.conf
  393.  
  394.  
  395.  
  396. ## --[ Disable Composite for better H264 acceleration ]------------------------------------------------------
  397. sed -i '30i\Section "Extensions"' /etc/X11/xorg.conf
  398. sed -i '31i\    Option         "Composite" "Disable"' /etc/X11/xorg.conf
  399. sed -i '32i\EndSection' /etc/X11/xorg.conf
  400.  
  401.  
  402.  
  403. ## --[ INSTALLING XBMC HELPERS ]-----------------------------------------------------------------------------
  404. apt-get install xbmc-live python-apt -y
  405.  
  406. ## --[ Setup autologin for user "xbmc" ]-----------------------------------------------------------------------------------
  407.  
  408. if [[ "$RELEASE" == "hardy" || "$RELEASE" == "intrepid" || "$RELEASE" == "jaunty" ]]
  409.     then
  410.         echo '# tty1 - getty' > /etc/event.d/tty1
  411.         echo '#' >> /etc/event.d/tty1
  412.         echo '# This service maintains a getty on tty1 from the point the system is' >> /etc/event.d/tty1
  413.         echo '# started until it is shut down again.' >> /etc/event.d/tty1
  414.         echo >> /etc/event.d/tty1
  415.         echo 'start on stopped rc2' >> /etc/event.d/tty1
  416.         echo 'start on stopped rc3' >> /etc/event.d/tty1
  417.         echo 'start on stopped rc4' >> /etc/event.d/tty1
  418.         echo 'start on stopped rc5' >> /etc/event.d/tty1
  419.         echo >> /etc/event.d/tty1
  420.         echo 'stop on runlevel 0' >> /etc/event.d/tty1
  421.         echo 'stop on runlevel 1' >> /etc/event.d/tty1
  422.         echo 'stop on runlevel 6' >> /etc/event.d/tty1
  423.         echo >> /etc/event.d/tty1
  424.         echo 'respawn' >> /etc/event.d/tty1
  425.         echo 'exec /bin/login -f xbmc </dev/tty1 > /dev/tty1 2>&1' >> /etc/event.d/tty1
  426. elif [ "$RELEASE" == "karmic" ]
  427.     then
  428.         echo '# tty1 - getty' > /etc/init/tty1.conf
  429.         echo '#' >> /etc/init/tty1.conf
  430.         echo '# This service maintains a getty on tty1 from the point the system is' >> /etc/init/tty1.conf
  431.         echo '# started until it is shut down again.' >> /etc/init/tty1.conf
  432.         echo >> /etc/init/tty1.conf
  433.         echo 'start on stopped rc RUNLEVEL=[2345]' >> /etc/init/tty1.conf
  434.         echo 'stop on runlevel [!2345]' >> /etc/init/tty1.conf
  435.         echo >> /etc/init/tty1.conf
  436.         echo 'respawn' >> /etc/init/tty1.conf
  437.         echo 'exec /bin/login -f xbmc </dev/tty1 > /dev/tty1 2>&1' >> /etc/init/tty1.conf
  438. fi
  439.  
  440. echo 'case "`tty`" in' > /home/xbmc/.bash_profile
  441. echo '/dev/tty1) clear && startx &>/dev/null;;' >> /home/xbmc/.bash_profile
  442. echo 'esac' >> /home/xbmc/.bash_profile
  443.  
  444. echo exec openbox-session > /home/xbmc/.xinitrc
  445.  
  446. mkdir -p /home/xbmc/.config/openbox
  447.  
  448. echo '#!/bin/bash' > /usr/local/bin/xbmc-session
  449. echo >> /usr/local/bin/xbmc-session
  450. echo 'until xbmc --standalone; do' >> /usr/local/bin/xbmc-session
  451. echo    'echo "uh oh xbmc crashed with code $?... restarting it" >$2' >> /usr/local/bin/xbmc-session
  452. echo    'sleep 5' >> /usr/local/bin/xbmc-session
  453. echo 'done' >> /usr/local/bin/xbmc-session
  454.  
  455. chmod +x /usr/local/bin/xbmc-session
  456.  
  457. echo xbmc-session > /home/xbmc/.config/openbox/autostart.sh
  458.  
  459. chown -R xbmc:xbmc /home/xbmc
  460.        
  461.    
  462.    
  463. #SYSTEM Reboot
  464. sync
  465. /sbin/reboot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement