erase of Exports File
-
I don’t understand the problem.
-
@Tom-Elliott said:
I don’t understand the problem.
He have custom sharings in his “exports” file which are overwrite after each FOG update, I think lol
-
Still don’t understand.
-
When i do an install or udapte fog it’s make a new exports file and i 've some share on my dev server and i have to edit the exports file after each update (it’s not really a probleme just a question).
-
Can you be more specific? I’m not understanding.
What export file is being erased?
-
When i run the installer the file etc/exports is replaced by the following entries:
/images *(ro,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=0)
/images/dev *(rw,async,no_wdelay,no_subtree_check,no_root_squash,insecure,fsid=1)all other entries was deleted.
I’m sorry, I’m struggling to make me understand.I don’t speak english very well
Oliver
-
Yes, the installer script creates a new empty (overwrites) exports-file. It’s not easy to write fail-proof script code that checks to see if other entries (or old FOG entries) are in that file. So we better create a clean new one. If you have a good idea how to better do this you are more than welcome to give us a hint.
Please make a backup copy of your file before running the installer. @Tom-Elliott Well, maybe we should do that like we do with /tftpboot…
-
@Uncle-Frank said:
Yes, the installer script creates a new empty (overwrites) exports-file. It’s not easy to write fail-proof script code that checks to see if other entries (or old FOG entries) are in that file. So we better create a clean new one. If you have a good idea how to better do this you are more than welcome to give us a hint.
Please make a backup copy of your file before running the installer. @Tom-Elliott Well, maybe we should do that like we do with /tftpboot…
Maybe use comments before/after the fog exports, like that :
/custom/config1 #FOG settings /images *(ro,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=0) /images/dev *(rw,async,no_wdelay,no_subtree_check,no_root_squash,insecure,fsid=1) #END FOG settings /custom/config2
On each update store all other lines not in these comments
-
How about having the installer move any existing file to /etc/exports.old ?
-
Hi
In your script before add share it can be thisif [ -f $nfsconfig ] then if [ $(grep -c "##FOG-SHARE-START##" $nfsconfig) -ne 0 ] then sed -in '/##FOG-SHARE-START##/,/##FOG-END-SHARE##/{//d;D}' $nfsconfig fi fi
And add this configureNFS()
echo -e "##FOG-SHARE-START##\n$storageLocation *(ro,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=0)\n$storageLocation/dev *(rw,async,no_wdelay,no_subtree_check,no_root_squash,insecure,fsid=1)\n##FOG-END-SHARE##" >> "$nfsconfig";
I am not tested for the moment
Olivier
-
Hi
I have tested this norming and it’s worrking for my case.Olivier
-
What’s the actual code?
-
@Tom-Elliott has added a new option in /opt/fog/.fogsettings
blexports=
1 means to rebuild /etc/exports
0 means do not rebuild it.https://forums.fogproject.org/topic/5975/dhcpd-conf-file-gets-rebuilt-on-every-install
-
@Tom-Elliott In lib/common/functions.sh
configureNFS() { echo -e "$storageLocation *(ro,sync,no_wdelay,no_subtree_check,insecure_locks,no_root_squash,insecure,fsid=0)\n$storageLocation/dev *(rw,async,no_wdelay,no_subtree_check,no_root_squash,insecure,fsid=1)" > "$nfsconfig"; dots "Setting up and starting RPCBind"; if [ "$systemctl" == "yes" ]; then systemctl enable rpcbind.service >/dev/null 2>&1 && \ systemctl restart rpcbind.service >/dev/null 2>&1 && \ systemctl status rpcbind.service >/dev/null 2>&1 elif [ "$osid" -eq 2 ]; then true else chkconfig rpcbind on >/dev/null 2>&1 && \ $initdpath/rpcbind restart >/dev/null 2>&1 && \ $initdpath/rpcbind status >/dev/null 2>&1 fi errorStat $? dots "Setting up and starting NFS Server..." for nfsItem in $nfsservice; do if [ "$systemctl" == "yes" ]; then systemctl enable $nfsItem >/dev/null 2>&1 && \ systemctl restart $nfsItem >/dev/null 2>&1 && \ systemctl status $nfsItem >/dev/null 2>&1 else if [ "$osid" == 2 ]; then sysv-rc-conf $nfsItem on >/dev/null 2>&1 && \ $initdpath/nfs-kernel-server stop >/dev/null 2>&1 && \ $initdpath/nfs-kernel-server start >/dev/null 2>&1 else chkconfig $nfsItem on >/dev/null 2>&1 && \ $initdpath/$nfsItem restart >/dev/null 2>&1 && \ $initdpath/$nfsItem status >/dev/null 2>&1 fi fi if [ "$?" -eq 0 ]; then break fi done errorStat $? }
-
@Wayne-Workman said:
@Tom-Elliott has added a new option in /opt/fog/.fogsettings
blexports=
1 means to rebuild /etc/exports
0 means do not rebuild it.https://forums.fogproject.org/topic/5975/dhcpd-conf-file-gets-rebuilt-on-every-install
It’ll be better to have it automatically in the installer like the @olivierl solution.
-
@ch3i much appreciated but I meant the code for the sed statement not the function code that needs to be altered.
-
@Tom-Elliott Code snippet was provided by olivierl in this thread (post number 11).
-
@Tom-Elliott said:
@ch3i much appreciated but I meant the code for the sed statement not the function code that needs to be altered.
https://forums.fogproject.org/topic/5952/erase-of-exports-file/11
-
Hi,
It’'s work but before use it i think i need to verify before if the line "/image and image/dev"exist
To make the transition from a version that does not contain ##Fog–share-start##
to avoid having 2 times sharing appear in the file -
Oh now I see what @olivierl did here… added those tags to the top and bottom.
##FOG-SHARE-START##
##FOG-END-SHARE##That’s pretty smart.
But I don’t think the new
blexports
setting should be undone, but I think that this could be added…
In fact something similar is not a bad idea for all of the conf files that fog touches…