FIXME - incomplete ======dCore tc-functions Script Overview====== The /etc/init.d/tc-functions script consists of almost 400 lines of code. It contains numerous functions and is utilized heavily by both Tiny Core and dCore. This review references older [[dcore:tc-functions source 20150429|tc-functions source code]], which has likely received updates since the review. =====Set variables===== start out with various variables for colors and, notably, "CMDLINE" for the full boot stanza =====useBusybox()===== set aliases to the Busybox commands (as opposed to possibly installed extensions providing the same commands) =====trim()===== return the argument =====stringinfile()===== do what the name says (returns 1 or 0) =====stringinstring()===== ditto =====getbootparam()===== test if a boot code is set (returns 1 or 0). If the code is associated with a value (e.g. "waitusb=5") then the value is echoed =====getparam()===== (?!) something similar with the boot stanza replaced by a second argument =====checkbootparam()===== test if a boot parameter is set =====getbasefile()===== (?!) echo the basename with some chosable number of fields =====mounted()===== check if a partition is mounted. Sets variables BASENAME, FIELDS, INFO. =====find_mountpoint()===== check if a device is mounted. The argument maybe of the form "nfs", "UUID=…", "LABEL=…", "/dev/tcvd" (a virtual disk, cf. the respective boot-code). Sets variables MOUNTPOINT, MOUNTED. =====autoscan()===== check if any physical partition contains the specified file (or directory) in it root. The type of file is specified by a second argument whose syntax is taken from the test command (shell built-in); so "d" for directory, "f" for a regular file etc. Calls '/usr/bin/autoscan-devices'. =====getpasswd()===== first define 'readpassword()' which does what it says until the password is between 8 and 56 characters long. That is applied until the password has been re-typed correctly. Sets variables PASSWD. =====status()===== depending on the value of "$?" (return value of calling process ?!) print either [OK] or [Failed] in suitable colors to the console =====usleep_progress()===== print a sequence of dots over the width of the console screen, indicating a waiting period =====checkroot()===== check it is called with root privileges; exit with error otherwise =====checkroot()===== check it is called //not //with root privileges; exit with error otherwise =====checkX()===== check if an X desktop is available =====setupHome()===== make sure there is a user home directory with sub-directories '.X.d/' and '.local/bin/' and minimal structure taken from '/etc/skel/'. Group ownership is "staff". =====merge()===== (?!) =====replace()===== (?!) =====purge()===== (?!) =====getMajorVer()===== (?!) should probably do what it says (I failed AWK-class!) =====getBuild()===== echoes architecture (one of "armv6", "armv7", "x86", "x86_64") =====getMirror()===== sets variable MIRROR according to build (cf. above) to something like "[[http://repo.tinycorelinux.net/dCore/x86|http://repo.tinycorelinux.net/dCore/x86]]" =====installed()===== checks if an extension is installed =====getKeyEventDevice()===== (?!) does what it says, returns some device under '/dev/input/' =====parentOf()===== (?!) probably returns the desired process ID =====myParent()===== (?!) probably returns the desired process ID =====launchApp()===== (?!) uses '.desktop'-files, sets variable FREEDESKTOP. \\ \\ **[[http://wiki.tinycorelinux.net/dcore:welcome|> Return to the dCore wiki welcome page]]**