cl-adams/adams

Diff from f4cfeb433bd93db04f6de57febe8fcfd4a6f107d to master


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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..f27f198
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: thodg
diff --git a/LICENSE.md b/LICENSE.md
index 250cdd5..0535628 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,19 +1,7 @@
 # Adams license information
 
 Adams - UNIX system administration tool written in Common Lisp
-Copyright 2013,2014,2018,2020 Thomas de Grivel <thoxdg@gmail.com>
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 
 ## Adams dependencies license information
@@ -579,40 +567,6 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-### re
-
-Copyright 2014 Thomas de Grivel <thomas@lowh.net>
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-
-### str
-
-Copyright 2012-2015 Thomas de Grivel <thomas@lowh.net>
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-
 ### trivial-utf-8
 
 Copyright (c) Marijn Haverbeke
diff --git a/Makefile b/Makefile
index 0e0c10c..4f8385d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,17 @@
-
+## Adams - UNIX system administration tool written in Common Lisp
+## Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
+
+PACKAGE = adams
+VERSION = 0.3.2
+RELEASE_DIR = ${PACKAGE}-${VERSION}
+RELEASE_TARBALL = ${PACKAGE}-${VERSION}.tar.gz
+RELEASE_DEPS_TARBALL = ${PACKAGE}-${VERSION}.deps.tar.gz
 PROGRAM = build/adams
 PREFIX = /usr/local
-LISP = sbcl
+LISP = sbcl --dynamic-space-size 2048
 LISP_LOAD = ${LISP} --load
+CLEANFILES = build/*
+DISTCLEANFILES = ${RELEASE_DIR} ${RELEASE_TARBALL} ${RELEASE_DEPS_TARBALL}
 
 all: ${PROGRAM}
 
@@ -15,10 +24,23 @@ build/systems.lisp: prepare-build.lisp adams.asd
 ${PROGRAM}: build.lisp config.lisp build/systems.lisp toplevel.lisp
 	LANG=C.UTF-8 ${LISP_LOAD} build.lisp --quit
 
+install:
+	install -m 0755 ${PROGRAM} ${PREFIX}/bin
+
+release: ${RELEASE_TARBALL} ${RELEASE_DEPS_TARBALL}
+
+${RELEASE_TARBALL}:
+	mkdir ${RELEASE_DIR}
+	find . -name build -prune -or -name '*.lisp' -or -name '*.asd' -or -name '*.md' | cpio -pd ${RELEASE_DIR}
+	tar czf ${RELEASE_TARBALL} ${RELEASE_DIR}
+
+${RELEASE_DEPS_TARBALL}:
+	tar czf ${RELEASE_DEPS_TARBALL} build/*.lisp
+
 clean:
-	rm -rf build/*
+	rm -rf ${CLEANFILES}
 
-install: ${PROGRAM}
-	install -m 0755 ${PROGRAM} ${PREFIX}/bin
+distclean:
+	rm -rf ${DISTCLEANFILES}
 
-.PHONY: all clean deps install ${PROGRAM}
+.PHONY: all clean deps install ${PROGRAM} release
diff --git a/README.md b/README.md
index 484cd8e..3408ef9 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-Adams 0.1
-=========
+Adams 0.3.2
+===========
 
 Adams is a UNIX system administration tool written in Common Lisp.
 
@@ -8,12 +8,6 @@ You describe your systems (hosts) using resources having properties.
 The properties are then probed and synchronized by Adams using only
 `/bin/sh` on the remote host, and `/usr/bin/ssh` on the control host.
 
-More viable alternatives include
-[Ansible](https://www.ansible.com/),
-[Chef](https://www.chef.io/)
-and
-[Puppet](https://puppet.com/).
-
 
 Configuration example
 ---------------------
@@ -148,37 +142,11 @@ In your main script :
 ```
 
 
-ISC License
------------
-```
-;;  Copyright YEAR AUTHOR <EMAIL>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
-```
-
-
-Contribute
-----------
-
-To contribute, fork this repository and send us a pull request.
-
-Please publish under the
-[ISC License](https://en.wikipedia.org/wiki/ISC_license)
-terms.
+[License](LICENSE.md)
+---------------------
 
 
 Authors
 -------
 
-Thomas de Grivel <thoxdg@gmail.com>
+Thomas de Grivel <thodg@kmx.io>
diff --git a/adams.asd b/adams.asd
index d6590f8..00eab78 100644
--- a/adams.asd
+++ b/adams.asd
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (defpackage :adams.system
   (:use :cl :asdf))
@@ -67,6 +52,7 @@
 	     (:file "linux" :depends-on ("commands" "defs"))
 	     (:file "openbsd" :depends-on ("commands" "defs"))
 	     (:file "freebsd" :depends-on ("commands" "defs"))
+	     (:file "darwin" :depends-on ("commands" "defs"))
 	     (:file "operations" :depends-on ("commands" "defs"))
 	     (:file "probes"  :depends-on ("commands" "defs"
                                            "stat" "syntaxes"))
diff --git a/build.lisp b/build.lisp
index 8f03252..5f38baf 100644
--- a/build.lisp
+++ b/build.lisp
@@ -1,23 +1,14 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :common-lisp-user)
 
+(declaim (optimize (speed 1)
+                   (space 1)
+                   (safety 3)
+                   (debug 3)
+                   (compilation-speed 0)))
+
 (defun compile-lisp (path)
   (let* ((fasl (make-pathname :type "fasl" :defaults path))
          (fasl (merge-pathnames fasl)))
diff --git a/config.lisp b/config.lisp
index 207c5fe..c039f50 100644
--- a/config.lisp
+++ b/config.lisp
@@ -1,2 +1,4 @@
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (declaim (optimize (debug 3) (safety 3) (speed 3)))
diff --git a/core/defs.lisp b/core/defs.lisp
index 064f98f..d2123a1 100644
--- a/core/defs.lisp
+++ b/core/defs.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
@@ -195,6 +180,7 @@
    (probe-host-locale :properties (:locale))
    (probe-host-packages :properties (:packages))
    (probe-boot-time :properties (:boot-time))
+   (probe-host-homedir :properties (:homedir))
    (probe-host-user :properties (:user))
    (probe-hostname :properties (:hostname)))
   ((op-host-locale :properties (:locale))
@@ -261,3 +247,7 @@
   `(loop
       (unless (remf ,place ,indicator)
         (return))))
+
+;;  Shebang
+
+(set-dispatch-macro-character #\# #\! #'read-line)
diff --git a/core/helpers.lisp b/core/helpers.lisp
index f72ac9b..8955517 100644
--- a/core/helpers.lisp
+++ b/core/helpers.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2020 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
@@ -28,3 +13,20 @@
                (when (zerop size)
                  (return))
                (write-sequence buf out :end size))))))))
+
+(defun static-file (path &rest plist)
+  (resource 'file path
+            :content (read-file (hostname *host*) path)
+            plist))
+
+(defun static-directory (directory &rest plist)
+  (let* ((host-dir (truename (pathname (the string
+                                            (str (hostname) #\/)))))
+         (dir-path (str host-dir directory)))
+    (print dir-path)
+    (mapcar (lambda (path)
+              (let ((name (enough-namestring path host-dir)))
+              (resource 'file (str "/" name)
+                        :content (read-file path)
+                        plist)))
+                  (directory dir-path))))
diff --git a/core/host.lisp b/core/host.lisp
index abf5e1d..5a17214 100644
--- a/core/host.lisp
+++ b/core/host.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
@@ -74,6 +59,23 @@
 (defun hostname (&optional (host (current-host)))
   (resource-id (the host host)))
 
+(defun homedir (user &optional (host (current-host)))
+  (str (etypecase (host-os host)
+         (os-darwin "/Users")
+         (os "/home"))
+       "/"
+       (etypecase user
+         (user (resource-id user))
+         (string user))))
+
+(defgeneric probe-host-homedir (host os))
+
+(defmethod probe-host-homedir (host (os os-unix))
+  '(:homedir "/home"))
+
+(defmethod probe-host-homedir (host (os os-darwin))
+  '(:homedir "/Users"))
+
 ;;  Host shell
 
 (defmethod host-shell ((host host))
diff --git a/core/include.lisp b/core/include.lisp
index c9672fe..da6142a 100644
--- a/core/include.lisp
+++ b/core/include.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2020 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
@@ -23,8 +8,8 @@
            (let ((path (str parts)))
              (when (probe-file path)
                (return-from include/resolve-filename path)))))
-    (try spec)
-    (try spec ".adams")))
+    (try spec ".adams")
+    (try spec)))
 
 (defun include/resolve-filename! (spec)
   (or (include/resolve-filename spec)
diff --git a/core/operation.lisp b/core/operation.lisp
index b6659da..76e4ead 100644
--- a/core/operation.lisp
+++ b/core/operation.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/core/os.lisp b/core/os.lisp
index 54e2a2f..0ffdace 100644
--- a/core/os.lisp
+++ b/core/os.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/core/probe.lisp b/core/probe.lisp
index 2fc2e8f..c9fc2be 100644
--- a/core/probe.lisp
+++ b/core/probe.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/core/properties.lisp b/core/properties.lisp
index a232b4b..d97f345 100644
--- a/core/properties.lisp
+++ b/core/properties.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/core/resource-container.lisp b/core/resource-container.lisp
index b102d5c..43636f4 100644
--- a/core/resource-container.lisp
+++ b/core/resource-container.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/core/resource.lisp b/core/resource.lisp
index d5ea4e5..a07c641 100644
--- a/core/resource.lisp
+++ b/core/resource.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/core/spec.lisp b/core/spec.lisp
index 6d9106a..13a2853 100644
--- a/core/spec.lisp
+++ b/core/spec.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
@@ -122,14 +107,33 @@ First value lists properties out of specification in the following format :
 Second value lists properties in line with spec. Format is
   (PROPERTY-NAME VALUE)"))
 
-(defmethod resource-diff ((res resource))
-  (let ((specified-properties (specified-properties res))
-        diff)
+(defvar *virtual-properties*
+  '(:after
+    :before)
+  "Special properties that will not be synchronized.")
+
+(declaim (type list *virtual-properties*))
+
+(defun diffable-properties (specified-properties)
+  (let ((properties))
     (loop
        (when (endp specified-properties)
-         (return))
+         (return (nreverse properties)))
        (let* ((property (pop specified-properties))
-              (specified (pop specified-properties))
+              (specified (pop specified-properties)))
+         (unless (find property *virtual-properties* :test #'eq)
+           (push property properties)
+           (push specified properties))))))
+
+(defmethod resource-diff ((res resource))
+  (let* ((specified-properties (specified-properties res))
+         (properties (diffable-properties specified-properties))
+         diff)
+    (loop
+       (when (endp properties)
+         (return))
+       (let* ((property (pop properties))
+              (specified (pop properties))
               (probed (get-probed res property))
               (desc (describe-probed-property-value res property probed)))
          (unless (match-specified-value res property specified desc (host-os *host*))
diff --git a/core/syntaxes.lisp b/core/syntaxes.lisp
index 60638a9..8b8d6b4 100644
--- a/core/syntaxes.lisp
+++ b/core/syntaxes.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/package.lisp b/package.lisp
index b195fca..efca103 100644
--- a/package.lisp
+++ b/package.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :cl-user)
 
@@ -115,6 +100,7 @@
    #:resource-diff
    ;;  Host
    #:current-host
+   #:homedir
    #:host
    #:host-connect
    #:host-disconnect
@@ -123,6 +109,8 @@
    #:host-run
    #:localhost
    #:run
+   #:run-as-root
+   #:run-as-root-command
    #:ssh-host
    #:with-connected-host
    #:with-host
@@ -143,6 +131,7 @@
    #:ssh-authorized-key
    #:stat
    #:stat<1>
+   #:symlink
    #:+timestamp-offset+
    #:timestamp-to-universal-time
    #:universal-time-to-timestamp
@@ -153,6 +142,8 @@
    ;; helpers
    #:include
    #:read-file
+   #:static-file
+   #:static-directory
    #:str
    ))
 
diff --git a/prepare-build.lisp b/prepare-build.lisp
index 65c2147..3c8234a 100644
--- a/prepare-build.lisp
+++ b/prepare-build.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2020 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :common-lisp-user)
 
@@ -123,10 +108,17 @@
 
 (defmethod collect-sources :around ((x asdf:component))
   (let ((if-feature (asdf::component-if-feature x)))
-    (if if-feature
-        (when (find (the symbol if-feature) *features*)
-          (call-next-method))
-        (call-next-method))))
+    (etypecase if-feature
+      (null
+       (call-next-method))
+      (symbol
+       (when (find (the symbol if-feature) *features*)
+         (call-next-method)))
+      (cons
+       (cond ((string-equal 'not (first if-feature))
+              (unless (find (the symbol (second if-feature)) *features*)
+                (call-next-method)))
+             (t (error "Bad if-feature")))))))
 
 #+nil (collect-sources :adams)
 
@@ -156,10 +148,11 @@
   (let (dependencies)
     (labels ((dfs (name)
                (let ((sys (asdf:find-system name)))
-                 (when sys
+                 (when (and sys (not (find sys dependencies)))
                    (locally (declare (type asdf:system sys))
+                     (format t "~& ~A" sys) (force-output)
                      (map 'nil #'dfs (asdf:system-depends-on sys))
-                     (pushnew sys dependencies))))))
+                     (push sys dependencies))))))
       (dfs name)
       (nreverse dependencies))))
 
@@ -180,6 +173,7 @@
                (load-form `(load ,build-file)))
           (format t "~& ~A~%" sys) (force-output)
           (print load-form out)))
-      (fresh-line out))))
+      (fresh-line out)
+      (force-output out))))
 
 (write-build-systems-file :adams)
diff --git a/shell/sb-shell.lisp b/shell/sb-shell.lisp
index 9abbbee..e7627f9 100644
--- a/shell/sb-shell.lisp
+++ b/shell/sb-shell.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/shell/shell.lisp b/shell/shell.lisp
index 3f3e1cc..c4aa608 100644
--- a/shell/shell.lisp
+++ b/shell/shell.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
@@ -137,7 +122,7 @@ Error: ~S"
     (shell-in (format nil " ; echo \"~%~A $?\"~%" delim) shell)
     (let* ((prev nil)
            (status
-            (loop (let ((line (the string (shell-out/line shell))))
+            (loop (let ((line (shell-out/line shell)))
                     (when (or (null line)
                               (and (< len (length line))
                                    (string= delim line :end2 len)))
@@ -160,7 +145,7 @@ Error: ~S"
 	  (shell-log shell "| ~A~%" line))
 	(dolist (line err)
 	  (shell-log shell "# ~A~&" line))
-        (unless (= 0 status)
+        (unless (and status (= 0 status))
           (shell-log shell   " ⇒ ~D~%" status)))
       (values status out err))))
 
diff --git a/test.lisp b/test.lisp
index 7da15f0..e57cce3 100644
--- a/test.lisp
+++ b/test.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :cl-user)
 
@@ -32,6 +17,11 @@
 (adams:clear-resources)
 (adams:clear-probed)
 
+(resource 'symlink "/home/dx/test-symlink"
+          :owner "dx"
+          :group "dx"
+          :target "../test")
+
 (resource 'host "ams.kmx.io"
           :user "root"
           :hostname "ams"
diff --git a/toplevel.lisp b/toplevel.lisp
index 3396cc6..576873b 100644
--- a/toplevel.lisp
+++ b/toplevel.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/unix/commands.lisp b/unix/commands.lisp
index b5018a9..90868f2 100644
--- a/unix/commands.lisp
+++ b/unix/commands.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
@@ -54,3 +39,9 @@
 
 (defun sudo (&rest command)
   (run (apply #'sudo_ command)))
+
+(defun doas_ (&rest command)
+  (join-str " " "doas" command))
+
+(defun doas (&rest command)
+  (run (apply #'doas_ command)))
diff --git a/unix/darwin.lisp b/unix/darwin.lisp
new file mode 100644
index 0000000..0e48d54
--- /dev/null
+++ b/unix/darwin.lisp
@@ -0,0 +1,192 @@
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
+
+(in-package :adams)
+
+(in-re-readtable)
+
+(defmethod echo-command ((host t) (os os-darwin))
+  "printf %s ")
+
+(defmethod probe-hostname ((host host) (os os-darwin))
+  (list :hostname (run-1 "hostname -s")))
+
+(define-resource-class brew-pkg (pkg)
+  ()
+  ((probe-brew-pkg :properties (:ensure :flavor :version)))
+  ((op-brew-pkg :properties (:ensure :version))))
+
+(defgeneric probe-brew-pkg (resource os))
+
+(defgeneric op-brew-pkg (pkg os &key ensure version))
+
+(defmethod probe-host-packages ((host host) (os os-darwin))
+  (list :packages ()))
+
+(defmethod op-host-packages ((host host) (os os-darwin) &key packages)
+  nil)
+
+(defmethod op-hostname ((host host) (os os-unix) &key hostname)
+  (run-as-root "hostname -s " (sh-quote hostname)))
+
+(defmethod probe-group ((group group) (os os-darwin))
+  (let ((id (resource-id group))
+        (ensure :absent)
+        (gid nil))
+    (multiple-value-bind (out status)
+        (run "dscl . -read /Groups/" (sh-quote id))
+      (when (= 0 status)
+        (setq ensure :present)
+        (dolist (line out)
+          (re-bind "PrimaryGroupID: ([0-9]+)" (n) line
+            (setq gid (parse-number n)))))
+      (properties* ensure gid))))
+
+#+nil
+(probe (resource 'group "dx") :gid)
+
+(defmethod probe-user ((user user) (os os-darwin))
+  (let* ((id (resource-id user))
+         (sh-id (sh-quote id))
+         (ensure :absent)
+         uid
+         gid
+         shell
+         home)
+    (multiple-value-bind (out status)
+        (run "dscl . -read /Users/" sh-id)
+      (when (= 0 status)
+        (setq ensure :present)
+        (dolist (line out)
+          (re-bind #~|^UniqueID: ([0-9]+)| (n) line
+            (setq uid (parse-number n)))
+          (re-bind #~|^PrimaryGroupID: ([0-9]+)| (n) line
+            (setq gid (parse-number n)))
+          (re-bind #~|^UserShell: (/[^ \n]+)| (s) line
+            (setq shell s))
+          (re-bind #~|^NFSHomeDirectory: (/[^ \n]+)| (h) line
+            (setq home h)))))
+    (let ((realname (string-trim
+                     '(#\Space #\Newline)
+                     (second (run "dscl . -read /Users/" sh-id
+                                  " RealName")))))
+      (properties* ensure uid gid shell home realname))))
+
+#+nil
+(probe (resource 'user "root") :gid)
+
+(define-syntax id<1>-tr ((#'parse-integer gid) name)
+    #~|([0-9]+)[(]([^)]+)|)
+
+(defmethod probe-user-groups ((user user) (os os-darwin))
+  (let ((id (resource-id user))
+        (groups nil))
+    (unless (eq :absent (get-probed user :ensure))
+      (let ((user-gid (get-probed user :gid))
+            (user-group nil))
+        (with-id<1>-tr (gid name) (run "id " (sh-quote id)
+                                       " | tr ' ,=' '\\n'")
+          (when gid
+            (when (= user-gid gid)
+              (setq user-group (resource 'group name)))
+            (push (resource 'group name) groups)))
+        (setq groups (sort groups #'string< :key #'resource-id)
+              groups (if user-group
+                         (cons user-group
+                               (remove (resource-id user-group)
+                                       groups :key #'resource-id
+                                              :test #'string=))
+                         groups)
+              groups (remove-if (lambda (x)
+                                  (find (resource-id x)
+                                        '("_lpoperator"
+                                          "com.apple.access_ssh"
+                                          "com.apple.sharepoint.group.1"
+                                          "com.apple.sharepoint.group.2"
+                                          "everyone"
+                                          "localaccounts")
+                                        :test #'string=))
+                                groups))))
+    (properties* groups)))
+
+#+nil
+(probe (resource 'user "root") :groups)
+
+(defmethod op-update-group ((group group) (os os-darwin) &key ensure gid)
+  (let ((id (resource-id group)))
+    (run-as-root
+     (join-str
+      " "
+      "dscl ." 
+      (ecase ensure
+        ((:absent)  "-delete")
+        ((:present) "-create")
+        ((nil)      "-change"))
+      (str "/Groups/" (sh-quote id))
+      (when gid
+        `("PrimaryGroupID"
+          ,(unless ensure
+             (sh-quote (get-probed group :gid)))
+          ,(sh-quote gid)))))))
+
+(defmethod op-update-user ((user user) (os os-darwin)
+                           &key ensure uid gid realname home shell
+                             login-class groups)
+  (declare (ignore login-class))
+  (sync-groups)
+  (let* ((id (resource-id user))
+         (sh-id (sh-quote id)))
+    (when ensure
+      (run-as-root
+       "dscl . "
+       (ecase ensure
+         ((:absent)  "-delete ")
+         ((:present) "-create "))
+       (str "/Users/" sh-id)))
+    (when uid
+      (run-as-root
+       "dscl . -create /Users/" sh-id
+       " UniqueID "
+       (sh-quote uid)))
+    (when gid
+      (run-as-root
+       "dscl . -create /Users/" sh-id
+       " PrimaryGroupID "
+       (sh-quote gid)))
+    (when home
+      (run-as-root
+       "dscl . -create /Users/" sh-id
+       " NFSHomeDirectory "
+       (sh-quote home)))
+    (when shell
+      (run-as-root
+       "dscl . -create /Users/" sh-id
+       " UserShell "
+       (sh-quote shell)))
+    (dolist (group (get-probed user :groups))
+      (unless (find (resource-id group) groups)
+        (run-as-root
+         "dscl . -delete /Groups/" (sh-quote (resource-id group))
+         " GroupMembership " sh-id)))
+    (dolist (group groups)
+      (run-as-root
+       "dscl . -append /Groups/" (sh-quote group)
+       " GroupMembership " sh-id))))
+
+#+nil
+(clear-resources)
+
+#+nil
+(describe-probed (resource 'openbsd-pkg "emacs"))
+
+#+nil
+(probe-host-packages *host* (host-os *host*))
+
+#+nil
+(probe *host* :packages)
+
+#+nil
+(map nil #'describe-probed (probe-installed-packages))
+
+#+nil
+(run "pkg_info -q | grep emacs-")
diff --git a/unix/debian.lisp b/unix/debian.lisp
index a9d3f54..734e4b9 100644
--- a/unix/debian.lisp
+++ b/unix/debian.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/unix/defs.lisp b/unix/defs.lisp
index fb32d1b..7bb5065 100644
--- a/unix/defs.lisp
+++ b/unix/defs.lisp
@@ -1,41 +1,26 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
 ;;  Group
 
 (define-resource-class group () ()
-  ((probe-group-in-/etc/group :properties (:ensure :name :passwd :gid :members)))
+  ((probe-group :properties (:ensure :name :passwd :gid :members)))
   ((op-update-group :properties (:ensure :gid))))
 
-(defgeneric probe-group-in-/etc/group (resource os))
+(defgeneric probe-group (resource os))
 (defgeneric op-update-group (resource os &key ensure gid))
 
 ;;  User
 
 (define-resource-class user (resource-container)
   ()
-  ((probe-user-in-/etc/passwd :properties (:ensure :login :uid :gid :realname
-                                                   :home :shell))
-   (probe-user-groups-in-/etc/group :properties (:groups)))
+  ((probe-user :properties (:ensure :login :uid :gid :realname
+                                    :home :shell))
+   (probe-user-groups :properties (:groups)))
   ((op-update-user :properties (:ensure :uid :gid :realname :home :shell
-                                        :login-class :groups))))
+                                :login-class :groups))))
 
 (defgeneric probe-user-in-/etc/passwd (resource os))
 (defgeneric probe-user-groups-in-/etc/group (resource os))
@@ -94,6 +79,19 @@
 (defgeneric op-file-ensure (resource os &key ensure))
 (defgeneric op-file-content (resource os &key content))
 
+;;  Symbolic link
+
+(define-resource-class symlink (vnode)
+  ()
+  ((probe-symlink-target :properties (:target)))
+  ((op-symlink-ensure :properties (:ensure))
+   (op-symlink-target :properties (:target)))
+  ((:op-properties (:ensure :target))))
+
+(defgeneric probe-symlink-target (resource os))
+(defgeneric op-symlink-ensure (resource os &key ensure))
+(defgeneric op-symlink-target (resource os &key target))
+
 ;;  Directory
 
 (define-resource-class directory (vnode)
diff --git a/unix/freebsd.lisp b/unix/freebsd.lisp
index 7fb3042..9b34175 100644
--- a/unix/freebsd.lisp
+++ b/unix/freebsd.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/unix/linux.lisp b/unix/linux.lisp
index be4b6b3..4d2f441 100644
--- a/unix/linux.lisp
+++ b/unix/linux.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/unix/openbsd.lisp b/unix/openbsd.lisp
index 64908d3..6ba2960 100644
--- a/unix/openbsd.lisp
+++ b/unix/openbsd.lisp
@@ -1,32 +1,23 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
 (in-re-readtable)
 
+(defmethod echo-command ((host t) (os os-openbsd))
+  "echo -E -n ")
+
+(defmethod run-as-root-command ((host t) (os os-openbsd))
+  "doas ")
+
 (defmethod probe-hostname ((host host) (os os-openbsd))
   (list :hostname (run-1 "hostname -s")))
 
 (define-resource-class openbsd-pkg (pkg)
   ()
   ((probe-openbsd-pkg :properties (:ensure :flavor :version)))
-  ((op-openbsd-pkg :properties (:ensure))))
+  ((op-openbsd-pkg :properties (:ensure :version))))
 
 (define-syntax pkg_info<1> (name version flavor installed)
   #~|\s*([^-\s]+(?:-[^-0-9\s][^-\s]+)*)-([0-9][^-\s]*)(?:-([^-\s]+))?( \(installed\))?|
@@ -43,11 +34,11 @@
   (let ((id (resource-id pkg))
         (ensure :absent))
     (with-openbsd-pkg-id (id-name id-version id-flavor) (list id)
-      ;(format t "~&id-name ~S id-flavor ~S~%" id-name id-flavor)
+      (format t "~&id-name ~S id-flavor ~S~%" id-name id-flavor)
       (multiple-value-bind (version flavor)
           (with-pkg_info<1> (name version flavor installed)
               (run "pkg_info | egrep " (sh-quote (str "^" id-name)))
-            ;(format t "~&name ~S version ~S flavor ~S installed ~S~%" name version flavor installed)
+            (format t "~&name ~S version ~S flavor ~S installed ~S~%" name version flavor installed)
             (when (and (string= id-name name)
                        (or (and (null id-flavor) (null flavor))
                            (and id-flavor flavor
@@ -58,34 +49,26 @@
               (return (values version flavor))))
         (return (properties* ensure version flavor))))))
 
-(defmethod merge-property-values ((pkg openbsd-pkg)
-                                  (property (eql :versions))
-                                  (old list)
-                                  (new list))
-  (sort (remove-duplicates (append old new))
-        #'string<))
-
 (defmethod match-specified-value ((res host)
                                   (property (eql :packages))
                                   (specified list)
                                   (probed list)
                                   (os os-openbsd))
-  (format t "~&match-specified-value specified ~S~%" specified)
-  (format t "~&match-specified-value probed ~S~%" probed)
-  (force-output)
-  (with-openbsd-pkg-id (name version flavor) specified
-    (unless (find name probed :test #'string=)
-      (return nil)))
+  (dolist (pkg-id specified)
+    (unless (find pkg-id probed :test #'string=)
+      (return-from match-specified-value nil)))
   t)
 
-(defmethod op-openbsd-pkg ((pkg openbsd-pkg) (os os-openbsd) &key ensure)
+(defmethod op-openbsd-pkg ((pkg openbsd-pkg) (os os-openbsd) &key ensure version)
   (with-openbsd-pkg-id (id-name id-version id-flavor) (list (resource-id pkg))
-    (when (and id-flavor (not id-version))
-      (probe pkg :version))
+    (setq version
+	  (or version
+	      id-version
+	      (progn (probe pkg :version)
+		     (get-probed pkg :version))))
     (let ((pkg-string (str id-name
-                           (when (or id-version id-flavor)
-                             `(#\- ,(or id-version
-                                        (get-probed pkg :version))))
+			   (when version
+                             `(#\- ,version))
                            (when id-flavor
                              `(#\- ,id-flavor)))))
       (cond
@@ -111,16 +94,17 @@
 
 (defmethod op-host-packages ((host host) (os os-openbsd) &key packages)
   (with-host host
-    (with-openbsd-pkg-id (name version flavor) packages
-      (let ((pkg (resource 'openbsd-pkg name
-                           :ensure :installed)))
-        (when version
-          (resource 'openbsd-pkg name
-                    :version version))
-        (when flavor
-          (resource 'openbsd-pkg name
-                    :flavor flavor))
-        (sync pkg)))))
+    (dolist (pkg-id packages)
+      (with-openbsd-pkg-id (name version flavor) (list pkg-id)
+	(let ((pkg (resource 'openbsd-pkg pkg-id
+                             :ensure :installed)))
+          (when version
+            (resource 'openbsd-pkg pkg-id
+                      :version version))
+          (when flavor
+            (resource 'openbsd-pkg pkg-id
+                      :flavor flavor))
+          (sync pkg))))))
 
 #+nil
 (clear-resources)
diff --git a/unix/operations.lisp b/unix/operations.lisp
index 189f58b..fdd219c 100644
--- a/unix/operations.lisp
+++ b/unix/operations.lisp
@@ -1,28 +1,35 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
+;;  Echo
+
+(defgeneric echo-command (host os))
+
+(defmethod echo-command ((host t) (os t))
+  "echo -n ")
+
+(defun echo_ (&rest parts)
+  (let* ((host (current-host))
+         (cmd (echo-command host (host-os host))))
+    (str cmd (sh-quote parts))))
+
+(defun echo (&rest parts)
+  (run (echo_ parts)))
+
+;;  Run as root
+
+(defgeneric run-as-root-command (host os))
+
+(defmethod run-as-root-command ((host t) (os os-unix))
+  "sudo ")
+
 (defun run-as-root (&rest command)
-  (apply #'run
-         (unless (equal "root" (get-probed (current-host) :user))
-           "sudo ")
-         command))
+  (let* ((host (current-host))
+         (prefix (unless (equal "root" (get-probed host :user))
+                   (run-as-root-command host (get-probed host :os)))))
+    (apply #'run prefix command)))
 
 ;;  Host operations
 
@@ -56,13 +63,19 @@
    (join-str " "
              (ecase ensure
                ((:absent)  "userdel")
-               ((:present) "useradd -m")
+               ((:present) `("useradd"
+                             ,(unless (eq :present
+                                          (get-probed
+                                           (resource 'directory (homedir
+                                                                 user))
+                                           :ensure))
+                                "-m")))
                ((nil)      "usermod"))
              (when realname `("-c" ,(sh-quote realname)))
              (when home `("-d" ,(sh-quote home)))
              (when gid `("-g" ,(sh-quote gid)))
              (when login-class `("-L" ,(sh-quote login-class)))
-             (when groups `("-S" ,(join-str "," (mapcar #'sh-quote
+             (when groups `("-G" ,(join-str "," (mapcar #'sh-quote
                                                         groups))))
              (when shell `("-s" ,(sh-quote shell)))
              (when uid `("-u" ,(sh-quote uid)))
@@ -70,6 +83,30 @@
 
 ;;  VNode
 
+(defgeneric vnode-owner (res))
+
+(defmethod vnode-owner ((res vnode))
+  (let ((owner-spec (get-specified res :owner)))
+    (when owner-spec
+      (resource 'user owner-spec))))
+  
+(defgeneric vnode-group (res))
+
+(defmethod vnode-group ((res vnode))
+  (let ((group-spec (get-specified res :group)))
+    (when group-spec
+      (resource 'user group-spec))))
+  
+(defgeneric sync-owner-and-group (res))
+
+(defmethod sync-owner-and-group ((res vnode))
+  (let ((owner (vnode-owner res))
+        (group (vnode-group res)))
+    (when group
+      (sync group))
+    (when owner
+      (sync owner))))
+
 (defmethod op-chown ((res vnode) (os os-unix) &key uid gid owner group
                                                 &allow-other-keys)
   (when (stringp owner)
@@ -80,10 +117,10 @@
     (assert (= uid (get-probed owner :uid))))
   (when (and gid group)
     (assert (= gid (get-probed group :gid))))
-  (when owner
-    (sync owner))
   (when group
     (sync group))
+  (when owner
+    (sync owner))
   (let ((u (or (when owner (resource-id owner))
                uid))
         (g (or (when group (resource-id group))
@@ -96,6 +133,7 @@
 
 (defmethod op-chmod ((res vnode) (os os-unix) &key mode
                                                 &allow-other-keys)
+  (sync-owner-and-group res)
   (run "chmod " (octal (mode-permissions mode)) " "
        (sh-quote (resource-id res))))
 
@@ -119,6 +157,7 @@
     (resource 'directory parent-path)))
 
 (defmethod op-file-ensure ((res file) (os os-unix) &key ensure)
+  (sync-owner-and-group res)
   (sync (parent-directory res))
   (let* ((id (resource-id res))
          (sh-id (sh-quote id)))
@@ -128,15 +167,42 @@
       ((nil)))))
 
 (defmethod op-file-content ((res file) (os os-unix) &key content)
+  (sync-owner-and-group res)
   (sync (parent-directory res))
   (let ((id (resource-id res)))
-    (run "echo -n " (sh-quote content) " > " (sh-quote id))
+    (run (echo_ content) " > " (sh-quote id))
+    (when-let (after (get-specified res :after))
+      (funcall (the function after) res os))
     (clear-probed res)))
 
+;;  Symlink
+
+(defmethod op-symlink-ensure ((res symlink) (os os-unix)
+                              &key ensure)
+  (sync-owner-and-group res)
+  (sync (parent-directory res))
+  (let* ((id (resource-id res))
+         (sh-id (sh-quote id))
+         (target (get-specified res :target))
+         (sh-target (sh-quote target)))
+    (ecase ensure
+      ((:absent) (run "rm " sh-id))
+      ((:present) (run "ln -s " sh-target " " sh-id))
+      ((nil)))))
+
+(defmethod op-symlink-target ((res symlink) (os os-unix)
+                              &key target)
+  (let* ((id (resource-id res))
+         (sh-id (sh-quote id))
+         (sh-target (sh-quote target)))
+    (run "ln -sf " sh-target " " sh-id)))
+
 ;;  Directory
 
 (defmethod op-directory-ensure ((res directory) (os os-unix)
                                 &key ensure)
+  (sync-owner-and-group res)
+  (sync (parent-directory res))
   (let* ((id (resource-id res))
          (sh-id (sh-quote id)))
     (ecase ensure
diff --git a/unix/probes.lisp b/unix/probes.lisp
index bf30d72..4c62883 100644
--- a/unix/probes.lisp
+++ b/unix/probes.lisp
@@ -1,26 +1,11 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
 ;;  Group
 
-(defmethod probe-group-in-/etc/group ((group group) (os os-unix))
+(defmethod probe-group ((group group) (os os-unix))
   (let ((id (resource-id group))
         (ensure :absent))
     (multiple-value-bind #1=(name passwd gid members)
@@ -32,7 +17,7 @@
 
 ;;  User
 
-(defmethod probe-user-in-/etc/passwd ((user user) (os os-unix))
+(defmethod probe-user ((user user) (os os-unix))
   (let ((id (resource-id user))
         (ensure :absent))
     (multiple-value-bind #1=(login pass uid gid realname home shell)
@@ -46,7 +31,7 @@
           (return (values* #1#))))
       (properties* (ensure . #1#)))))
 
-(defmethod probe-user-groups-in-/etc/group ((user user) (os os-unix))
+(defmethod probe-user-groups ((user user) (os os-unix))
   (let ((id (resource-id user))
         groups)
     (unless (eq :absent (get-probed user :ensure))
@@ -76,10 +61,10 @@
 (defmethod probe-vnode-using-ls ((vnode vnode) (os os-unix))
   (let ((id (resource-id vnode))
         (ensure :absent))
-    (multiple-value-bind #1=(mode links owner group size mtime)
+    (multiple-value-bind #1=(mode links owner group size mtime target)
         (with-ls<1>-lT #.(cons 'name '#1#)
-            (ls "-ldT" (sh-quote id))
-          (when (string= id name)
+            (ls "-ldT" id)
+          (when (string= id (the string name))
             (setq mode (mode (mode-permissions mode))
                   owner (resource 'user owner)
                   group (resource 'group group)
@@ -144,6 +129,14 @@
                         :file-too-large))))
     (properties* content)))
 
+;;  Symlink
+
+(defmethod probe-symlink-target ((symlink symlink) (os os-unix))
+  (let ((target (string-trim '(#\Newline)
+                             (run-1 "readlink "
+                                    (sh-quote (resource-id symlink))))))
+    (properties* target)))
+
 ;;  Directory
 
 (defmethod probe-directory-content ((dir directory) (os os-unix))
diff --git a/unix/ssh.lisp b/unix/ssh.lisp
index f6c3c0a..0dda1af 100644
--- a/unix/ssh.lisp
+++ b/unix/ssh.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
diff --git a/unix/stat.lisp b/unix/stat.lisp
index 703ffea..28ec881 100644
--- a/unix/stat.lisp
+++ b/unix/stat.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
@@ -144,4 +129,7 @@
 
 (defmethod match-specified-value ((resource vnode) (property (eql :mode))
                                   specified probed os)
-  (= (mode-fixnum specified) (mode-fixnum probed)))
+  (or (eq specified probed)
+      (and specified
+           probed
+           (= (mode-fixnum specified) (mode-fixnum probed)))))
diff --git a/unix/syntaxes.lisp b/unix/syntaxes.lisp
index 0e438ce..74b54aa 100644
--- a/unix/syntaxes.lisp
+++ b/unix/syntaxes.lisp
@@ -1,20 +1,5 @@
-;;
-;;  adams - system administrator written in Common Lisp
-;;
-;;  Copyright 2013,2014,2018 Thomas de Grivel <thoxdg@gmail.com>
-;;
-;;  Permission to use, copy, modify, and distribute this software for any
-;;  purpose with or without fee is hereby granted, provided that the above
-;;  copyright notice and this permission notice appear in all copies.
-;;
-;;  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-;;  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-;;  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-;;  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-;;  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-;;  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-;;  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-;;
+;; Adams - UNIX system administration tool written in Common Lisp
+;; Copyright 2013-2022 Thomas de Grivel <thodg@kmx.io>
 
 (in-package :adams)
 
@@ -41,10 +26,11 @@
 			 group
 			 (#'sh-parse-integer size)
 			 (#'chronicity:parse time)
-			 name)
-  #~|^([-a-zA-Z]{10})\s+([0-9]+)\s+(\S+)\s+(\S+)\s+([0-9]+)\s+(\S+\s+\S+ \S+ \S+)\s+(.+)$|
+			 name
+                         target)
+  #~|^([-a-zA-Z]{10})\s+([0-9]+)\s+(\S+)\s+(\S+)\s+([0-9]+)\s+(\S+\s+\S+ \S+ \S+)\s+(.+?)(?: -> (.*))?$|
   "Syntax for `ls -lT` output. See ls(1)."
-  (values name mode links owner group size time))
+  (values name mode links owner group size time target))
 
 (define-syntax stat<1>-r ((#'sh-parse-integer
 			   dev ino mode links uid gid rdev size)