#!/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/Cpanel
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/API
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Admin
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Admin/Modules
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Admin/Modules/Cpanel
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Config
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Config/ConfigObj
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Config/ConfigObj/Driver
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Server
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Server/WebSocket
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Server/WebSocket/cpanel
install -d -m 755 $buildroot/usr/local/cpanel/Cpanel/Sitejet
install -d -m 755 $buildroot/usr/local/cpanel/base
install -d -m 755 $buildroot/usr/local/cpanel/base/frontend
install -d -m 755 $buildroot/usr/local/cpanel/base/frontend/jupiter
install -d -m 755 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet
install -d -m 755 $buildroot/usr/local/cpanel/t
install -d -m 755 $buildroot/usr/local/cpanel/t/medium
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/sitejet
# Installing source files
install -D -m 644 $SOURCE4 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-add_api_token.openapi.yaml
install -D -m 644 $SOURCE5 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-create_account.openapi.yaml
install -D -m 644 $SOURCE6 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-create_website.openapi.yaml
install -D -m 644 $SOURCE7 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-disk_quota_check.openapi.yaml
install -D -m 644 $SOURCE8 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-get_all_sites_metadata.openapi.yaml
install -D -m 644 $SOURCE9 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-get_all_user_sitejet_info.openapi.yaml
install -D -m 644 $SOURCE10 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-get_api_token.openapi.yaml
install -D -m 644 $SOURCE11 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-get_preview_url.openapi.yaml
install -D -m 644 $SOURCE12 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-get_sitebuilder_domain_statuses.openapi.yaml
install -D -m 644 $SOURCE13 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-get_sso_link.openapi.yaml
install -D -m 644 $SOURCE14 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-get_templates.openapi.yaml
install -D -m 644 $SOURCE15 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-get_user_site_metadata.openapi.yaml
install -D -m 644 $SOURCE16 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-publish.openapi.yaml
install -D -m 644 $SOURCE17 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet-set_template.openapi.yaml
install -D -m 644 $SOURCE18 $buildroot/usr/local/cpanel/Cpanel/API/Sitejet.pm
install -D -m 644 $SOURCE19 $buildroot/usr/local/cpanel/Cpanel/Admin/Modules/Cpanel/sitejet.pm
install -D -m 644 $SOURCE20 $buildroot/usr/local/cpanel/Cpanel/Config/ConfigObj/Driver/sitejet.json
install -D -m 644 $SOURCE21 $buildroot/usr/local/cpanel/Cpanel/Server/WebSocket/cpanel/LogStreamer.pm
install -D -m 644 $SOURCE22 $buildroot/usr/local/cpanel/Cpanel/Sitejet/Connector.pm
install -D -m 644 $SOURCE23 $buildroot/usr/local/cpanel/Cpanel/Sitejet/Publish.pm
install -D -m 644 $SOURCE24 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/3rdpartylicenses.txt
install -D -m 644 $SOURCE25 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/assets/Site_Builder_Dark.svg
install -D -m 644 $SOURCE26 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/assets/Site_Builder_Light.svg
install -D -m 644 $SOURCE27 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/assets/no-image.svg
install -D -m 644 $SOURCE28 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/index.html.tt
install -D -m 644 $SOURCE29 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/main.23f54ed7144c51a4.js
install -D -m 644 $SOURCE30 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/main.23f54ed7144c51a4.js.map
install -D -m 644 $SOURCE31 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/polyfills.a904e6a5b2d40e5d.js
install -D -m 644 $SOURCE32 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/polyfills.a904e6a5b2d40e5d.js.map
install -D -m 644 $SOURCE33 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/runtime.24a400ee4bddc63b.js
install -D -m 644 $SOURCE34 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/runtime.24a400ee4bddc63b.js.map
install -D -m 644 $SOURCE35 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/styles.ef46db3751d8e999.css
install -D -m 644 $SOURCE36 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/vendor.6a2f167f9057fc0c.js
install -D -m 644 $SOURCE37 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/vendor.6a2f167f9057fc0c.js.map
install -D -m 644 $SOURCE38 $buildroot/usr/local/cpanel/base/frontend/jupiter/sitejet/webpack.shim.html
install -D -m 644 $SOURCE39 $buildroot/usr/local/cpanel/t/medium/Cpanel-API-Sitejet.t
install -D -m 644 $SOURCE40 $buildroot/usr/local/cpanel/t/medium/Cpanel-Admin-Modules-Cpanel-sitejet.t
install -D -m 644 $SOURCE41 $buildroot/usr/local/cpanel/t/medium/Cpanel-Sitejet-Connector.t
install -D -m 644 $SOURCE42 $buildroot/usr/local/cpanel/t/medium/Cpanel-Sitejet-Publish.t
install -D -m 644 $SOURCE43 $buildroot/var/cpanel/plugins/sitejet/README.md
install -D -m 644 $SOURCE44 $buildroot/var/cpanel/plugins/sitejet/cpanel-sitejet-plugin.svg
install -D -m 644 $SOURCE45 $buildroot/var/cpanel/plugins/sitejet/install.json
install -D -m 644 $SOURCE46 $buildroot/var/cpanel/plugins/sitejet/menu/LeftMenu.yaml
echo "Tree for buildroot: $buildroot"
tree $buildroot
