Skip to content

Commit eef1eea

Browse files
feat: enhance profile generation and update README
- Added cross-shell support in `gen-profile.sh` to detect Bash or Zsh - Included `.shell-aliases` back in the README contents table - Improved `README.md` with detailed usage instructions - Explained `cleanup` and `cleanupThumbnails` functions - Documented how to use `.zipping` with encryption/decryption examples - Clarified modular file structure and profile generation logic - Removed incorrect reference to `.shell-aliases` (now restored)
1 parent c6175bb commit eef1eea

3 files changed

Lines changed: 193 additions & 28 deletions

File tree

src/main/resources/.tweak.sh

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,60 @@
1-
##############################
2-
# clean up the ubuntu system #
3-
##############################
1+
2+
#######################################
3+
# Clean up the Linux system based on OS
4+
# - Keeps function name 'cleanup' for compatibility
5+
#######################################
46
cleanup() {
5-
sudo apt-get autoclean
6-
sudo apt-get clean
7-
sudo apt-get autoremove
8-
sudo apt-get update
9-
sudo apt-get upgrade
10-
sudo apt --fix-broken install
7+
info "🧹 Starting system cleanup for $OS..."
8+
9+
case "$OS" in
10+
ubuntu|debian|raspbian|wsl)
11+
cleanup_debian_based
12+
;;
13+
manjaro|arch)
14+
cleanup_arch_based
15+
;;
16+
*)
17+
error "Unsupported OS: $OS. Skipping cleanup."
18+
return 1
19+
;;
20+
esac
21+
22+
info "✅ System cleanup completed for $OS."
1123
}
1224

1325
##########################################
14-
# clean up the thumbnails from the cache #
26+
# Clean up the thumbnails from the cache
27+
# - Keeps function name 'cleanupThumbnails'
1528
##########################################
1629
cleanupThumbnails() {
17-
rm -rf ~/.cache/thumbnails/*
30+
local cache_path="$HOME/.cache/thumbnails"
31+
if [[ -d "$cache_path" ]]; then
32+
info "🗑️ Cleaning thumbnail cache in $cache_path..."
33+
rm -rf "${cache_path:?}/"*
34+
else
35+
warning "Thumbnail cache directory not found: $cache_path"
36+
fi
1837
}
38+
39+
#######################################
40+
# Internal: Debian-based cleanup
41+
#######################################
42+
cleanup_debian_based() {
43+
info "[Debian/Ubuntu] Running apt cleanup..."
44+
sudo apt-get autoclean -y
45+
sudo apt-get clean
46+
sudo apt-get autoremove -y
47+
sudo apt --fix-broken install -y
48+
sudo apt-get update -y
49+
sudo apt-get upgrade -y
50+
}
51+
52+
#######################################
53+
# Internal: Arch-based cleanup
54+
#######################################
55+
cleanup_arch_based() {
56+
info "[Manjaro/Arch] Running pacman/pamac cleanup..."
57+
pamac clean --build-files --no-confirm || true
58+
sudo pacman -Rns $(pacman -Qtdq) --noconfirm 2>/dev/null || info "No orphaned packages to remove"
59+
sudo pacman -Syu --noconfirm
60+
}

src/main/resources/README.md

Lines changed: 95 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,105 @@
1-
## .zipping
1+
# 💻 Linux System Profile & Maintenance Scripts
22

3-
For zip a folder or a file you can use the alias functions for zipping. If not done you have to import the aliases from the .zipping file to your .profile.
3+
This repository contains a collection of Bash configuration files, aliases, and maintenance scripts to standardize and
4+
manage your Linux environments (e.g., Ubuntu, Debian, Raspbian, Manjaro, Arch, WSL, Cygwin).
45

6+
---
57

6-
Here an example how to zip and unzip with encryption:
8+
## 📦 Contents
79

8-
Lets say you have a folder '/home/johndoe/docs' and you want to zip and encrypt it. Change from the shell to the home folder of the user johndoe '/home/johndoe' and execute the following command:
10+
| File / Script | Description |
11+
|--------------------------|-------------------------------------------------|
12+
| `.aliasesrc` | Collection of useful shell aliases |
13+
| `.shell-aliases` | Erweiterte Aliase für gängige CLI-Kommandos |
14+
| `.profile` | General profile loaded by your shell |
15+
| `.aptrc` | Aliases and functions for Debian/Ubuntu (apt) |
16+
| `.mvnrc`, `.npmrc`, etc. | Tool-specific configurations |
17+
| `gen-profile.sh` | Builds the main profile from modular components |
18+
| `gen-cygwin-profile.sh` | Profile generation script tailored for Cygwin |
19+
| `.tweak.sh` | Optional shell tweaks for cleaning the system |
20+
| `.zipping` | Script for packaging the environment |
21+
| `LICENSE.txt` | License information |
22+
| `README.md` | This documentation |
923

10-
```shell
11-
:~$ zipAndEncrypt docs/ docs.enc
24+
---
25+
26+
## ⚙️ Usage
27+
28+
### 🛠️ 1. Generate the Profile
29+
30+
Use the script to automatically generate a `.profile` (for Bash) or `.zshrc` (for Zsh):
31+
32+
```bash
33+
bash gen-profile.sh
34+
```
35+
36+
For Cygwin users:
37+
38+
```bash
39+
bash gen-cygwin-profile.sh
40+
```
41+
42+
### 🧹 2. Use the System Cleanup Functions
43+
44+
The following maintenance functions are available in your profile:
45+
46+
```bash
47+
cleanup # Runs an OS-specific cleanup (apt, pacman, etc.)
48+
cleanupThumbnails # Clears the thumbnail cache (~/.cache/thumbnails/*)
1249
```
1350

14-
You will be prompted twice to enter a password for the encryption. If everything goes right the output will be the zip-file 'docs.enc'.
51+
> ✅ These functions automatically detect your operating system (Ubuntu, Debian, Manjaro, Arch, etc.)
52+
53+
### 🔄 3. Reload Your Shell Config
1554

16-
If you want later to decrypt the zip-file 'docs.enc' change to the folder where the zip-file is and execute the following command:
55+
After generating the new `.bashrc` or `.zshrc`, activate the changes:
1756

18-
```shell
19-
:~$ unzipAndDencrypt docs.enc
57+
```bash
58+
source ~/.bashrc
59+
# or
60+
source ~/.zshrc
2061
```
21-
You will be prompted to enter the password for the decryption of the zip-file.
22-
If the password is correct the zip-file 'docs.enc' will be unzip in the current folder.
62+
63+
---
64+
65+
## 📌 Recommendations
66+
67+
- Automate the setup with an `install.sh` script
68+
- Use `cron` or a `systemd` timer to run cleanup tasks regularly
69+
- Version control your dotfiles with Git
70+
71+
---
72+
73+
## 📄 License
74+
75+
See [`LICENSE.txt`](./LICENSE.txt)
76+
77+
---
78+
79+
## 🔐 .zipping
80+
81+
To zip a folder or file, you can use the alias functions provided in the `.zipping` script. If not already sourced, make
82+
sure to import these aliases into your `.profile`.
83+
84+
### 🔒 Example: Zip and Encrypt
85+
86+
Suppose you have a folder `/home/johndoe/docs` that you want to zip and encrypt. First, change to the user's home
87+
directory:
88+
89+
```bash
90+
cd /home/johndoe
91+
zipAndEncrypt docs/ docs.enc
92+
```
93+
94+
You will be prompted twice to enter a password for encryption. If successful, the output will be the encrypted zip file
95+
`docs.enc`.
96+
97+
### 🔓 Example: Unzip and Decrypt
98+
99+
To decrypt and unzip the file later, go to the folder where `docs.enc` is located and run:
100+
101+
```bash
102+
unzipAndDencrypt docs.enc
103+
```
104+
105+
You will be asked for the decryption password. If correct, the archive will be extracted in the current directory.

src/main/resources/gen-profile.sh

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,46 @@
11
#!/bin/bash
2-
#########################################################################################
3-
# merge defragmented aliases files to the '.profile'. #
4-
# This file can than merged with the '.profile' for the users home directory. #
5-
#########################################################################################
6-
cat .aliasesrc .bowerrc .dirrc .git-aliases .gulprc .mvnrc .npmrc .shell-aliases .tweak.sh .zipping > .profile
2+
3+
################################################################################
4+
# Generate .profile or .zshrc based on the user's shell #
5+
# This script merges modular dotfiles into one unified profile file #
6+
################################################################################
7+
8+
# Define input files
9+
INPUT_FILES=(
10+
.aliasesrc
11+
.bowerrc
12+
.dirrc
13+
.git-aliases
14+
.gulprc
15+
.mvnrc
16+
.npmrc
17+
.tweak.sh
18+
.zipping
19+
)
20+
21+
# Detect user shell
22+
SHELL_NAME=$(basename "$SHELL")
23+
TARGET_FILE="$HOME/.profile"
24+
25+
if [[ "$SHELL_NAME" == "zsh" ]]; then
26+
TARGET_FILE="$HOME/.zshrc"
27+
fi
28+
29+
# Announce action
30+
echo "🔧 Generating config for shell: $SHELL_NAME"
31+
echo "📄 Output file: $TARGET_FILE"
32+
echo "🔍 Combining the following files:"
33+
34+
# Combine files
35+
> "$TARGET_FILE"
36+
for file in "${INPUT_FILES[@]}"; do
37+
if [[ -f "$file" ]]; then
38+
echo "$file"
39+
cat "$file" >> "$TARGET_FILE"
40+
echo -e "\n" >> "$TARGET_FILE"
41+
else
42+
echo " ⚠️ Skipping missing file: $file"
43+
fi
44+
done
45+
46+
echo "✅ Profile generated successfully!"

0 commit comments

Comments
 (0)