#!/bin/bash

source debian/vars.sh
set -x

# Debify doesn't detect %patch, only m/\%patch\d+/
ln -s run bin/ccs_init
mkdir -p .develop/pkg/
mkdir -p conf
cp -f $SOURCE1 conf/caldavd-dev.plist
cp -f $SOURCE3 cpanel-ccs.service.in
cp -f $SOURCE4 txdav/who/cpanel.py
cp -f $SOURCE5 bin/populate_mailuser_directory_for_ccs
cp -f $SOURCE6 CCSHooks.pm
cp -f $SOURCE7 CCS_AdminBin.pm
cp -f $SOURCE9 CCSPkgAcct.pm
cp -f $SOURCE10 bin/test_add_ccs_cal_event
cp -f $SOURCE11 bin/test_get_ccs_cal_events
cp -f $SOURCE12 CCS.pm
cp -f $SOURCE13 CCSTasks.pm
cp -f $SOURCE17 Cpanel_CCS.pm
cp -f $SOURCE18 CCS_Utils.pm
cp -f $SOURCE14 conf/caldavd.tmpl
cp -f $SOURCE15 bin/rebuildccsconfig
cp -f $SOURCE16 bin/safe_configure_postgres_for_cpanel
cp -f $SOURCE19 bin/migrate_horde2ccs
cp -f $SOURCE20 horde_calendars2ics.php
cp -f $SOURCE21 horde_contacts2vcf.php
cp -f $SOURCE22 chkservd_config
cp -f $SOURCE23 CCS_DBUtils.pm
cp -f $SOURCE24 CCS_Userdata.pm
cp -f $SOURCE25 CCS_Constants.pm
cp -f $SOURCE8 CCS_UAPI.pm
cp -f $SOURCE26 CCS_DomainTLS.pm
cp -f $SOURCE27 CCS_Delegates.pm
chmod +x bin/populate_mailuser_directory_for_ccs
chmod +x bin/rebuildccsconfig
chmod +x bin/safe_configure_postgres_for_cpanel
chmod +x bin/migrate_horde2ccs
chmod +x bin/test_add_ccs_cal_event
chmod +x bin/test_get_ccs_cal_events
find ./ -name .gitignore | xargs rm -f
find ./ -name .git | xargs rm -rf
echo "version = \"$version\"" > calendarserver/version.py
