Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit 5ef485d

Browse files
authored
Merge pull request #12 from Cyber-Syntax:refactor
- Add games installation support - Improve borg backup script - Update issue templates - Improve logging
2 parents 6fd3220 + 02b6ae1 commit 5ef485d

File tree

13 files changed

+168
-81
lines changed

13 files changed

+168
-81
lines changed
Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,41 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: "bug: "
4+
title: "🐞 bug: "
55
labels: bug
66
assignees: ""
77
---
88

9-
**Desktop (please complete the following information):**
9+
**Versions**
1010

11-
- OS: [e.g. Linux Fedora]
12-
- Version [e.g. 0.4.3-beta]
13-
- Bash version [e.g 3.11]
11+
- fedora-setup version: <!-- e.g: 0.10.10-alpha -->
12+
- Python version: <!-- [e.g 3.12] -->
1413

1514
**Describe the bug**
16-
A clear and concise description of what the bug is.
1715

18-
**To Reproduce**
19-
Steps to reproduce the behavior:
16+
<!-- A clear and concise description of what the bug is. -->
2017

21-
1. Started script
22-
2. select choice 3
23-
3. See choice 1... 2..., select 2
24-
4. See this error:
18+
**Console Output**
2519

26-
```bash
20+
<!-- Place to output in the below in the quotes -->
21+
22+
```
2723
2824
```
2925

3026
**Expected behavior**
31-
A clear and concise description of what you expected to happen.
3227

33-
**5. ERROR LOG: logs/my-unicorn.log:**
28+
<!-- A clear and concise description of what you expected to happen. -->
29+
30+
**LOG**
3431

35-
````bash
32+
> Paste the log(`/home/<your_username>/.local/state/my-unicorn/my-unicorn.log`) here:
3633
37-
```.
34+
```
3835
3936
37+
```
4038

4139
**Additional context**
42-
Add any other context about the problem here.
43-
````
40+
41+
<!-- Add any other context about the problem here. -->
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: "feat: "
4+
title: "🚀 feat: "
55
labels: enhancement
66
assignees: ""
77
---
88

99
**Is your feature request related to a problem? Please describe.**
10-
A clear and concise description of what the problem is.
11-
Ex. I'm always frustrated when [...]
10+
<!-- A clear and concise description of what the problem is. -->
11+
<!-- Ex. I'm always frustrated when [...] -->
1212

1313
**Describe the solution you'd like**
14-
A clear and concise description of what you want to happen.
14+
<!-- Clear and concise description of the solution you'd like to implement -->
1515

