05.02.2013 Views

opsi manual opsi version 4.0.2 - opsi Download - uib

opsi manual opsi version 4.0.2 - opsi Download - uib

opsi manual opsi version 4.0.2 - opsi Download - uib

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>opsi</strong> <strong>manual</strong> <strong>opsi</strong> <strong>version</strong> <strong>4.0.2</strong><br />

114 / 193<br />

A single downgrade license results in a license option for at least two different license pools, but only one of them can<br />

be requested for an installation. So using a downgrade license option decreases the number of available license options<br />

(remaining_<strong>opsi</strong>) in each of the license pools concerned by that downgrade option by 1. So this looks like a single<br />

installation reduces the number of available license options by 2, which, in this case, actually is the fact.<br />

14.9 Service methods for license management<br />

The service methods for license management can be called from the command line tool <strong>opsi</strong>-admin. So they are<br />

accessible for scripting, e.g. to read license keys from a file.<br />

Examples can be found in the products license-test-. . . .<strong>opsi</strong> from http://download.<strong>uib</strong>.de/<strong>opsi</strong>4.0/products/licensemanagement/.<br />

After installing the packets with <strong>opsi</strong>-package-manager -i *.<strong>opsi</strong>, in the directory /opt/pcbin/install/ the corresponding scripts: create_license-*.sh can be found.<br />

As an example here the script create_license-mixed.sh (the current <strong>version</strong> comes with the download packet).<br />

#!/bin/bash<br />

# This is a test and example script<br />

# (c) <strong>uib</strong> gmbh licensed under GPL<br />

PRODUCT_ID=license-test-mixed<br />

# read the license key from a file<br />

# myretailkeys.txt has one licensekey per line<br />

MYRETAILKEYS=‘cat myretailkeys.txt‘<br />

# myoemkeys.txt has one pair: per line<br />

MYOEMKEYS=‘cat myoemkeys.txt‘<br />

# some output<br />

echo "$PRODUCT_ID"<br />

# this is the function to create the oem licenses<br />

#############<br />

createlic ()<br />

{<br />

while [ -n "$1" ]<br />

do<br />

#echo $1<br />

AKTKEY=$1<br />

shift<br />

#echo $1<br />

AKTHOST=$1<br />

shift<br />

echo "createSoftwareLicense with oem key: ${PRODUCT_ID}-oem-${AKTKEY} for host ${AKTHOST}"<br />

MYLIC=‘<strong>opsi</strong>-admin -dS method createSoftwareLicense "" "c_$PRODUCT_ID" "OEM" "1" "${AKTHOST}" ""‘<br />

<strong>opsi</strong>-admin -d method addSoftwareLicenseToLicensePool "$MYLIC" "p_$PRODUCT_ID" "${PRODUCT_ID}-oem-${AKTKEY}"<br />

done<br />

}<br />

#############<br />

# here the script starts<br />

# delete the existing license pool and all connected licenses<br />

# ATTENTION: never (!) do this on a productive system<br />

echo "deleteLicensePool p_$PRODUCT_ID"<br />

<strong>opsi</strong>-admin -d method deleteLicensePool "p_$PRODUCT_ID" true<br />

# delete the existing license contract<br />

echo "deleteLicenseContract c_$PRODUCT_ID"<br />

<strong>opsi</strong>-admin -d method deleteLicenseContract "c_$PRODUCT_ID"<br />

# create the new license pool<br />

# the used method has the following syntax:<br />

# createLicensePool(*licensePoolId, *description, *productIds, *windowsSoftwareIds)<br />

echo "createLicensePool p_$PRODUCT_ID"<br />

<strong>opsi</strong>-admin -d method createLicensePool "p_$PRODUCT_ID" "<strong>opsi</strong> license test" \’[’"’$PRODUCT_ID’"’]\’ \’[’"’$PRODUCT_ID’"\<br />

’]\’

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!