TritonDataCenter / pkgsrc-legacy

Automatically updated conversion of the "pkgsrc" module from anoncvs.netbsd.org
http://www.pkgsrc.org
127 stars 64 forks source link

ucarp package missing smf manifest #374

Open sjorge opened 8 years ago

sjorge commented 8 years ago

I had to write my own

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
  <service name='network/ucarp' type='service' version='0'>
    <dependency name='filesystem' grouping='require_all' restart_on='error' type='service'>
      <service_fmri value='svc:/system/filesystem/local'/>
    </dependency>
    <dependency name='network' grouping='require_all' restart_on='error' type='service'>
      <service_fmri value='svc:/milestone/network:default'/>
    </dependency>
    <property_group name='startd' type='framework'>
      <propval name='duration' type='astring' value='child'/>
      <propval name='ignore_error' type='astring' value='core,signal'/>
    </property_group>
    <instance name='default' enabled='false'>
      <exec_method name='start' type='method' exec='/opt/local/sbin/ucarp -z -i %{ucarp/iface} -a %{ucarp/addr} -v %{ucarp/vhid} -p %{ucarp/pass} -s %{ucarp/srcip} -x %{ucarp/vhid} -u /opt/local/bin/ucarp_vip_up.sh -d /opt/local/bin/ucarp_vip_down.sh' timeout_seconds='60'/>
      <exec_method name='stop' type='method' exec=':kill' timeout_seconds='60'/>
      <property_group name='ucarp' type='application'>
        <propval name='addr' type='astring' value=''/>
        <propval name='iface' type='astring' value=''/>
        <propval name='pass' type='astring' value=''/>
        <propval name='srcip' type='astring' value=''/>
        <propval name='vhid' type='astring' value=''/>
      </property_group>
    </instance>
    <stability value='Unstable'/>
    <template>
      <common_name>
        <loctext xml:lang='C'>ucarp</loctext>
      </common_name>
      <documentation>
        <doc_link name='UCARP Documentation' uri='https://www.pureftpd.org/project/ucarp'/>
      </documentation>
    </template>
  </service>
</service_bundle>

ucarp_vip_up.sh

#!/bin/bash
ifconfig "$1":"$3" plumb
ifconfig "$1":"$3" $2 netmask 255.255.255.255
ifconfig "$1":"$3" up

ucarp_vip_down.sh

ifconfig "$1":"$3" > /dev/null 2> /dev/null
if [ $? -eq 0 ]; then
  ifconfig "$1":"$3" down
  ifconfig "$1":"$3" unplumb
fi

to configure

svccfg -s ucarp:default setprop ucarp/vhid = 15
svccfg -s ucarp:default setprop ucarp/addr = 192.168.0.15
svccfg -s ucarp:default setprop ucarp/iface = net0
svccfg -s ucarp:default setprop ucarp/pass = sm4rt0s_r0cks
svccfg -s ucarp:default setprop ucarp/srcip = 192.168.0.10
svccfg -s ucarp:default refresh
sjorge commented 8 years ago

did a few minor tweaks, ucarp_vip_down is now called on shutdown to remove the vip