#!/bin/sh set -e if [ -e /etc/kernel/postinst.d/lliurex-tcos ]; then rm -f /etc/kernel/postinst.d/lliurex-tcos 2>/dev/null ||true fi ISO_MODELS="modelo-biblio modelo-centro modelo-client modelo-desktop modelo-infantil modelo-lite modelo-music modelo-pime modelo-server" OLD_PATH="/var/lib/tcos/tftp" NEW_PATH="/net/zero-net-boot/tftp" case $1 in upgrade) if dpkg --compare-versions $2 le 0.63; then for model in $ISO_MODELS; do if [ -e "$OLD_PATH/$model" ] && [ ! -h "$OLD_PATH/$model" ]; then SIZE_NET=$(df --total /net | tail -1 | awk '{print $4}') SIZE_MODEL=$(du -s $OLD_PATH/$model | awk '{print $1}') SIZE_MODEL=$(($SIZE_MODEL + 10000)) mkdir -p $NEW_PATH/$model 2>/dev/null >/dev/null || true if [ $SIZE_NET -ge $SIZE_MODEL ] && [ -d "$NEW_PATH/$model" ]; then if [ -d "$OLD_PATH/$model/casper" ]; then SIZE_MODEL=$(du -hs $OLD_PATH/$model | awk '{print $1}') printf " Moving $SIZE_MODEL of $model to new location $NEW_PATH... " if ! mv $OLD_PATH/$model/casper $NEW_PATH/$model/ 2>/dev/null >/dev/null; then echo "FAILED, please reload your ISO in zero-net-boot." rm -rf $NEW_PATH/$model/* 2>/dev/null >/dev/null || true else echo "OK" fi fi rm -rf $OLD_PATH/$model 2>/dev/null >/dev/null || true fi fi done fi ;; esac #DEBHELPER# exit 0