1 The documentaion can be found here:
2 https://wiki.tizen.org/wiki/IVI/artem-setup-ivi
4 Some coding style notes for the shell scripts
5 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 1. Do not use bashisms, install 'dash' and use it to verify that the
8 scripts are free of bashisms. Please, read this article:
9 https://wiki.ubuntu.com/DashAsBinSh
11 2. Do not use all capitals for variables
13 3. For shared files, prefix all symbols which are not supposed to be
14 used from outside with "__".
16 4. Be consistent with my style. If you see that something makes no sense
17 or could be improved, change that globally.
19 5. All the error and verbose output should go to stderr
21 6. Use -- to separate options and arguments, this is generally a good defensive
22 programming practice to make sure no one tricks your commands by adding
23 options to what should be arguments. E.g., 'rm $file' can be made 'rm -rf /"
24 if one makes "$file" to be "-rf /" somehow. 'rm -- $file' would catch this.
26 7. Distinguish between options and arguments:
27 command --option1 --option2 argument1 argument2
28 Options are optional, do add "mandatory" options.
29 Arguments are mandatory, do not add optional arguments.
31 8. Quote all the variables. This is important for everything which comes from
32 outside. But it is better to have this as a habit, jsut quote everything
33 starting with "$". Well, there exceptions sometimes, e.g., see how $verbose
34 is used. But these are rare. You can google for shell script attack vectors,
35 and notice that many of them are about giving tricky inputs with "$" signs,
36 spaces, and so on. Most of them are based on the fact that people do not
39 9. Do not use "echo", use "printf". Well, "echo" is OK to use with "controlled"
40 data, but it is easier to just always use "printf" to maintain good
41 discipline. E.g., read this for some insight about why "printf" is safer:
42 http://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo