77 Chapter 16. Extension install scripts Extensions may optionally include a script to…
- User
77 Chapter 16. Extension install scripts Extensions may optionally include a script to be run after they’re loaded. This is often used to make a default configuration file writable, or to work around some application that doesn’t recognize its plugins if they are symlinks instead of real files. These install scripts live in the /usr/local/tce.installed directory. They are named after the extension’s file name, so for myext- foo.tcz the install script needs to be named myext-foo. Install scripts run as root. The install scripts should be owned by tc:staff and have executable permissions. The tce.installed directory should be owned by root:staff and have 775 permissions. Faulty permissions for the tce.installed directory may break extension loading. 16.1. Example: nano For an example, let’s take a look at what kind of install script would be needed for the nano editor. Nano ships with a system-wide default configuration file. If the user loads the nano extension to RAM, the file will be writable, and nothing needs to be done; but what about the other case, default mounting? In that case, the file would be a symlink to a read-only file, not what we want. So in the install script, we need to detect if the configuration file is a symlink, and if so, copy the real file in its place. Example: nano 78 As the install scripts are run before the backup is restored, we never overwrite any custom configuration the user has done. #!/bin/sh CONFDIR=/usr/local/etc [ -h CONFDIR/nanorc ] && \ rm -f CONFDIR/nanorc &&
cp -a /tmp/tcloop/nano/CONFDIR - Assistant
The text covers two main topics:
-
Extension Install Scripts: This section (Chapter 16) explains how extensions can include scripts to be run after they're loaded. It discusses the purpose of these scripts, typically to ensure default configuration files are writable or to resolve issues with application plugins. The scripts are stored in the
/usr/local/tce.installeddirectory, named after the extension, and are executed with root permissions. There's an example provided for the "nano" editor, illustrating how to replace a symlinked configuration file with a real file if it's read-only. -
Creating Custom Boot Codes: This section (Chapter 17) explains the creation of custom boot codes, which can be used for different scenarios like GUI boot or stress test options on a rescue USB stick. The boot command line parameters are read from
/proc/cmdline, and helper functions fromtc-functionscan be utilized for checking and retrieving boot parameters. An example script shows how to use these utilities to perform specific actions based on boot codes.
If you have a particular area you're curious about or need more clarification, feel free to ask!
-