-
In principle, the standard location for user-installed scripts should be in Has anyone else solved this well? Well enough to document for other users, such that it covers general cases? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 40 replies
-
The way I see it, there are 2 problems:
Issue 1: Privileged invocationWe either need (a) a
I like the user-side simplicity of (a), for the dev side, (c) seems rather simple. Issue 2: PersistenceI'll just add that ther requirement is specifically in TrueNAS SCALE - which gives us OS access (including root), but only an immutable read-only OS root file-system. I say, let's have the script do a double-take autodetection and installation - similar to what it does today, utilizing ZFS User Properties. We can still use environment or cli arguments, but use a similar approach to iX, by storing metadata in a location we designate, and then rely on that data exclusively. As long as we set the properties at the root of the pool, I believe we shouldn't hit any performance snags. Example:
So, order of detection:
As long as there is only 1 such pool, we should be good to go. Example on setting the prop: # zfs set "com.github.jip-hop.jailmaker:jails_path=mydata/myjails" tank reading the props ( # zfs get -Hd0 -s local "com.github.jip-hop.jailmaker:jails_path"
tank com.github.jip-hop.jailmaker:jails_path mydata/myjails local Followed by: # sudo zfs get -Hd0 "mountpoint" tank/mydata/myjails
tank/mydata/myjails mountpoint /mnt/tank/mydata/myjails default |
Beta Was this translation helpful? Give feedback.
-
OK… I've pored through the latest Recommendation
How to
Always edit
The relevant line to edit is fairly clear.
Extend the path with Then, for example, if you install
Done and done. 🥳 Also consideredTrying to chart a decision tree through all the permutations of
I don't think there's a good/responsible way to explain how to use The default Having But Debian's choice of Hit meHave I missed anything? |
Beta Was this translation helpful? Give feedback.
-
What do you think of this as a general solution? Post Init Command: mkdir -p /root/usr-local-bin && mount -o remount,rw /usr && mount -t overlay overlay -o lowerdir=/root/usr-local-bin:/usr/local/bin /usr/local/bin; mount -o remount,ro /usr This will temporarily remount Since This will survive reboots, updates and upgrades. I find this a more direct way to make executables globally available then by changing It's quite elegant if you ask me. 🙂 But I agree there needs to be an officially documented (in the TrueNAS docs) way to do these kinds of things as you suggest. |
Beta Was this translation helpful? Give feedback.
What do you think of this as a general solution?
Post Init Command:
This will temporarily remount
/usr
as read-write, then overlay mount/root/usr-local-bin
underneath/usr/local/bin
and remount/usr
back as readonly as if nothing happend. Put your executables inside/root/usr-local-bin
and they shall be available globally for any user, including for use withsudo
.Since
/usr/local/bin
is the last dir in the defaultsecure_path
it can't override any of the commands in directories that come before it. Since/root/usr-lo…