Skip to content

Commit 03e6a46

Browse files
committed
Add arch linux support #172
1 parent 6a28513 commit 03e6a46

23 files changed

Lines changed: 592 additions & 112 deletions

PKGBUILD

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Maintainer: Jean28518@Github
2+
pkgname=linux-assistant
3+
pkgdesc="A daily linux helper with powerful integrated search, routines and checks."
4+
pkgver=0.4.4
5+
pkgrel=1
6+
arch=('x86_64')
7+
license=('GPL-3.0-or-later')
8+
9+
source=("https://github.com/Jean28518/linux-assistant/releases/latest/download/linux-assistant-bundle.zip")
10+
11+
depends=("libkeybinder3", "wmctrl", "wget", "python", "mesa-utils", "polkit")
12+
13+
package() {
14+
mkdir -p "$pkgdir/usr/bin"
15+
cp -f "$srcdir/linux-assistant-bundle/linux-assistant.sh" "$pkgdir/usr/bin/linux-assistant"
16+
chmod +x "$srcdir/usr/bin/linux-assistant"
17+
18+
mkdir -p "$pkgdir/usr/share/polkit-1/actions"
19+
cp -f "$srcdir/linux-assistant-bundle/org.linux-assistant.operations.policy" "$pkgdir/usr/share/polkit-1/actions/org.linux-assistant.operations.policy"
20+
21+
mkdir -p "$pkgdir/usr/share/applications"
22+
cp -f "$srcdir/linux-assistant-bundle/linux-assistant.desktop" "$pkgdir/usr/share/applications/linux-assistant.desktop"
23+
24+
mkdir -p "$pkgdir/usr/share/icons/hicolor/256x256/apps"
25+
cp -f "$srcdir/linux-assistant-bundle/linux-assistant.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/linux-assistant.png"
26+
27+
mkdir -p "$pkgdir/usr/lib/linux-assistant"
28+
cp -r "$srcdir/linux-assistant-bundle/lib" "$pkgdir/usr/lib/linux-assistant/"
29+
cp -r "$srcdir/linux-assistant-bundle/data" "$pkgdir/usr/lib/linux-assistant/"
30+
cp -r "$srcdir/linux-assistant-bundle/additional" "$pkgdir/usr/lib/linux-assistant/"
31+
cp -f "$srcdir/linux-assistant-bundle/version" "$pkgdir/usr/lib/linux-assistant/"
32+
cp -f "$srcdir/linux-assistant-bundle/linux-assistant" "$pkgdir/usr/lib/linux-assistant/"
33+
34+
35+
tar -czf "$pkgname-$pkgver-$arch.pkg.tar.gz" -C "$pkgdir" .
36+
}

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ sudo dpkg --install linux-assistant.deb
3535

3636
# Option 3: Build .rpm package:
3737
bash ./build-rpm.sh
38+
39+
# Option 3: Build Arch package
40+
# You can only do this on an arch based distro
41+
bash ./build-arch-pkg.sh
42+
# To Install:
43+
makepkg -s --skipchecksums --install
3844
```
3945

4046
## Run as flatpak
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import os
2+
import jessentials
3+
import jfolders
4+
import jfiles
5+
from check_home_folder_rights import check_home_folder_rights
6+
7+
8+
9+
def get_additional_sources():
10+
# Check if yay is installed
11+
if (jfiles.does_file_exist("/usr/bin/yay")):
12+
# lines = jessentials.run_command("/usr/bin/yay -Q", False, True)
13+
# for line in lines:
14+
# print(f"aurpackage: {line.split(" ")[0]}")
15+
print("yayinstalled")
16+
17+
def get_available_updates():
18+
jessentials.run_command("pacman -Sy", False, False, {'DEBIAN_FRONTEND': 'noninteractive'})
19+
lines = jessentials.run_command("pacman -Qu", False, True)
20+
for line in lines:
21+
print(f"upgradeablepackage: {line}")
22+
23+
def check_server_access():
24+
# Check for firewall
25+
if (jfiles.does_file_exist("/usr/sbin/ufw")):
26+
lines = jessentials.run_command("/usr/sbin/iptables -L", False, True)
27+
ufwUserFound = False
28+
for line in lines:
29+
if "ufw-user" in line:
30+
ufwUserFound = True
31+
break
32+
if not ufwUserFound:
33+
print("firewallinactive")
34+
# Check for firewalld
35+
elif (jfiles.does_file_exist("/usr/bin/firewalld")):
36+
lines = jessentials.run_command("/usr/bin/firewall-cmd --list-all", False, True)
37+
if (len(lines) > 1):
38+
pass
39+
else:
40+
print("firewallinactive")
41+
else:
42+
print("nofirewall")
43+
44+
# Check for Xrdp
45+
lines = jessentials.run_command("/usr/bin/systemctl status xrdp", False, True)
46+
if (len(lines) > 1):
47+
print("xrdprunning")
48+
# Check for ssh:
49+
lines = jessentials.run_command("/usr/bin/systemctl status ssh", False, True)
50+
if (len(lines) > 1):
51+
print("sshrunning")
52+
lines = jessentials.run_command("/usr/bin/systemctl status fail2ban", False, True)
53+
if (len(lines) == 0):
54+
print("fail2bannotrunning")
55+
56+
if __name__ == "__main__":
57+
jessentials.ensure_root_privileges()
58+
get_additional_sources()
59+
get_available_updates()
60+
check_home_folder_rights(jessentials.get_value_from_arguments("home", ""))
61+
check_server_access()
62+
print("#!script ran successfully.")

additional/python/setup_automatic_snapshots.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,32 @@
88
if not jfiles.does_file_exist("/etc/timeshift/timeshift.json"):
99
jfiles.copy_file("/etc/timeshift/default.json", "/etc/timeshift/timeshift.json")
1010
timeshift_config = jfiles.get_dict_of_json_file("/etc/timeshift/timeshift.json")
11-
print(timeshift_config)
12-
fstab_line = jfiles.get_value_from_file("/etc/fstab", "UUID").strip()
13-
fstab_line = re.sub(' +', ' ', fstab_line) # Remove all multiple whitespaces within string
14-
uuid = fstab_line.split(" ")[0]
15-
mount = fstab_line.split(" ")[1]
16-
filesystem = fstab_line.split(" ")[2]
17-
if len(uuid) == 36 and mount == "/" and filesystem == "ext4":
11+
# Get all lines in /etc/fstab and search for the line with / as mount point
12+
lines = jfiles.get_all_lines_from_file("/etc/fstab")
13+
uuid = ""
14+
mount = ""
15+
filesystem = ""
16+
for line in lines:
17+
line = line.replace("\t", " ")
18+
line = re.sub(' +', ' ', line) # Remove all multiple whitespaces within string
19+
if line.strip().startswith("#"):
20+
continue
21+
if "/ " in line:
22+
uuid = line.split(" ")[0].strip()
23+
mount = line.split(" ")[1].strip()
24+
filesystem = line.split(" ")[2].strip()
25+
break
26+
27+
if "UUID=" in uuid:
28+
uuid = uuid.replace("UUID=", "")
29+
30+
if len(uuid) == 36 and mount == "/" and (filesystem == "ext4" or filesystem == "btrfs"):
1831
timeshift_config["backup_device_uuid"] = uuid
1932
timeshift_config["schedule_monthly"] = "true"
33+
if "--daily" in jessentials.get_arguments():
34+
timeshift_config["schedule_daily"] = "true"
2035
timeshift_config["exclude"].append("/home/***")
21-
print(timeshift_config)
36+
if filesystem == "btrfs":
37+
timeshift_config["btrfs_mode"] = "true"
2238
jfiles.write_dict_to_json_file(dict=timeshift_config, file_path="/etc/timeshift/timeshift.json")
23-
pass
39+
pass

build-arch-pkg.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Build bundle
2+
VERSION="$( cat version )"
3+
4+
sed -i "s/pkgver=.*/pkgver=\"$VERSION\"/" pkg/PKGBUILD
5+
6+
makepkg -s --skipchecksums

build-bundle.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ cp linux-assistant.sh linux-assistant-bundle/
1616
cp linux-assistant.png linux-assistant-bundle/
1717
cp -r flatpak linux-assistant-bundle/
1818
cp version linux-assistant-bundle/
19+
cp linux-assistant.desktop linux-assistant-bundle/
20+
cp org.linux-assistant.operations.policy linux-assistant-bundle/
1921

2022
# Get libkeybinder.so
2123
cp /lib/x86_64-linux-gnu/libkeybinder-3.0.so.0 linux-assistant-bundle/lib/

features.csv

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
Feature,Flatpak,Debian,Ubuntu,Linux Mint,LMDE,PopOS,MX Linux,Zorin OS,KDE neon,openSUSE,Fedora,Gnome,Xfce,Cinnamon,KDE,Notes
2-
Adabtable dark mode,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes *,yes,yes,yes,"*) depends on window theme,not gtk "
3-
Hotkey handling,yes,yes *,yes *,yes,yes,yes,yes,yes,yes,yes,yes *,yes *,yes,yes,yes,*) only works on wayland with workaround described in #24
4-
Feedback function,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
5-
Automatic recognition of environment,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
6-
App search,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
7-
Folder structure search,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
8-
Bookmark/Places folder search,yes,-,-,-,-,-,-,-,-,-,-,yes,yes,yes,yes,
9-
Recent file search,yes,-,-,-,-,-,-,-,-,-,-,yes,yes,yes,yes,
10-
Favorite file search,yes,-,-,-,-,-,-,-,-,-,-,no,no,yes,no,
11-
Browser bookmark search,yes,yes,?,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes," Currently works with firefox,chromium and chrome; needs to checked with firefox on snap "
12-
Security check,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
13-
Health check,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,,,,,
14-
After installation routine,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
15-
Warpinator,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,Only works if flatpak is installed/available in the sources
16-
Nvidia installation,-,(yes),yes,yes,(yes),(yes),(yes),(yes),(yes),no,no,-,-,-,-,
17-
Multimedia codecs installation,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
18-
Timeshift setup,yes,yes,yes,yes,yes,yes,yes,yes *,yes,no,no,-,-,-,-,*) When you start timeshift the welcome dialog with config is started. But the timeshift.json is configured successfully??
19-
Automatic update setup,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,integrates on Linux Mint with mintupdate
20-
Update full system (all packages of all pack. man.),yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
21-
Search and installation of system packages,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
22-
General integration of system package manager,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
23-
General integration of flatpak,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
24-
General integration of snapd,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
25-
Recognition of drive space utilization,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,,,,,
26-
Change user passwort dialog,yes,-,-,-,-,-,yes,-,no,-,yes,yes,yes,yes,no,
27-
open system information,yes,-,-,-,-,-,yes,-,no,-,yes,yes,yes,yes,no,
28-
automatic update check & install of linux assistant,no,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
29-
openAdditionalSoftwareSourcesSettings,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes *,-,-,-,-,*) We can only open gnome-software here
30-
Change Power Mode,yes,yes,yes,yes,yes,yes,yes,no,yes,?,yes,-,-,-,-,
31-
Change user profile,yes,-,-,-,yes,-,yes,-,no,-,yes,yes,yes,yes,no,
32-
hardinfo,yes,yes,yes,yes,yes,yes,yes,yes,yes,?,no *,-,-,-,-,*) Fedora does not package hardinfo anymore
33-
redshift,yes,yes,yes,yes,yes,yes,yes,yes,yes,?,yes,yes,yes,yes,yes,
34-
makeCurrentUserToAdministrator,?,yes,yes,yes,yes,yes,yes,yes,yes,?,yes,-,-,-,-,
35-
setupSnapAndInstallSnapStore,?,yes,yes,yes,yes,yes,yes,yes,yes,no,yes,-,-,-,-,
36-
Commands in Searchbar,?,-,-,-,-,-,-,-,-,-,-,yes,yes,yes,yes,
37-
AutomaticRepairOfPackageManager,?,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
1+
Feature,Flatpak,Debian,Ubuntu,Linux Mint,LMDE,PopOS,MX Linux,Zorin OS,KDE neon,openSUSE,Fedora,Arch,Gnome,Xfce,Cinnamon,KDE,Notes
2+
Adabtable dark mode,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes *,yes,yes,yes,"*) depends on window theme,not gtk "
3+
Hotkey handling,yes,yes *,yes *,yes,yes,yes,yes,yes,yes,yes,yes *,yes,yes *,yes,yes,yes,*) only works on wayland with workaround described in #24
4+
Feedback function,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
5+
Automatic recognition of environment,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
6+
App search,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
7+
Folder structure search,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
8+
Bookmark/Places folder search,yes,-,-,-,-,-,-,-,-,-,-,-,yes,yes,yes,yes,
9+
Recent file search,yes,-,-,-,-,-,-,-,-,-,-,-,yes,yes,yes,yes,
10+
Favorite file search,yes,-,-,-,-,-,-,-,-,-,-,-,no,no,yes,no,
11+
Browser bookmark search,yes,yes,?,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes," Currently works with firefox,chromium and chrome; needs to checked with firefox on snap "
12+
Security check,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
13+
Health check,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,,,,,
14+
After installation routine,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,
15+
Warpinator,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,Only works if flatpak is installed/available in the sources
16+
Nvidia installation,-,(yes),yes,yes,(yes),(yes),(yes),(yes),(yes),no,no,no,-,-,-,-,
17+
Multimedia codecs installation,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
18+
Timeshift setup,yes,yes,yes,yes,yes,yes,yes,yes *,yes,no,no,yes,-,-,-,-,*) When you start timeshift the welcome dialog with config is started. But the timeshift.json is configured successfully??
19+
Automatic update setup,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,no,-,-,-,-,integrates on Linux Mint with mintupdate
20+
Update full system (all packages of all pack. man.),yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
21+
Search and installation/uninstallation of system packages,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
22+
General integration of system package manager,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
23+
General integration of flatpak,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
24+
General integration of snapd,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,-,-,-,-,
25+
Recognition of drive space utilization,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,,,,,
26+
Change user passwort dialog,yes,-,-,-,-,-,yes,-,no,-,yes,-,yes,yes,yes,no,
27+
open system information,yes,-,-,-,-,-,yes,-,no,-,yes,-,yes,yes,yes,no,
28+
automatic update check & install of linux assistant,no,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,no,-,-,-,-,
29+
openAdditionalSoftwareSourcesSettings,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes *,no,-,-,-,-,*) We can only open gnome-software here
30+
Change Power Mode,yes,yes,yes,yes,yes,yes,yes,no,yes,?,yes,yes,-,-,-,-,
31+
Change user profile,yes,-,-,-,yes,-,yes,-,no,-,yes,-,yes,yes,yes,no,
32+
hardinfo,yes,yes,yes,yes,yes,yes,yes,yes,yes,?,no *,no *,-,-,-,-,*) Fedora and arch do not have package hardinfo anymore
33+
redshift,yes,yes,yes,yes,yes,yes,yes,yes,yes,?,yes,no *,yes,yes,yes,yes,*) Does only work with further complicated setup.
34+
makeCurrentUserToAdministrator,?,yes,yes,yes,yes,yes,yes,yes,yes,?,yes,yes,-,-,-,-,
35+
setupSnapAndInstallSnapStore,?,yes,yes,yes,yes,yes,yes,yes,yes,no,yes,yes,-,-,-,-,
36+
Commands in Searchbar,?,-,-,-,-,-,-,-,-,-,-,-,yes,yes,yes,yes,
37+
AutomaticRepairOfPackageManager,?,yes,yes,yes,yes,yes,yes,yes,yes,yes,yes,no,-,-,-,-,

lib/content/basic_entries.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ List<ActionEntry> getBasicEntries(BuildContext context) {
7373
color: MintY.currentColor,
7474
),
7575
disableEntryIf: () {
76-
return [DISTROS.FEDORA].contains(Linux.currentenvironment.distribution);
76+
return [DISTROS.FEDORA, DISTROS.ARCH]
77+
.contains(Linux.currentenvironment.distribution);
7778
},
7879
),
7980
ActionEntry(
@@ -130,6 +131,9 @@ List<ActionEntry> getBasicEntries(BuildContext context) {
130131
size: 48,
131132
color: MintY.currentColor,
132133
),
134+
disableEntryIf: () =>
135+
// We disable this entry on arch because the user should check the update manager by himself.
136+
Linux.currentenvironment.distribution == DISTROS.ARCH,
133137
),
134138
ActionEntry(
135139
name: AppLocalizations.of(context)!.automaticSnapshots,
@@ -163,6 +167,9 @@ List<ActionEntry> getBasicEntries(BuildContext context) {
163167
action: "fix_package_manager",
164168
iconWidget: Icon(Icons.bug_report, size: 48, color: MintY.currentColor),
165169
keywords: ["fix", "package", "manager", "apt", "dpkg", "rpm", "zypper"],
170+
disableEntryIf: () {
171+
return [DISTROS.ARCH].contains(Linux.currentenvironment.distribution);
172+
},
166173
),
167174
ActionEntry(
168175
name: AppLocalizations.of(context)!.setupSnap,

lib/content/recommendations.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ List<ActionEntry> getRecommendations(BuildContext context) {
5656
size: 48,
5757
color: MintY.currentColor,
5858
),
59+
disableEntryIf: () {
60+
return [DISTROS.ARCH].contains(Linux.currentenvironment.distribution);
61+
},
5962
),
6063
ActionEntry(
6164
name: AppLocalizations.of(context)!.powerMode,

lib/enums/distros.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ enum DISTROS {
99
OPENSUSE,
1010
LMDE,
1111
FEDORA,
12+
ARCH,
1213
}
1314

1415
String getNiceStringOfDistrosEnum(var distro) {
@@ -33,6 +34,8 @@ String getNiceStringOfDistrosEnum(var distro) {
3334
return "LMDE";
3435
case DISTROS.FEDORA:
3536
return "Fedora";
37+
case DISTROS.ARCH:
38+
return "Arch";
3639
default:
3740
return "";
3841
}

0 commit comments

Comments
 (0)