1616
**Describe alternatives you've considered**
17-
A clear and concise description of any alternative solutions or features you've considered.
17+
<!-- Clear and concise description of any alternative solutions or features you've considered. -->

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## v0.4.0-alpha
5+
### CHANGES
6+
New setups and improvements.
7+
48
## v0.3.0-alpha
59
### CHANGES
610
New setups and improvements.

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,3 @@ Experimental: Below functions are need to tested with caution.
5858
Example:
5959
sudo $0 -a
6060
```
61-
62-
```
63-
64-
```

configs/borg/README.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

configs/borg/borgbackup-home.timer

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
Description=Timer for Home Backup using BorgBackup
33

44
[Timer]
5-
# Schedules the backup at 10:00 every day.
6-
OnCalendar=*-*-* 10:00:00
5+
# Schedules the backup at 07:00 every day.
6+
OnCalendar=*-*-* 07:00:00
7+
# Persistence will ensure the timer runs even if the system is down at the scheduled time.
78
Persistent=true
8-
# Note: systemd timers work with local time. To follow Europe/Istanbul time, ensure your system’s timezone is set accordingly.
9+
# Note: systemd timers work with local time.
10+
# ensure your system’s timezone is set accordingly.
911

1012
[Install]
1113
WantedBy=timers.target

configs/borg/home-borgbackup.sh

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1-
#!/bin/bash -e
2-
# Extract command
3-
# sudo borg extract --progress --list /mnt/backups/borgbackup/doc-repo::doc-27-02-2024
4-
#NOTE: this file need to be on /opt/borg/home-borgbackup.sh
1+
#!/usr/bin/env bash
2+
set -o errexit
3+
set -o nounset
4+
set -o pipefail
55

6-
export BORG_UKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
6+
# Check prerequisites
7+
command -v borg >/dev/null 2>&1 || {
8+
echo >&2 "Borg is not installed. Please install it first."
9+
exit 1
10+
}
11+
[[ -d /mnt/backups/borgbackup ]] || {
12+
echo >&2 "Backup directory does not exist."
13+
exit 1
14+
}
715

8-
REPOSITORY_home='/mnt/backups/borgbackup/home-nixos'
16+
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
917

10-
echo "Starting backup"
11-
# home
12-
sudo borg create --list --filter=AME --progress --stats --exclude-caches --show-rc \
18+
borg_home_repo='/mnt/backups/borgbackup/home-repo'
19+
20+
echo "Starting backup for home"
21+
22+
# --show-rc: if return 0 code, then it's successful
23+
if ! sudo borg create --list --filter=AME --progress --stats --exclude-caches --show-rc \
1324
--exclude /home/*/Documents/backup-for-cloud/ \
1425
--exclude /home/*/.cache/ \
1526
--exclude /home/*Downloads/ \
@@ -25,33 +36,38 @@ sudo borg create --list --filter=AME --progress --stats --exclude-caches --show-
2536
--exclude /home/*/.tox/ \
2637
--exclude /home/*/.venv/ \
2738
--exclude /home/*/.backups/ \
28-
--compression zstd,15 $REPOSITORY_home::'{now:home-developer-%d-%m-%Y}' \
29-
/home/developer/
39+
--compression zstd,15 $borg_home_repo::'{now:home-developer-%d-%m-%Y}' \
40+
/home/developer/; then
41+
echo "Backup of home directory failed" >&2
42+
exit 1
43+
fi
3044

3145
echo "Backup of home directory complete"
3246

33-
echo "Pruning old home backups"
34-
35-
# --show-rc: if return 0 code, then it's successful
36-
sudo borg prune -v $REPOSITORY_home --list --stats --show-rc \
47+
if ! sudo borg prune -v $borg_home_repo --list --stats --show-rc \
3748
--keep-daily=7 \
3849
--keep-weekly=4 \
39-
--keep-monthly=2
50+
--keep-monthly=2; then
51+
echo "Pruning of home backups failed" >&2
52+
exit 1
53+
fi
54+
55+
echo "Pruning of home backups complete"
4056

41-
sudo borg check $REPOSITORY_home
42-
# after check
43-
echo "Check complete"
57+
if ! sudo borg check $borg_home_repo; then
58+
echo "Check of home backups failed" >&2
59+
exit 1
60+
fi
61+
echo "borg check completed successfully"
4462

45-
# compact the repository to free up the space
46-
sudo borg compact $REPOSITORY_home
63+
if ! sudo borg compact $borg_home_repo; then
64+
echo "Compaction of home backups failed" >&2
65+
exit 1
66+
fi
4767

4868
echo "Compaction complete"
49-
# make sure to sync
69+
70+
# Being paronoid here
5071
sync
5172

52-
# if return = 'rc 0' then it's successful
53-
if [ $? -eq 0 ]; then
54-
echo "Backup and prune complete!"
55-
else
56-
echo "Backup and prune failed!"
57-
fi
73+
echo "Borg backup completed successfully"

setup.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ needs_dnf_speedup() {
124124
$install_system_specific_packages_option ||
125125
$install_app_packages_option ||
126126
$install_dev_packages_option ||
127+
$install_games_packages_option ||
127128
$librewolf_option ||
128129
$qtile_option ||
129130
$brave_option ||
@@ -226,6 +227,16 @@ install_dev_packages() {
226227
log_info "Development packages installation completed."
227228
}
228229

230+
install_games_packages() {
231+
log_info "Installing games..."
232+
if ! sudo dnf install -y "${GAMES_PACKAGES[@]}"; then
233+
log_error "Error: Failed to install games." >&2
234+
return 1
235+
fi
236+
237+
log_info "Games installation completed."
238+
}
239+
229240
install_flatpak_packages() {
230241
log_info "Installing Flatpak packages..."
231242

@@ -358,6 +369,7 @@ main() {
358369
install_system_specific_packages_option=false
359370
install_app_packages_option=false
360371
install_dev_packages_option=false
372+
install_games_packages_option=false
361373
flatpak_option=false
362374
librewolf_option=false
363375
qtile_option=false
@@ -395,11 +407,12 @@ main() {
395407
nfancurve_option=false
396408

397409
# Process command-line options.
398-
while getopts "abBcdDEFfghHIiAalLjnNopPrstTuUvVzqQxCMSX" opt; do
410+
while getopts "abBcdDEFfGghHIiAalLjnNopPrstTuUvVzqQxCMSX" opt; do
399411
case $opt in
400412
a) all_option=true ;;
401413
A) install_app_packages_option=true ;;
402414
D) install_dev_packages_option=true ;;
415+
G) install_games_packages_option=true ;;
403416
b) brave_option=true ;;
404417
B) borgbackup_option=true ;;
405418
c) touchpad_option=true ;;
@@ -446,6 +459,7 @@ main() {
446459
[[ "$install_system_specific_packages_option" == "false" ]] &&
447460
[[ "$install_app_packages_option" == "false" ]] &&
448461
[[ "$install_dev_packages_option" == "false" ]] &&
462+
[[ "$install_games_packages_option" == "false" ]] &&
449463
[[ "$flatpak_option" == "false" ]] &&
450464
[[ "$borgbackup_option" == "false" ]] &&
451465
[[ "$touchpad_option" == "false" ]] &&
@@ -521,6 +535,7 @@ main() {
521535
install_core_packages
522536
install_app_packages
523537
install_dev_packages
538+
install_games_packages
524539
install_system_specific_packages "$system_type"
525540

526541
# System-specific additional functions.
@@ -569,6 +584,7 @@ main() {
569584
if $install_core_packages_option; then install_core_packages; fi
570585
if $install_app_packages_option; then install_app_packages; fi
571586
if $install_dev_packages_option; then install_dev_packages; fi
587+
if $install_games_packages_option; then install_games_packages; fi
572588
if $install_system_specific_packages_option; then install_system_specific_packages "$system_type"; fi
573589
if $touchpad_option; then touchpad_setup; fi
574590
if $flatpak_option; then install_flatpak_packages; fi

src/config.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ parse_json() {
319319
# Purpose: Create default packages.json configuration file
320320
# Arguments: $1 - Output file path
321321
# Returns: 0 on success, 1 on failure
322+
#TODO: Make function to install games too.
322323
create_default_packages_json() {
323324
local output_file="$1"
324325

@@ -347,9 +348,21 @@ create_default_packages_json() {
347348
"neovim",
348349
"vim",
349350
"pavucontrol",
350-
"chromium"
351+
"chromium",
352+
"gimp",
351353
],
352354
"dev": [
355+
"gparted",
356+
"kernel-tools",
357+
"kdiskmark",
358+
"gitleaks",
359+
"stow",
360+
"clamav",
361+
"freshclam",
362+
"libsecret",
363+
"libsecret-devel",
364+
"gnome-screenshot",
365+
"openssh-askpass",
353366
"papirus-icon-theme",
354367
"git-credential-libsecret",
355368
"gh",
@@ -373,6 +386,7 @@ create_default_packages_json() {
373386
"yarnpkg",
374387
"bash-language-server",
375388
"python3-devel",
389+
"python3-tkinter",
376390
"dbus-devel",
377391
"shfmt",
378392
"ShellCheck"
@@ -411,6 +425,14 @@ create_default_packages_json() {
411425
"playerctl",
412426
"xev"
413427
],
428+
"games": [
429+
"wine",
430+
"wine-mono",
431+
"winetricks",
432+
"lutris",
433+
"steam",
434+
"heroic-games-launcher-bin"
435+
],
414436
"flatpak": [
415437
"org.signal.Signal",
416438
"io.github.martchus.syncthingtray",
@@ -954,6 +976,7 @@ load_package_arrays() {
954976
CORE_PACKAGES=($(parse_json "$packages_file" ".core[]"))
955977
APPS_PACKAGES=($(parse_json "$packages_file" ".apps[]"))
956978
DEV_PACKAGES=($(parse_json "$packages_file" ".dev[]"))
979+
GAMES_PACKAGES=($(parse_json "$packages_file" ".games[]"))
957980
DESKTOP_PACKAGES=($(parse_json "$packages_file" ".desktop[]"))
958981
LAPTOP_PACKAGES=($(parse_json "$packages_file" ".laptop[]"))
959982
QTILE_PACKAGES=($(parse_json "$packages_file" ".qtile[]"))
@@ -1073,6 +1096,7 @@ init_config() {
10731096
log_info "Qtile Packages: ${#QTILE_PACKAGES[@]} packages"
10741097
log_info "Flatpak Packages: ${#FLATPAK_PACKAGES[@]} packages"
10751098
log_info "Development Packages: ${#DEV_PACKAGES[@]} packages"
1099+
log_info "Games Packages: ${#GAMES_PACKAGES[@]} packages"
10761100
log_info "Desktop Packages: ${#DESKTOP_PACKAGES[@]} packages"
10771101
log_info "Laptop Packages: ${#LAPTOP_PACKAGES[@]} packages"
10781102
log_info "===== End of Summary ====="

src/general.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,13 @@ lightdm_autologin() {
343343
# Write the new content to the file
344344
echo -e "$new_content" | sudo tee "$conf_file" >/dev/null
345345
fi
346+
# pam setup for auto unlock gnome keyring
347+
#TODO: handle this later
348+
#NOTE: this isn't work with autologin because its need password on from display manager
349+
# # Gnome keyring auto unlock
350+
# auth optional pam_gnome_keyring.so
351+
# session optional pam_gnome_keyring.so auto_start
352+
#
346353

347354
log_success "LightDM autologin configuration completed"
348355
return 0

0 commit comments

Comments
 (0)