55 lines
1.2 KiB
Bash
Executable File
55 lines
1.2 KiB
Bash
Executable File
apt updtae;
|
|
apt upgrade -y;
|
|
apt install php ffmpeg apache2 samba -y
|
|
|
|
rm -rf /var/www/html/*
|
|
mkdir -p /var/www/download /var/www/downloader /var/www/download/queue /var/www/download/ready
|
|
|
|
cp -r downloader/* /var/www/downloader
|
|
|
|
# Create system user if it doesn't exist
|
|
sudo useradd -m -s /bin/bash shreebhattji
|
|
sudo smbpasswd -a shreebhattji
|
|
echo "foreverstreamingpartner" | sudo smbpasswd -s -a shreebhattji
|
|
sudo chmod 755 /var/www/download
|
|
|
|
# Add shreebhattji to www-data group to avoid read/write conflicts
|
|
sudo usermod -a -G www-data shreebhattji
|
|
|
|
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
|
|
|
|
cat << EOF | sudo tee -a /etc/samba/smb.conf
|
|
|
|
[download]
|
|
path = /var/www/download
|
|
browseable = yes
|
|
writable = yes
|
|
guest ok = no
|
|
read only = no
|
|
valid users = shreebhattji
|
|
EOF
|
|
|
|
sudo systemctl restart smbd nmbd
|
|
sudo systemctl enable smbd nmbd
|
|
|
|
cp transcode.sh /var/www/transcode.sh
|
|
cat << EOF | sudo tee -a /etc/systemd/system/transcode.service
|
|
|
|
[Unit]
|
|
Description=Video Transcoding Service
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=www-data
|
|
Group=www-data
|
|
WorkingDirectory=/var/www/
|
|
ExecStart=/bin/bash /var/www/transcode.sh
|
|
Restart=always
|
|
RestartSec=10
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF |