#!/bin/bash

set -e

echo "95install-extra-packages start"
fifoName="95install-extra-packages-fifo"
if [ ! -e ${fifoName} ]; then
    mkfifo -m 666 ${fifoName}
fi
exec 6<>${fifoName}
echo "0" >&6



### automatically install the packages listed in the /cdrom/.kylin-post-packages
if [ -f "/cdrom/.kylin-post-packages" ]; then
    echo "安装光盘源列表包\n"
    /bin/sh -c "unset DEBIAN_HAS_FRONTEND && apt-get install -y $(cat /cdrom/.kylin-post-packages | grep -v ^\# | xargs)"
else
    echo "/cdrom/.kylin-post-packages not exists"
fi

echo "100" >&6
exec 6<&-
rm -f ${fifoName}
