Skip to content

Instantly share code, notes, and snippets.

@mixa3607
Last active February 27, 2022 13:19
Show Gist options
  • Save mixa3607/0297ae24c32588e12333fc1983bd6d91 to your computer and use it in GitHub Desktop.
Save mixa3607/0297ae24c32588e12333fc1983bd6d91 to your computer and use it in GitHub Desktop.
Patch py file that generate daemon.json file in truenas scale
#!/bin/sh
#Author: @mixa3607
#Desc: Patch py file that generate daemon.json file in truenas scale. Tested on TrueNAS-SCALE-22.02-RC.2
#Gist: https://gist.github.com/mixa3607/0297ae24c32588e12333fc1983bd6d91
#HowTo: Place file in any persistent dir and add entry to "System Settings" => "Advanced" => "Init/Shutdown Scripts"
OUTPUT=/tmp/init.log
#OUTPUT=/dev/stdout #for debug#
DOCKERPY_TARGET="/usr/lib/python3/dist-packages/middlewared/etc_files/docker.py"
echo "Patching docker.py" >> "$OUTPUT"
patch "$DOCKERPY_TARGET" << EOF
47,48c47,48
< 'iptables': False,
< 'bridge': 'none',
---
> 'iptables': True,
> 'bridge': '',
EOF >> "$OUTPUT"
echo "After patch" >> "$OUTPUT"
cat "$DOCKERPY_TARGET" >> "$OUTPUT"
echo "Done" >> "$OUTPUT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment