Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from C0dePlayer/dev
Browse files Browse the repository at this point in the history
✨ feat(*): introduce new `image-cleaner` module and improve scripts
  • Loading branch information
c0deplayer authored Oct 10, 2023
2 parents 9c197c7 + 4b132f4 commit 6f60d13
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 116 deletions.
7 changes: 7 additions & 0 deletions config/common_modules/image-cleaner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: image-cleaner
entries:
- nvtop
- htop
repos:
- _copr:copr.fedorainfracloud.org:phracek:PyCharm
- google-chrome
1 change: 1 addition & 0 deletions config/common_modules/rpm-ostree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ remove:
- gnome-tour
- gnome-terminal
- gnome-terminal-nautilus
- gnome-classic-session
1 change: 0 additions & 1 deletion config/common_modules/scripts.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
type: script
scripts:
- cleanup.sh
- signing.sh
62 changes: 0 additions & 62 deletions config/files/usr/lib/udev/razer_mount

This file was deleted.

39 changes: 0 additions & 39 deletions config/files/usr/lib/udev/rules.d/99-razer.rules

This file was deleted.

13 changes: 0 additions & 13 deletions config/scripts/cleanup.sh

This file was deleted.

1 change: 0 additions & 1 deletion config/scripts/container-tools.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env bash

# Tell build process to exit if there are any errors.
set -oue pipefail
FILES_ROOT="/tmp/config/files"

Expand Down
10 changes: 10 additions & 0 deletions config/scripts/udev-rules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -oue pipefail
FILES_ROOT="/tmp/config/files"

wget -O $FILES_ROOT/99-razer.rules 'https://raw.githubusercontent.com/ublue-os/openrazer/master/install_files/udev/99-razer.rules'
wget -O $FILES_ROOT/razer_mount 'https://raw.githubusercontent.com/ublue-os/openrazer/master/install_files/udev/razer_mount'

install -m 0644 "$FILES_ROOT/99-razer.rules" "/usr/lib/udev/rules.d/99-razer.rules"
install -m 0755 "$FILES_ROOT/razer_mount" "/usr/lib/udev/razer_mount"
2 changes: 2 additions & 0 deletions config/silverflow-nvidia-38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ modules:
enabled:
- podman.socket

- from-file: common_modules/image-cleaner.yml
- from-file: common_modules/scripts.yml

- type: script
scripts:
- container-tools.sh
- udev-rules.sh
1 change: 1 addition & 0 deletions config/silverflow-nvidia-39.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ modules:
- type: yafti

- from-file: common_modules/systemd.yml
- from-file: common_modules/image-cleaner.yml
- from-file: common_modules/scripts.yml
Empty file removed modules/.gitkeep
Empty file.
16 changes: 16 additions & 0 deletions modules/image-cleaner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# `image-cleaner` Module for Startingpoint

The `image-cleaner` module is a tool designed to enhance your desktop experience by efficiently managing and decluttering unnecessary shortcuts or repositories that may accumulate during image building.

To make the most of the `image-cleaner` module, you can easily specify the desktop entries you want to remove in your configuration file using the `entries:` section. If you need to remove repositories, you can do so by utilizing the `repos:` section.

## Example configuration
```yaml
type: desktop-cleaner
entries:
- nvtop
- htop
repos:
- _copr:copr.fedorainfracloud.org:phracek:PyCharm.repo
- google-chrome.repo
```
36 changes: 36 additions & 0 deletions modules/image-cleaner/image-cleaner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -oue pipefail

get_yaml_array ENTRIES '.entries[]' "$1"

if [[ ${#ENTRIES[@]} -gt 0 ]]; then
echo "Removing desktop entries..."
for entry in "${ENTRIES[@]}"; do
entry="$(echo "$entry" | tr -d '\n')"
desktop_file="/usr/share/applications/${entry}.desktop"

if [[ -f "$desktop_file" ]]; then
rm -f "$desktop_file"
echo "Removed: $entry"
else
echo "Not found: $entry"
fi
done
fi

get_yaml_array REPOS '.repos[]' "$1"

if [[ ${#REPOS[@]} -gt 0 ]]; then
echo "Removing repositories..."
for repo in "${REPOS[@]}"; do
repo="$(echo "$repo" | tr -d '\n')"
repo_file="/etc/yum.repos.d/${repo}.repo"

if [[ -f "$repo_file" ]]; then
rm -f "$repo_file"
echo "Removed: $repo_file"
else
echo "Not found: $repo_file"
fi
done
fi

0 comments on commit 6f60d13

Please sign in to comment.