#!/bin/bash

source debian/vars.sh

# Clean the build root first
rm -rf $buildroot
# Installing directories
install -d -m 755 $buildroot/usr
install -d -m 755 $buildroot/usr/local
install -d -m 755 $buildroot/usr/local/cpanel
install -d -m 755 $buildroot/usr/local/cpanel/scripts
install -d -m 755 $buildroot/var
install -d -m 755 $buildroot/var/cpanel
install -d -m 755 $buildroot/var/cpanel/plugins
install -d -m 755 $buildroot/var/cpanel/plugins/common
# Installing source files
install -D -m 644 $SOURCE4 $buildroot/usr/local/cpanel/Cpanel/API/Plugins-get_uuid.openapi.yaml
install -D -m 644 $SOURCE5 $buildroot/usr/local/cpanel/Cpanel/API/Plugins-reset_uuid.openapi.yaml
install -D -m 644 $SOURCE6 $buildroot/usr/local/cpanel/Cpanel/API/Plugins.pm
install -D -m 644 $SOURCE7 $buildroot/usr/local/cpanel/Cpanel/Plugins/UUID.pm
install -D -m 700 $SOURCE8 $buildroot/usr/local/cpanel/scripts/manage_extra_marketing
install -D -m 644 $SOURCE9 $buildroot/usr/local/cpanel/t/medium/Cpanel-API-Plugins.t
install -D -m 644 $SOURCE10 $buildroot/usr/local/cpanel/t/medium/Cpanel-Plugins-UUID.t
install -D -m 644 $SOURCE11 $buildroot/var/cpanel/plugins/common/README.md
echo "Tree for buildroot: $buildroot"
tree $buildroot
