Skip to content

PPA Launchpad smart feature#156

Open
FrankiePustorino wants to merge 1 commit intoUtappia:masterfrom
FrankiePustorino:patch-5
Open

PPA Launchpad smart feature#156
FrankiePustorino wants to merge 1 commit intoUtappia:masterfrom
FrankiePustorino:patch-5

Conversation

@FrankiePustorino
Copy link
Copy Markdown
Contributor

  1. Availability check – CHECK_LAUNCHPAD bash
    function CHECK_LAUNCHPAD {
    if curl -4 -s --max-time 8 --connect-timeout 5 --head --fail
    "https://ppa.launchpad.net" >/dev/null 2>&1; then
    return 0
    fi
    return 1
    }
    It verifies whether ppa.launchpad.net is reachable before attempting apt update.

  2. Disable / Restore functions DISABLE_LAUNCHPAD_SOURCES – Finds all .list and .sources files in /etc/apt/sources.list.d that reference ppa.launchpad.net and renames them to *.ucare_disabled. It also comments out any ppa.launchpad.net lines in /etc/apt/sources.list with a marker.

RESTORE_LAUNCHPAD_SOURCES – Reverses both operations, restoring the original files and commenting.

  1. Usage in the maintenance flow Inside the MAINTENANCE function:

bash
echo -e "${YELLOW} • Checking ppa.launchpad.net availability...${ENDCOLOR}" if ! CHECK_LAUNCHPAD; then
echo -e "${YELLOW}⚠ ppa.launchpad.net appears to be unreachable ...${ENDCOLOR}"
DISABLE_LAUNCHPAD_SOURCES
_UCARE_PPA_EXCLUDED=1
else
echo -e "${CYAN} ✓ ppa.launchpad.net is reachable ...${ENDCOLOR}"
fi

... then apt update runs ...

After the update, sources are restored unconditionally: if [ "$_UCARE_PPA_EXCLUDED" -eq 1 ]; then

echo -e "${GREEN}▸ Restoring temporarily disabled PPA sources${ENDCOLOR}"
RESTORE_LAUNCHPAD_SOURCES
echo -e "${YELLOW}⚠ Note: PPA packages were not updated this run.${ENDCOLOR}"

fi
Therefore, the script fully validates and implements a “skip/disable Launchpad PPA when unreachable” mechanism, and automatically restores them after the update run.

1. Availability check – CHECK_LAUNCHPAD
bash
function CHECK_LAUNCHPAD {
    if curl -4 -s --max-time 8 --connect-timeout 5 --head --fail \
        "https://ppa.launchpad.net" >/dev/null 2>&1; then
        return 0
    fi
    return 1
}
It verifies whether ppa.launchpad.net is reachable before attempting apt update.

2. Disable / Restore functions
DISABLE_LAUNCHPAD_SOURCES – Finds all .list and .sources files in /etc/apt/sources.list.d that reference ppa.launchpad.net and renames them to *.ucare_disabled. It also comments out any ppa.launchpad.net lines in /etc/apt/sources.list with a marker.

RESTORE_LAUNCHPAD_SOURCES – Reverses both operations, restoring the original files and commenting.

3. Usage in the maintenance flow
Inside the MAINTENANCE function:

bash
echo -e "${YELLOW}  • Checking ppa.launchpad.net availability...${ENDCOLOR}"
if ! CHECK_LAUNCHPAD; then
    echo -e "${YELLOW}⚠ ppa.launchpad.net appears to be unreachable ...${ENDCOLOR}"
    DISABLE_LAUNCHPAD_SOURCES
    _UCARE_PPA_EXCLUDED=1
else
    echo -e "${CYAN}  ✓ ppa.launchpad.net is reachable ...${ENDCOLOR}"
fi

# ... then apt update runs ...

# After the update, sources are restored unconditionally:
if [ "$_UCARE_PPA_EXCLUDED" -eq 1 ]; then
    echo -e "${GREEN}▸ Restoring temporarily disabled PPA sources${ENDCOLOR}"
    RESTORE_LAUNCHPAD_SOURCES
    echo -e "${YELLOW}⚠ Note: PPA packages were not updated this run.${ENDCOLOR}"
fi
Therefore, the script fully validates and implements a “skip/disable Launchpad PPA when unreachable” mechanism, and automatically restores them after the update run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant