#!/bin/bash

dir_to_watch="/data/deepin-server/UploadQueue"
repo_tools_dir="/data/deepin-server/repo/deepin-repo-tools"

inotifywait -me close_write --format '%w%f' /data/deepin-server/UploadQueue 2> /dev/null | while read line
do
    if [ "${line##*.}" = "changes" ];then
        DIST=`cat $line | grep Distribution | awk '{print $2}'`
        cd ${repo_tools_dir} && ${repo_tools_dir}/reprepro.sh include kui $line
    fi
done
