scrypted-install.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies (Patience)"
  14. $STD apt-get -y install software-properties-common apt-utils
  15. $STD apt-get -y update
  16. $STD apt-get -y upgrade
  17. $STD apt-get install -y avahi-daemon
  18. $STD apt-get -y install \
  19. build-essential \
  20. gcc \
  21. gir1.2-gtk-3.0 \
  22. libcairo2-dev \
  23. libgirepository1.0-dev \
  24. libglib2.0-dev \
  25. libjpeg-dev \
  26. libgif-dev \
  27. libopenjp2-7 \
  28. libpango1.0-dev \
  29. librsvg2-dev \
  30. pkg-config \
  31. curl \
  32. sudo \
  33. mc \
  34. ca-certificates \
  35. gnupg
  36. msg_ok "Installed Dependencies"
  37. if [[ "$CTTYPE" == "0" ]]; then
  38. msg_info "Setting Up Hardware Acceleration"
  39. $STD apt-get -y install \
  40. va-driver-all \
  41. ocl-icd-libopencl1 \
  42. intel-opencl-icd
  43. chgrp video /dev/dri
  44. chmod 755 /dev/dri
  45. chmod 660 /dev/dri/*
  46. $STD adduser $(id -u -n) video
  47. $STD adduser $(id -u -n) render
  48. msg_ok "Set Up Hardware Acceleration"
  49. fi
  50. msg_info "Installing GStreamer (Patience)"
  51. $STD apt-get -y install \
  52. gstreamer1.0-tools \
  53. libgstreamer1.0-dev \
  54. libgstreamer-plugins-base1.0-dev \
  55. libgstreamer-plugins-bad1.0-dev \
  56. gstreamer1.0-plugins-base \
  57. gstreamer1.0-plugins-good \
  58. gstreamer1.0-plugins-bad \
  59. gstreamer1.0-plugins-ugly \
  60. gstreamer1.0-libav \
  61. gstreamer1.0-alsa
  62. msg_ok "Installed GStreamer"
  63. msg_info "Setting up Node.js Repository"
  64. mkdir -p /etc/apt/keyrings
  65. curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
  66. echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
  67. msg_ok "Set up Node.js Repository"
  68. msg_info "Installing Node.js"
  69. $STD apt-get update
  70. $STD apt-get install -y nodejs
  71. msg_ok "Installed Node.js"
  72. msg_info "Updating Python3"
  73. $STD apt-get install -y \
  74. python3 \
  75. python3-dev \
  76. python3-pip
  77. msg_ok "Updated Python3"
  78. msg_info "Installing Python3 Dependencies"
  79. $STD apt-get -y install \
  80. python3-gi \
  81. python3-gst-1.0 \
  82. python3-matplotlib \
  83. python3-numpy \
  84. python3-opencv \
  85. python3-pil \
  86. python3-setuptools \
  87. python3-skimage \
  88. python3-wheel
  89. $STD python3 -m pip install --upgrade pip
  90. $STD python3 -m pip install aiofiles debugpy typing_extensions typing
  91. msg_ok "Installed Python3 Dependencies"
  92. read -r -p "Would you like to add Coral Edge TPU support? <y/N> " prompt
  93. if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
  94. msg_info "Adding Coral Edge TPU Support"
  95. wget -qO /etc/apt/trusted.gpg.d/coral-repo.asc "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
  96. echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" >/etc/apt/sources.list.d/coral-edgetpu.list
  97. $STD apt-get -y update
  98. $STD apt-get -y install libedgetpu1-std
  99. msg_ok "Coral Edge TPU Support Added"
  100. fi
  101. msg_info "Installing Scrypted"
  102. $STD npx -y scrypted@latest install-server
  103. msg_ok "Installed Scrypted"
  104. msg_info "Creating Service"
  105. service_path="/etc/systemd/system/scrypted.service"
  106. echo "[Unit]
  107. Description=Scrypted service
  108. After=network.target
  109. [Service]
  110. User=root
  111. Group=root
  112. Type=simple
  113. ExecStart=/usr/bin/npx -y scrypted serve
  114. Restart=on-failure
  115. RestartSec=3
  116. [Install]
  117. WantedBy=multi-user.target" >$service_path
  118. $STD systemctl enable --now scrypted.service
  119. msg_ok "Created Service"
  120. motd_ssh
  121. customize
  122. msg_info "Cleaning up"
  123. $STD apt-get autoremove
  124. $STD apt-get autoclean
  125. msg_ok "Cleaned"