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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
# kiss
Tiny and straightforward package manager for KISS written in POSIX `sh`.
- Only 600~ lines of POSIX `sh` (*excluding blank lines and comments*).
- Runtime dependency detection.
- Incremental package installation.
- Fast dependency solver.
- File conflict detection.
- Package alternatives system.
- Binary stripping.
- `shellcheck` compliant.
## `kiss` Guidestones
```
* The package manager must not exceed 1000 lines of code.
This number excludes blank lines and comments which make
up around 50% of the program's current size.
* The ends do not justify the means. A feature, fix or what
have you will not be implemented if it requires gross
hacks to accomplish.
* The user is smart, the package manager is dumb. The package
manager is written under the assumption that the user has
some kind of functioning brain in their skull.
* There are some things which can't be, shouldn't be and won't
be automated. Firstly, for my sanity and secondly, for yours.
```
## Usage
```sh
➜ kiss
-> kiss [a|b|c|i|l|r|s|u|v] [pkg] [pkg] [pkg]
-> alternatives: List and swap to alternatives
-> build: Build a package
-> checksum: Generate checksums
-> install: Install a package
-> list: List installed packages
-> remove: Remove a package
-> search: Search for a package
-> update: Check for updates
-> version: Package manager version
```
## Index
<!-- vim-markdown-toc GFM -->
* [Package format](#package-format)
* [Customization](#customization)
* [Alternatives system](#alternatives-system)
* [Extending the package manager](#extending-the-package-manager)
<!-- vim-markdown-toc -->
## Package format
See: <https://getkiss.org/pages/package-system/>
## Customization
```sh
# The package manager is controlled through environment variables.
#
# These can be set in your '.profile' or '/etc/profile.d' to have
# the options apply all the time.
#
# These can also be set in the current shell to have them apply
# only for the current session.
#
# NOTE: The values shown below are the defaults.
# Managing repositories.
#
# This works exactly like '$PATH' (Colon separated).
#
# A list of repositories the package manager will use. You can
# add your own repositories or remove the default ones.
export KISS_PATH=/var/db/kiss/repo/core:/var/db/kiss/repo/extra:/var/db/kiss/repo/xorg
# Delete junk from packages.
#
# This works exactly like '$PATH' (Colon separated).
#
# A list of paths and files to remove from built packages.
#
# Set this to a blank value to keep all of the below files
# and directories around. This can be customized to keep or
# remove whatever you like.
export KISS_RM=usr/share/doc:usr/share/gtk-doc:usr/share/info:usr/share/polkit-1:usr/share/gettext:usr/share/locale:etc/bash_completion.d:usr/share/zsh
# Force package installation or removal.
#
# This can be used to bypass the dependency checks on installation
# and removal of packages.
#
# Set it to '1' to force.
export KISS_FORCE=0
# Show diff on system updates.
#
# This will spawn '$PAGER' (fallback to 'less') with a diff
# of each changed file in the system update.
#
# Set it to '1' to enable.
export KISS_AUDIT=0
# Hook into kiss through a script.
#
# This can be used set custom CFLAGS per package, modify builds,
# etc. This environment variable must point to a shellscript.
#
# The script will have the following environment variables set.
#
# $PKG: Name of the current package .
# $TYPE: The type of hook (valid: pre-build, post-build).
# $DEST: The full path to where 'make install' will put the package.
#
# Simple example script:
#
# case $TYPE in
# pre-build)
# case $PKG in
# zlib) export CFLAGS="-Os -static" ;;
# curl) export CFLAGS="-O3" ;;
# esac
# ;;
#
# post-build)
# # post-build code here.
# ;;
# esac
#
export KISS_HOOK=/path/to/script
# Root directory.
#
# Where installed packages will go. You won't ever need
# to touch this during normal usage.
#
# This can be used to have the package manager run in a "fake root".
export KISS_ROOT=/
# Keep build logs around for successful builds and not just failing
# ones. Helpful when debugging.
#
# Set it to '1' to enable.
export KISS_DEBUG=0
# Force the usage of a different 'sudo' tool.
#
# Values: 'su', 'sudo', 'doas'
export KISS_SU=
# Use a reproducible cache naming scheme.
#
# The package manager builds packages inside 'build-$PID/' with '$PID'
# being the package manager's process ID. This allows for multiple
# builds to happen at once.
#
# You can override this and _know_ the location beforehand with the
# below environment variable. 'KISS_PID=test' will build the package
# in 'build-test'.
#
# Unset by default.
export KISS_PID=
#
# non-package-manager related options.
# These are listed for clarity.
#
# Cache directory location.
export XDG_CACHE_HOME=$HOME/.cache/
# Compiler.
export CC=gcc
export CXX=g++
# AR.
export AR=ar
# NM.
export NM=nm
# RANLIB.
export RANLIB=ranlib
# Compiler flags.
# Good value: CFLAGS/CXXFLAGS='-march=native -pipe -O2'
export CFLAGS=
export CXXFLAGS=
# Linker flags.
export LDFLAGS=
# Make flags.
# Good value: MAKEFLAGS='-j4' (number of cores).
export MAKEFLAGS=
# Ninja (Samurai) flags.
# Good value: SAMUFLAGS='-j4' (number of cores).
export SAMUFLAGS=
# Cmake Generator.
# Good value (Ninja): export CMAKE_GENERATOR='Ninja'
# Good value (Makefiles): export CMAKE_GENERATOR='Unix Makefiles'
export CMAKE_GENERATOR=
```
## Alternatives system
When a package with conflicts is installed the conflicting
files will be added as "choices" to the alternatives system.
Afterwards, running kiss a/kiss alternatives will list all of
the choices you are able to make. Each line of output with this
command is also usable directly as input.
NOTE: To disable this functionality, set 'KISS_CHOICE=0'.
Example usage:
```sh
# List alternatives.
-> kiss a
-> Alternatives:
ncurses /usr/bin/clear
ncurses /usr/bin/reset
# Swap to ncurses 'clear'.
-> kiss a ncurses /usr/bin/clear
-> Swapping '/usr/bin/clear' from 'busybox' to 'ncurses'
Password:
# New listing (busybox clear was swapped out).
-> kiss a
-> Alternatives:
busybox /usr/bin/clear
ncurses /usr/bin/reset
```
Example usage (complex):
```sh
-> kiss i sbase
# More lines...
-> sbase Found conflict (/usr/bin/renice), adding choice
-> sbase Found conflict (/usr/bin/logger), adding choice
-> sbase Found conflict (/usr/bin/flock), adding choice
-> sbase Found conflict (/usr/bin/cal), adding choice
-> sbase Installing package incrementally
-> sbase Installed successfully
# List alternatives.
-> kiss a
-> Alternatives:
# More lines...
sbase /usr/bin/uuencode
sbase /usr/bin/wc
sbase /usr/bin/which
sbase /usr/bin/whoami
sbase /usr/bin/xargs
sbase /usr/bin/yes
# Swapping in bulk (all of sbase).
# The 'kiss a' command with '-' as an argument will read
# from stdin and use each line as arguments to 'kiss a'.
kiss a | grep ^sbase | kiss a -
# New listing, sbase has replaced busybox utilities.
-> kiss a
-> Alternatives:
# More lines...
busybox /usr/bin/uuencode
busybox /usr/bin/wc
busybox /usr/bin/which
busybox /usr/bin/whoami
busybox /usr/bin/xargs
busybox /usr/bin/yes
```
## Extending the package manager
The `contrib` directory contains a set of simple scripts to extend the package manager. These scripts can be installed through the `kiss-utils` package.
- `kiss-chroot`: Enter a KISS `chroot`.
- `kiss-depends-finder`: Find missing dependencies by parsing 'ldd'.
- `kiss-depends`: Display a package's dependencies.
- `kiss-export`: Turn an installed package into a KISS tarball.
- `kiss-manifest-tree`: Display all files as tree owned by a package.
- `kiss-manifest`: Display all files owned by a package.
- `kiss-maintainer`: Display the package maintainers.
- `kiss-orphans`: List orphaned packages.
- `kiss-owns`: Check which package owns a file.
- `kiss-revdepends`: Display packages which depend on package.
- `kiss-size`: Show the size on disk for an installed package.
|