scrypted-install.sh 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. /bin/chgrp video /dev/dri
  44. /bin/chmod 755 /dev/dri
  45. /bin/chmod 660 /dev/dri/*
  46. msg_ok "Set Up Hardware Acceleration"
  47. fi
  48. msg_info "Installing GStreamer (Patience)"
  49. $STD apt-get -y install \
  50. gstreamer1.0-tools \
  51. libgstreamer1.0-dev \
  52. libgstreamer-plugins-base1.0-dev \
  53. libgstreamer-plugins-bad1.0-dev \
  54. gstreamer1.0-plugins-base \
  55. gstreamer1.0-plugins-good \
  56. gstreamer1.0-plugins-bad \
  57. gstreamer1.0-plugins-ugly \
  58. gstreamer1.0-libav \
  59. gstreamer1.0-alsa
  60. msg_ok "Installed GStreamer"
  61. msg_info "Setting up Node.js Repository"
  62. mkdir -p /etc/apt/keyrings
  63. curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
  64. 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
  65. msg_ok "Set up Node.js Repository"
  66. msg_info "Installing Node.js"
  67. $STD apt-get update
  68. $STD apt-get install -y nodejs
  69. msg_ok "Installed Node.js"
  70. msg_info "Updating Python3"
  71. $STD apt-get install -y \
  72. python3 \
  73. python3-dev \
  74. python3-pip
  75. msg_ok "Updated Python3"
  76. msg_info "Installing Python3 Dependencies"
  77. $STD apt-get -y install \
  78. python3-gi \
  79. python3-gst-1.0 \
  80. python3-matplotlib \
  81. python3-numpy \
  82. python3-opencv \
  83. python3-pil \
  84. python3-setuptools \
  85. python3-skimage \
  86. python3-wheel
  87. $STD python3 -m pip install --upgrade pip
  88. $STD python3 -m pip install aiofiles debugpy typing_extensions typing
  89. msg_ok "Installed Python3 Dependencies"
  90. read -r -p "Would you like to add Coral Edge TPU support? <y/N> " prompt
  91. if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
  92. msg_info "Adding Coral Edge TPU Support"
  93. wget -qO /etc/apt/trusted.gpg.d/coral-repo.asc "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
  94. echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" >/etc/apt/sources.list.d/coral-edgetpu.list
  95. $STD apt-get -y update
  96. $STD apt-get -y install libedgetpu1-std
  97. msg_ok "Coral Edge TPU Support Added"
  98. fi
  99. msg_info "Installing Scrypted"
  100. $STD npx -y scrypted@latest install-server
  101. msg_ok "Installed Scrypted"
  102. msg_info "Creating Service"
  103. service_path="/etc/systemd/system/scrypted.service"
  104. echo "[Unit]
  105. Description=Scrypted service
  106. After=network.target
  107. [Service]
  108. User=root
  109. Group=root
  110. Type=simple
  111. ExecStart=/usr/bin/npx -y scrypted serve
  112. Restart=on-failure
  113. RestartSec=3
  114. [Install]
  115. WantedBy=multi-user.target" >$service_path
  116. $STD systemctl enable --now scrypted.service
  117. msg_ok "Created Service"
  118. motd_ssh
  119. customize
  120. msg_info "Cleaning up"
  121. $STD apt-get autoremove
  122. $STD apt-get autoclean
  123. msg_ok "Cleaned"