Skip to content

Commit

Permalink
Merge branch 'main' into auto-cpufreq
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevithakannan2 committed Nov 8, 2024
2 parents 3fb9cce + 8639da3 commit 8e8307f
Show file tree
Hide file tree
Showing 10 changed files with 156 additions and 57 deletions.
72 changes: 68 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/tabs/applications-setup/auto-cpufreq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ applyTweak() {
printf "%b\n" "${YELLOW}Configuring auto-cpufreq.${RC}"

if command_exists auto-cpufreq; then
if [ -d /sys/class/power_supply/BAT0 ]; then
if ls /sys/class/power_supply/BAT* >/dev/null 2>&1; then
printf "%b\n" "${GREEN}System detected as laptop. Updating auto-cpufreq for laptop.${RC}"
"$ESCALATION_TOOL" auto-cpufreq --force powersave
else
Expand Down
5 changes: 5 additions & 0 deletions core/tabs/security/tab_data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ name = "Firewall Baselines (CTT)"
description = "Developed to ease iptables firewall configuration, UFW provides a user friendly way to create an IPv4 or IPv6 host-based firewall. This command installs UFW and configures UFW based on CTT's recommended rules. For more information visit: https://christitus.com/linux-security-mistakes"
script = "firewall-baselines.sh"
task_list = "I SS"

[[data.preconditions]]
matches = false
data = "command_exists"
values = [ "firewalld" ]
2 changes: 0 additions & 2 deletions core/tabs/system-setup/fedora/multimedia-codecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ multimedia() {
if [ -e /etc/yum.repos.d/rpmfusion-free.repo ] && [ -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then
printf "%b\n" "${YELLOW}Installing Multimedia Codecs...${RC}"
"$ESCALATION_TOOL" "$PACKAGER" swap ffmpeg-free ffmpeg --allowerasing -y
"$ESCALATION_TOOL" "$PACKAGER" update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin -y
"$ESCALATION_TOOL" "$PACKAGER" update @sound-and-video -y
printf "%b\n" "${GREEN}Multimedia Codecs Installed...${RC}"
else
printf "%b\n" "${RED}RPM Fusion repositories not found. Please set up RPM Fusion first!${RC}"
Expand Down
21 changes: 12 additions & 9 deletions core/tabs/system-setup/gaming-setup.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/sh -e

# shellcheck disable=SC2086

. ../common-script.sh

installDepend() {
# Check for dependencies
DEPENDENCIES='wine dbus'
DEPENDENCIES='wine dbus git'
printf "%b\n" "${YELLOW}Installing dependencies...${RC}"
case "$PACKAGER" in
pacman)
Expand All @@ -25,13 +26,16 @@ installDepend() {

$AUR_HELPER -S --needed --noconfirm $DEPENDENCIES $DISTRO_DEPS
;;
apt-get|nala)
apt-get | nala)
DISTRO_DEPS="libasound2-plugins:i386 libsdl2-2.0-0:i386 libdbus-1-3:i386 libsqlite3-0:i386 wine64 wine32"

"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" dpkg --add-architecture i386
"$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common
"$ESCALATION_TOOL" apt-add-repository contrib -y

if [ "$DTYPE" != "pop" ]; then
"$ESCALATION_TOOL" "$PACKAGER" install -y software-properties-common
"$ESCALATION_TOOL" apt-add-repository contrib -y
fi

"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" install -y $DEPENDENCIES $DISTRO_DEPS
;;
Expand Down Expand Up @@ -62,7 +66,7 @@ installAdditionalDepend() {
DISTRO_DEPS='steam lutris goverlay'
"$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm $DISTRO_DEPS
;;
apt-get|nala)
apt-get | nala)
version=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/lutris/lutris |
grep -v 'beta' |
tail -n1 |
Expand All @@ -72,7 +76,7 @@ installAdditionalDepend() {
curl -sSLo "lutris_${version_no_v}_all.deb" "https://github.com/lutris/lutris/releases/download/${version}/lutris_${version_no_v}_all.deb"

printf "%b\n" "${YELLOW}Installing Lutris...${RC}"
"$ESCALATION_TOOL" "$PACKAGER" install ./lutris_"${version_no_v}"_all.deb
"$ESCALATION_TOOL" "$PACKAGER" install -y ./lutris_"${version_no_v}"_all.deb

rm lutris_"${version_no_v}"_all.deb

Expand All @@ -91,7 +95,6 @@ installAdditionalDepend() {
"$ESCALATION_TOOL" "$PACKAGER" install -y $DISTRO_DEPS
;;
zypper)
# Flatpak
DISTRO_DEPS='lutris'
"$ESCALATION_TOOL" "$PACKAGER" -n install $DISTRO_DEPS
;;
Expand Down
2 changes: 1 addition & 1 deletion core/tabs/system-setup/system-cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cleanup_system() {
;;
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -Sc --noconfirm
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null 2>&1
"$ESCALATION_TOOL" "$PACKAGER" -Rns $(pacman -Qtdq) --noconfirm > /dev/null || true
;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" cache clean
Expand Down
64 changes: 28 additions & 36 deletions core/tabs/system-setup/system-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,102 +5,94 @@
fastUpdate() {
case "$PACKAGER" in
pacman)

$AUR_HELPER -S --needed --noconfirm rate-mirrors-bin
"$AUR_HELPER" -S --needed --noconfirm rate-mirrors-bin

printf "%b\n" "${YELLOW}Generating a new list of mirrors using rate-mirrors. This process may take a few seconds...${RC}"

if [ -s /etc/pacman.d/mirrorlist ]; then
if [ -s "/etc/pacman.d/mirrorlist" ]; then
"$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
fi

# If for some reason DTYPE is still unknown use always arch so the rate-mirrors does not fail
dtype_local=${DTYPE}
if [ "${DTYPE}" = "unknown" ]; then
dtype_local="$DTYPE"
if [ "$dtype_local" = "unknown" ]; then
dtype_local="arch"
fi

"$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root ${dtype_local}
if [ $? -ne 0 ] || [ ! -s /etc/pacman.d/mirrorlist ]; then
if ! "$ESCALATION_TOOL" rate-mirrors --top-mirrors-number-to-retest=5 --disable-comments --save /etc/pacman.d/mirrorlist --allow-root "$dtype_local" > /dev/null || [ ! -s "/etc/pacman.d/mirrorlist" ]; then
printf "%b\n" "${RED}Rate-mirrors failed, restoring backup.${RC}"
"$ESCALATION_TOOL" cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist
fi
;;

apt-get|nala)
"$ESCALATION_TOOL" apt-get update
if ! command_exists nala; then
"$ESCALATION_TOOL" apt-get install -y nala || { printf "%b\n" "${YELLOW}Falling back to apt-get${RC}"; PACKAGER="apt-get"; }
if [ "$PACKAGER" = "apt-get" ]; then
printf "%b\n" "${YELLOW}Installing nala for faster updates.${RC}"
"$ESCALATION_TOOL" "$PACKAGER" update
if "$ESCALATION_TOOL" "$PACKAGER" install -y nala; then
PACKAGER="nala";
printf "%b\n" "${CYAN}Using $PACKAGER as package manager${RC}"
else
printf "%b\n" "${RED}Nala installation failed.${RC}"
printf "%b\n" "${YELLOW}Falling back to apt-get.${RC}"
fi
fi

if [ "$PACKAGER" = "nala" ]; then
"$ESCALATION_TOOL" cp /etc/apt/sources.list /etc/apt/sources.list.bak
"$ESCALATION_TOOL" nala update
PACKAGER="nala"
if [ -f "/etc/apt/sources.list.d/nala-sources.list" ]; then
"$ESCALATION_TOOL" cp /etc/apt/sources.list.d/nala-sources.list /etc/apt/sources.list.d/nala-sources.list.bak
fi
if ! "$ESCALATION_TOOL" nala fetch --auto -y || [ ! -s "/etc/apt/sources.list.d/nala-sources.list" ]; then
printf "%b\n" "${RED}Nala fetch failed, restoring backup.${RC}"
"$ESCALATION_TOOL" cp /etc/apt/sources.list.d/nala-sources.list.bak /etc/apt/sources.list.d/nala-sources.list
fi
fi

"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" update -y
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" ref
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" update
;;
*)
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
exit 1
;;
esac
}

