Package opennebula-server: Скрипты

Post install

 
if sd_booted; then 
    systemctl daemon-reload 
    if [ $1 -eq 1 ]; then 
        # Initial installation 
        systemctl --no-reload preset opennebula.service opennebula-scheduler.service opennebula-hem.service opennebula-ssh-agent.service || : 
    else 
        # Package upgrade, not uninstall 
        /lib/systemd/systemd-update-helper mark-restart-system-units opennebula.service opennebula-scheduler.service opennebula-hem.service opennebula-ssh-agent.service || : 
    fi 
fi
Pre install

if [ $1 = 1 ]; then
    if [ ! -e /var/lib/one/.one/one_auth ]; then
        PASSWORD=$(echo $RANDOM$(date '+%s')|md5sum|cut -d' ' -f1)
        mkdir -p /var/lib/one/.one
        chmod 700 /var/lib/one/.one
        echo oneadmin:$PASSWORD > /var/lib/one/.one/one_auth
        chown -R oneadmin:oneadmin /var/lib/one/.one
        chmod 600 /var/lib/one/.one/one_auth
    fi

    if [ ! -f /var/lib/one/.ssh/id_rsa ]; then
        su -c "ssh-keygen -N '' -t rsa -f /var/lib/one/.ssh/id_rsa" -l oneadmin
        if [ ! -f "/var/lib/one/.ssh/authorized_keys" ]; then
            cp -p /var/lib/one/.ssh/id_rsa.pub /var/lib/one/.ssh/authorized_keys
            chmod 600 /var/lib/one/.ssh/authorized_keys
        fi
    fi
fi
Pre uninstall

 
if [ $1 -eq 0 ] && sd_booted; then 
    # Package removal, not upgrade 
    systemctl --no-reload -q disable --now opennebula.service opennebula-scheduler.service opennebula-hem.service opennebula-ssh-agent.service || : 
fi 


# %post node-xen
# if [ $1 = 1 ]; then
#     /usr/bin/grub-bootxen.sh
# fi