-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkiss
executable file
·88 lines (79 loc) · 2.61 KB
/
kiss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/sh
arrow="\033[1;33m->\033[m"
_deps="$HOME/usr/src/eudald-kiss/metapkg/depends"
_kern="$HOME/usr/src/eudald-kiss/linux"
_live="$HOME/usr/src/kiss-live"
case "$1" in
alternatives|build|checksum|download|install|list|remove|search|update|version|''|help-ext|\
chroot|depends|export|fork|graph|help|link|maintainer|manifest|new|orphans|outdated|owns|reset|revdepends|size)
/usr/bin/kiss "$@"
;;
add|del)
_1="$1"
shift 1
[ "$#" -ne 0 ] && {
for _pkg in "$@"; do
if [ -n "$(cat $_deps | grep -w $_pkg)" ]; then
[ "$_1" = del ] && { sed -i "/^$_pkg$/d" "$_deps"; ch=1; }
else
[ "$_1" = add ] && { echo "$_pkg" >> "$_deps"; ch=1; }
fi
done
[ "$ch" = 1 ] && {
sort -uk1,1 "$_deps" -o "$_deps"
KISS_PROMPT=0 kiss bi metapkg; kiss ro
}
}
;;
k|kernel) # Great with 'u' -> kiss ku
printf "$arrow Updating kernel\n"
r=$(curl -Ss https://www.kernel.org/feeds/kdist.xml) && {
remote_ver=${r%%: stable*}
remote_ver=${remote_ver##*>}
} || {
printf "$arrow Kernel network error\n"
exit 1
}
l=$(cat "$_kern/version") && {
local_ver=${l% *}
} || {
printf "$arrow Kernel local version not found\n"
exit 1
}
if [ "$local_ver" != "$remote_ver" ]; then
printf "$arrow Found new kernel update\n"
printf 'linux %s ==> %s\n' "${l// /\-}" "$remote_ver-1"
printf "$arrow Apply?: Press Enter to continue or Ctrl+C to abort here\n"
[ "$KISS_PROMPT" = 0 ] || read -r _
sed -i "s/$local_ver/$remote_ver/g" "$_kern/sources"
echo "$remote_ver 1" > "$_kern/version"
( cd "$_kern"; kiss cbi; cd - >&/dev/null )
else
printf "Already up to date.\n"
fi
;;
ku)
kiss k && kiss u
;;
live)
shift 1
for _pkg in grub libisoburn syslinux; do
[ -d "/var/db/kiss/installed/$_pkg" ] || {
kiss i "$_pkg" || kiss bi "$_pkg"
}
done
( cd "$_live"; sls ./kiss-live "$@"; cd - >&/dev/null )
;;
ro)
while kiss o | grep -qv "${2:-metapkg}"; do
kiss r `kiss o | grep -v "${2:-metapkg}" | tr '\n' ' '`
done
;;
*)
_1="$1"
shift 1
for _action in $(echo "$_1" | grep -o .); do
/usr/bin/kiss "$_action" "$@"
done
;;
esac