Maybe this function could be implemented using `require.file('/etc/profile.d/java.sh', contents='...', mode='0755', use_sudo=True)`?