4. Post Installation Configuration

After the TrueOS® system has finished booting for the first time, TrueOS® will present additional screens that assist in configuring the system.

4.1. Booting Into TrueOS®

After installation, TrueOS® reboots and displays a boot menu. The menu displayed depends upon the boot loader selection chosen during the installation.

4.1.1. BSD Boot Loader

A system with a default or “BSD” install option for the boot loader loads the boot menu seen in Figure 4.1.1.

_images/install1b.png

Fig. 4.1.1 : TrueOS® Boot Menu

This menu provides several options. To pause this menu, press any key except for Enter. To select an option, press either the bolded number or key for that option. Once any selections are made, press Enter to boot using the specified options.

  • 1. Boot Multi User: This is the default option for booting TrueOS®. The system automatically uses this option either after pausing for a few moments or if Enter is pressed while the boot menu is displayed.
  • 2. Boot Single User: Advanced users can select this option to fix critical system failures.
  • 3. Escape to loader prompt: Advanced users can select this option to perform advanced operations, such as loading kernel modules.
  • 4. Reboot: Reboots the system.
  • 5. Kernel: This option indicates how many kernels are available. Press either 5 or k to toggle between available kernels. This option is available to the user if they have created a custom kernel, but wish to have a kernel.old boot option available in case the custom primary kernel fails.
  • 6. Configure Boot Options: Press either 6 or o to see the boot options screen, shown in Figure 4.1.2. To change an option, press either the bolded number or key for the option to toggle through its available settings. When finished, press either 1 or Backspace to return to the TrueOS® boot menu.
  • 7. Select Boot Environment: In TrueOS®, boot environments are automatically created when the system updates and can also be manually created using the Boot Environment Manager. This allows the system to boot to the point of time before an update occurred and can be used to recover from a failed update. Press either 7 or e to view the available boot environments.

Tip

The first time the system boots, no additional boot environments are available. Over time, this menu will populate as boot environments are created.

_images/boot1b.png

Fig. 4.1.2 : Boot Options Menu

Several boot options are available in the Boot Options Menu:

  • 3. ACPI Support: Toggles power management support. This may be useful for some BIOS’s and laptops.
  • 4. Safe Mode: Select this option if the installation hangs when probing hardware and 3 ACPI Support did not help. It will boot with a forced PIO mode (disabling the use of DMA), disable write caching for all IDE hard drives and CD-ROM drives, and disable the probing of EISA slots (as very few systems have them).
  • 5. Single User: Advanced users can select this option to fix critical system failures.
  • 6. Verbose: Select this option to see more detailed messages during the boot process. This can be useful when troubleshooting a piece of hardware.

4.1.2. GRUB Boot Loader

If the installation was customized with the GRUB option for the boot loader, it will instead load the menu shown in Figure 4.1.3.

_images/boot2.png

Fig. 4.1.3 : GRUB Boot Menu

This boot menu is used to display the entry for TrueOS®, an entry for the screen which lists the available boot environments (these are automatically created when the system updates and can also be manually created using the SysAdm Boot Environment Manager), and any other operating systems installed on the system.

By default, this menu displays for a few seconds before continuing to boot into TrueOS®. To pause this screen to review its items, press any key (other than Enter). To boot into a different operating system or boot environment, use the up and down arrows to select the desired entry then press Enter.

Press Enter when the TrueOS entry is highlighted to see the TrueOS® boot options screen, shown in Figure 4.1.4.

_images/boot3.png

Fig. 4.1.4 : TrueOS® Graphical Boot Menu Options

Several boot options are available:

  • Normal Bootup: Continues to boot TrueOS®.
  • Single User Mode: Advanced users can select this option to fix critical system failures.
  • Verbose Mode: Select this option to see more detailed messages during the boot process. This can be useful when troubleshooting a piece of hardware.

Use the arrow keys to select an option, then press Enter to boot using the highlighted option.

This menu is provided by GRUB. Press e to access the GRUB editor or c to access the GRUB command line. Familiarity with GRUB is recommended.

4.1.3. Encrypted Disks

If Encrypt disk with GELI was selected during installation, physical access to the TrueOS® system when it boots is required. As the system starts to boot, it will display a message similar to the one shown in Figure 4.1.5.

_images/encrypt1.png

Fig. 4.1.5 : Master Key Decryption

The boot process will wait for the password created in the installation screen shown in Configure Encryption. If the correct password is typed, the system will calculate the GELI encryption key, then continue to boot.

4.1.4. Display Detection

The first time the boot completes, the post-installer configuration script will attempt to set the optimal display settings. A pop-up menu either asks to accept the settings or indicates the system could not find the optimal settings. Click Yes to accept the settings and TrueOS® proceeds to the Choose a Language screen so the initial configuration can continue.

If the optimal display settings could not be determined, or if No is selected in the Confirm Resolution screen, the Display Settings screen shown in Figure 4.1.6 will launch.

_images/display3.png

Fig. 4.1.6 : Display Settings Wizard

This screen can be used to select the desired screen resolution, color depth, and video driver. The vesa driver will always work but will provide sub-optimal performance. Click on the drop-down menu to select the driver that most closely matches your video card name.

The drop-down menus can also be used to change the screen resolution and color depth values. If the desired value is not listed, the selected driver may not support that resolution or depth.

Advanced users can select their monitor’s horizontal sync and vertical refresh rate in the Advanced tab, seen in Figure 4.1.7.

_images/display4.png

Fig. 4.1.7 : Advanced Display Settings

Use caution and refer to the connected monitor’s documentation while making changes. If unsure what settings are required, it is recommended to leave the default values.

If the computer is connected to two monitors, check Enable Dual-Head support.

When finished, click Apply for the settings to be tested. If anything goes wrong during testing, the system will return to the Display Settings screen in order for the user to select another setting. Once satisfied with the settings, click Yes when prompted to accept them.

4.2. Choose a Language

The language selection screen is seen in Figure 4.2.1.

_images/config1a.png

Fig. 4.2.1 : Language Selection

This allows for the selection of the language used to access the installed system. It also contains three icons from the installer screens to enable:

  • Reading the screen’s Help text.
  • Using the onscreen keyboard.
  • Switching between the US keyboard layout and a user selected layout.

Once the selection is made, click Next to move to the next configuration screen.

4.3. Time Zone Selection

The next configuration screen, shown in Figure 4.3.1, allows selection of the timezone.

_images/config2b.png

Fig. 4.3.1 : Time Zone Selection

Use the drop-down menu to select the city closest to the system’s location. If the system is connected to the Internet, the installer automatically attempts to detect the correct timezone.

If the system is dual booting and the other operating system expects the BIOS to use UTC, also check Set BIOS to UTC time.

A default system hostname will be created. To change the name, type the desired hostname in the System Hostname field. If the computer is a member of a DNS domain, the Domain Name is also an option.

When finished, click Next to proceed to the next screen.

4.4. Set the Root Password

This configuration screen, seen in Figure 4.4.1, requires the root (administrative) password to be set.

_images/config3a.png

Fig. 4.4.1 : Root Password Creation

The password must be a minimum of 4 characters and must be typed twice to confirm the password. Click Next when finished.

4.5. Create a User

This screen is used to create the primary user account used to login to the system. Create a strong password as the password is used whenever the system indicates administrative access is required.

Figure 4.5.1 shows the configuration screen used to create the initial user account.

_images/config4a.png

Fig. 4.5.1 : User Creation

The User Details tab is used to create a login user. This screen requires completing several fields:

  • Name: This value displays in the login screen. It can be the user’s full name and can contain both capital letters and spaces.
  • Username: This is the name used when logging in. It can not contain spaces and is case sensitive (e.g. Kris is a different username from kris).
  • Password: This is the password to use when logging in. It must be typed twice to confirm it.
  • Specify UID: By default, the user will be assigned the next available User ID (UID). If a specific UID is required, it can be set here.

Note

A UID can not be set lower than 1001, and a UID already in use by another account will also be unavailable.

TrueOS® provides the ability to use a removable device, such as a USB stick, as the user’s encrypted home directory. This is useful in a multi-user or multi-computer environment, as it provides the user with secure access to their encrypted files. When a user is configured to use PersonaCrypt, their username will only appear in the login menu if the removable media associated with that TrueOS® system is inserted. They must input the password associated with the removable device in order to login.

Note

When a user is configured to use a PersonaCrypt device, that user can not login using an unencrypted session on the same system. In other words, the PersonaCrypt username is reserved for PersonaCrypt use. If necessary to login to both encrypted and unencrypted sessions on the same system, create two different user accounts; one for each type of session.

Encryption is also possible without requiring removable devices using PEFS. Refer to the SysAdm section on PEFS Encryption for more detailed instructions to initialize a user with PEFS.

The PersonaCrypt tab, shown in Figure 4.5.2, is used to initialize PersonaCrypt for the user.

_images/persona1a.png

Fig. 4.5.2 : User’s PersonaCrypt Initialization

Check Initialize PersonaCrypt Device, insert a removable media large enough to hold the files to store in the home directory, and click Select.

Warning

Ensure there are no desired files on the removable media. Initializing the media for PersonaCrypt will format the device with ZFS and encrypt it with GELI, deleting any existing data.

Input and repeat the Device Password to associate with the device. A pop-up window indicates the current contents of the device will be wiped. Click Yes to initialize the device.

To share the computer with other users, create additional login and PersonaCrypt accounts using the SysAdm User Manager. After creating at least one user, click Next to continue to the next screen.

4.6. Configure Audio Output

The next screen, seen in Figure 4.6.1, is used to configure the default audio output.

_images/audio1a.png

Fig. 4.6.1 : Configure Audio Output

Click the Output Device drop-down menu to select the desired sound device. Click Test to verify the setting as a working configuration will result in a test sound. The Testing Volume slider can also be used to set the default volume level.

All these settings can be viewed and edited at any time using the instructions in Sound Mixer Tray.

4.7. Connect to a Wireless Network

Note

Be sure the network card is supported by FreeBSD. Refer to Supported Hardware for links to FreeBSD support and a list of known issues with different hardware.

If the system has an active wireless interface, a screen similar to Figure 4.7.1 will indicate the wireless networks automatically detected. Available networks will be ordered by signal strength.

_images/config5.png

Fig. 4.7.1 : Wireless Network Connections

To set the default wireless connection, click the desired network in the Available Wireless Networks area, then click Add Selected. If the network requires a password, a window will appear requesting the password and indicate the security type used by the desired network. If the desired network is not visible in the Available Wireless Networks area, click Scan. If unable to connect or to configure the connection later, refer to Network Manager for more detailed instructions.

4.8. Enable Optional Services

Figure 4.8.1 shows the next screen in the process.

_images/config6.png

Fig. 4.8.1 : Optional Services

Check Disable IPV6 (Requires Reboot) and the system will be configured to only support IPv4 addresses. The default is to support both IPv4 and IPv6 and prefer IPv6 over IPv4.

Tip

Altering this setting will not take affect until the next system reboot.

If Enable SSH is checked, the SSH service will start and be configured to start whenever the system boots. It also creates the firewall rules needed to allow incoming SSH connections to the TrueOS® system.

Danger

Do not check this box if SSH connections to the system are undesired.

When finished, click Next. The screen in Figure 4.8.2 indicates the post-installation setup is complete. Click Finish to access the login menu.

_images/config7.png

Fig. 4.8.2 : Setup Complete

4.9. Logging In

Once finished setting up the system, the PCDM (PC-BSD® Display Manager) graphical login screen will display. An example is seen in Figure 4.9.1.

_images/login1.png

Fig. 4.9.1 : TrueOS® Login

The hostname of the system will be displayed at the top of the login window. In this example, it is trueos-5320. This login screen lets has several configuration options:

  • user: Upon first login, the created username (from Create a User) is the only available login user. If additional users are created using the SysAdm User Manager, they will be added to the drop-down menu for more login choices. PCDM does not allow logging in as the root user. Instead, whenever a utility requires administrative access, TrueOS® asks for the password of the login account.
  • password: Input the password associated with the selected user.
  • desktop: If any additional desktops are installed using AppCafe, use the drop-down menu to select the desktop to log into.

Note