updateSystem() {
printf "%b\n" "${GREEN}Updating system${RC}"
printf "%b\n" "${YELLOW}Updating system packages.${RC}"
case "$PACKAGER" in
apt-get|nala)
"$ESCALATION_TOOL" "$PACKAGER" update
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;;
dnf)
"$ESCALATION_TOOL" "$PACKAGER" update -y
"$ESCALATION_TOOL" "$PACKAGER" upgrade -y
;;
pacman)
"$ESCALATION_TOOL" "$PACKAGER" -Sy --noconfirm --needed archlinux-keyring
"$ESCALATION_TOOL" "$PACKAGER" -Su --noconfirm
"$AUR_HELPER" -Su --noconfirm
;;
zypper)
"$ESCALATION_TOOL" "$PACKAGER" ref
"$ESCALATION_TOOL" "$PACKAGER" --non-interactive dup
;;
apk)
"$ESCALATION_TOOL" "$PACKAGER" upgrade
;;
*)
printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}"
printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}"
exit 1
;;
esac
}

updateFlatpaks() {
if command_exists flatpak; then
printf "%b\n" "${YELLOW}Updating installed Flathub apps...${RC}"
installed_apps=$(flatpak list --app --columns=application)

if [ -z "$installed_apps" ]; then
printf "%b\n" "${RED}No Flathub apps are installed.${RC}"
return
fi

for app in $installed_apps; do
printf "%b\n" "${YELLOW}Updating $app...${RC}"
flatpak update -y "$app"
done
printf "%b\n" "${YELLOW}Updating flatpak packages.${RC}"
flatpak update -y
fi
}

Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
### Q4 2024
- [x] Finish the foundation of the project's CLI
- [x] Implement CLI arguments and configuration support
- [ ] Add an option for logging script executions
- [x] Add an option for logging script executions

### Q1 2025
- [ ] GUI Brainstorming and Planning
Expand Down
1 change: 1 addition & 0 deletions tui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ portable-pty = "0.8.1"
ratatui = "0.29.0"
tui-term = "0.2.0"
temp-dir = "0.1.14"
time = { version = "0.3.36", features = ["local-offset", "macros", "formatting"] }
unicode-width = "0.2.0"
rand = { version = "0.8.5", optional = true }
linutil_core = { path = "../core", version = "24.9.28" }
Expand Down
Loading

0 comments on commit 8e8307f

Please sign in to comment.