5 Commits
Author SHA1 Message Date
EnumDev 2b33b64602 Added missing dependency warning 2024-05-08 14:26:01 +03:00
EnumDev 200e300be0 Improved DE/WM Detection 2024-05-08 14:12:38 +03:00
EnumDev 139e64d682 Added GO variable to Makefile 2024-05-08 13:00:29 +03:00
EnumDev 0608d1b84b Added a 'compress' goal to the Makefile to quickly create a tar.gz archive 2024-05-08 11:52:59 +03:00
EnumDev 325d6bff13 Updated fetch script
Added new ascii art for more linux distros
2024-05-08 11:21:13 +03:00
11 changed files with 137 additions and 15 deletions
+3 -1
View File
@@ -1,2 +1,4 @@
.idea .idea
build build
stormfetch
stormfetch.tar.gz
+12 -1
View File
@@ -7,10 +7,13 @@ endif
ifeq ($(SYSCONFDIR),) ifeq ($(SYSCONFDIR),)
SYSCONFDIR := $(PREFIX)/etc SYSCONFDIR := $(PREFIX)/etc
endif endif
ifeq ($(GO),)
GO := /usr/bin/go
endif
build: build:
mkdir -p build mkdir -p build
go build -o build/stormfetch stormfetch $(GO) build -o build/stormfetch stormfetch
install: build/stormfetch config/ install: build/stormfetch config/
mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(BINDIR)
@@ -18,5 +21,13 @@ install: build/stormfetch config/
cp build/stormfetch $(DESTDIR)$(BINDIR)/stormfetch cp build/stormfetch $(DESTDIR)$(BINDIR)/stormfetch
cp -r config/. $(DESTDIR)$(SYSCONFDIR)/stormfetch/ cp -r config/. $(DESTDIR)$(SYSCONFDIR)/stormfetch/
compress: build/stormfetch config/
mkdir -p stormfetch/$(BINDIR)
mkdir -p stormfetch/$(SYSCONFDIR)/stormfetch/
cp build/stormfetch stormfetch/$(BINDIR)/stormfetch
cp -r config/. stormfetch/$(SYSCONFDIR)/stormfetch/
tar --owner=root --group=root -czf stormfetch.tar.gz stormfetch
rm -r stormfetch
clean: clean:
rm -r build/ rm -r build/
+2
View File
@@ -12,6 +12,8 @@ Stormfetch is still in beta and distro compatibility is limited. If you would li
### Installation Guide ### Installation Guide
- Download `go` from your package manager or from the go website - Download `go` from your package manager or from the go website
- Download `make` from your package manager - Download `make` from your package manager
- (Optional) Download `xorg-xhost` from your package manager to display DE/WM and monitor information
- (Optional) Download `xorg-xdpyinfo` from your package manager to display Screen Resolution
- (Optional) Download `lshw` from your package manager to display GPU information - (Optional) Download `lshw` from your package manager to display GPU information
- Run the following command to compile the project - Run the following command to compile the project
``` ```
+18
View File
@@ -0,0 +1,18 @@
.;ldkO0000Okdl;.
.;d00xl:^''''''^:ok00d;.
.d00l' 'o00d.
.d0Kd' Okxol:;,. :O0d.
.OKKKK0kOKKKKKKKKKKOxo:, lKO.
,0KKKKKKKKKKKKKKKK0P^,,,^dx: ;00,
.OKKKKKKKKKKKKKKKKk'.oOPPb.'0k. cKO.
:KKKKKKKKKKKKKKKKK: kKx..dd lKd 'OK:
dKKKKKKKKKKKOx0KKKd ^0KKKO' kKKc dKd
dKKKKKKKKKKKK;.;oOKx,..^..;kKKK0. dKd
:KKKKKKKKKKKK0o;...^cdxxOK0O/^^' .0K:
kKKKKKKKKKKKKKKK0x;,,......,;od lKk
'0KKKKKKKKKKKKKKKKKKKKK00KKOo^ c00'
'kKKKOxddxkOO00000Okxoc;'' .dKk'
l0Ko. .c00l'
'l0Kk:. .;xK0l'
'lkK0xl:;,,,,;:ldO0kl'
'^:ldxkkkkxdl:^'
+13
View File
@@ -0,0 +1,13 @@
......
.,cdxxxoc,. .:kKMMMNWMMMNk:.
cKMMN0OOOKWMMXo. ; ;0MWk:. .:OMMk.
;WMK;. .lKMMNM, :NMK, .OMW;
cMW; 'WMMMN ,XMK, oMM'
.MMc ..;l. xMN: KM0
'MM. 'NMO oMM
.MM, .kMMl xMN
KM0 .kMM0. .dl:,.. .WMd
.XM0. ,OMMK, OMMMK. .XMK
oWMO:. .;xNMMk, NNNMKl. .xWMx
:ONMMNXMMMKx; . ,xNMWKkxllox0NMWk,
..... .:dOOXXKOxl,
+17
View File
@@ -0,0 +1,17 @@
@@@@@@@@@
@@@~~~~~~~~~@@
@@~~~ ~~@
@~~ @
@~ @@@ @
@@~ @ @@
@@~~ @
@@@~~ ~@@ @@@
~~~ ~~@@@ @@@@~~~
~~~@@@@~~~~
@@@@ @@@@@@@ ~~~~ @@@@
~~~~@@@@ @@~~~~~~~@@ @@@@
~~~~@@@@~~ ~~@@@@~~~~
@@@ ~~~~ @@@@@ ~~~~ @@@
~~~@@@@ @@@@~~~~~@@@@ @@@@~~~
~~~~@@@~~~~ ~~~~@@@~~~
~~~ ~~~
+20
View File
@@ -0,0 +1,20 @@
.-/+oossssoo+\-.
´:+ssssssssssssssssss+:`
-+ssssssssssssssssssyyssss+-
.ossssssssssssssssssdMMMNysssso.
/ssssssssssshdmmNNmmyNMMMMhssssss\
+ssssssssshmydMMMMMMMNddddyssssssss+
/sssssssshNMMMyhhyyyyhmNMMMNhssssssss\
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
+sssshhhyNMMNyssssssssssssyNMMMysssssss+
ossyNMMMNyMMhsssssssssssssshmmmhssssssso
ossyNMMMNyMMhsssssssssssssshmmmhssssssso
+sssshhhyNMMNyssssssssssssyNMMMysssssss+
.ssssssssdMMMNhsssssssssshNMMMdssssssss.
\sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
+sssssssssdmydMMMMMMMMddddyssssssss+
\ssssssssssshdmNNNNmyNMMMMhssssss/
.ossssssssssssssssssdMMMNysssso.
-+sssssssssssssssssyyyssss+-
`:+ssssssssssssssssss+:`
.-\+oossssoo+/-.
+1
View File
@@ -1,2 +1,3 @@
distro_ascii: auto distro_ascii: auto
fetch_script: auto fetch_script: auto
dependency_warning: true
+6 -2
View File
@@ -11,7 +11,11 @@ if command_exists lshw; then
fi fi
echo "Memory: $(get_used_mem) MiB / $(get_total_mem) MiB" echo "Memory: $(get_used_mem) MiB / $(get_total_mem) MiB"
if xhost >& /dev/null ; then if xhost >& /dev/null ; then
echo "DE/WM: $(get_de_wm)" if get_de_wm &> /dev/null; then
echo "Screen Resolution: $(get_screen_resolution)" echo "DE/WM: $(get_de_wm)"
fi
if command_exists xdpyinfo ; then
echo "Screen Resolution: $(get_screen_resolution)"
fi
fi fi
+25 -9
View File
@@ -23,10 +23,10 @@ get_shell() {
*) *)
SHELL_NAME=${SHELL##*/} SHELL_NAME=${SHELL##*/}
SHELL_VERSION="$($SHELL --version)" SHELL_VERSION="$($SHELL --version)"
SHELL_VERSION=$(SHELL_VERSION//,//) SHELL_VERSION=${SHELL_VERSION//","}
SHELL_VERSION=$(SHELL_VERSION// //) SHELL_VERSION=${SHELL_VERSION//" "}
SHELL_VERSION=$(SHELL_VERSION//VERSION//) SHELL_VERSION=${SHELL_VERSION//"version"}
SHELL_VERSION=$(SHELL_VERSION//"$SHELL_NAME"//) SHELL_VERSION=${SHELL_VERSION//"$SHELL_NAME"}
echo "$SHELL_NAME $SHELL_VERSION" echo "$SHELL_NAME $SHELL_VERSION"
unset SHELL_NAME unset SHELL_NAME
unset SHELL_VERSION unset SHELL_VERSION
@@ -51,16 +51,32 @@ get_used_mem() {
} }
get_de_wm() { get_de_wm() {
if [[ $DESKTOP_SESSION == "plasma" ]]; then if ps -e | grep "plasmashell" &> /dev/null ; then
echo "KDE Plasma $(plasmashell --version | sed 's/plasmashell //g')" echo "KDE Plasma $(plasmashell --version | awk '{print $2}')"
elif ps -e | grep "gnome-session" &> /dev/null ; then
echo "Gnome $(gnome-shell --version | awk '{print $3}')"
elif ps -e | grep "xfce4-session" &> /dev/null ; then
echo "XFCE $(xfce4-session --version | grep xfce4-session | awk '{print $2}')"
elif ps -e | grep "cinnamon" &> /dev/null ; then
echo "Cinnamon $(cinnamon --version | awk '{print $2}')"
elif ps -e | grep "mate-panel" &> /dev/null ; then
echo "Mate $(mate-about --version | awk '{print $4}')"
elif ps -e | grep "lxsession" &> /dev/null ; then
echo "LXDE"
elif ps -e | grep "sway" &> /dev/null ; then
echo "Sway $(sway --version | awk '{print $2}')"
elif ps -e | grep "icewm-session" &> /dev/null ; then
echo "IceWM $(icewm --version | awk '{print $2}' | sed 's/,//g')"
elif [ ! -z $DESKTOP_SESSION ]; then
echo "$DESKTOP_SESSION"
else else
echo "$DESKTOP_SESSION" return 1
fi fi
} }
get_screen_resolution() { get_screen_resolution() {
if xhost >& /dev/null ;then if xhost >& /dev/null && command_exists xdpyinfo; then
xdpyinfo | grep dimensions | tr -s ' ' | cut -d " " -f3 xdpyinfo | grep dimensions | tr -s ' ' | cut -d " " -f3
fi fi
} }
+20 -2
View File
@@ -16,8 +16,9 @@ var fetchScriptPath = ""
var config = StormfetchConfig{} var config = StormfetchConfig{}
type StormfetchConfig struct { type StormfetchConfig struct {
Ascii string `yaml:"distro_ascii"` Ascii string `yaml:"distro_ascii"`
FetchScript string `yaml:"fetch_script"` FetchScript string `yaml:"fetch_script"`
DependencyWarning bool `yaml:"dependency_warning"`
} }
type DistroInfo struct { type DistroInfo struct {
@@ -67,6 +68,23 @@ func readConfig() {
} else { } else {
log.Fatalf("Fetch script file not found: %s", err.Error()) log.Fatalf("Fetch script file not found: %s", err.Error())
} }
// Show Dependency warning if enabled
if config.DependencyWarning {
dependencies := []string{"lshw", "xhost", "xdpyinfo"}
var missing []string
for _, depend := range dependencies {
if _, err := os.Stat(path.Join("/usr/bin/", depend)); err != nil {
missing = append(missing, depend)
}
}
if len(missing) != 0 {
fmt.Println("[WARNING] Stormfetch functionality may be limited due to the following dependencies not being installed:")
for _, depend := range missing {
fmt.Println(depend)
}
fmt.Println("You can disable this warning through your stormfetch config")
}
}
//Execute fetch script //Execute fetch script
cmd := exec.Command("/bin/bash", fetchScriptPath) cmd := exec.Command("/bin/bash", fetchScriptPath)
cmd.Dir = path.Dir(fetchScriptPath) cmd.Dir = path.Dir(fetchScriptPath)