2019-08-09 23:00:14 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
source="/home/ci/sftp-root/CIAptPackages";
|
|
|
|
destination="/srv/aptosaurus/sources";
|
|
|
|
aptosaurus="/srv/aptosaurus/aptosaurus.sh";
|
|
|
|
# The user account to chown to & run aptosaurus under
|
|
|
|
# FUTURE: Use own account? Is it worth it for a cron job?
|
|
|
|
user_account="daemon";
|
|
|
|
|
2019-09-06 17:09:39 +00:00
|
|
|
# Locate & move the .deb files into place
|
2019-08-09 23:00:14 +00:00
|
|
|
find "${source}" -type f -name "*.deb" -print0 | xargs -n1 -I{} --null mv "{}" "${destination}";
|
|
|
|
|
|
|
|
# chown them to the right user account
|
|
|
|
chown -R "${user_account}:${user_account}" "${destination}";
|
|
|
|
|
|
|
|
# Re-run aptosaurus
|
|
|
|
aptosaurus_dir="$(dirname "${aptosaurus}")";
|
|
|
|
cd "${aptosaurus_dir}" || exit 1;
|
2019-08-09 23:02:35 +00:00
|
|
|
sudo -u "${user_account}" bash "$(basename "${aptosaurus}")" update-cron;
|