
deb: common
	install -m 755 generate-sample-file.pl                  $(DESTDIR)/usr/bin/disk_downloader.generate-sample-file.pl
	install -m 644 conf.d/upstreams.*			$(DESTDIR)/etc/nginx/disk/env/

	install -d $(DESTDIR)/etc/nginx/disk/include
	install -m 644 disk/include/downloader-get-file.include $(DESTDIR)/etc/nginx/disk/include/downloader-get-file.include
	install -m 644 disk/include/downloader-check-auth.include       $(DESTDIR)/etc/nginx/disk/include/downloader-check-auth.include
	install -m 644 disk/include/downloader-check-auth_ua.include       $(DESTDIR)/etc/nginx/disk/include/downloader-check-auth_ua.include
	install -m 644 disk/include/downloader-preview.include  $(DESTDIR)/etc/nginx/disk/include/downloader-preview.include
	install -m 644 disk/include/downloader-installer.include  $(DESTDIR)/etc/nginx/disk/include/downloader-installer.include
	install -m 644 disk/include/downloader-zip.include      $(DESTDIR)/etc/nginx/disk/include/downloader-zip.include
	install -m 644 disk/include/downloader-zip-host.development.include      $(DESTDIR)/etc/nginx/disk/include/downloader-zip-host.development.include
	install -m 644 disk/include/downloader-zip-host.testing.include      $(DESTDIR)/etc/nginx/disk/include/downloader-zip-host.testing.include
	install -m 644 disk/include/downloader-zip-host.prestable.include      $(DESTDIR)/etc/nginx/disk/include/downloader-zip-host.prestable.include
	install -m 644 disk/include/downloader-zip-host.production.include      $(DESTDIR)/etc/nginx/disk/include/downloader-zip-host.production.include
	install -m 644 disk/include/downloader-get-file-or-redirect-to-mulca.include $(DESTDIR)/etc/nginx/disk/include/downloader-get-file-or-redirect-to-mulca.include
	install -m 644 disk/include/downloader-get-file-after-redirect.include $(DESTDIR)/etc/nginx/disk/include/downloader-get-file-after-redirect.include
	install -m 644 disk/include/range_cache-central.include $(DESTDIR)/etc/nginx/disk/include/range_cache-central.include
	install -m 644 disk/include/range_cache-regional.include $(DESTDIR)/etc/nginx/disk/include/range_cache-regional.include
	install -m 644 disk/include/downloader-server-central.include   $(DESTDIR)/etc/nginx/disk/include/downloader-server-central.include
	install -m 644 disk/include/downloader-server-regional.include  $(DESTDIR)/etc/nginx/disk/include/downloader-server-regional.include
	install -m 644 disk/include/proxy_cache_path.include    $(DESTDIR)/etc/nginx/disk/include/proxy_cache_path.include
	install -m 644 disk/include/downloader-cors-support.include $(DESTDIR)/etc/nginx/disk/include/downloader-cors-support.include

rpm: common
	install -m 644 logrotate-downloader.cron.d		$(DESTDIR)/etc/cron.d/logrotate-downloader
	install -m 644 rm-nginx-spool.cron.d			$(DESTDIR)/etc/cron.d/rm-nginx-spool

	install -d $(DESTDIR)/etc/nginx/conf.d

	install -d $(DESTDIR)/etc/cron.yandex
	install -m 755 logrotate-downloader.sh			$(DESTDIR)/etc/cron.yandex/logrotate-downloader.sh

	install -d $(DESTDIR)/etc/sudoers.d
	install -m 440 downloader.sudoers.d			$(DESTDIR)/etc/sudoers.d/downloader

	./generate-sample-file.pl				$(DESTDIR)/etc/nginx/disk/html/rsample

	install -d $(DESTDIR)/etc/yamail/ssl
	install -d $(DESTDIR)/root/bin
	install -d $(DESTDIR)/var/log/nginx/downloader
	install -m 644 downloader-logbackup.cron.d		$(DESTDIR)/etc/cron.d/downloader-logbackup
	install -m 400 downloader-logbackup-rsync.passwd	$(DESTDIR)/etc/downloader-logbackup-rsync.passwd
	install -m 755 downloader-logbackup.sh			$(DESTDIR)/etc/cron.yandex/downloader-logbackup.sh

	install -d $(DESTDIR)/etc/nginx/disk/include
	install -m 644 disk/include/downloader-mulca.include    $(DESTDIR)/etc/nginx/disk/include/downloader-mulca.include
	install -m 644 disk/include/downloader-server-mulca.include     $(DESTDIR)/etc/nginx/disk/include/downloader-server-mulca.include

common:
	install -d $(DESTDIR)/usr/bin
	install -d $(DESTDIR)/etc/yandex
	install -d $(DESTDIR)/etc/cron.d
	install -d $(DESTDIR)/etc/nginx/disk/env
	install -m 644 wd-downloader.cron.d			$(DESTDIR)/etc/cron.d/wd-downloader
	install -m 644 downloads-counter.cron.d		$(DESTDIR)/etc/cron.d/downloads-counter

	install -m 644 disk-downloader.yaml		$(DESTDIR)/etc/yandex/disk-downloader.yaml

	install -d $(DESTDIR)/etc/nginx/conf.d
	install -m 644 conf.d/downloader.conf			$(DESTDIR)/etc/nginx/conf.d/downloader.conf

	install -d $(DESTDIR)/etc/nginx/disk/include
	install -m 644 disk/include/downloader-check-stid.include	$(DESTDIR)/etc/nginx/disk/include/downloader-check-stid.include
	install -m 644 disk/include/downloader-ssl.include	$(DESTDIR)/etc/nginx/disk/include/downloader-ssl.include
	install -m 644 disk/include/fastcgi_params              $(DESTDIR)/etc/nginx/disk/include/fastcgi_params

	install -d $(DESTDIR)/etc/nginx/disk/html
	install -m 644 disk/html/404.html			$(DESTDIR)/etc/nginx/disk/html/404.html
	install -m 644 disk/html/500.html			$(DESTDIR)/etc/nginx/disk/html/500.html
	install -m 644 disk/html/index.html			$(DESTDIR)/etc/nginx/disk/html/index.html
	install -m 644 disk/html/robots.txt			$(DESTDIR)/etc/nginx/disk/html/robots.txt

	install -d $(DESTDIR)/etc/nginx/YandexDisk/
	install -m 644 YandexDisk/DownloaderCipher.pm		$(DESTDIR)/etc/nginx/YandexDisk/DownloaderCipher.pm
	install -m 644 YandexDisk/DownloaderHandlers.pm		$(DESTDIR)/etc/nginx/YandexDisk/DownloaderHandlers.pm
	install -m 644 YandexDisk/DownloaderVars.pm		$(DESTDIR)/etc/nginx/YandexDisk/DownloaderVars.pm
	install -m 644 YandexDisk/DownloaderSecrets.pm		$(DESTDIR)/etc/nginx/YandexDisk/DownloaderSecrets.pm
	install -m 644 YandexDisk/DownloadsCounter.pm		$(DESTDIR)/etc/nginx/YandexDisk/DownloadsCounter.pm

	install -m 755 downloads-counter-inc.pl			$(DESTDIR)/usr/bin/downloads-counter-inc.pl
	install -m 755 downloads-counter-stat.pl		$(DESTDIR)/usr/bin/downloads-counter-stat.pl

