# old version (without -$pkgrel): ${1%%-*}
# new version (without -$pkgrel): ${2%%-*}

PKGNAME=ubm-docker
PATH_UPGRADE=/mnt/upgrade

# arg 1:  the new package version
ubm_pre_load(){
    true
}

# arg 1:  the new package version
ubm_post_load(){
    systemctl stop docker.socket docker.service 2>/dev/null || true
    ubconfig --nocolor set [server] STORAGE_CONTAINERS_PATH=yes || true
    ubconfig --nocolor set [server] STORAGE_DOCKER_PATH=yes || true
    ubconfig --nocolor set [system] SERVICES_ENABLE++="docker.socket" SERVICES_ENABLE++="docker.service" || true
}

# arg 1:  the old package version
ubm_pre_unload(){
    systemctl stop docker.socket docker.service 2>/dev/null || true
    ubconfig --nocolor set [system] SERVICES_ENABLE--="docker.socket" SERVICES_ENABLE--="docker.service" || true
    ubconfig --nocolor remove [server] STORAGE_DOCKER_PATH=yes || true
    ubconfig --nocolor remove [server] STORAGE_CONTAINERS_PATH=yes || true
}

# arg 1:  the old package version
ubm_post_unload(){
    true
}

# arg 1:  the new package version
pre_install(){
    pre_upgrade $@
}

# arg 1:  the new package version
post_install(){
    post_upgrade $@
}

# arg 1:  the new package version
# arg 2:  the old package version
pre_upgrade(){
    true
}

# arg 1:  the new package version
# arg 2:  the old package version
post_upgrade(){
    true
}

# arg 1:  the old package version
pre_remove(){
    true
}

# arg 1:  the old package version
post_remove(){
    true
}
