Skip to content

Commit

Permalink
[docs] Updated "Including additional files" section in OpenWrt page
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Feb 10, 2016
1 parent f780964 commit 443dfcf
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions docs/source/backends/openwrt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -229,28 +229,8 @@ The following example code will generate an archive with one file in ``/etc/cron
{
"path": "/etc/crontabs/root",
# new lines must be escaped with ``\n``
"contents": '* * * * * echo "test" > /etc/testfile\n* * * * * echo "test2" > /etc/testfile2'
}
]
})
o.generate()
List of file lines example
~~~~~~~~~~~~~~~~~~~~~~~~~~

If you don't want to escape new lines with ``\n``, you can represent lines in the ``contents``
key with a list:

.. code-block:: python
o = OpenWrt({
"files": [
{
"path": "/etc/crontabs/root",
"contents": [
'* * * * * echo "test" > /etc/testfile',
'* * * * * echo "test2" > /etc/testfile2'
]
"contents": '* * * * * echo "test" > /etc/testfile\n'
'* * * * * echo "test2" > /etc/testfile2'
}
]
})
Expand All @@ -268,10 +248,8 @@ The following example will create an executable shell script:
{
"path": "/bin/hello_world",
"mode": "0755",
"contents": [
'#!/bin/sh',
'echo "Hello world!"'
]
"contents": "#!/bin/sh\n"
"echo 'Hello world'"
}
]
})
Expand Down

0 comments on commit 443dfcf

Please sign in to comment.