Update mm-scripts.sh
This commit is contained in:
@@ -1127,6 +1127,78 @@ MMSETUP(){
|
||||
*) exit 0;;
|
||||
esac
|
||||
|
||||
|
||||
echo
|
||||
echo -en "${idsCL[LightCyan]}Would you like to setup an SSH mount for Plex Media, requires linux Plex server (y/N)? ${idsCL[Default]}"
|
||||
read -n 1 choice
|
||||
case "$choice" in
|
||||
[Yy])
|
||||
if [ "$(dpkg-query -W --showformat='${Status}\n' grepcidr | grep "install ok installed")" == "" ]; then
|
||||
echo
|
||||
echo -en "${idsCL[LightCyan]}Installing requirements ... ${idsCL[Default]}"
|
||||
sudo apt -y install sshfs >/dev/null 2>&1
|
||||
apt install sshfs -y
|
||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||
|
||||
fi
|
||||
|
||||
echo
|
||||
echo -en "${idsCL[LightYellow]}Plex Server IP/Hostname: ${idsCL[Default]}"
|
||||
read -e PLEXSERVER
|
||||
echo
|
||||
echo -en "${idsCL[LightYellow]}File Access Username: ${idsCL[Default]}"
|
||||
read -e PLEXUSER
|
||||
echo
|
||||
echo -en "${idsCL[LightYellow]}File Access Password: ${idsCL[Default]}"
|
||||
read -e PLEXPASSWORD
|
||||
echo
|
||||
echo -en "${idsCL[LightYellow]}Plex Media Folder location [ex. /srv/media/plex-media]: ${idsCL[Default]}"
|
||||
read -e PLEXFOLDER
|
||||
echo
|
||||
|
||||
echo -en "${idsCL[LightCyan]}Verifying local SSH key, otherwise generating one ... ${idsCL[Default]}"
|
||||
if [ ! -f /root/.ssh/id_rsa.pub]; then
|
||||
echo
|
||||
echo -e "${idsCL[LightYellow]}Generating new key, enter no password, and keep defaults: ${idsCL[Default]}"
|
||||
echo
|
||||
sudo ssh-keygen -t rsa
|
||||
fi
|
||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||
|
||||
echo -en "${idsCL[LightCyan]}Configuring and mounting ... ${idsCL[Default]}"
|
||||
if [ "${PLEXSERVER}" != "" ] && [ "${PLEXUSER}" != "" ] && [ "${PLEXPASSWORD}" != "" ] && [ "${PLEXFOLDER}" != "" ]; then
|
||||
sudo echo "sshfs#${PLEXUSER}@${PLEXSERVER}:${PLEXFOLDER} /mnt/plex-media fuse ,_netdev,reconnect,allow_other,umask=002,gid=100,uid=1000,IdentityFile=/root/.ssh/id_rsa 0 0" >> /etc/fstab
|
||||
mount -a >/dev/null 2>&1
|
||||
sleep 2s
|
||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||
echo
|
||||
echo -e "${idsCL[LightCyan]}Verify the following folder structure looks correct:${idsCL[Default]}"
|
||||
ls -l /mnt/plex-media
|
||||
echo -en "${idsCL[LightCyan]}Is the above folder your plex media (Y/n)? ${idsCL[Default]}"
|
||||
read -n 1 choice
|
||||
case "$choice" in
|
||||
[Nn]) echo -e "${idsCL[Magenta]}Missing info, configure mounting to '${idsCL[White]}/mnt/plex-media${idsCL[Magenta]}' manually${idsCL[Default]}";;
|
||||
* )
|
||||
echo
|
||||
echo -en "${idsCL[LightCyan]}Adding the file 'mounted', to the plex media folder, this file must exist for the system to know its mounted properly ... ${idsCL[Default]}"
|
||||
touch /mnt/plex-media/mounted
|
||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -e "${idsCL[Green]}Your Plex Media is now mounted, and will automatically remount at startup.${idsCL[Default]}"
|
||||
|
||||
else
|
||||
echo -e "${idsCL[Magenta]}Missing info, configure mounting to '${idsCL[White]}/mnt/plex-media${idsCL[Magenta]}' manually${idsCL[Default]}"
|
||||
fi
|
||||
|
||||
;;
|
||||
* )
|
||||
echo -e "${idsCL[Magenta]}Make sure to manually configure mounting to '${idsCL[White]}/mnt/plex-media${idsCL[Magenta]}' ${idsCL[Default]}"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
if [ "${NETCHNG}" == "true" ] || [ "${CNFG}" == "true" ]; then
|
||||
if [ "${NETCHNG}" == "true" ]; then
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user