The code that drives my apt repository. https://apt.starbeamrainbowlabs.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
807 B

  1. #!/usr/bin/env bash
  2. set -e;
  3. source="/home/ci/sftp-root/CIAptPackages";
  4. destination="/srv/aptosaurus/sources";
  5. aptosaurus="/srv/aptosaurus/aptosaurus.sh";
  6. HOME="$(dirname "${aptosaurus}")";
  7. export HOME;
  8. # The user account to chown to & run aptosaurus under
  9. # FUTURE: Use own account? Is it worth it for a cron job?
  10. user_account="daemon";
  11. # Locate & move the .deb files into place
  12. find "${source}" -type f -name "*.deb" -print0 | xargs -n1 -I{} --null mv "{}" "${destination}";
  13. # chown them to the right user account
  14. chown -R "${user_account}:${user_account}" "${destination}";
  15. # Re-run aptosaurus
  16. aptosaurus_dir="$(dirname "${aptosaurus}")";
  17. cd "${aptosaurus_dir}" || { echo "Failed to cd into aptosaurus directory"; exit 1; };
  18. sudo -u "${user_account}" bash "$(basename "${aptosaurus}")" update-cron;