Skip to content
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

Write current state to a statefile (preparation for the future systray applet) #148

Merged
merged 6 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ install:
install -Dm 644 po/fr.mo "${DESTDIR}${PREFIX}/share/locale/fr/LC_MESSAGES/${_pkgname}.mo"
rm -f po/fr.mo

# Generate state
install -Dm 666 "res/state" "${DESTDIR}/var/lib/arch-update/state"
Antiz96 marked this conversation as resolved.
Show resolved Hide resolved

# Install shell completions
install -Dm 644 "res/completions/${pkgname}.bash" "${DESTDIR}${PREFIX}/share/bash-completion/completions/${pkgname}"
install -Dm 644 "res/completions/${pkgname}.zsh" "${DESTDIR}${PREFIX}/share/zsh/site-functions/_${pkgname}"
Expand Down
1 change: 1 addition & 0 deletions res/state
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
arch-update
Antiz96 marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 9 additions & 4 deletions src/script/arch-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ _name="Arch-Update"
version="1.15.0"
option="${1}"

if [ -z "$ARCH_UPDATE_STATE"]
Antiz96 marked this conversation as resolved.
Show resolved Hide resolved
then
ARCH_UPDATE_STATE="/var/lib/arch-update/state"
fi

# Display debug traces if the -D/--debug argument is passed
for arg in "${@}"; do
case "${arg}" in
Expand Down Expand Up @@ -195,22 +200,22 @@ icon_dir="/usr/share/icons/${name}"

# Definition of the icon_checking function: Change icon to "checking"
icon_checking() {
Antiz96 marked this conversation as resolved.
Show resolved Hide resolved
cp -f "${icon_dir}/${name}_checking.svg" "${icon_dir}/${name}.svg" || exit 3
echo "${name}_checking" > "${ARCH_UPDATE_STATE}"
trigg marked this conversation as resolved.
Show resolved Hide resolved
}

# Definition of the icon_updates_available function: Change icon to "updates-available"
icon_updates_available() {
cp -f "${icon_dir}/${name}_updates-available.svg" "${icon_dir}/${name}.svg" || exit 3
echo "${name}_updates-available" > "${ARCH_UPDATE_STATE}"
Antiz96 marked this conversation as resolved.
Show resolved Hide resolved
}

# Definition of the icon_installing function: Change icon to "installing"
icon_installing() {
cp -f "${icon_dir}/${name}_installing.svg" "${icon_dir}/${name}.svg" || exit 3
echo "${name}_installing" > "${ARCH_UPDATE_STATE}"
}

# Definition of the icon_up_to_date function: Change icon to "up to date"
icon_up_to_date() {
cp -f "${icon_dir}/${name}_up-to-date.svg" "${icon_dir}/${name}.svg" || exit 3
echo "${name}_up-to-date" > "${ARCH_UPDATE_STATE}"
}

# Definition of the check function: Check for available updates, change the icon accordingly and send a desktop notification containing the number of available updates
Expand Down