feat: +fastfetch/mediainfo/ouch, config+plugin Yazi (metadata media & arsip), greeting fastfetch
This commit is contained in:
1 parent
23f51898f1
commit
2541e539b1
2 files changed
+164
-31
No files matched your search
@@ -1,10 +1,13 @@
|
||||
# temp-own
|
||||
|
||||
Installer sekali jalan untuk terminal dev environment: **fish + starship (polos) + yazi + micro + lazydocker**.
|
||||
Installer sekali jalan untuk terminal dev environment:
|
||||
|
||||
**fish** (shell default) + **starship** (polos) + **yazi** (+ plugin & metadata media) +
|
||||
**micro** (editor) + **lazydocker** + **fastfetch** (greeting) + **mediainfo** + **ouch** (arsip).
|
||||
|
||||
- **Auto-deteksi distro** (pacman / apt / dnf / zypper / apk) — pakai paket distro bila ada, kalau tidak ambil dari sumber resmi.
|
||||
- **fish jadi default shell global** + config global di `/etc/fish/conf.d/`.
|
||||
- **Yazi** disetel **default editor = micro** (bukan vim).
|
||||
- **fish jadi default shell** + config global di `/etc/fish/conf.d/`.
|
||||
- **Yazi**: editor default **micro**, pratinjau **metadata media** (mediainfo), pratinjau & ekstrak **arsip** (ouch), plus keybind `fg` / `zoxide` / `chmod`.
|
||||
- Hanya butuh **sudo**. Idempotent (aman diulang).
|
||||
|
||||
## Instal (satu perintah)
|
||||
@@ -13,28 +16,39 @@ Installer sekali jalan untuk terminal dev environment: **fish + starship (polos)
|
||||
curl -fsSL https://gitea.oxpoe.qzz.io/oxpoe/temp-own/raw/branch/main/install.sh | sudo bash
|
||||
```
|
||||
|
||||
Raw URL: `https://gitea.oxpoe.qzz.io/oxpoe/temp-own/raw/branch/main/install.sh`
|
||||
|
||||
## Yang dipasang
|
||||
|
||||
| Tool | Sumber |
|
||||
|---|---|
|
||||
| fish | repo distro |
|
||||
| starship | repo distro / [starship.rs/install.sh](https://starship.rs/install.sh) |
|
||||
| yazi | repo distro / release GitHub `sxyazi/yazi` |
|
||||
| micro | repo distro / [getmic.ro](https://getmic.ro) |
|
||||
| lazydocker | repo distro / script resmi `jesseduffield/lazydocker` |
|
||||
| Tool | Fungsi | Sumber |
|
||||
|---|---|---|
|
||||
| fish | shell | repo distro |
|
||||
| starship | prompt (polos) | repo distro / starship.rs |
|
||||
| yazi | file manager | repo distro / release GitHub |
|
||||
| micro | editor | repo distro / getmic.ro |
|
||||
| lazydocker | TUI Docker | repo distro / script resmi |
|
||||
| fastfetch | greeting | repo distro |
|
||||
| mediainfo | metadata media (yazi) | repo distro |
|
||||
| ouch | arsip zip/tar/7z/… (yazi) | repo distro / release GitHub |
|
||||
|
||||
Yang tak tersedia di repo distro dipasang ke `/usr/local/bin`.
|
||||
|
||||
## Yang diubah di sistem
|
||||
|
||||
- `/etc/shells` → menambah path `fish`.
|
||||
- `/etc/fish/conf.d/temp-own.fish` → config fish **untuk semua user**:
|
||||
- `EDITOR`/`VISUAL=micro`
|
||||
- `starship init fish` (prompt default/polos)
|
||||
- `/etc/fish/conf.d/temp-own.fish` → config fish **semua user**:
|
||||
`EDITOR`/`VISUAL=micro`, `starship init fish`, dan **greeting `fastfetch`**.
|
||||
- default shell user (SUDO_USER) & `root` → fish (`chsh`).
|
||||
- `~/.config/yazi/yazi.toml` (user + root) → opener `edit` = `micro` (file lama di-backup `.bak-<ts>`).
|
||||
- `~/.config/yazi/` (user + root) → `yazi.toml` (editor micro, previewer mediainfo/ouch, ekstrak ouch), `keymap.toml`, `init.lua` — file lama di-backup `.bak-<ts>`.
|
||||
- Plugin Yazi: `full-border`, `smart-filter`, `chmod`, `ouch`, `mediainfo`, `fg`.
|
||||
|
||||
## Keybind Yazi
|
||||
|
||||
| Tombol | Fungsi |
|
||||
|---|---|
|
||||
| `C` | kompres (ouch) |
|
||||
| `Enter` pada arsip | ekstrak (ouch) |
|
||||
| `f` `g` / `f` `G` / `f` `f` | cari isi (fuzzy/ripgrep) / cari nama |
|
||||
| `Z` | lompat direktori (zoxide) |
|
||||
| `c` `h` | chmod |
|
||||
|
||||
## Setelah install
|
||||
|
||||
@@ -42,18 +56,16 @@ Logout–login (atau buka terminal baru) agar shell fish aktif. Cek:
|
||||
|
||||
```sh
|
||||
echo $SHELL
|
||||
starship --version
|
||||
yazi --version
|
||||
micro --version
|
||||
lazydocker --version
|
||||
starship --version; yazi --version; micro --version
|
||||
lazydocker --version; fastfetch --version; mediainfo --version; ouch --version
|
||||
```
|
||||
|
||||
## Catatan
|
||||
|
||||
- `chsh` untuk user lain (uid ≥ 1000) bisa manual:
|
||||
`sudo chsh -s "$(command -v fish)" <user>`
|
||||
- Untuk menghapus: balikkan shell ke bash (`sudo chsh -s /bin/bash <user>`),
|
||||
hapus `/etc/fish/conf.d/temp-own.fish`, dan `~/.config/yazi/yazi.toml` bila perlu.
|
||||
- Untuk menghapus: balikkan shell ke bash, hapus `/etc/fish/conf.d/temp-own.fish`,
|
||||
dan `~/.config/yazi/` bila perlu.
|
||||
|
||||
## Lisensi
|
||||
|
||||
|
||||
+130
-9
@@ -56,7 +56,7 @@ log "Paket dasar (curl/unzip/tar)"; install_base || warn "sebagian paket dasar g
|
||||
|
||||
# ---------------------------------------------------------------- distro pkgs
|
||||
distro_install() {
|
||||
local want=(fish starship yazi micro lazydocker) got=() p
|
||||
local want=(fish starship yazi micro lazydocker fastfetch mediainfo ouch) got=() p
|
||||
case "$PM" in
|
||||
apt-get)
|
||||
for p in "${want[@]}"; do apt-cache show "$p" >/dev/null 2>&1 && got+=("$p"); done
|
||||
@@ -125,31 +125,143 @@ ensure_lazydocker() {
|
||||
has lazydocker || die "lazydocker gagal dipasang"
|
||||
}
|
||||
|
||||
ensure_ouch() {
|
||||
has ouch && return 0
|
||||
log "Install ouch (release GitHub -> $BIN)"
|
||||
local tag target url tmp
|
||||
tag="$(curl -fsSL -o /dev/null -w '%{url_effective}' https://github.com/ouch-org/ouch/releases/latest | sed 's#.*/tag/##')"
|
||||
[ -n "$tag" ] || die "gagal menentukan versi ouch"
|
||||
case "$ARCH" in
|
||||
x86_64) target=x86_64-unknown-linux-musl ;;
|
||||
aarch64) target=aarch64-unknown-linux-musl ;;
|
||||
*) target="${ARCH}-unknown-linux-musl" ;;
|
||||
esac
|
||||
url="https://github.com/ouch-org/ouch/releases/download/${tag}/ouch-${target}.tar.gz"
|
||||
tmp="$(mktemp -d)"
|
||||
curl -fsSL "$url" -o "$tmp/ouch.tgz" || die "gagal unduh $url"
|
||||
tar xzf "$tmp/ouch.tgz" -C "$tmp"
|
||||
cp -f "$tmp/ouch-${target}/ouch" "$BIN/ouch"; chmod 0755 "$BIN/ouch"
|
||||
rm -rf "$tmp"
|
||||
has ouch || die "ouch gagal dipasang"
|
||||
}
|
||||
|
||||
log "Pastikan tool terpasang"
|
||||
ensure_fish
|
||||
ensure_micro
|
||||
ensure_starship
|
||||
ensure_yazi
|
||||
ensure_lazydocker
|
||||
ensure_ouch
|
||||
has fastfetch || warn "fastfetch tak ada di repo distro (greeting dilewati)"
|
||||
has mediainfo || warn "mediainfo tak ada di repo distro (metadata media Yazi dilewati)"
|
||||
|
||||
# ---------------------------------------------------------------- config yazi
|
||||
run_as_user() { # jalankan perintah sebagai user target (HOME-nya benar)
|
||||
local u="$1"; shift
|
||||
if [ "$u" = root ]; then bash -lc "$*" 2>/dev/null
|
||||
else su -l "$u" -c "$*" 2>/dev/null; fi
|
||||
}
|
||||
|
||||
write_yazi() {
|
||||
local home="$1" user="$2" file
|
||||
local home="$1" user="$2" dir
|
||||
[ -d "$home" ] || return 0
|
||||
file="$home/.config/yazi/yazi.toml"
|
||||
mkdir -p "$home/.config/yazi"
|
||||
[ -f "$file" ] && cp -a "$file" "${file}.bak-$(date +%Y%m%d%H%M%S)"
|
||||
cat > "$file" <<'EOF'
|
||||
dir="$home/.config/yazi"
|
||||
mkdir -p "$dir"
|
||||
local f; for f in yazi.toml keymap.toml init.lua; do
|
||||
[ -f "$dir/$f" ] && cp -a "$dir/$f" "$dir/$f.bak-$(date +%Y%m%d%H%M%S)"
|
||||
done
|
||||
|
||||
cat > "$dir/yazi.toml" <<'EOF'
|
||||
# Editor default: micro (bukan vim)
|
||||
[opener]
|
||||
edit = [
|
||||
{ run = 'micro %s', block = true, desc = "Edit (micro)", for = "unix" },
|
||||
]
|
||||
# Ekstrak arsip pakai ouch
|
||||
extract = [
|
||||
{ run = 'ouch d -y "$@"', desc = "Ekstrak di sini (ouch)", for = "unix" },
|
||||
]
|
||||
|
||||
[plugin]
|
||||
prepend_preloaders = [
|
||||
{ mime = "{audio,video,image}/*", run = "mediainfo" },
|
||||
{ mime = "application/{subrip,postscript,illustrator,dvb.ait,vnd.adobe.illustrator,eps}", run = "mediainfo" },
|
||||
{ url = "*.{ai,eps,ait}", run = "mediainfo" },
|
||||
]
|
||||
prepend_previewers = [
|
||||
{ mime = "{audio,video,image}/*", run = "mediainfo" },
|
||||
{ mime = "application/{subrip,postscript,illustrator,dvb.ait,vnd.adobe.illustrator,eps}", run = "mediainfo" },
|
||||
{ url = "*.{ai,eps,ait}", run = "mediainfo" },
|
||||
{ mime = "application/{*zip,tar,bzip2,7z*,rar,xz,zstd,java-archive}", run = "ouch" },
|
||||
]
|
||||
|
||||
# Batas memori decode gambar (untuk file media besar)
|
||||
[tasks]
|
||||
image_alloc = 2147483648
|
||||
image_bound = [12000, 12000]
|
||||
EOF
|
||||
chown -R "$user:$user" "$home/.config/yazi" 2>/dev/null || true
|
||||
|
||||
cat > "$dir/keymap.toml" <<'EOF'
|
||||
# fg.yazi: cari isi / nama file (ripgrep + fzf)
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "f", "g" ]
|
||||
run = "plugin fg"
|
||||
desc = "Cari file by isi (fuzzy)"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "f", "G" ]
|
||||
run = "plugin fg -- rg"
|
||||
desc = "Cari file by isi (ripgrep)"
|
||||
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "f", "f" ]
|
||||
run = "plugin fg -- fzf"
|
||||
desc = "Cari file by nama"
|
||||
|
||||
# zoxide (plugin bawaan Yazi): lompat direktori
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "Z"
|
||||
run = "plugin zoxide"
|
||||
desc = "Lompat direktori (zoxide)"
|
||||
|
||||
# ouch: kompres (format ikut ekstensi nama)
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "C"
|
||||
run = "plugin ouch"
|
||||
desc = "Kompres dengan ouch (zip/tar.gz/7z/xz/zst)"
|
||||
|
||||
# chmod: ubah permission
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "c", "h" ]
|
||||
run = "plugin chmod"
|
||||
desc = "Ubah permission (chmod)"
|
||||
EOF
|
||||
|
||||
cat > "$dir/init.lua" <<'EOF'
|
||||
require("full-border"):setup { type = ui.Border.ROUNDED }
|
||||
require("fg"):setup { default_action = "menu" }
|
||||
require("zoxide"):setup { update_db = true }
|
||||
EOF
|
||||
|
||||
chown -R "$user:$user" "$dir" 2>/dev/null || true
|
||||
}
|
||||
log "Config Yazi (editor=micro) untuk $TARGET_USER"
|
||||
|
||||
install_yazi_plugins() {
|
||||
local home="$1" user="$2" ya p cmd
|
||||
ya="$(command -v ya || command -v yazi || true)"
|
||||
[ -n "$ya" ] || { warn "ya/yazi tak ada — plugin Yazi dilewati"; return 0; }
|
||||
for p in yazi-rs/plugins:full-border yazi-rs/plugins:smart-filter yazi-rs/plugins:chmod ndtoan96/ouch boydaihungst/mediainfo; do
|
||||
run_as_user "$user" "'$ya' pkg add '$p'" || true
|
||||
done
|
||||
# fg.yazi: nama tak kebab-case -> clone manual
|
||||
if [ ! -d "$home/.config/yazi/plugins/fg.yazi" ]; then
|
||||
run_as_user "$user" "git clone --depth 1 https://github.com/DreamMaoMao/fg.yazi.git '$home/.config/yazi/plugins/fg.yazi'" || true
|
||||
fi
|
||||
}
|
||||
|
||||
log "Config Yazi (editor=micro, metadata media, arsip) untuk $TARGET_USER"
|
||||
write_yazi "$TARGET_HOME" "$TARGET_USER"
|
||||
install_yazi_plugins "$TARGET_HOME" "$TARGET_USER"
|
||||
if [ "$TARGET_USER" != root ]; then
|
||||
write_yazi "/root" "root"
|
||||
fi
|
||||
@@ -170,6 +282,12 @@ if status is-interactive
|
||||
if command -q starship
|
||||
starship init fish | source
|
||||
end
|
||||
# Greeting pembuka: fastfetch
|
||||
if command -q fastfetch
|
||||
function fish_greeting
|
||||
fastfetch
|
||||
end
|
||||
end
|
||||
end
|
||||
EOF
|
||||
|
||||
@@ -188,9 +306,12 @@ cat <<EOF
|
||||
$(printf "${BLUE}==>${NC}") Selesai.
|
||||
fish : $(command -v fish)
|
||||
starship : $(command -v starship) (polos)
|
||||
yazi : $(command -v yazi) (editor default: micro)
|
||||
yazi : $(command -v yazi) (editor default: micro, plugin+metadata siap)
|
||||
micro : $(command -v micro)
|
||||
lazydocker: $(command -v lazydocker)
|
||||
fastfetch : $(command -v fastfetch || echo '-') (greeting fish)
|
||||
mediainfo : $(command -v mediainfo || echo '-') (metadata media di Yazi)
|
||||
ouch : $(command -v ouch || echo '-') (arsip zip/tar/7z)
|
||||
|
||||
Logout/login (atau buka terminal baru) agar shell fish aktif.
|
||||
Konfigurasi fish global: /etc/fish/conf.d/temp-own.fish
|
||||
|
||||
Reference in new issue
Block a user