-
Notifications
You must be signed in to change notification settings - Fork 6
Mirror linux mint #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@LuisDakan Try to check what was changed in comparison with main, if it looks ok, we can merge PD: Don't forget to approve ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR sets up infrastructure for mirroring Linux Mint repositories and ISO images on a LIDSoL mirror server. It introduces Ansible automation for deploying systemd services and timers that periodically synchronize content from upstream Linux Mint sources.
- Adds Ansible playbook to deploy Linux Mint mirror synchronization services
- Implements two separate sync scripts for repository packages and ISO images
- Configures systemd timers to run synchronization every 15 minutes
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| mirrors/main.yml | Main Ansible playbook entry point for mirror server setup |
| mirrors/hosts.ini | Inventory file defining the target mirror server |
| mirrors/tasks/linux-mint.yaml | Ansible tasks to deploy systemd services, timers, and sync scripts |
| mirrors/files/linux-mint/repository/scripts/linux-mint-sync-repo.sh | Bash script to synchronize Linux Mint repository packages |
| mirrors/files/linux-mint/repository/confd/mintUpdateRepository.service | Systemd service unit for repository synchronization |
| mirrors/files/linux-mint/repository/confd/mintUpdateRepository.timer | Systemd timer to trigger repository sync every 15 minutes |
| mirrors/files/linux-mint/images/scripts/linux-mint-sync-images.sh | Bash script to synchronize Linux Mint ISO images |
| mirrors/files/linux-mint/images/confd/mintUpdateImages.service | Systemd service unit for ISO image synchronization |
| mirrors/files/linux-mint/images/confd/mintUpdateImages.timer | Systemd timer to trigger image sync every 15 minutes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| function get_local_time() { | ||
| if [ -f ${MIRROR_DIRECTORY}/${LATEST_UPDATE_FILE} ]; then | ||
| cat ${MIRROR_DIRECTORY}/${LATEST_UPDATE_FILE} | head -n 1 |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless use of cat. Replace cat ${MIRROR_DIRECTORY}/${LATEST_UPDATE_FILE} | head -n 1 with head -n 1 ${MIRROR_DIRECTORY}/${LATEST_UPDATE_FILE} to avoid unnecessary process creation.
| cat ${MIRROR_DIRECTORY}/${LATEST_UPDATE_FILE} | head -n 1 | |
| head -n 1 ${MIRROR_DIRECTORY}/${LATEST_UPDATE_FILE} |
| echo "Error: rsync failed" | ||
| exit 1 | ||
| fi | ||
|
|
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing whitespace at the end of line.
| | grep -Eo '[0-9]{2}-[A-Za-z]{3}-[0-9]{4} [0-9]{2}:[0-9]{2}') | ||
| local latest="" | ||
| local latest_epoch=0 | ||
| #In case we don't receive any date for connection problems |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after #. Should be # In case we don't receive any date for connection problems.
| #In case we don't receive any date for connection problems | |
| # In case we don't receive any date for connection problems |
|
|
||
| - name: Copy linux mint sync script for repository mirror | ||
| ansible.builtin.copy: | ||
| src: files/linux-mint/repository/scripts/linux-mint-sync-repo.sh |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space after src:. Remove the extra space for consistency with other file copy tasks in the playbook.
| src: files/linux-mint/repository/scripts/linux-mint-sync-repo.sh | |
| src: files/linux-mint/repository/scripts/linux-mint-sync-repo.sh |
| Type=oneshot | ||
| ExecStart=/usr/local/bin/linux-mint-sync-images.sh | ||
| TimeoutStartSec=7200 | ||
| User=mirrors No newline at end of file |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The service specifies User=mirrors, but there's no task in the Ansible playbook to create this user. Ensure the user exists on the target system, or add a task to create it before deploying these services.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I write the task in main instead?, because the user most exist for every mirror
| MIRROR_DIRECTORY=/srv/linux-mint | ||
| LOCAL_MIRROR="lidsol.fi-b.unam.mx" | ||
| MIRROR_DIRECTORY_RP=${MIRROR_DIRECTORY}/repository | ||
| LATEST_UPDATE_FILE=latest_sync_repository.meta |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script creates directories and writes files in /srv/linux-mint while running as the mirrors user. Ensure the Ansible playbook creates the /srv/linux-mint directory with appropriate ownership and permissions for the mirrors user, otherwise the script will fail with permission errors.
| LATEST_UPDATE_FILE=latest_sync_repository.meta | |
| LATEST_UPDATE_FILE=latest_sync_repository.meta | |
| # Ensure MIRROR_DIRECTORY exists and is writable | |
| if [ ! -d "${MIRROR_DIRECTORY}" ]; then | |
| mkdir -p "${MIRROR_DIRECTORY}" || { echo "Error: Could not create ${MIRROR_DIRECTORY}. Permission denied."; exit 1; } | |
| fi | |
| if [ ! -w "${MIRROR_DIRECTORY}" ]; then | |
| echo "Error: ${MIRROR_DIRECTORY} is not writable by user $(whoami). Please ensure correct ownership and permissions." | |
| exit 1 | |
| fi |
| LOCAL_MIRROR="lidsol.fi-b.unam.mx" | ||
| MIRROR_DIRECTORY_SO=${MIRROR_DIRECTORY}/images | ||
| LATEST_UPDATE_FILE=latest_sync_images.meta | ||
|
|
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script creates directories and writes files in /srv/linux-mint while running as the mirrors user. Ensure the Ansible playbook creates the /srv/linux-mint directory with appropriate ownership and permissions for the mirrors user, otherwise the script will fail with permission errors.
| # Ensure the main mirror directory exists and is owned by the mirrors user | |
| if [ ! -d "${MIRROR_DIRECTORY}" ]; then | |
| mkdir -p "${MIRROR_DIRECTORY}" | |
| fi | |
| chown mirrors:mirrors "${MIRROR_DIRECTORY}" | |
| chmod 755 "${MIRROR_DIRECTORY}" |
| echo "Error: rsync failed" | ||
| exit 1 | ||
| fi | ||
|
|
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing whitespace at the end of line.
| fi | ||
|
|
||
|
|
||
| if [ $(($current_time_epoch - $local_mirror_time_epoch)) -lt 43200 ]; then |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition checks if less than 12 hours (43200 seconds) have passed, but the comment at the top of the file states "less than 24 hours". Either update this threshold to 86400 seconds to match the documentation, or update the file header comment to reflect the actual 12-hour threshold.
| if [ $(($current_time_epoch - $local_mirror_time_epoch)) -lt 43200 ]; then | |
| if [ $(($current_time_epoch - $local_mirror_time_epoch)) -lt 86400 ]; then |
|
|
||
| - name: Copy linux mint sync script for images mirror | ||
| ansible.builtin.copy: | ||
| src: files/linux-mint/images/scripts/linux-mint-sync-images.sh |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space after src:. Remove the extra space for consistency with other file copy tasks in the playbook.
@LuisDakan Try to make the PRs to main to avoid duplicated PRs ;)