Skip to content

Commit

Permalink
Merge branch 'testing' into Eeems-patch-10
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems authored Sep 12, 2024
2 parents 54d5dcb + f8430da commit 3cd792e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
9 changes: 6 additions & 3 deletions package/kernelctl/kernelctl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ bl="\033[1;34m" # blue
# change our working directory to / to ease filesystem operations
cd /

# find current os version
os_version=$(awk -F= '/RELEASE_VERSION/{print $2}' /usr/share/remarkable/update.conf)

help() {
read -r -d '' msg <<- EOM
Usage: $(basename "$0") COMMAND
Expand All @@ -36,7 +39,7 @@ help() {
# backup current kernel
backup() {
if [[ "$1" = "vanilla" ]]; then
kernel_name="vanilla-$(< /etc/version)"
kernel_name="vanilla-$os_version"
else
kernel_name=$1
fi
Expand Down Expand Up @@ -82,7 +85,7 @@ to_kernel_name() {
echo "${kernel_names[$(($1 - 1))]}"
return
elif [[ "$1" = "default" ]]; then
ker="vanilla-$(< /etc/version)"
ker="vanilla-$os_version"
else
ker="$1"
fi
Expand Down Expand Up @@ -185,7 +188,7 @@ prune() {
echo -n "Do you want to proceed? [N/y]: "
read -r ans
if [[ "$ans" = "y" || "$ans" = "Y" ]]; then
mapfile -t filenames < <(find "$kernelctl_dir" -path "*vanilla-*.tar.bz2" ! -name vanilla-"$(< /etc/version)".tar.bz2)
mapfile -t filenames < <(find "$kernelctl_dir" -path "*vanilla-*.tar.bz2" ! -name vanilla-"$os_version".tar.bz2)
for filename in "${filenames[@]}"; do
rm "$filename"
done
Expand Down
10 changes: 6 additions & 4 deletions package/kernelctl/package
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pkgnames=(kernelctl)
pkgdesc="Manage aftermarket kernels"
url=https://toltec-dev.org/
pkgver=0.1-7
pkgver=0.2-1
timestamp=2022-11-12T00:00Z
section="utils"
maintainer="Salvatore Stella <[email protected]>"
Expand All @@ -26,15 +26,17 @@ package() {
}

configure() {
if [[ "$(kernelctl list | tail -n +2 | awk '{print $2}' | grep "vanilla-$(< /etc/version)")" == "" ]]; then
os_version=$(awk -F= '/RELEASE_VERSION/{print $2}' /usr/share/remarkable/update.conf)
if [[ "$(kernelctl list | tail -n +2 | awk '{print $2}' | grep "vanilla-$os_version")" == "" ]]; then
echo "Creating a backup of the currently running kernel."
kernelctl backup vanilla
fi
}

preremove() {
if [[ "$(kernelctl show | tail -n 1 | grep "vanilla-$(< /etc/version)")" == "" ]]; then
if [[ "$(kernelctl list | tail -n +2 | awk '{print $2}' | grep "vanilla-$(< /etc/version)")" == "" ]]; then
os_version=$(awk -F= '/RELEASE_VERSION/{print $2}' /usr/share/remarkable/update.conf)
if [[ "$(kernelctl show | tail -n 1 | grep "vanilla-$os_version")" == "" ]]; then
if [[ "$(kernelctl list | tail -n +2 | awk '{print $2}' | grep "vanilla-$os_version")" == "" ]]; then
echo "Unable to restore default kernel."
echo "To force removal, you can run the following:"
echo " opkg remove --force-remove kernelctl"
Expand Down

0 comments on commit 3cd792e

Please sign in to comment.