add auto install

This commit is contained in:
Lifailon
2024-11-21 11:00:10 +03:00
parent 25674eb116
commit ff7c38bf24
3 changed files with 53 additions and 19 deletions
+30 -18
View File
@@ -39,17 +39,19 @@ Binaries for the Linux operating system are available on the [releases](https://
> Development is done on the Ubuntu system, also tested in WSL environment on Debian system (`amd64` platform) and Raspberry Pi (`arm64` platform).
For a quick installation, download the executable from the GitHub repository to your home directory with other executables for the current user and grant execute permissions:
Run the command in your console to quickly install or update:
```shell
version="0.1.0"
arch="amd64" # or "arm64"
curl https://raw.githubusercontent.com/Lifailon/lazyjournal/main/install.sh | bash
```
mkdir -p ~/.local/bin
grep -F 'export PATH=$PATH:~/.local/bin' ~/.bashrc || echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc && source ~/.bashrc
This command will run a script that will download the latest executable from the GitHub repository into your current user's home directory along with other executables (or create one) and grant execution permission.
curl -L -s https://github.com/Lifailon/lazyjournal/releases/download/$version/lazyjournal-$version-linux-$arch -o ~/.local/bin/lazyjournal
chmod +x ~/.local/bin/lazyjournal
You can also use Go for installation. To do this, the Go interpreter must be installed on the system, for example, for Ubuntu you can use the SnapCraft package manager:
```shell
sudo snap install go --classic
go install github.com/Lifailon/lazyjournal/src@latest
```
You can launch the interface anywhere:
@@ -62,20 +64,11 @@ If the current user does not have rights to read logs in the `/var/log` director
## Build
Go must be installed on the system, for example, for Ubuntu you can use the SnapCraft package manager:
```shell
snap install go --classic
# grep -F 'export PATH=$PATH:/snap/bin' ~/.bashrc || echo 'export PATH=$PATH:/snap/bin' >> ~/.bashrc && source ~/.bashrc
go version
```
Clone the repository, install dependencies from `go.mod` and run the project:
```shell
git clone https://github.com/Lifailon/lazyjournal
cd lazyjournal/src
go mod tidy
go run main.go
```
@@ -88,10 +81,29 @@ arch="amd64"
for arch in amd64 arm64; do
GOOS=linux GOARCH=$arch go build -o bin/lazyjournal-$version-linux-$arch
done
./bin/lazyjournal-0.1.0-linux-amd64
```
<!--
### Build deb package
```shell
mkdir -p lazyjournal/DEBIAN lazyjournal/usr/local/bin
cp bin/lazyjournal-$version-linux-$arch lazyjournal/usr/local/bin/lazyjournal
```
`vim lazyjournal/DEBIAN/control`
```
Package: lazyjournal
Version: 0.1.0
Architecture: amd64
Maintainer: https://github.com/Lifailon
Description: TUI for journalctl, logs in the file system and docker containers for quick viewing and filtering with fuzzy find and regex support.
```
`dpkg-deb --build lazyjournal`
-->
## Hotkeys
- `Tab` - Switch between windows.
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
ARCH=$(uname -m)
case $ARCH in
x86_64|amd64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
*)
echo -e "Processor architecture not supported:\033[31m $ARCH \033[0m"
echo -e "Create a request with a \033[31mproblem\033[0m: https://github.com/Lifailon/lazyjournal/issues"
exit 1
;;
esac
mkdir -p $HOME/.local/bin
grep -F 'export PATH=$PATH:$HOME/.local/bin' $HOME/.bashrc || echo 'export PATH=$PATH:$HOME/.local/bin' >> $HOME/.bashrc && source $HOME/.bashrc
GITHUB_LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' https://github.com/Lifailon/lazyjournal/releases/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
curl -L -s https://github.com/Lifailon/lazyjournal/releases/download/$GITHUB_LATEST_VERSION/lazyjournal-$GITHUB_LATEST_VERSION-linux-$ARCH -o $HOME/.local/bin/lazyjournal
chmod +x $HOME/.local/bin/lazyjournal
echo -e "✔ \033[32m Installation completed successfully \033[0m"
exit 0
+1 -1
View File
@@ -1,4 +1,4 @@
module lazyjournal
module github.com/Lifailon/lazyjournal/src
go 1.18