97 lines
3.0 KiB
Bash
97 lines
3.0 KiB
Bash
#!/bin/bash
|
|
|
|
#Below is a script designed to guide you through the post-procedure setup for LXC. This script includes prompts for user inputs such as usernames, passwords, and IP addresses.
|
|
|
|
## Install Unattended-Upgrades Package
|
|
|
|
# Update package list and install unattended-upgrades
|
|
echo "Updating package list and installing unattended-upgrades..."
|
|
apt update
|
|
apt install unattended-upgrades -y
|
|
|
|
## Edit Configuration
|
|
|
|
# Open the configuration file for editing
|
|
echo "Opening configuration file for editing..."
|
|
nano /etc/apt/apt.conf.d/50unattended-upgrades
|
|
|
|
# Prompt user to un-comment necessary lines
|
|
echo 'Un-comment the following lines (remove "//"):'
|
|
echo '"origin=Debian,codename=${distro_codename}-updates";'
|
|
echo '"origin=Debian,codename=${distro_codename}-proposed-updates";'
|
|
echo '"origin=Debian,codename=${distro_codename},label=Debian";'
|
|
echo '"origin=Debian,codename=${distro_codename},label=Debian-Security";'
|
|
echo '"origin=Debian,codename=${distro_codename}-security,label=Debian-Security";'
|
|
|
|
# Prompt user to add email for notifications (optional)
|
|
echo "Enter your email to receive notifications about applied updates (optional):"
|
|
read email
|
|
echo "Unattended-Upgrade::Mail \"$email\";" >> /etc/apt/apt.conf.d/50unattended-upgrades
|
|
|
|
# Save and close the file
|
|
echo "Save the file by pressing [Ctrl+O] and exit with [Ctrl+X]."
|
|
|
|
# Enable automatic updates
|
|
echo "Enabling automatic updates..."
|
|
dpkg-reconfigure --priority=low unattended-upgrades
|
|
|
|
## Tailscale Installation
|
|
|
|
# Install Tailscale
|
|
echo "Installing Tailscale..."
|
|
curl -fsSL https://tailscale.com/install.sh | sh
|
|
|
|
# Start Tailscale and add to Tailscale network
|
|
echo "Starting Tailscale and adding to network..."
|
|
tailscale up
|
|
|
|
# Add autoupdate
|
|
echo "Enabling autoupdate for Tailscale..."
|
|
tailscale set --auto-update
|
|
|
|
## Add CIFS Folder to LXC
|
|
|
|
# Install cifs-utils
|
|
echo "Installing cifs-utils..."
|
|
apt install cifs-utils -y
|
|
|
|
# Create mount folder
|
|
echo "Creating mount folder for Synology Shared folder..."
|
|
mkdir /media/synolager
|
|
echo "You can rename the folder as desired, but remember it for the following steps."
|
|
|
|
# Create credential file
|
|
echo "Creating credential file..."
|
|
nano /etc/synocred
|
|
|
|
# Prompt for Synology username and password
|
|
echo "Enter your Synology username:"
|
|
read syno_user
|
|
echo "Enter your Synology password:"
|
|
read syno_pass
|
|
|
|
# Write credentials to file
|
|
echo "username=$syno_user" >> /etc/synocred
|
|
echo "password=$syno_pass" >> /etc/synocred
|
|
|
|
# Set permissions for credential file
|
|
echo "Setting permissions for credential file..."
|
|
sudo chown root: /etc/synocred
|
|
sudo chmod 600 /etc/synocred
|
|
|
|
# Edit fstab to add mount points
|
|
echo "Editing fstab to add mount points..."
|
|
nano /etc/fstab
|
|
|
|
# Prompt for Synology server IP and shared folder
|
|
echo "Enter the IP address of your Synology server:"
|
|
read syno_ip
|
|
echo "Enter the shared folder name on your Synology server:"
|
|
read shared_folder
|
|
|
|
# Write mount point information to fstab
|
|
echo "//${syno_ip}/${shared_folder} /media/synolager cifs credentials=/etc/synocred,file_mode=0777,dir_mode=0777 0 0" >> /etc/fstab
|
|
|
|
# Mount the share
|
|
echo "Mounting the share..."
|
|
sudo mount /media/synolager |