commit 4259a7e58bdaad700c03bfbd5fbbbe0f31c9e8d0 Author: jay Date: Fri Nov 3 16:46:28 2023 +0000 effsyno diff --git a/99effsyno.sh b/99effsyno.sh new file mode 100755 index 0000000..42d4933 --- /dev/null +++ b/99effsyno.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Synology sucks so I have to do some gross hacks. +# +# Both of these are already mounted as /volumeUSBn/usbshare +# But fuck it, we'll mount them by UUID again. +mount -U 6a748cf9-e31c-430c-9017-e2709338495d /volume1/main/video +mount -U 8681ad07-6f73-4faa-9424-a84283985483 /volume1/main/gen +# Fuck their samba share configuation. +mv /etc/samba/smb.share.conf /etc/samba/smb.share.old +# We hid the file here, but it's not executable. It's not a script. +cp /usr/local/etc/rc.d/smb.sh /etc/samba/smb.share.conf +# Restart samba +synopkg restart SMBService +# Fuck Synology DSM diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2086a98 --- /dev/null +++ b/LICENSE @@ -0,0 +1 @@ +Public Domain. No warranty. diff --git a/README.md b/README.md new file mode 100644 index 0000000..df6e3da --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +# 99effsyno - a script for Synology + +DSM sucks. I hate it. I absolutely hate what it does to the underlying operating system. I hate how idiotic it is +regarding mounts. I hate how things are it's way. I mostly hate it because I didn't ask for pay for these features +and they seemingly give you no way of telling them to GTFO. + +99effsyno is just a couple of things that make the synology do *the absolute minimum* I expect to be able to do. It's +name comes from the shell script used to achieve this; 99 is just an execution priority, effsyno is fuck synology.... +because fuck DSM. + +## What sucks + +I have a USB enclosure that holds a lot of disks. By default...Synology mounts any valid partition to +`/volumeUSB*n*/usbshare` where *n* is the number assigned. It then automatically creates a samba share configuration +that shares it as usbshare*n*...where *n* is once again the drive number. + +This is all you're given. You cannot rename the share in DSM, you cannot move it. + +To complicate this, while I can achieve exactly what I want to do through standard command line hacking, these changes +don't persist between reboots. The two biggies are `/etc/fstab` and samba configurations are generated dynamically. So +the idea of just adding the UUID to `/etc/fstab` and modding `/etc/samba/smb.share.conf` the usual way are out. + +## Other Oddities + +They seem to have a lof of abstraction between you and the hardware. My internal RAID1 is actually LVM2 on /dev/md2. This +sucks because it adds another layer of useless complexity if I want to remount this later. I mean it can be done...I just +have to look all that up. It's going to happen...I'm not sticking with this hardware for long. + +I also noticed that even manual mounts from command line have a systemd service created for them. No...I want out. + +## The Hack + +While it generates a lot of configs and wipes directories out on boot, I did find one little trick that still worked: +`/usr/local/etc/rc.d` - We can stick shell scripts here, they'll run at boot, and they'll persist between reboots. + +There are two files: `99effsyno.sh` and `smb.sh`. The `smb.sh` file is not actually a script. I only gave it the .sh filename +to ensure it didn't get deleted. This is actually our replacement samba configuration. *This file should not be +x!* +The original varient had a simple exit routine and tail command to output just the .conf; this is easier. + +`99effsyno.sh` is the executable script that does the following: + + * mounts the external drives by UUID to points I specify + * replaces the samba share configuration + * reboots samba + +## At Your Own Risk + +Don't do this. I'm not taking responsibility and Synology will tell you to GTFO and never give you support again. diff --git a/smb.sh b/smb.sh new file mode 100644 index 0000000..9f5d869 --- /dev/null +++ b/smb.sh @@ -0,0 +1,57 @@ +[main] + recycle bin admin only=no + ftp disable modify=no + ftp disable download=no + write list=@administrators,dewdude + browseable=no + read list=nobody,nobody + hide unreadable=yes + win share=yes + enable recycle bin=no + invalid users=nobody,nobody + valid users=@administrators,dewdude + ftp disable list=no + edit synoacl=yes + writeable=yes + guest ok=no + path=/volume1/main + skip smb perm=yes + comment="root of RAID1" +[music] + recycle bin admin only=no + ftp disable modify=no + ftp disable download=no + write list=nobody,nobody + browseable=yes + read list=nobody,nobody + hide unreadable=no + win share=no + enable recycle bin=no + invalid users=nobody,nobody + valid users=nobody,@administrators,nobody + ftp disable list=no + edit synoacl=no + writeable=no + guest ok=yes + path=/volume1/main/music + skip smb perm=no + comment="Music Read-Only" +[video] + recycle bin admin only=no + ftp disable modify=no + ftp disable download=no + write list=nobody,nobody + browseable=yes + read list=nobody,nobody + hide unreadable=no + win share=no + enable recycle bin=no + invalid users=nobody,nobody + valid users=nobody,@administrators,nobody + ftp disable list=no + edit synoacl=no + writeable=no + guest ok=yes + path=/volume1/main/video + skip smb perm=no + comment="Video Read-Only"