If a PersonaCrypt user is active, insert the PersonaCrypt device in order to login. As seen in Figure 4.9.2, this will add an extra field to the login screen so the password associated with the PersonaCrypt device can be typed.

_images/login5.png

Fig. 4.9.2 : TrueOS® PersonaCrypt Login

The toolbar at the bottom of the screen allows several options to be selected on a per-login basis:

  • Locale: If the localization was not set during installation, or needs to be changed, click this icon to set the locale for this login session.
  • Keyboard Layout: Click this icon to change the keyboard layout for this login session. This will open the window seen in Figure 4.9.3.
_images/keyboard1.png

Fig. 4.9.3 : Keyboard Settings

Click the Keyboard model drop-down menu to select the type of keyboard.

Note

The default model of Generic 104-key PC does not support special keys such as multimedia or Windows keys. This default will need to change to enable support for hot keys.

This screen also allows selection of the Key Layout and Variant. After making any selections, test them by typing some text into the you may type into the space below... field.

  • Restart/Shut Down: To restart or shutdown the system without logging in, click the icon in the lower-right corner. This icon also allows to Change DPI and to Refresh PCDM.

Once any selections are made, input the password associated with the selected user and press Enter or click the blue arrow to login.

Tip

It is possible to change keyboard layouts during an active desktop session using the included fcitx utility

4.10. Managing System Services and Daemons

TrueOS® now uses OpenRC to manage system services. OpenRC is an integral component of the TrueOS® operating system, and is a major point of difference between TrueOS® and FreeBSD. This section is intended to provide detailed information about system service management in TrueOS®.

4.10.1. OpenRC in TrueOS® compared with rc

Table 4.10.1 serves as a quick summary and series of working examples contrasting the FreeBSD rc system and OpenRC in TrueOS®.

Table 4.10.1 : Comparison between the traditional FreeBSD rc and TrueOS® OpenRC service management
Component or action FreeBSD TrueOS®
Base system rc script location /etc/rc.d /etc/init.d
Ports rc script location /usr/local/etc/rc.d /usr/local/etc/init.d
Service configuration

/etc/rc.conf or /etc/rc.conf.local

All services are configured in a central location.

OpenRC prefers /etc/conf.d/servicename, but can use /etc/rc.conf or /etc/rc.conf.local Each service has its own configuration file.
Starting e.g. the nginx service $ service nginx start $ service nginx start
Configuring e.g. nginx to start on bootup. Edit /etc/rc.conf and add nginx_enable="YES" $ rc-update add nginx default
Check to see if a service is enabled.

$ service nginx rcvar

If the service is enabled, the result is:

nginx_enable="YES"

$ rc-update show default | grep nginx

If the service is enabled, the result is:

nginx | default

Warning

The user may find leftover RC files during the TrueOS® migration to OpenRC. These files do not work with OpenRC and are intended to be removed both from the source tree and via pc-updatemanager when all functionality is successfully migrated. If discovered, do not attempt to use these leftover files.

4.10.2. Service Management in OpenRC

4.10.2.1. Runlevels

Traditionally, FreeBSD operates in single- and multi-user modes. However, OpenRC offers the ability to define runlevels. An OpenRC runlevel is a grouping of services, nothing more. Any number of system services can be associated with a given runlevel. In TrueOS®, there are two main preconfigured runlevels: boot and default. The default runlevel is analogous to the FreeBSD multi-user mode, and is associated with the Normal Bootup option of the TrueOS® bootloader.

Note

No OpenRC runlevels are executed if the system is booted into single-user mode (see Figure 4.1.1.)

Runlevels are defined by subdirectories of /etc/runlevels; all associations between services and runlevels can be shown by running the command:

$ rc-update show -v
OpenRC has a few ordered runlevels in TrueOS®. In order of execution:
  1. sysinit runlevel: used for OpenRC to initialize itself.
  2. boot runlevel: starts most base services from /etc/init.d/.
  3. default runlevel, which is where services started by ports are added.

Note

Services added by ports cannot be added to boot or sysinit.

OpenRC allows users to add services in the prefix location to the boot runlevel. These services are started before the /usr filesystem is mounted. Finally, there is a shutdown runlevel reserved for a few services like savecore or pc-updatemanager, which installs updates at shutdown.

When a service is added to a runlevel, a symlink is created in /etc/runlevels. When a service is started, stopped, or changed to another state, a symlink is added to /libexec/rc/init.d/, as seen in this example:

[tmoore@Observer] ~% ls /libexec/rc/init.d/
daemons exclusive inactive scheduled starting wasinactive
depconfig failed options softlevel stopping
deptree hotplugged prefix.lock started tmp

4.10.2.2. Services and Runlevels

OpenRC includes options to start, stop, add, or delete services from runlevels as seen in Table 4.10.2. Most of these actions can be accomplished using the Service Manager built into SysAdm. Individuals familiar with the FreeBSD service command may notice some similarities between some of these commands.

Table 4.10.2 : Service and Runlevel Management Commands
Command Description
service nginx start Start nginx from usr/local/etc/init.d/nginx.
service nginx restart Restart nginx from /usr/local/etc/init.d/nginx.
service nginx stop Stop nginx from /usr/local/etc/init.d/nginx.
service nginx status View the status of the nginx service.
rc-status View the status of all running services.
rc-update Views all runlevels. Used in conjunction with service names to add or delete services from the default runlevel.
rc-update add nginx default Adds the nginx service to the default runlevel.
rc-update delete nginx default Removes the nginx service from the default runlevel.

4.10.2.3. Writing OpenRC Services

OpenRC has a dependency based init system. As an example, let’s examine a service which needs network such as SysAdm. Here are the contents of the /usr/local/etc/init.d/sysadm depend section:

depend() {
need net
after bootmisc
keyword -shutdown
}

We can define that SysAdm needs network, which is the nickname of the /etc/init.d/network service defined by provide in network. We also see that it starts after bootmisc. If we don’t want restarting network to restart SysAdm then we don’t need net for SysAdm. If we just want SysAdm to start after network then we add network the actual name of the script in after bootmisc.

Here are the contents of /etc/init.d/network:

depend()
{
provide net
need localmount
after bootmisc modules
keyword -jail -prefix -vserver -stop
}

The provide option will set the service nickname to net. Need indicates restarting localmount will restart network. After defines that we start after bootmisc and modules. For example, the keyword -jail option says this service doesn’t run in a jail, prefix, any of the other options shown.

Also under /libexec/rc exists a cache directory which keeps a dependencies cache that is only updated when dependencies change. Several other directories exist for other binaries and special binaries used by OpenRC functions.

For more creation options for OpenRC compatible init scripts, type man openrc-run in a CLI.

4.10.3. RC Defaults

Note

RC Defaults are subject to change during development.

TrueOS® and FreeBSD now have very different rc defaults.

TrueOS OpenRC Defaults

The entire TrueOS rc.conf file is viewable on GitHub.

# Global OpenRC configuration settings

# Set to "YES" if you want the rc system to try and start services
# in parallel for a slight speed improvement. When running in parallel we
# prefix the service output with its name as the output will get
# jumbled up.
# WARNING: whilst we have improved parallel, it can still potentially lock
# the boot process. Don't file bugs about this unless you can supply
# patches that fix it without breaking other things!
#rc_parallel="NO"

# Set rc_interactive to "YES" and you'll be able to press the I key during
# boot so you can choose to start specific services. Set to "NO" to disable
# this feature. This feature is automatically disabled if rc_parallel is
# set to YES.
#rc_interactive="YES"

# If we need to drop to a shell, you can specify it here.
# If not specified we use $SHELL, otherwise the one specified in /etc/passwd,
# otherwise /bin/sh

FreeBSD RC Defaults

The entire FreeBSD rc.conf file is available online.

#!/bin/sh

# This is rc.conf - a file full of useful variables that you can set
# to change the default startup behavior of your system.  You should
# not edit this file!  Put any overrides into one of the ${rc_conf_files}
# instead and you will be able to update these defaults later without
# spamming your local configuration information.
#
# The ${rc_conf_files} files should only contain values which override
# values set in this file.  This eases the upgrade path when defaults
# are changed and new features are added.
#
# All arguments must be in double or single quotes.
#
# For a more detailed explanation of all the rc.conf variables, please
# refer to the rc.conf(5) manual page.
#
# $FreeBSD$

##############################################################

The TrueOS® rc.conf file is much smaller because rc.conf is now primarily used for tuning OpenRC behavior. By default, TrueOS® uses 3 elements, documented in Table 4.10.4

Table 4.10.3 lists services and their default runlevels in TrueOS®.

Table 4.10.3 : Services and runlevels
Service Runlevel
abi boot
adjkerntz boot
automount default
bootmisc boot
bridge boot
cron boot
cupsd default
dbus default
devd boot
dumpon boot
fsck boot
hostid boot
hostname boot
ipfw boot
local default nonetwork
localmount boot
lockd default
loopback boot
modules boot
motd boot
moused default
netmount default
network boot
newsyslog boot
openntpd default
pcdm default
root boot
rpcbind default
savecache shutdown
savecore boot
statd default
staticroute boot
swap boot
sysadm default
syscons boot
sysctl boot
syslogd boot
trueosinit default
urandom boot
zfs boot
zvol boot

4.10.4. Tuneables

Table 4.10.4 : OpenRC Primary Tunables
Tunable Description
rc_parallel=”YES” Starts all services in parallel (experimental).
rc_logger=”YES” Enables logging
rc_log_path=”/var/log/rc.log” Defines the location for logging rc activity

Table 4.10.5 shows all other tunables enabled on a clean TrueOS® installation. Many of these tunables continue to work in /etc/rc.conf to ensure a smoother migration for existing users to upgrade. The eventual target locations for these services are also listed.

Note

These migration targets are estimates and subject to change.

Table 4.10.5 : OpenRC Other Tunables
Tunable Description Migration Target
linux_enable=”YES” Notifies /etc/init.d/abi service to enable the Linux compatability during boot /etc/conf.d/abi
ifconfig_re0=”DHCP” Auto-obtain IP address on the re0 device. /etc/conf.d/network
ifconfig_re0_ipv6=”inet6 accept_rtadv” Configure IPv6. /etc/conf.d/network
hostname=”trueos-4843” Set the system hostname. /etc/conf.d/hostname
kldload_i915kms=”i915kms” TrueOS specific. Allows loading an individual module via the installer post installation. etc/conf.d/modules
zfs_enable=”YES” Obsolete, marked for removal None
wlans_iwm0=”wlan 0 DHCP” Configure iwm wireless with DHCP. /etc.conf.d.network
ifconfig_wlan0_ipv6=”inet6 accept_rtadv” Configure iwm wireless with IPv6. /etc.conf.d.network

4.10.5. OpenRC Install Scripts

There are number of scripts used for older TrueOS® systems and new installations, listed below.

4.10.5.1. One-time Migration Script

A one time migration script is available for TrueOS® installations dated 10-28-16 or older that are still using the legacy FreeBSD rc system:

Note

This block is truncated from the original file

#!/bin/sh

if [ ! -e /etc/rc.conf ] ; then
  exit 0
fi

. /etc/rc.conf

for var in `set | grep "_enable="`
do
  key=`echo $var | cut -d '=' -f 1 | sed 's|_enable||g'`
  val=`echo $var | cut -d '=' -f 2`
  if [ "$val" != "YES" ] && [ "$val" != "NO" ] ; then continue; fi
  if [ "$val" = "NO" ] && [ -e "/etc/runlevels/default/$key" ] ; then
      echo "Deleting OpenRC service for $key to default runlevel..."
      rc-update delete $key default
  fi
  if [ -e "/etc/init.d/$key" -o -e "/usr/local/etc/init.d/$key" ] ; then
    if [ -e "/etc/runlevels/default/$key" ] ; then
      echo "OpenRC service for $key already enabled, skipping.."

With this migration, rc.conf.trueos, located in /etc/, has been phased out of TrueOS® and is automatically removed from legacy installs dated 10-28-16 and older by pc-updatemanger:

This script is used to define a list of services such as PCDM designated to boot by default on a desktop. It also defines what drivers to load on a desktop. This is now accomplished when the trueos-desktop or trueos-server package is installed using sysrc or other methods. Now there is no need to keep an extra overlay file to accomplish this behaviour.

4.10.5.2. TrueOS® Desktop pkg-install Script

Note

This is an excerpt from the TrueOS® Desktop pkg-install file, available online: https://github.com/trueos/trueos-desktop/blob/master/port-files/pkg-install

#!/bin/sh
# Script to install preload.conf

PREFIX=${PKG_PREFIX-/usr/local}

if [ "$2" != "POST-INSTALL" ] ; then
   exit 0
fi

# If this is during staging, we can skip for now
echo $PREFIX | grep -q '/stage/'
if [ $? -eq 0 ] ; then
   exit 0
fi

# REMOVEME - Temp fix to ensure i915kms is loaded on upgraded systems
# 8-29-2016
if [ -e "/etc/rc.conf.trueos" ] ; then
  set +e
  grep -q "i915kms" /etc/rc.conf.trueos

4.10.5.3. TrueOS Server pkg-install script

Note

This is an excerpt from the TrueOS® Server pkg-install file, available online: https://github.com/trueos/trueos-server/blob/master/port-files/pkg-install

#!/bin/sh
# Script to install preload.conf

PREFIX=${PKG_PREFIX-/usr/local}

if [ "$2" != "POST-INSTALL" ] ; then
   exit 0
fi

# If this is during staging, we can skip for now
echo $PREFIX | grep -q '/stage/'
if [ $? -eq 0 ] ; then
   exit 0
fi

# Copy over customizations for TrueOS
  install -m 644 ${PREFIX}/share/trueos/conf/loader.conf.trueos /boot/loader.conf.trueos
  install -m 644 ${PREFIX}/share/trueos/conf/brand-trueos.4th /boot/brand-trueos.4th
  install -m 644 ${PREFIX}/share/trueos/server-defaults/etc/conf.d/modules /etc/conf.d/modules/

The typical nginx_enable=”YES” is no longer used to enable services. Instead, rc-update is used to add or delete services from runlevels. The one time migration script automatically adds previously defined user services to the OpenRC default runlevel. Leftover lines can be removed after migration.

4.10.6. Updating a Port’s Makefile

There is still quite a bit of work to do updating each port’s Makefile to the new format, USE_OPENRC_SUBR=. However, these are to be changed only when each service file has the new OpenRC ready format:

Note

This is an excerpt from the TrueOS® dbus.in file, which is available online: https://github.com/trueos/freebsd-ports/blob/xserver-next/devel/dbus/files/dbus.in

#!/sbin/openrc-run
# Copyright (c) 2007-2015 The OpenRC Authors.
# See the Authors file at the top-level directory of this distribution and
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
#
# This file is part of OpenRC. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.

command=/usr/local/bin/dbus-daemon
pidfile=/var/run/dbus/dbus.pid
command_args="${dbusd_args---system}"
name="Message Bus Daemon"

depend()
{
        need localmount
        after bootmisc
}

Here is an example from FreeBSD of dbus using the legacy rc script format:

Note

This is an excerpt from the legacy FreeBSD dbus.in file, which is available online: https://github.com/freebsd/freebsd-ports/blob/master/devel/dbus/files/dbus.in

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dbus
# REQUIRE: DAEMON ldconfig
#
# Add the following lines to /etc/rc.conf to enable the D-BUS messaging system:
#
# dbus_enable="YES"
#

. /etc/rc.subr
. %%GNOME_SUBR%%

dbus_enable=${dbus_enable-${gnome_enable}}
dbus_flags=${dbus_flags-"--system"}

name=dbus
rcvar=dbus_enable

Several developers are working on the thousands of instances as quickly as possible. Anyone can begin transitioning to defining all service configurations in /etc/conf.d/, if desired. All configuration files should reside in that directory with the name of the service for the configuration file itself. For example, nginx is /etc/conf.d/nginx.

Generally, usage of /etc/rc.conf is minimized. Tweaking the default OpenRC configuration parameters is recommended only for advanced users. It is still possible to use service configurations through /etc/rc.conf, but this file is unusable for enabling or disabling services for startup.