Created
May 17, 2017 02:06
-
-
Save RantyDave/c4852d79280b6cdd250dc9f499be4f74 to your computer and use it in GitHub Desktop.
An SMF service that moves a SmartOS root directory onto the persistent storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
mkdir -p /opt/root | |
mkdir -p /opt/root/.ssh | |
cd / | |
cp /root/.* /opt/root | |
cp /root/.ssh/* /opt/root/.ssh | |
rm -rf /root | |
ln -s /opt/root | |
touch /opt/root/.forward | |
echo 'real@email' > /opt/root/.forward |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> | |
<service_bundle type="manifest" name="root-in-opt"> | |
<service name="site/root-in-opt" type="service" version="1"> | |
<create_default_instance enabled="true"/> | |
<single_instance/> | |
<dependency name="filesystem" grouping="require_all" restart_on="error" type="service"> | |
<service_fmri value="svc:/system/filesystem/usr"/> | |
</dependency> | |
<method_context> | |
<method_credential user="root" group="root"/> | |
</method_context> | |
<exec_method type="method" name="start" exec="/opt/20ft/root-in-opt" timeout_seconds="60"/> | |
<exec_method type="method" name="stop" exec="true" timeout_seconds="60"/> | |
<property_group name="startd" type="framework"> | |
<propval name="duration" type="astring" value="transient"/> | |
</property_group> | |
<template> | |
<common_name> | |
<loctext xml:lang="C"> | |
Root in /opt | |
</loctext> | |
</common_name> | |
</template> | |
</service> | |
</service_bundle> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment