Advertisement
Guest User

Displaylink-Parrot.sh

a guest
Jan 13th, 2019
1,129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.75 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # displaylink-debian:
  4. # DisplayLink driver installer for Debian and Ubuntu based Linux distributions: Debian, Ubuntu, Elementary OS,
  5. # Mint, Kali, Deepin and more! Full list of all supported platforms: http://bit.ly/2zrwz2u
  6. #
  7. # DisplayLink driver installer for Debian GNU/Linux, Ubuntu, Elementary OS, Mint, Kali, Deepin and more! Full list of all supported Linux distributions
  8. #
  9. # Blog post: http://foolcontrol.org/?p=1777
  10. #
  11. # Copyleft: Adnan Hodzic <adnan@hodzic.org>
  12. # License: GPLv3
  13.  
  14. # define the version to get as the latest available version
  15. version=`wget -q -O - https://www.displaylink.com/downloads/ubuntu | grep "download-version" | head -n 1 | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/'`
  16. # define download url to be the correct version
  17. dlurl="https://www.displaylink.com/"`wget -q -O - https://www.displaylink.com/downloads/ubuntu | grep "download-link" | head -n 1 | perl -pe '($_)=/<a href="\/([^"]+)"[^>]+class="download-link"/'`
  18. driver_dir=$version
  19.  
  20. # globalvars
  21. lsb="$(lsb_release -is)"
  22. codename="$(lsb_release -cs)"
  23. platform="$(lsb_release -ics | sed '$!s/$/ /' | tr -d '\n')"
  24. kernel="$(uname -r)"
  25. xorg_config_displaylink="/etc/X11/xorg.conf.d/20-displaylink.conf"
  26. dlm_service_check="$(systemctl is-active --quiet dlm.service && echo up and running)"
  27. vga_info="$(lspci | grep -oP '(?<=VGA compatible controller: ).*')"
  28. graphics_vendor="$(lspci -nnk | grep -i vga -A3 | grep 'in use' | cut -d ':' -f2 | sed 's/ //g')"
  29. graphics_subcard="$(lspci -nnk | grep -i vga -A3 | grep Subsystem | cut -d ' ' -f5)"
  30. providers="$(xrandr --listproviders)"
  31. xorg_vcheck="$(dpkg -l | grep "ii xserver-xorg-core" | awk '{print $3}' | sed 's/[^,:]*://g')"
  32. min_xorg=1.18.3
  33. newgen_xorg=1.19.6
  34.  
  35. separator(){
  36. sep="\n-------------------------------------------------------------------"
  37. echo -e $sep
  38. }
  39.  
  40. # Wrong key error message
  41. wrong_key(){
  42. echo -e "\n-----------------------------"
  43. echo -e "\nWrong value. Concentrate!\n"
  44. echo -e "-----------------------------\n"
  45. echo -e "Enter any key to continue"
  46. read key
  47. }
  48.  
  49. root_check(){
  50. # root check
  51. if (( $EUID != 0 ));
  52. then
  53. separator
  54. echo -e "\nMust be run as root (i.e: 'sudo $0')."
  55. separator
  56. exit 1
  57. fi
  58. }
  59.  
  60. # Dependencies
  61. dep_check() {
  62. echo -e "\nChecking dependencies\n"
  63.  
  64. if [ "$lsb" == "Deepin" ];
  65. then
  66. deps=(unzip linux-headers-$(uname -r)-deepin dkms lsb-release linux-source-deepin x11-xserver-utils wget)
  67. else
  68. deps=(unzip linux-headers-$(uname -r) dkms lsb-release linux-source x11-xserver-utils wget)
  69. fi
  70.  
  71. for dep in ${deps[@]}
  72. do
  73. if ! dpkg -s $dep | grep "Status: install ok installed" > /dev/null 2>&1
  74. then
  75. default=y
  76. read -p "$dep not found! Install? [Y/n] " response
  77. response=${response:-$default}
  78. if [[ $response =~ ^(yes|y|Y)$ ]]
  79. then
  80. if ! apt-get install $dep
  81. then
  82. echo "$dep installation failed. Aborting."
  83. exit 1
  84. fi
  85. else
  86. separator
  87. echo -e "\nCannot continue without $dep. Aborting."
  88. separator
  89. exit 1
  90. fi
  91. else
  92. echo "$dep is installed"
  93. fi
  94. done
  95. }
  96.  
  97. distro_check(){
  98. separator
  99. # RedHat
  100. if [ -f /etc/redhat-release ];
  101. then
  102. echo "This is a Redhat based distro ..."
  103. # ToDo:
  104. # Add platform type message for RedHat
  105. exit 1
  106. else
  107.  
  108. # Confirm dependencies are in place
  109. dep_check
  110.  
  111. # Unsupported platform message
  112. message(){
  113. echo -e "\n---------------------------------------------------------------\n"
  114. echo -e "Unsuported platform: $platform"
  115. echo -e "Full list of all supported platforms: http://bit.ly/2zrwz2u"
  116. echo -e ""
  117. echo -e "This tool is Open Source and feel free to extend it"
  118. echo -e "GitHub repo: https://github.com/AdnanHodzic/displaylink-debian/"
  119. echo -e "\n---------------------------------------------------------------\n"
  120. }
  121.  
  122. # Ubuntu
  123. if [ "$lsb" == "Ubuntu" ];
  124. then
  125. if [ $codename == "trusty" ] || [ $codename == "vivid" ] || [ $codename == "wily" ] || [ $codename == "xenial" ] || [ $codename == "yakkety" ] || [ $codename == "zesty" ] || [ $codename == "artful" ] || [ $codename == "bionic" ] || [ $codename == "cosmic" ] || [ $codename == "disco" ];
  126. then
  127. echo -e "\nPlatform requirements satisfied, proceeding ..."
  128. else
  129. message
  130. exit 1
  131. fi
  132. # elementary OS
  133. elif [ "$lsb" == "elementary OS" ] || [ "$lsb" == "elementary" ];
  134. then
  135. if [ $codename == "freya" ] || [ $codename == "loki" ] || [ $codename == "juno" ];
  136. then
  137. echo -e "\nPlatform requirements satisfied, proceeding ..."
  138. else
  139. message
  140. exit 1
  141. fi
  142. # Debian
  143. elif [ "$lsb" == "Debian" ];
  144. then
  145. if [ $codename == "jessie" ] || [ $codename == "stretch" ] || [ $codename == "sid" ] || [ $codename == "buster" ] || [ $codename == "n/a" ] ;
  146. then
  147. echo -e "\nPlatform requirements satisfied, proceeding ..."
  148. else
  149. message
  150. exit 1
  151. fi
  152. # Mint
  153. elif [ "$lsb" == "LinuxMint" ];
  154. then
  155. if [ $codename == "sarah" ] || [ $codename == "rosa" ] || [ $codename == "petra" ] || [ $codename == "olivia" ] || [ $codename == "serena" ] || [ $codename == "sonya" ] || [ $codename == "sylvia" ] || [ $codename == "tara" ];
  156. then
  157. echo -e "\nPlatform requirements satisfied, proceeding ..."
  158. else
  159. message
  160. exit 1
  161. fi
  162. # Kali
  163. elif [ "$lsb" == "Kali" ];
  164. then
  165. if [ $codename == "kali-rolling" ] || [ $codename == "2016.2" ] || [ $codename == "2017.3" ] || [ $codename == "2018.3" ] || [ $codename == "2018.4" ];
  166. then
  167. echo -e "\nPlatform requirements satisfied, proceeding ..."
  168. else
  169. message
  170. exit 1
  171. fi
  172. # parrot
  173. elif [ "$lsb" == "Parrot" ];
  174. then
  175. if [ $codename == "n/a" ];
  176. then
  177. echo -e "\nPlatform requirements satisfied, proceeding ..."
  178. else
  179. message
  180. exit 1
  181. fi
  182. # MX Linux
  183. elif [ "$lsb" == "MX" ];
  184. then
  185. if [ $codename == "Horizon" ];
  186. then
  187. echo -e "\nPlatform requirements satisfied, proceeding ..."
  188. else
  189. message
  190. exit 1
  191. fi
  192. # BunsenLabs
  193. elif [ "$lsb" == "BunsenLabs" ];
  194. then
  195. if [ $codename == "helium" ];
  196. then
  197. echo -e "\nPlatform requirements satisfied, proceeding ..."
  198. else
  199. message
  200. exit 1
  201. fi
  202. else
  203. message
  204. exit 1
  205. fi
  206. fi
  207. }
  208.  
  209. sysinitdaemon_get(){
  210. sysinitdaemon="systemd"
  211.  
  212. if [ "$lsb" == "Ubuntu" ];
  213. then
  214. if [ $codename == "trusty" ];
  215. then
  216. sysinitdaemon="upstart"
  217. fi
  218. # Elementary
  219. elif [ "$lsb" == "elementary OS" ];
  220. then
  221. if [ $codename == "freya" ];
  222. then
  223. sysinitdaemon="upstart"
  224. fi
  225. fi
  226.  
  227. echo $sysinitdaemon
  228. }
  229.  
  230. clean_up(){
  231. # remove obsolete/redundant files which can only hamper reinstalls
  232.  
  233. separator
  234. echo -e "\nPerforming clean-up"
  235.  
  236. # go back to displaylink-debian
  237. cd - &> /dev/null
  238.  
  239. if [ -f "DisplayLink_Ubuntu_$version.zip" ]
  240. then
  241. echo "Removing redundant: \"DisplayLink_Ubuntu_$version.zip\" file"
  242. rm "DisplayLink_Ubuntu_$version.zip"
  243. fi
  244.  
  245. if [ -d $driver_dir ]
  246. then
  247. echo "Removing redundant: \"$driver_dir\" directory"
  248. rm -r $driver_dir
  249. fi
  250.  
  251. }
  252.  
  253. setup_complete(){
  254. ack=${ack:-$default}
  255. default=N
  256.  
  257. read -p "Reboot now? [y/N] " ack
  258. ack=${ack:-$default}
  259.  
  260. for letter in "$ack"; do
  261. if [[ "$letter" == [Yy] ]];
  262. then
  263. echo "Rebooting ..."
  264. reboot
  265. elif [[ "$letter" == [Nn] ]];
  266. then
  267. echo -e "\nReboot postponed, changes won't be applied until reboot"
  268. else
  269. wrong_key
  270. fi
  271. done
  272. }
  273.  
  274. download() {
  275. local dlfileid=$(echo $dlurl | perl -pe '($_)=/.+\?id=(\d+)/')
  276.  
  277. echo -en "\nPlease read the Software License Agreement\navailable at $dlurl\nand accept here: [Y]es or [N]o: "
  278. read ACCEPT
  279. case $ACCEPT in
  280. y*|Y*)
  281. echo -e "\nDownloading DisplayLink Ubuntu driver:\n"
  282. wget -O DisplayLink_Ubuntu_${version}.zip "--post-data=fileId=$dlfileid&accept_submit=Accept" $dlurl
  283. # make sure we got the file downloadet before continueing
  284. if [ $? -ne 0 ]
  285. then
  286. echo -e "\nUnable to download Displaylink driver\n"
  287. exit
  288. fi
  289. ;;
  290. *)
  291. echo "Can't download the driver without accepting the license agreement!"
  292. exit 1
  293. ;;
  294. esac
  295. }
  296.  
  297. install(){
  298. separator
  299. download
  300.  
  301. # prep
  302. mkdir $driver_dir
  303.  
  304. separator
  305. echo -e "\nPreparing for install\n"
  306. test -d $driver_dir && /bin/rm -Rf $driver_dir
  307. unzip -d $driver_dir DisplayLink_Ubuntu_${version}.zip
  308. chmod +x $driver_dir/displaylink-driver-${version}.[0-9]*.run
  309. ./$driver_dir/displaylink-driver-${version}.[0-9]*.run --keep --noexec
  310. mv displaylink-driver-${version}.[0-9]*/ $driver_dir/displaylink-driver-${version}
  311.  
  312. # get sysinitdaemon
  313. sysinitdaemon=$(sysinitdaemon_get)
  314.  
  315. # modify displaylink-installer.sh
  316. sed -i "s/SYSTEMINITDAEMON=unknown/SYSTEMINITDAEMON=$sysinitdaemon/g" $driver_dir/displaylink-driver-${version}/displaylink-installer.sh
  317.  
  318. if [ "$lsb" == "Debian" ] || [ "$lsb" == "Kali" ] || [ "$lsb" == "Deepin" ] || [ "$lsb" == "BunsenLabs" ];
  319. then
  320. sed -i 's#/lib/modules/$KVER/build/Kconfig#/lib/modules/$KVER/build/scripts/kconfig/conf#g' $driver_dir/displaylink-driver-${version}/displaylink-installer.sh
  321. ln -s /lib/modules/$(uname -r)/build/Makefile /lib/modules/$(uname -r)/build/Kconfig
  322. fi
  323.  
  324. # install
  325. separator
  326. echo -e "\nInstalling driver version: $version\n"
  327. # original install before newgen_kernel_patch
  328. # cd $driver_dir/displaylink-driver-${version} && ./displaylink-installer.sh install
  329. cd $driver_dir/displaylink-driver-${version}
  330.  
  331. # Broken after update to 4.19 kernel (issue: #191)
  332. #
  333. # check kernel version
  334. kernel_check="$(uname -r | egrep -o '[0-9]+\.[0-9]+')"
  335.  
  336. kernel_patch(){
  337. # extract evdi src
  338. evdi_src_ver="$(echo evdi-* | cut -d'-' -f2)"
  339. evdi_src="evdi-$evdi_src_ver-src"
  340. mkdir $evdi_src
  341.  
  342. evdi_patch_version=v1.5.1
  343. # get version v1.5.1 of evdi. Note: the version could also be "devel" or "master"
  344. wget https://github.com/DisplayLink/evdi/archive/$evdi_patch_version.tar.gz -O evdi-$evdi_patch_version.tar.gz
  345. # extract evdi to $evdi_src
  346. tar -xzvf evdi-$evdi_patch_version.tar.gz -C $evdi_src --strip 1
  347. # compress new $evdi_src.tar.gz from $evdi_src/module - this replaces evdi from displaylink-driver package
  348. tar -zcvf $evdi_src.tar.gz -C $evdi_src/module .
  349. }
  350.  
  351. function ver2int {
  352. echo "$@" | awk -F "." '{ printf("%03d%03d%03d\n", $1,$2,$3); }';
  353. }
  354.  
  355. # patch evdi depending on kernel version
  356. if [ "$(ver2int $kernel_check)" -ge "$(ver2int '4.19')" ];
  357. then
  358. echo "detected: $kernel_check, patching\n"
  359. kernel_patch
  360. ./displaylink-installer.sh install
  361. else
  362. ./displaylink-installer.sh install
  363. fi
  364.  
  365. }
  366.  
  367. # post install
  368. post_install(){
  369. separator
  370. echo -e "\nPerforming post install steps\n"
  371.  
  372. # fix: issue #42 (dlm.service can't start)
  373. # note: for this to work libstdc++6 package needs to be installed from >= Stretch
  374. if [ "$lsb" == "Debian" ] || [ "$lsb" == "Kali" ];
  375. then
  376. ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /opt/displaylink/libstdc++.so.6
  377. fi
  378.  
  379. # fix: issue #36 (can't enable dlm.service)
  380. sed -i "/RestartSec=5/a[Install]\nWantedBy=multi-user.target" /lib/systemd/system/dlm.service
  381. sudo systemctl enable dlm.service
  382.  
  383. # setup xorg.conf depending on graphics card
  384. modesetting(){
  385. test ! -d /etc/X11/xorg.conf.d && mkdir -p /etc/X11/xorg.conf.d
  386. drv=$(lspci -nnk | grep -i vga -A3 | grep 'in use'|cut -d":" -f2|sed 's/ //g')
  387. cardsub=$(lspci -nnk | grep -i vga -A3|grep Subsystem|cut -d" " -f5)
  388.  
  389. # intel displaylink xorg.conf
  390. xorg_intel(){
  391. cat > $xorg_config_displaylink <<EOL
  392. Section "Device"
  393. Identifier "Intel"
  394. Driver "intel"
  395. EndSection
  396. EOL
  397. }
  398.  
  399. # modesetting displaylink xorg.conf
  400. xorg_modesetting(){
  401. cat > $xorg_config_displaylink <<EOL
  402. Section "Device"
  403. Identifier "DisplayLink"
  404. Driver "modesetting"
  405. Option "PageFlip" "false"
  406. EndSection
  407. EOL
  408. }
  409.  
  410. # modesetting displaylink xorg.conf
  411. xorg_modesetting_newgen(){
  412. cat > $xorg_config_displaylink <<EOL
  413. Section "OutputClass"
  414. Identifier "DisplayLink"
  415. MatchDriver "evdi"
  416. Driver "modesetting"
  417. Option "AccelMethod" "none"
  418. EndSection
  419. EOL
  420. }
  421.  
  422. nvidia_pregame(){
  423. xsetup_loc="/usr/share/sddm/scripts/Xsetup"
  424.  
  425. nvidia_xrandr(){
  426. cat >> $xsetup_loc << EOL
  427.  
  428. xrandr --setprovideroutputsource modesetting NVIDIA-0
  429. xrandr --auto
  430. EOL
  431. }
  432.  
  433. # make necessary changes to Xsetup
  434. if ! grep -q "setprovideroutputsource modesetting" $xsetup_loc
  435. then
  436. mv $xsetup_loc $xsetup_loc.org.bak
  437. echo -e "\nMade backup of: $xsetup_loc file"
  438. echo -e "\nLocation: $xsetup_loc.org.bak"
  439. nvidia_xrandr
  440. echo -e "Wrote changes to $xsetup_loc"
  441. fi
  442.  
  443. # xorg.conf ops
  444. xorg_config="/etc/x11/xorg.conf"
  445. usr_xorg_config_displaylink="/usr/share/X11/xorg.conf.d/20-displaylink.conf"
  446.  
  447. if [ -f $xorg_config ];
  448. then
  449. mv $xorg_config $xorg_config.org.bak
  450. echo -e "\nMade backup of: $xorg_config file"
  451. echo -e "\nLocation: $xorg_config.org.bak"
  452. fi
  453.  
  454. if [ -f $xorg_config_displaylink ];
  455. then
  456. mv $xorg_config_displaylink $xorg_config_displaylink.org.bak
  457. echo -e "\nMade backup of: $xorg_config_displaylink file"
  458. echo -e "\nLocation: $xorg_config_displaylink.org.bak"
  459. fi
  460.  
  461. if [ -f $usr_xorg_config_displaylink ];
  462. then
  463. mv $usr_xorg_config_displaylink $usr_xorg_config_displaylink.org.bak
  464. echo -e "\nMade backup of: $usr_xorg_config_displaylink file"
  465. echo -e "\nLocation: $usr_xorg_config_displaylink.org.bak"
  466. fi
  467. }
  468.  
  469. # nvidia displaylink xorg.conf (issue: 176)
  470. xorg_nvidia(){
  471. cat > $xorg_config_displaylink <<EOL
  472. Section "ServerLayout"
  473. Identifier "layout"
  474. Screen 0 "nvidia"
  475. Inactive "intel"
  476. EndSection
  477.  
  478. Section "Device"
  479. Identifier "intel"
  480. Driver "modesetting"
  481. Option "AccelMethod" "None"
  482. EndSection
  483.  
  484. Section "Screen"
  485. Identifier "intel"
  486. Device "intel"
  487. EndSection
  488.  
  489. Section "Device"
  490. Identifier "nvidia"
  491. Driver "nvidia"
  492. Option "ConstrainCursor" "off"
  493. EndSection
  494.  
  495. Section "Screen"
  496. Identifier "nvidia"
  497. Device "nvidia"
  498. Option "AllowEmptyInitialConfiguration" "on"
  499. Option "IgnoreDisplayDevices" "CRT"
  500. EndSection
  501. EOL
  502. }
  503.  
  504. # amd displaylink xorg.conf
  505. xorg_amd(){
  506. cat > $xorg_config_displaylink <<EOL
  507. Section "Device"
  508. Identifier "AMDGPU"
  509. Driver "amdgpu"
  510. Option "PageFlip" "false"
  511. EndSection
  512. EOL
  513. }
  514.  
  515. # set xorg for Intel cards
  516. if [ "$drv" == "i915" ];
  517. then
  518. # set xorg modesetting for Intel cards (issue: 179, 68, 88, 192)
  519. if [ "$cardsub" == "v2/3rd" ] || [ "$cardsub" == "[HD" ] || [ "$cardsub" == "620" ] || [ "$cardsub" == "540" ];
  520. then
  521. if [ "$(ver2int $xorg_vcheck)" -gt "$(ver2int $newgen_xorg)" ];
  522. then
  523. # temporarily disabled (issue: 200)
  524. #xorg_modesetting_newgen
  525. #else
  526. xorg_modesetting
  527. fi
  528. # generic intel
  529. else
  530. xorg_intel
  531. fi
  532. # set xorg for Nvidia cards (issue: 176, 179)
  533. elif [ "$drv" == "nvidia" ];
  534. then
  535. nvidia_pregame
  536. xorg_nvidia
  537. # set xorg for AMD cards (issue: 180)
  538. elif [ "$drv" == "amdgpu" ];
  539. then
  540. xorg_amd
  541. # default xorg modesetting
  542. else
  543. if [ "$(ver2int $xorg_vcheck)" -gt "$(ver2int $newgen_xorg)" ];
  544. then
  545. # temporarily disabled (issue: 200)
  546. # xorg_modesetting_newgen
  547. #else
  548. xorg_modesetting
  549. fi
  550. fi
  551.  
  552. echo -e "Wrote X11 changes to: $xorg_config_displaylink"
  553. chown root: $xorg_config_displaylink
  554. chmod 644 $xorg_config_displaylink
  555. }
  556.  
  557. function ver2int {
  558. echo "$@" | awk -F "." '{ printf("%03d%03d%03d\n", $1,$2,$3); }';
  559. }
  560.  
  561. # depending on X11 version start modesetting func
  562. if [ "$(ver2int $xorg_vcheck)" -gt "$(ver2int $min_xorg)" ];
  563. then
  564. echo "Setup DisplayLink xorg.conf depending on graphics card"
  565. modesetting
  566. else
  567. echo "No need to disable PageFlip for modesetting"
  568. fi
  569. }
  570.  
  571. # uninstall
  572. uninstall(){
  573. separator
  574. echo -e "\nUninstalling ...\n"
  575.  
  576. # displaylink-installer uninstall
  577. if [ "$lsb" == "Debian" ] || [ "$lsb" == "Kali" ] || [ "$lsb" == "Deepin" ] || [ "$lsb" == "BunsenLabs" ];
  578. then
  579. rm /lib/modules/$(uname -r)/build/Kconfig
  580. fi
  581.  
  582. # evdi module still in use (issue 178, 192)
  583. evdi_version="$(dkms status evdi|grep -o '4.4.[[:digit:]]*')"
  584. dkms remove evdi/$evdi_version --all
  585. evdi_dir="/usr/src/evdi-$evdi_version"
  586. if [ -d "$evdi_dir" ];
  587. then
  588. rm -rf $evdi_dir
  589. fi
  590.  
  591. # disabled and remove dlm.service
  592. systemctl disable dlm.service
  593. rm -f /lib/systemd/system/dlm.service
  594.  
  595. # double check if evdi module is loaded, if yes remove it
  596. if lsmod | grep "evdi" &> /dev/null ; then
  597. echo "Removing evdi module"
  598. rmmod evdi
  599. fi
  600.  
  601. # remove modesetting file
  602. if [ -f $xorg_config_displaylink ]
  603. then
  604. echo "Removing Displaylink Xorg config file"
  605. rm $xorg_config_displaylink
  606. fi
  607.  
  608. }
  609.  
  610. # debug: get system information for issue debug
  611. debug(){
  612. separator
  613. echo -e "\nStarting Debug ...\n"
  614.  
  615. ack=${ack:-$default}
  616. default=N
  617.  
  618. read -p "Did you read Post Installation Guide? http://bit.ly/2TbZleK [y/N] " ack
  619. ack=${ack:-$default}
  620.  
  621. for letter in "$ack"; do
  622. if [[ "$letter" == [Yy] ]];
  623. then
  624. echo ""
  625. continue
  626. elif [[ "$letter" == [Nn] ]];
  627. then
  628. echo -e "\nPlease read Post Installation Guide: http://bit.ly/2TbZleK\n"
  629. exit 1
  630. else
  631. wrong_key
  632. fi
  633. done
  634.  
  635. read -p "Did you read Troubleshooting most common issues? http://bit.ly/2Rofd0x [y/N] " ack
  636. ack=${ack:-$default}
  637.  
  638. for letter in "$ack"; do
  639. if [[ "$letter" == [Yy] ]];
  640. then
  641. echo -e ""
  642. continue
  643. elif [[ "$letter" == [Nn] ]];
  644. then
  645. echo -e "\nPlease read Troubleshooting most common issues: http://bit.ly/2Rofd0x\n"
  646. exit 1
  647. else
  648. wrong_key
  649. fi
  650. done
  651.  
  652. evdi_version="$(systemctl status dlm.service | grep -o '4.4.[[:digit:]]*')"
  653. echo -e "--------------- Linux system info ----------------\n"
  654. echo -e "Distro: $lsb"
  655. echo -e "Release: $codename"
  656. echo -e "Kernel: $kernel"
  657. echo -e "\n---------------- DisplayLink info ----------------\n"
  658. echo -e "Driver version: $version"
  659. echo -e "EVDI service status: $dlm_service_check"
  660. echo -e "EVDI service version: $evdi_version"
  661. echo -e "\n------------------ Graphics card -----------------\n"
  662. echo -e "Vendor: $graphics_vendor"
  663. echo -e "Subsystem: $graphics_subcard"
  664. echo -e "VGA: $vga_info"
  665. echo -e "X11 version: $xorg_vcheck"
  666. echo -e "\n-------------- DisplayLink xorg.conf -------------\n"
  667. echo -e "File: $xorg_config_displaylink"
  668. echo -e "Contents:\n $(cat $xorg_config_displaylink)"
  669. echo -e "\n-------------------- Monitors --------------------\n"
  670. echo -e "$providers"
  671. }
  672.  
  673. # interactively asks for operation
  674. ask_operation(){
  675. echo -e "\n--------------------------- displaylink-debian -------------------------------"
  676. echo -e "\nDisplayLink driver installer for Debian and Ubuntu based Linux distributions:\n"
  677. echo -e "* Debian, Ubuntu, Elementary OS, Mint, Kali, Parrot and many more!"
  678. echo -e "* Full list of all supported platforms: http://bit.ly/2zrwz2u"
  679. echo -e "* When submitting a new issue, include Debug information"
  680. echo -e "\nOptions:\n"
  681. read -p "[I]nstall
  682. [D]ebug
  683. [R]e-install
  684. [U]ninstall
  685. [Q]uit
  686.  
  687. Select a key: [i/d/r/u/q]: " answer
  688. }
  689.  
  690. root_check
  691.  
  692. if [[ -z "${1}" ]];
  693. then
  694. ask_operation
  695. else
  696. case "${1}" in
  697. "--install")
  698. answer="i"
  699. ;;
  700. "--uninstall")
  701. answer="u"
  702. ;;
  703. "--reinstall")
  704. answer="r"
  705. ;;
  706. "--debug")
  707. answer="d"
  708. ;;
  709. *)
  710. answer="n"
  711. ;;
  712. esac
  713. fi
  714.  
  715. if [[ $answer == [Ii] ]];
  716. then
  717. distro_check
  718. install
  719. post_install
  720. clean_up
  721. separator
  722. echo -e "\nInstall complete, please reboot to apply the changes"
  723. echo -e "After reboot, make sure to consult post-install guide! http://bit.ly/2TbZleK"
  724. setup_complete
  725. separator
  726. echo ""
  727. elif [[ $answer == [Uu] ]];
  728. then
  729. distro_check
  730. uninstall
  731. clean_up
  732. separator
  733. echo -e "\nUninstall complete, please reboot to apply the changes"
  734. setup_complete
  735. separator
  736. echo ""
  737. elif [[ $answer == [Rr] ]];
  738. then
  739. distro_check
  740. uninstall
  741. clean_up
  742. distro_check
  743. install
  744. post_install
  745. clean_up
  746. separator
  747. echo -e "\nInstall complete, please reboot to apply the changes"
  748. echo -e "After reboot, make sure to consult post-install guide! http://bit.ly/2TbZleK"
  749. setup_complete
  750. separator
  751. echo ""
  752. elif [[ $answer == [Dd] ]];
  753. then
  754. debug
  755. separator
  756. echo -e "\nUse this information when submitting an issue (http://bit.ly/2GLDlpY)"
  757. separator
  758. echo ""
  759. elif [[ $answer == [Qq] ]];
  760. then
  761. separator
  762. echo ""
  763. exit 0
  764. else
  765. echo -e "\nWrong key, aborting ...\n"
  766. exit 1
  767. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement