This file is indexed.

/usr/share/doc/debian-policy/policy-1.html is in debian-policy 3.9.8.0.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

    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
 1875
 1876
 1877
 1878
 1879
 1880
 1881
 1882
 1883
 1884
 1885
 1886
 1887
 1888
 1889
 1890
 1891
 1892
 1893
 1894
 1895
 1896
 1897
 1898
 1899
 1900
 1901
 1902
 1903
 1904
 1905
 1906
 1907
 1908
 1909
 1910
 1911
 1912
 1913
 1914
 1915
 1916
 1917
 1918
 1919
 1920
 1921
 1922
 1923
 1924
 1925
 1926
 1927
 1928
 1929
 1930
 1931
 1932
 1933
 1934
 1935
 1936
 1937
 1938
 1939
 1940
 1941
 1942
 1943
 1944
 1945
 1946
 1947
 1948
 1949
 1950
 1951
 1952
 1953
 1954
 1955
 1956
 1957
 1958
 1959
 1960
 1961
 1962
 1963
 1964
 1965
 1966
 1967
 1968
 1969
 1970
 1971
 1972
 1973
 1974
 1975
 1976
 1977
 1978
 1979
 1980
 1981
 1982
 1983
 1984
 1985
 1986
 1987
 1988
 1989
 1990
 1991
 1992
 1993
 1994
 1995
 1996
 1997
 1998
 1999
 2000
 2001
 2002
 2003
 2004
 2005
 2006
 2007
 2008
 2009
 2010
 2011
 2012
 2013
 2014
 2015
 2016
 2017
 2018
 2019
 2020
 2021
 2022
 2023
 2024
 2025
 2026
 2027
 2028
 2029
 2030
 2031
 2032
 2033
 2034
 2035
 2036
 2037
 2038
 2039
 2040
 2041
 2042
 2043
 2044
 2045
 2046
 2047
 2048
 2049
 2050
 2051
 2052
 2053
 2054
 2055
 2056
 2057
 2058
 2059
 2060
 2061
 2062
 2063
 2064
 2065
 2066
 2067
 2068
 2069
 2070
 2071
 2072
 2073
 2074
 2075
 2076
 2077
 2078
 2079
 2080
 2081
 2082
 2083
 2084
 2085
 2086
 2087
 2088
 2089
 2090
 2091
 2092
 2093
 2094
 2095
 2096
 2097
 2098
 2099
 2100
 2101
 2102
 2103
 2104
 2105
 2106
 2107
 2108
 2109
 2110
 2111
 2112
 2113
 2114
 2115
 2116
 2117
 2118
 2119
 2120
 2121
 2122
 2123
 2124
 2125
 2126
 2127
 2128
 2129
 2130
 2131
 2132
 2133
 2134
 2135
 2136
 2137
 2138
 2139
 2140
 2141
 2142
 2143
 2144
 2145
 2146
 2147
 2148
 2149
 2150
 2151
 2152
 2153
 2154
 2155
 2156
 2157
 2158
 2159
 2160
 2161
 2162
 2163
 2164
 2165
 2166
 2167
 2168
 2169
 2170
 2171
 2172
 2173
 2174
 2175
 2176
 2177
 2178
 2179
 2180
 2181
 2182
 2183
 2184
 2185
 2186
 2187
 2188
 2189
 2190
 2191
 2192
 2193
 2194
 2195
 2196
 2197
 2198
 2199
 2200
 2201
 2202
 2203
 2204
 2205
 2206
 2207
 2208
 2209
 2210
 2211
 2212
 2213
 2214
 2215
 2216
 2217
 2218
 2219
 2220
 2221
 2222
 2223
 2224
 2225
 2226
 2227
 2228
 2229
 2230
 2231
 2232
 2233
 2234
 2235
 2236
 2237
 2238
 2239
 2240
 2241
 2242
 2243
 2244
 2245
 2246
 2247
 2248
 2249
 2250
 2251
 2252
 2253
 2254
 2255
 2256
 2257
 2258
 2259
 2260
 2261
 2262
 2263
 2264
 2265
 2266
 2267
 2268
 2269
 2270
 2271
 2272
 2273
 2274
 2275
 2276
 2277
 2278
 2279
 2280
 2281
 2282
 2283
 2284
 2285
 2286
 2287
 2288
 2289
 2290
 2291
 2292
 2293
 2294
 2295
 2296
 2297
 2298
 2299
 2300
 2301
 2302
 2303
 2304
 2305
 2306
 2307
 2308
 2309
 2310
 2311
 2312
 2313
 2314
 2315
 2316
 2317
 2318
 2319
 2320
 2321
 2322
 2323
 2324
 2325
 2326
 2327
 2328
 2329
 2330
 2331
 2332
 2333
 2334
 2335
 2336
 2337
 2338
 2339
 2340
 2341
 2342
 2343
 2344
 2345
 2346
 2347
 2348
 2349
 2350
 2351
 2352
 2353
 2354
 2355
 2356
 2357
 2358
 2359
 2360
 2361
 2362
 2363
 2364
 2365
 2366
 2367
 2368
 2369
 2370
 2371
 2372
 2373
 2374
 2375
 2376
 2377
 2378
 2379
 2380
 2381
 2382
 2383
 2384
 2385
 2386
 2387
 2388
 2389
 2390
 2391
 2392
 2393
 2394
 2395
 2396
 2397
 2398
 2399
 2400
 2401
 2402
 2403
 2404
 2405
 2406
 2407
 2408
 2409
 2410
 2411
 2412
 2413
 2414
 2415
 2416
 2417
 2418
 2419
 2420
 2421
 2422
 2423
 2424
 2425
 2426
 2427
 2428
 2429
 2430
 2431
 2432
 2433
 2434
 2435
 2436
 2437
 2438
 2439
 2440
 2441
 2442
 2443
 2444
 2445
 2446
 2447
 2448
 2449
 2450
 2451
 2452
 2453
 2454
 2455
 2456
 2457
 2458
 2459
 2460
 2461
 2462
 2463
 2464
 2465
 2466
 2467
 2468
 2469
 2470
 2471
 2472
 2473
 2474
 2475
 2476
 2477
 2478
 2479
 2480
 2481
 2482
 2483
 2484
 2485
 2486
 2487
 2488
 2489
 2490
 2491
 2492
 2493
 2494
 2495
 2496
 2497
 2498
 2499
 2500
 2501
 2502
 2503
 2504
 2505
 2506
 2507
 2508
 2509
 2510
 2511
 2512
 2513
 2514
 2515
 2516
 2517
 2518
 2519
 2520
 2521
 2522
 2523
 2524
 2525
 2526
 2527
 2528
 2529
 2530
 2531
 2532
 2533
 2534
 2535
 2536
 2537
 2538
 2539
 2540
 2541
 2542
 2543
 2544
 2545
 2546
 2547
 2548
 2549
 2550
 2551
 2552
 2553
 2554
 2555
 2556
 2557
 2558
 2559
 2560
 2561
 2562
 2563
 2564
 2565
 2566
 2567
 2568
 2569
 2570
 2571
 2572
 2573
 2574
 2575
 2576
 2577
 2578
 2579
 2580
 2581
 2582
 2583
 2584
 2585
 2586
 2587
 2588
 2589
 2590
 2591
 2592
 2593
 2594
 2595
 2596
 2597
 2598
 2599
 2600
 2601
 2602
 2603
 2604
 2605
 2606
 2607
 2608
 2609
 2610
 2611
 2612
 2613
 2614
 2615
 2616
 2617
 2618
 2619
 2620
 2621
 2622
 2623
 2624
 2625
 2626
 2627
 2628
 2629
 2630
 2631
 2632
 2633
 2634
 2635
 2636
 2637
 2638
 2639
 2640
 2641
 2642
 2643
 2644
 2645
 2646
 2647
 2648
 2649
 2650
 2651
 2652
 2653
 2654
 2655
 2656
 2657
 2658
 2659
 2660
 2661
 2662
 2663
 2664
 2665
 2666
 2667
 2668
 2669
 2670
 2671
 2672
 2673
 2674
 2675
 2676
 2677
 2678
 2679
 2680
 2681
 2682
 2683
 2684
 2685
 2686
 2687
 2688
 2689
 2690
 2691
 2692
 2693
 2694
 2695
 2696
 2697
 2698
 2699
 2700
 2701
 2702
 2703
 2704
 2705
 2706
 2707
 2708
 2709
 2710
 2711
 2712
 2713
 2714
 2715
 2716
 2717
 2718
 2719
 2720
 2721
 2722
 2723
 2724
 2725
 2726
 2727
 2728
 2729
 2730
 2731
 2732
 2733
 2734
 2735
 2736
 2737
 2738
 2739
 2740
 2741
 2742
 2743
 2744
 2745
 2746
 2747
 2748
 2749
 2750
 2751
 2752
 2753
 2754
 2755
 2756
 2757
 2758
 2759
 2760
 2761
 2762
 2763
 2764
 2765
 2766
 2767
 2768
 2769
 2770
 2771
 2772
 2773
 2774
 2775
 2776
 2777
 2778
 2779
 2780
 2781
 2782
 2783
 2784
 2785
 2786
 2787
 2788
 2789
 2790
 2791
 2792
 2793
 2794
 2795
 2796
 2797
 2798
 2799
 2800
 2801
 2802
 2803
 2804
 2805
 2806
 2807
 2808
 2809
 2810
 2811
 2812
 2813
 2814
 2815
 2816
 2817
 2818
 2819
 2820
 2821
 2822
 2823
 2824
 2825
 2826
 2827
 2828
 2829
 2830
 2831
 2832
 2833
 2834
 2835
 2836
 2837
 2838
 2839
 2840
 2841
 2842
 2843
 2844
 2845
 2846
 2847
 2848
 2849
 2850
 2851
 2852
 2853
 2854
 2855
 2856
 2857
 2858
 2859
 2860
 2861
 2862
 2863
 2864
 2865
 2866
 2867
 2868
 2869
 2870
 2871
 2872
 2873
 2874
 2875
 2876
 2877
 2878
 2879
 2880
 2881
 2882
 2883
 2884
 2885
 2886
 2887
 2888
 2889
 2890
 2891
 2892
 2893
 2894
 2895
 2896
 2897
 2898
 2899
 2900
 2901
 2902
 2903
 2904
 2905
 2906
 2907
 2908
 2909
 2910
 2911
 2912
 2913
 2914
 2915
 2916
 2917
 2918
 2919
 2920
 2921
 2922
 2923
 2924
 2925
 2926
 2927
 2928
 2929
 2930
 2931
 2932
 2933
 2934
 2935
 2936
 2937
 2938
 2939
 2940
 2941
 2942
 2943
 2944
 2945
 2946
 2947
 2948
 2949
 2950
 2951
 2952
 2953
 2954
 2955
 2956
 2957
 2958
 2959
 2960
 2961
 2962
 2963
 2964
 2965
 2966
 2967
 2968
 2969
 2970
 2971
 2972
 2973
 2974
 2975
 2976
 2977
 2978
 2979
 2980
 2981
 2982
 2983
 2984
 2985
 2986
 2987
 2988
 2989
 2990
 2991
 2992
 2993
 2994
 2995
 2996
 2997
 2998
 2999
 3000
 3001
 3002
 3003
 3004
 3005
 3006
 3007
 3008
 3009
 3010
 3011
 3012
 3013
 3014
 3015
 3016
 3017
 3018
 3019
 3020
 3021
 3022
 3023
 3024
 3025
 3026
 3027
 3028
 3029
 3030
 3031
 3032
 3033
 3034
 3035
 3036
 3037
 3038
 3039
 3040
 3041
 3042
 3043
 3044
 3045
 3046
 3047
 3048
 3049
 3050
 3051
 3052
 3053
 3054
 3055
 3056
 3057
 3058
 3059
 3060
 3061
 3062
 3063
 3064
 3065
 3066
 3067
 3068
 3069
 3070
 3071
 3072
 3073
 3074
 3075
 3076
 3077
 3078
 3079
 3080
 3081
 3082
 3083
 3084
 3085
 3086
 3087
 3088
 3089
 3090
 3091
 3092
 3093
 3094
 3095
 3096
 3097
 3098
 3099
 3100
 3101
 3102
 3103
 3104
 3105
 3106
 3107
 3108
 3109
 3110
 3111
 3112
 3113
 3114
 3115
 3116
 3117
 3118
 3119
 3120
 3121
 3122
 3123
 3124
 3125
 3126
 3127
 3128
 3129
 3130
 3131
 3132
 3133
 3134
 3135
 3136
 3137
 3138
 3139
 3140
 3141
 3142
 3143
 3144
 3145
 3146
 3147
 3148
 3149
 3150
 3151
 3152
 3153
 3154
 3155
 3156
 3157
 3158
 3159
 3160
 3161
 3162
 3163
 3164
 3165
 3166
 3167
 3168
 3169
 3170
 3171
 3172
 3173
 3174
 3175
 3176
 3177
 3178
 3179
 3180
 3181
 3182
 3183
 3184
 3185
 3186
 3187
 3188
 3189
 3190
 3191
 3192
 3193
 3194
 3195
 3196
 3197
 3198
 3199
 3200
 3201
 3202
 3203
 3204
 3205
 3206
 3207
 3208
 3209
 3210
 3211
 3212
 3213
 3214
 3215
 3216
 3217
 3218
 3219
 3220
 3221
 3222
 3223
 3224
 3225
 3226
 3227
 3228
 3229
 3230
 3231
 3232
 3233
 3234
 3235
 3236
 3237
 3238
 3239
 3240
 3241
 3242
 3243
 3244
 3245
 3246
 3247
 3248
 3249
 3250
 3251
 3252
 3253
 3254
 3255
 3256
 3257
 3258
 3259
 3260
 3261
 3262
 3263
 3264
 3265
 3266
 3267
 3268
 3269
 3270
 3271
 3272
 3273
 3274
 3275
 3276
 3277
 3278
 3279
 3280
 3281
 3282
 3283
 3284
 3285
 3286
 3287
 3288
 3289
 3290
 3291
 3292
 3293
 3294
 3295
 3296
 3297
 3298
 3299
 3300
 3301
 3302
 3303
 3304
 3305
 3306
 3307
 3308
 3309
 3310
 3311
 3312
 3313
 3314
 3315
 3316
 3317
 3318
 3319
 3320
 3321
 3322
 3323
 3324
 3325
 3326
 3327
 3328
 3329
 3330
 3331
 3332
 3333
 3334
 3335
 3336
 3337
 3338
 3339
 3340
 3341
 3342
 3343
 3344
 3345
 3346
 3347
 3348
 3349
 3350
 3351
 3352
 3353
 3354
 3355
 3356
 3357
 3358
 3359
 3360
 3361
 3362
 3363
 3364
 3365
 3366
 3367
 3368
 3369
 3370
 3371
 3372
 3373
 3374
 3375
 3376
 3377
 3378
 3379
 3380
 3381
 3382
 3383
 3384
 3385
 3386
 3387
 3388
 3389
 3390
 3391
 3392
 3393
 3394
 3395
 3396
 3397
 3398
 3399
 3400
 3401
 3402
 3403
 3404
 3405
 3406
 3407
 3408
 3409
 3410
 3411
 3412
 3413
 3414
 3415
 3416
 3417
 3418
 3419
 3420
 3421
 3422
 3423
 3424
 3425
 3426
 3427
 3428
 3429
 3430
 3431
 3432
 3433
 3434
 3435
 3436
 3437
 3438
 3439
 3440
 3441
 3442
 3443
 3444
 3445
 3446
 3447
 3448
 3449
 3450
 3451
 3452
 3453
 3454
 3455
 3456
 3457
 3458
 3459
 3460
 3461
 3462
 3463
 3464
 3465
 3466
 3467
 3468
 3469
 3470
 3471
 3472
 3473
 3474
 3475
 3476
 3477
 3478
 3479
 3480
 3481
 3482
 3483
 3484
 3485
 3486
 3487
 3488
 3489
 3490
 3491
 3492
 3493
 3494
 3495
 3496
 3497
 3498
 3499
 3500
 3501
 3502
 3503
 3504
 3505
 3506
 3507
 3508
 3509
 3510
 3511
 3512
 3513
 3514
 3515
 3516
 3517
 3518
 3519
 3520
 3521
 3522
 3523
 3524
 3525
 3526
 3527
 3528
 3529
 3530
 3531
 3532
 3533
 3534
 3535
 3536
 3537
 3538
 3539
 3540
 3541
 3542
 3543
 3544
 3545
 3546
 3547
 3548
 3549
 3550
 3551
 3552
 3553
 3554
 3555
 3556
 3557
 3558
 3559
 3560
 3561
 3562
 3563
 3564
 3565
 3566
 3567
 3568
 3569
 3570
 3571
 3572
 3573
 3574
 3575
 3576
 3577
 3578
 3579
 3580
 3581
 3582
 3583
 3584
 3585
 3586
 3587
 3588
 3589
 3590
 3591
 3592
 3593
 3594
 3595
 3596
 3597
 3598
 3599
 3600
 3601
 3602
 3603
 3604
 3605
 3606
 3607
 3608
 3609
 3610
 3611
 3612
 3613
 3614
 3615
 3616
 3617
 3618
 3619
 3620
 3621
 3622
 3623
 3624
 3625
 3626
 3627
 3628
 3629
 3630
 3631
 3632
 3633
 3634
 3635
 3636
 3637
 3638
 3639
 3640
 3641
 3642
 3643
 3644
 3645
 3646
 3647
 3648
 3649
 3650
 3651
 3652
 3653
 3654
 3655
 3656
 3657
 3658
 3659
 3660
 3661
 3662
 3663
 3664
 3665
 3666
 3667
 3668
 3669
 3670
 3671
 3672
 3673
 3674
 3675
 3676
 3677
 3678
 3679
 3680
 3681
 3682
 3683
 3684
 3685
 3686
 3687
 3688
 3689
 3690
 3691
 3692
 3693
 3694
 3695
 3696
 3697
 3698
 3699
 3700
 3701
 3702
 3703
 3704
 3705
 3706
 3707
 3708
 3709
 3710
 3711
 3712
 3713
 3714
 3715
 3716
 3717
 3718
 3719
 3720
 3721
 3722
 3723
 3724
 3725
 3726
 3727
 3728
 3729
 3730
 3731
 3732
 3733
 3734
 3735
 3736
 3737
 3738
 3739
 3740
 3741
 3742
 3743
 3744
 3745
 3746
 3747
 3748
 3749
 3750
 3751
 3752
 3753
 3754
 3755
 3756
 3757
 3758
 3759
 3760
 3761
 3762
 3763
 3764
 3765
 3766
 3767
 3768
 3769
 3770
 3771
 3772
 3773
 3774
 3775
 3776
 3777
 3778
 3779
 3780
 3781
 3782
 3783
 3784
 3785
 3786
 3787
 3788
 3789
 3790
 3791
 3792
 3793
 3794
 3795
 3796
 3797
 3798
 3799
 3800
 3801
 3802
 3803
 3804
 3805
 3806
 3807
 3808
 3809
 3810
 3811
 3812
 3813
 3814
 3815
 3816
 3817
 3818
 3819
 3820
 3821
 3822
 3823
 3824
 3825
 3826
 3827
 3828
 3829
 3830
 3831
 3832
 3833
 3834
 3835
 3836
 3837
 3838
 3839
 3840
 3841
 3842
 3843
 3844
 3845
 3846
 3847
 3848
 3849
 3850
 3851
 3852
 3853
 3854
 3855
 3856
 3857
 3858
 3859
 3860
 3861
 3862
 3863
 3864
 3865
 3866
 3867
 3868
 3869
 3870
 3871
 3872
 3873
 3874
 3875
 3876
 3877
 3878
 3879
 3880
 3881
 3882
 3883
 3884
 3885
 3886
 3887
 3888
 3889
 3890
 3891
 3892
 3893
 3894
 3895
 3896
 3897
 3898
 3899
 3900
 3901
 3902
 3903
 3904
 3905
 3906
 3907
 3908
 3909
 3910
 3911
 3912
 3913
 3914
 3915
 3916
 3917
 3918
 3919
 3920
 3921
 3922
 3923
 3924
 3925
 3926
 3927
 3928
 3929
 3930
 3931
 3932
 3933
 3934
 3935
 3936
 3937
 3938
 3939
 3940
 3941
 3942
 3943
 3944
 3945
 3946
 3947
 3948
 3949
 3950
 3951
 3952
 3953
 3954
 3955
 3956
 3957
 3958
 3959
 3960
 3961
 3962
 3963
 3964
 3965
 3966
 3967
 3968
 3969
 3970
 3971
 3972
 3973
 3974
 3975
 3976
 3977
 3978
 3979
 3980
 3981
 3982
 3983
 3984
 3985
 3986
 3987
 3988
 3989
 3990
 3991
 3992
 3993
 3994
 3995
 3996
 3997
 3998
 3999
 4000
 4001
 4002
 4003
 4004
 4005
 4006
 4007
 4008
 4009
 4010
 4011
 4012
 4013
 4014
 4015
 4016
 4017
 4018
 4019
 4020
 4021
 4022
 4023
 4024
 4025
 4026
 4027
 4028
 4029
 4030
 4031
 4032
 4033
 4034
 4035
 4036
 4037
 4038
 4039
 4040
 4041
 4042
 4043
 4044
 4045
 4046
 4047
 4048
 4049
 4050
 4051
 4052
 4053
 4054
 4055
 4056
 4057
 4058
 4059
 4060
 4061
 4062
 4063
 4064
 4065
 4066
 4067
 4068
 4069
 4070
 4071
 4072
 4073
 4074
 4075
 4076
 4077
 4078
 4079
 4080
 4081
 4082
 4083
 4084
 4085
 4086
 4087
 4088
 4089
 4090
 4091
 4092
 4093
 4094
 4095
 4096
 4097
 4098
 4099
 4100
 4101
 4102
 4103
 4104
 4105
 4106
 4107
 4108
 4109
 4110
 4111
 4112
 4113
 4114
 4115
 4116
 4117
 4118
 4119
 4120
 4121
 4122
 4123
 4124
 4125
 4126
 4127
 4128
 4129
 4130
 4131
 4132
 4133
 4134
 4135
 4136
 4137
 4138
 4139
 4140
 4141
 4142
 4143
 4144
 4145
 4146
 4147
 4148
 4149
 4150
 4151
 4152
 4153
 4154
 4155
 4156
 4157
 4158
 4159
 4160
 4161
 4162
 4163
 4164
 4165
 4166
 4167
 4168
 4169
 4170
 4171
 4172
 4173
 4174
 4175
 4176
 4177
 4178
 4179
 4180
 4181
 4182
 4183
 4184
 4185
 4186
 4187
 4188
 4189
 4190
 4191
 4192
 4193
 4194
 4195
 4196
 4197
 4198
 4199
 4200
 4201
 4202
 4203
 4204
 4205
 4206
 4207
 4208
 4209
 4210
 4211
 4212
 4213
 4214
 4215
 4216
 4217
 4218
 4219
 4220
 4221
 4222
 4223
 4224
 4225
 4226
 4227
 4228
 4229
 4230
 4231
 4232
 4233
 4234
 4235
 4236
 4237
 4238
 4239
 4240
 4241
 4242
 4243
 4244
 4245
 4246
 4247
 4248
 4249
 4250
 4251
 4252
 4253
 4254
 4255
 4256
 4257
 4258
 4259
 4260
 4261
 4262
 4263
 4264
 4265
 4266
 4267
 4268
 4269
 4270
 4271
 4272
 4273
 4274
 4275
 4276
 4277
 4278
 4279
 4280
 4281
 4282
 4283
 4284
 4285
 4286
 4287
 4288
 4289
 4290
 4291
 4292
 4293
 4294
 4295
 4296
 4297
 4298
 4299
 4300
 4301
 4302
 4303
 4304
 4305
 4306
 4307
 4308
 4309
 4310
 4311
 4312
 4313
 4314
 4315
 4316
 4317
 4318
 4319
 4320
 4321
 4322
 4323
 4324
 4325
 4326
 4327
 4328
 4329
 4330
 4331
 4332
 4333
 4334
 4335
 4336
 4337
 4338
 4339
 4340
 4341
 4342
 4343
 4344
 4345
 4346
 4347
 4348
 4349
 4350
 4351
 4352
 4353
 4354
 4355
 4356
 4357
 4358
 4359
 4360
 4361
 4362
 4363
 4364
 4365
 4366
 4367
 4368
 4369
 4370
 4371
 4372
 4373
 4374
 4375
 4376
 4377
 4378
 4379
 4380
 4381
 4382
 4383
 4384
 4385
 4386
 4387
 4388
 4389
 4390
 4391
 4392
 4393
 4394
 4395
 4396
 4397
 4398
 4399
 4400
 4401
 4402
 4403
 4404
 4405
 4406
 4407
 4408
 4409
 4410
 4411
 4412
 4413
 4414
 4415
 4416
 4417
 4418
 4419
 4420
 4421
 4422
 4423
 4424
 4425
 4426
 4427
 4428
 4429
 4430
 4431
 4432
 4433
 4434
 4435
 4436
 4437
 4438
 4439
 4440
 4441
 4442
 4443
 4444
 4445
 4446
 4447
 4448
 4449
 4450
 4451
 4452
 4453
 4454
 4455
 4456
 4457
 4458
 4459
 4460
 4461
 4462
 4463
 4464
 4465
 4466
 4467
 4468
 4469
 4470
 4471
 4472
 4473
 4474
 4475
 4476
 4477
 4478
 4479
 4480
 4481
 4482
 4483
 4484
 4485
 4486
 4487
 4488
 4489
 4490
 4491
 4492
 4493
 4494
 4495
 4496
 4497
 4498
 4499
 4500
 4501
 4502
 4503
 4504
 4505
 4506
 4507
 4508
 4509
 4510
 4511
 4512
 4513
 4514
 4515
 4516
 4517
 4518
 4519
 4520
 4521
 4522
 4523
 4524
 4525
 4526
 4527
 4528
 4529
 4530
 4531
 4532
 4533
 4534
 4535
 4536
 4537
 4538
 4539
 4540
 4541
 4542
 4543
 4544
 4545
 4546
 4547
 4548
 4549
 4550
 4551
 4552
 4553
 4554
 4555
 4556
 4557
 4558
 4559
 4560
 4561
 4562
 4563
 4564
 4565
 4566
 4567
 4568
 4569
 4570
 4571
 4572
 4573
 4574
 4575
 4576
 4577
 4578
 4579
 4580
 4581
 4582
 4583
 4584
 4585
 4586
 4587
 4588
 4589
 4590
 4591
 4592
 4593
 4594
 4595
 4596
 4597
 4598
 4599
 4600
 4601
 4602
 4603
 4604
 4605
 4606
 4607
 4608
 4609
 4610
 4611
 4612
 4613
 4614
 4615
 4616
 4617
 4618
 4619
 4620
 4621
 4622
 4623
 4624
 4625
 4626
 4627
 4628
 4629
 4630
 4631
 4632
 4633
 4634
 4635
 4636
 4637
 4638
 4639
 4640
 4641
 4642
 4643
 4644
 4645
 4646
 4647
 4648
 4649
 4650
 4651
 4652
 4653
 4654
 4655
 4656
 4657
 4658
 4659
 4660
 4661
 4662
 4663
 4664
 4665
 4666
 4667
 4668
 4669
 4670
 4671
 4672
 4673
 4674
 4675
 4676
 4677
 4678
 4679
 4680
 4681
 4682
 4683
 4684
 4685
 4686
 4687
 4688
 4689
 4690
 4691
 4692
 4693
 4694
 4695
 4696
 4697
 4698
 4699
 4700
 4701
 4702
 4703
 4704
 4705
 4706
 4707
 4708
 4709
 4710
 4711
 4712
 4713
 4714
 4715
 4716
 4717
 4718
 4719
 4720
 4721
 4722
 4723
 4724
 4725
 4726
 4727
 4728
 4729
 4730
 4731
 4732
 4733
 4734
 4735
 4736
 4737
 4738
 4739
 4740
 4741
 4742
 4743
 4744
 4745
 4746
 4747
 4748
 4749
 4750
 4751
 4752
 4753
 4754
 4755
 4756
 4757
 4758
 4759
 4760
 4761
 4762
 4763
 4764
 4765
 4766
 4767
 4768
 4769
 4770
 4771
 4772
 4773
 4774
 4775
 4776
 4777
 4778
 4779
 4780
 4781
 4782
 4783
 4784
 4785
 4786
 4787
 4788
 4789
 4790
 4791
 4792
 4793
 4794
 4795
 4796
 4797
 4798
 4799
 4800
 4801
 4802
 4803
 4804
 4805
 4806
 4807
 4808
 4809
 4810
 4811
 4812
 4813
 4814
 4815
 4816
 4817
 4818
 4819
 4820
 4821
 4822
 4823
 4824
 4825
 4826
 4827
 4828
 4829
 4830
 4831
 4832
 4833
 4834
 4835
 4836
 4837
 4838
 4839
 4840
 4841
 4842
 4843
 4844
 4845
 4846
 4847
 4848
 4849
 4850
 4851
 4852
 4853
 4854
 4855
 4856
 4857
 4858
 4859
 4860
 4861
 4862
 4863
 4864
 4865
 4866
 4867
 4868
 4869
 4870
 4871
 4872
 4873
 4874
 4875
 4876
 4877
 4878
 4879
 4880
 4881
 4882
 4883
 4884
 4885
 4886
 4887
 4888
 4889
 4890
 4891
 4892
 4893
 4894
 4895
 4896
 4897
 4898
 4899
 4900
 4901
 4902
 4903
 4904
 4905
 4906
 4907
 4908
 4909
 4910
 4911
 4912
 4913
 4914
 4915
 4916
 4917
 4918
 4919
 4920
 4921
 4922
 4923
 4924
 4925
 4926
 4927
 4928
 4929
 4930
 4931
 4932
 4933
 4934
 4935
 4936
 4937
 4938
 4939
 4940
 4941
 4942
 4943
 4944
 4945
 4946
 4947
 4948
 4949
 4950
 4951
 4952
 4953
 4954
 4955
 4956
 4957
 4958
 4959
 4960
 4961
 4962
 4963
 4964
 4965
 4966
 4967
 4968
 4969
 4970
 4971
 4972
 4973
 4974
 4975
 4976
 4977
 4978
 4979
 4980
 4981
 4982
 4983
 4984
 4985
 4986
 4987
 4988
 4989
 4990
 4991
 4992
 4993
 4994
 4995
 4996
 4997
 4998
 4999
 5000
 5001
 5002
 5003
 5004
 5005
 5006
 5007
 5008
 5009
 5010
 5011
 5012
 5013
 5014
 5015
 5016
 5017
 5018
 5019
 5020
 5021
 5022
 5023
 5024
 5025
 5026
 5027
 5028
 5029
 5030
 5031
 5032
 5033
 5034
 5035
 5036
 5037
 5038
 5039
 5040
 5041
 5042
 5043
 5044
 5045
 5046
 5047
 5048
 5049
 5050
 5051
 5052
 5053
 5054
 5055
 5056
 5057
 5058
 5059
 5060
 5061
 5062
 5063
 5064
 5065
 5066
 5067
 5068
 5069
 5070
 5071
 5072
 5073
 5074
 5075
 5076
 5077
 5078
 5079
 5080
 5081
 5082
 5083
 5084
 5085
 5086
 5087
 5088
 5089
 5090
 5091
 5092
 5093
 5094
 5095
 5096
 5097
 5098
 5099
 5100
 5101
 5102
 5103
 5104
 5105
 5106
 5107
 5108
 5109
 5110
 5111
 5112
 5113
 5114
 5115
 5116
 5117
 5118
 5119
 5120
 5121
 5122
 5123
 5124
 5125
 5126
 5127
 5128
 5129
 5130
 5131
 5132
 5133
 5134
 5135
 5136
 5137
 5138
 5139
 5140
 5141
 5142
 5143
 5144
 5145
 5146
 5147
 5148
 5149
 5150
 5151
 5152
 5153
 5154
 5155
 5156
 5157
 5158
 5159
 5160
 5161
 5162
 5163
 5164
 5165
 5166
 5167
 5168
 5169
 5170
 5171
 5172
 5173
 5174
 5175
 5176
 5177
 5178
 5179
 5180
 5181
 5182
 5183
 5184
 5185
 5186
 5187
 5188
 5189
 5190
 5191
 5192
 5193
 5194
 5195
 5196
 5197
 5198
 5199
 5200
 5201
 5202
 5203
 5204
 5205
 5206
 5207
 5208
 5209
 5210
 5211
 5212
 5213
 5214
 5215
 5216
 5217
 5218
 5219
 5220
 5221
 5222
 5223
 5224
 5225
 5226
 5227
 5228
 5229
 5230
 5231
 5232
 5233
 5234
 5235
 5236
 5237
 5238
 5239
 5240
 5241
 5242
 5243
 5244
 5245
 5246
 5247
 5248
 5249
 5250
 5251
 5252
 5253
 5254
 5255
 5256
 5257
 5258
 5259
 5260
 5261
 5262
 5263
 5264
 5265
 5266
 5267
 5268
 5269
 5270
 5271
 5272
 5273
 5274
 5275
 5276
 5277
 5278
 5279
 5280
 5281
 5282
 5283
 5284
 5285
 5286
 5287
 5288
 5289
 5290
 5291
 5292
 5293
 5294
 5295
 5296
 5297
 5298
 5299
 5300
 5301
 5302
 5303
 5304
 5305
 5306
 5307
 5308
 5309
 5310
 5311
 5312
 5313
 5314
 5315
 5316
 5317
 5318
 5319
 5320
 5321
 5322
 5323
 5324
 5325
 5326
 5327
 5328
 5329
 5330
 5331
 5332
 5333
 5334
 5335
 5336
 5337
 5338
 5339
 5340
 5341
 5342
 5343
 5344
 5345
 5346
 5347
 5348
 5349
 5350
 5351
 5352
 5353
 5354
 5355
 5356
 5357
 5358
 5359
 5360
 5361
 5362
 5363
 5364
 5365
 5366
 5367
 5368
 5369
 5370
 5371
 5372
 5373
 5374
 5375
 5376
 5377
 5378
 5379
 5380
 5381
 5382
 5383
 5384
 5385
 5386
 5387
 5388
 5389
 5390
 5391
 5392
 5393
 5394
 5395
 5396
 5397
 5398
 5399
 5400
 5401
 5402
 5403
 5404
 5405
 5406
 5407
 5408
 5409
 5410
 5411
 5412
 5413
 5414
 5415
 5416
 5417
 5418
 5419
 5420
 5421
 5422
 5423
 5424
 5425
 5426
 5427
 5428
 5429
 5430
 5431
 5432
 5433
 5434
 5435
 5436
 5437
 5438
 5439
 5440
 5441
 5442
 5443
 5444
 5445
 5446
 5447
 5448
 5449
 5450
 5451
 5452
 5453
 5454
 5455
 5456
 5457
 5458
 5459
 5460
 5461
 5462
 5463
 5464
 5465
 5466
 5467
 5468
 5469
 5470
 5471
 5472
 5473
 5474
 5475
 5476
 5477
 5478
 5479
 5480
 5481
 5482
 5483
 5484
 5485
 5486
 5487
 5488
 5489
 5490
 5491
 5492
 5493
 5494
 5495
 5496
 5497
 5498
 5499
 5500
 5501
 5502
 5503
 5504
 5505
 5506
 5507
 5508
 5509
 5510
 5511
 5512
 5513
 5514
 5515
 5516
 5517
 5518
 5519
 5520
 5521
 5522
 5523
 5524
 5525
 5526
 5527
 5528
 5529
 5530
 5531
 5532
 5533
 5534
 5535
 5536
 5537
 5538
 5539
 5540
 5541
 5542
 5543
 5544
 5545
 5546
 5547
 5548
 5549
 5550
 5551
 5552
 5553
 5554
 5555
 5556
 5557
 5558
 5559
 5560
 5561
 5562
 5563
 5564
 5565
 5566
 5567
 5568
 5569
 5570
 5571
 5572
 5573
 5574
 5575
 5576
 5577
 5578
 5579
 5580
 5581
 5582
 5583
 5584
 5585
 5586
 5587
 5588
 5589
 5590
 5591
 5592
 5593
 5594
 5595
 5596
 5597
 5598
 5599
 5600
 5601
 5602
 5603
 5604
 5605
 5606
 5607
 5608
 5609
 5610
 5611
 5612
 5613
 5614
 5615
 5616
 5617
 5618
 5619
 5620
 5621
 5622
 5623
 5624
 5625
 5626
 5627
 5628
 5629
 5630
 5631
 5632
 5633
 5634
 5635
 5636
 5637
 5638
 5639
 5640
 5641
 5642
 5643
 5644
 5645
 5646
 5647
 5648
 5649
 5650
 5651
 5652
 5653
 5654
 5655
 5656
 5657
 5658
 5659
 5660
 5661
 5662
 5663
 5664
 5665
 5666
 5667
 5668
 5669
 5670
 5671
 5672
 5673
 5674
 5675
 5676
 5677
 5678
 5679
 5680
 5681
 5682
 5683
 5684
 5685
 5686
 5687
 5688
 5689
 5690
 5691
 5692
 5693
 5694
 5695
 5696
 5697
 5698
 5699
 5700
 5701
 5702
 5703
 5704
 5705
 5706
 5707
 5708
 5709
 5710
 5711
 5712
 5713
 5714
 5715
 5716
 5717
 5718
 5719
 5720
 5721
 5722
 5723
 5724
 5725
 5726
 5727
 5728
 5729
 5730
 5731
 5732
 5733
 5734
 5735
 5736
 5737
 5738
 5739
 5740
 5741
 5742
 5743
 5744
 5745
 5746
 5747
 5748
 5749
 5750
 5751
 5752
 5753
 5754
 5755
 5756
 5757
 5758
 5759
 5760
 5761
 5762
 5763
 5764
 5765
 5766
 5767
 5768
 5769
 5770
 5771
 5772
 5773
 5774
 5775
 5776
 5777
 5778
 5779
 5780
 5781
 5782
 5783
 5784
 5785
 5786
 5787
 5788
 5789
 5790
 5791
 5792
 5793
 5794
 5795
 5796
 5797
 5798
 5799
 5800
 5801
 5802
 5803
 5804
 5805
 5806
 5807
 5808
 5809
 5810
 5811
 5812
 5813
 5814
 5815
 5816
 5817
 5818
 5819
 5820
 5821
 5822
 5823
 5824
 5825
 5826
 5827
 5828
 5829
 5830
 5831
 5832
 5833
 5834
 5835
 5836
 5837
 5838
 5839
 5840
 5841
 5842
 5843
 5844
 5845
 5846
 5847
 5848
 5849
 5850
 5851
 5852
 5853
 5854
 5855
 5856
 5857
 5858
 5859
 5860
 5861
 5862
 5863
 5864
 5865
 5866
 5867
 5868
 5869
 5870
 5871
 5872
 5873
 5874
 5875
 5876
 5877
 5878
 5879
 5880
 5881
 5882
 5883
 5884
 5885
 5886
 5887
 5888
 5889
 5890
 5891
 5892
 5893
 5894
 5895
 5896
 5897
 5898
 5899
 5900
 5901
 5902
 5903
 5904
 5905
 5906
 5907
 5908
 5909
 5910
 5911
 5912
 5913
 5914
 5915
 5916
 5917
 5918
 5919
 5920
 5921
 5922
 5923
 5924
 5925
 5926
 5927
 5928
 5929
 5930
 5931
 5932
 5933
 5934
 5935
 5936
 5937
 5938
 5939
 5940
 5941
 5942
 5943
 5944
 5945
 5946
 5947
 5948
 5949
 5950
 5951
 5952
 5953
 5954
 5955
 5956
 5957
 5958
 5959
 5960
 5961
 5962
 5963
 5964
 5965
 5966
 5967
 5968
 5969
 5970
 5971
 5972
 5973
 5974
 5975
 5976
 5977
 5978
 5979
 5980
 5981
 5982
 5983
 5984
 5985
 5986
 5987
 5988
 5989
 5990
 5991
 5992
 5993
 5994
 5995
 5996
 5997
 5998
 5999
 6000
 6001
 6002
 6003
 6004
 6005
 6006
 6007
 6008
 6009
 6010
 6011
 6012
 6013
 6014
 6015
 6016
 6017
 6018
 6019
 6020
 6021
 6022
 6023
 6024
 6025
 6026
 6027
 6028
 6029
 6030
 6031
 6032
 6033
 6034
 6035
 6036
 6037
 6038
 6039
 6040
 6041
 6042
 6043
 6044
 6045
 6046
 6047
 6048
 6049
 6050
 6051
 6052
 6053
 6054
 6055
 6056
 6057
 6058
 6059
 6060
 6061
 6062
 6063
 6064
 6065
 6066
 6067
 6068
 6069
 6070
 6071
 6072
 6073
 6074
 6075
 6076
 6077
 6078
 6079
 6080
 6081
 6082
 6083
 6084
 6085
 6086
 6087
 6088
 6089
 6090
 6091
 6092
 6093
 6094
 6095
 6096
 6097
 6098
 6099
 6100
 6101
 6102
 6103
 6104
 6105
 6106
 6107
 6108
 6109
 6110
 6111
 6112
 6113
 6114
 6115
 6116
 6117
 6118
 6119
 6120
 6121
 6122
 6123
 6124
 6125
 6126
 6127
 6128
 6129
 6130
 6131
 6132
 6133
 6134
 6135
 6136
 6137
 6138
 6139
 6140
 6141
 6142
 6143
 6144
 6145
 6146
 6147
 6148
 6149
 6150
 6151
 6152
 6153
 6154
 6155
 6156
 6157
 6158
 6159
 6160
 6161
 6162
 6163
 6164
 6165
 6166
 6167
 6168
 6169
 6170
 6171
 6172
 6173
 6174
 6175
 6176
 6177
 6178
 6179
 6180
 6181
 6182
 6183
 6184
 6185
 6186
 6187
 6188
 6189
 6190
 6191
 6192
 6193
 6194
 6195
 6196
 6197
 6198
 6199
 6200
 6201
 6202
 6203
 6204
 6205
 6206
 6207
 6208
 6209
 6210
 6211
 6212
 6213
 6214
 6215
 6216
 6217
 6218
 6219
 6220
 6221
 6222
 6223
 6224
 6225
 6226
 6227
 6228
 6229
 6230
 6231
 6232
 6233
 6234
 6235
 6236
 6237
 6238
 6239
 6240
 6241
 6242
 6243
 6244
 6245
 6246
 6247
 6248
 6249
 6250
 6251
 6252
 6253
 6254
 6255
 6256
 6257
 6258
 6259
 6260
 6261
 6262
 6263
 6264
 6265
 6266
 6267
 6268
 6269
 6270
 6271
 6272
 6273
 6274
 6275
 6276
 6277
 6278
 6279
 6280
 6281
 6282
 6283
 6284
 6285
 6286
 6287
 6288
 6289
 6290
 6291
 6292
 6293
 6294
 6295
 6296
 6297
 6298
 6299
 6300
 6301
 6302
 6303
 6304
 6305
 6306
 6307
 6308
 6309
 6310
 6311
 6312
 6313
 6314
 6315
 6316
 6317
 6318
 6319
 6320
 6321
 6322
 6323
 6324
 6325
 6326
 6327
 6328
 6329
 6330
 6331
 6332
 6333
 6334
 6335
 6336
 6337
 6338
 6339
 6340
 6341
 6342
 6343
 6344
 6345
 6346
 6347
 6348
 6349
 6350
 6351
 6352
 6353
 6354
 6355
 6356
 6357
 6358
 6359
 6360
 6361
 6362
 6363
 6364
 6365
 6366
 6367
 6368
 6369
 6370
 6371
 6372
 6373
 6374
 6375
 6376
 6377
 6378
 6379
 6380
 6381
 6382
 6383
 6384
 6385
 6386
 6387
 6388
 6389
 6390
 6391
 6392
 6393
 6394
 6395
 6396
 6397
 6398
 6399
 6400
 6401
 6402
 6403
 6404
 6405
 6406
 6407
 6408
 6409
 6410
 6411
 6412
 6413
 6414
 6415
 6416
 6417
 6418
 6419
 6420
 6421
 6422
 6423
 6424
 6425
 6426
 6427
 6428
 6429
 6430
 6431
 6432
 6433
 6434
 6435
 6436
 6437
 6438
 6439
 6440
 6441
 6442
 6443
 6444
 6445
 6446
 6447
 6448
 6449
 6450
 6451
 6452
 6453
 6454
 6455
 6456
 6457
 6458
 6459
 6460
 6461
 6462
 6463
 6464
 6465
 6466
 6467
 6468
 6469
 6470
 6471
 6472
 6473
 6474
 6475
 6476
 6477
 6478
 6479
 6480
 6481
 6482
 6483
 6484
 6485
 6486
 6487
 6488
 6489
 6490
 6491
 6492
 6493
 6494
 6495
 6496
 6497
 6498
 6499
 6500
 6501
 6502
 6503
 6504
 6505
 6506
 6507
 6508
 6509
 6510
 6511
 6512
 6513
 6514
 6515
 6516
 6517
 6518
 6519
 6520
 6521
 6522
 6523
 6524
 6525
 6526
 6527
 6528
 6529
 6530
 6531
 6532
 6533
 6534
 6535
 6536
 6537
 6538
 6539
 6540
 6541
 6542
 6543
 6544
 6545
 6546
 6547
 6548
 6549
 6550
 6551
 6552
 6553
 6554
 6555
 6556
 6557
 6558
 6559
 6560
 6561
 6562
 6563
 6564
 6565
 6566
 6567
 6568
 6569
 6570
 6571
 6572
 6573
 6574
 6575
 6576
 6577
 6578
 6579
 6580
 6581
 6582
 6583
 6584
 6585
 6586
 6587
 6588
 6589
 6590
 6591
 6592
 6593
 6594
 6595
 6596
 6597
 6598
 6599
 6600
 6601
 6602
 6603
 6604
 6605
 6606
 6607
 6608
 6609
 6610
 6611
 6612
 6613
 6614
 6615
 6616
 6617
 6618
 6619
 6620
 6621
 6622
 6623
 6624
 6625
 6626
 6627
 6628
 6629
 6630
 6631
 6632
 6633
 6634
 6635
 6636
 6637
 6638
 6639
 6640
 6641
 6642
 6643
 6644
 6645
 6646
 6647
 6648
 6649
 6650
 6651
 6652
 6653
 6654
 6655
 6656
 6657
 6658
 6659
 6660
 6661
 6662
 6663
 6664
 6665
 6666
 6667
 6668
 6669
 6670
 6671
 6672
 6673
 6674
 6675
 6676
 6677
 6678
 6679
 6680
 6681
 6682
 6683
 6684
 6685
 6686
 6687
 6688
 6689
 6690
 6691
 6692
 6693
 6694
 6695
 6696
 6697
 6698
 6699
 6700
 6701
 6702
 6703
 6704
 6705
 6706
 6707
 6708
 6709
 6710
 6711
 6712
 6713
 6714
 6715
 6716
 6717
 6718
 6719
 6720
 6721
 6722
 6723
 6724
 6725
 6726
 6727
 6728
 6729
 6730
 6731
 6732
 6733
 6734
 6735
 6736
 6737
 6738
 6739
 6740
 6741
 6742
 6743
 6744
 6745
 6746
 6747
 6748
 6749
 6750
 6751
 6752
 6753
 6754
 6755
 6756
 6757
 6758
 6759
 6760
 6761
 6762
 6763
 6764
 6765
 6766
 6767
 6768
 6769
 6770
 6771
 6772
 6773
 6774
 6775
 6776
 6777
 6778
 6779
 6780
 6781
 6782
 6783
 6784
 6785
 6786
 6787
 6788
 6789
 6790
 6791
 6792
 6793
 6794
 6795
 6796
 6797
 6798
 6799
 6800
 6801
 6802
 6803
 6804
 6805
 6806
 6807
 6808
 6809
 6810
 6811
 6812
 6813
 6814
 6815
 6816
 6817
 6818
 6819
 6820
 6821
 6822
 6823
 6824
 6825
 6826
 6827
 6828
 6829
 6830
 6831
 6832
 6833
 6834
 6835
 6836
 6837
 6838
 6839
 6840
 6841
 6842
 6843
 6844
 6845
 6846
 6847
 6848
 6849
 6850
 6851
 6852
 6853
 6854
 6855
 6856
 6857
 6858
 6859
 6860
 6861
 6862
 6863
 6864
 6865
 6866
 6867
 6868
 6869
 6870
 6871
 6872
 6873
 6874
 6875
 6876
 6877
 6878
 6879
 6880
 6881
 6882
 6883
 6884
 6885
 6886
 6887
 6888
 6889
 6890
 6891
 6892
 6893
 6894
 6895
 6896
 6897
 6898
 6899
 6900
 6901
 6902
 6903
 6904
 6905
 6906
 6907
 6908
 6909
 6910
 6911
 6912
 6913
 6914
 6915
 6916
 6917
 6918
 6919
 6920
 6921
 6922
 6923
 6924
 6925
 6926
 6927
 6928
 6929
 6930
 6931
 6932
 6933
 6934
 6935
 6936
 6937
 6938
 6939
 6940
 6941
 6942
 6943
 6944
 6945
 6946
 6947
 6948
 6949
 6950
 6951
 6952
 6953
 6954
 6955
 6956
 6957
 6958
 6959
 6960
 6961
 6962
 6963
 6964
 6965
 6966
 6967
 6968
 6969
 6970
 6971
 6972
 6973
 6974
 6975
 6976
 6977
 6978
 6979
 6980
 6981
 6982
 6983
 6984
 6985
 6986
 6987
 6988
 6989
 6990
 6991
 6992
 6993
 6994
 6995
 6996
 6997
 6998
 6999
 7000
 7001
 7002
 7003
 7004
 7005
 7006
 7007
 7008
 7009
 7010
 7011
 7012
 7013
 7014
 7015
 7016
 7017
 7018
 7019
 7020
 7021
 7022
 7023
 7024
 7025
 7026
 7027
 7028
 7029
 7030
 7031
 7032
 7033
 7034
 7035
 7036
 7037
 7038
 7039
 7040
 7041
 7042
 7043
 7044
 7045
 7046
 7047
 7048
 7049
 7050
 7051
 7052
 7053
 7054
 7055
 7056
 7057
 7058
 7059
 7060
 7061
 7062
 7063
 7064
 7065
 7066
 7067
 7068
 7069
 7070
 7071
 7072
 7073
 7074
 7075
 7076
 7077
 7078
 7079
 7080
 7081
 7082
 7083
 7084
 7085
 7086
 7087
 7088
 7089
 7090
 7091
 7092
 7093
 7094
 7095
 7096
 7097
 7098
 7099
 7100
 7101
 7102
 7103
 7104
 7105
 7106
 7107
 7108
 7109
 7110
 7111
 7112
 7113
 7114
 7115
 7116
 7117
 7118
 7119
 7120
 7121
 7122
 7123
 7124
 7125
 7126
 7127
 7128
 7129
 7130
 7131
 7132
 7133
 7134
 7135
 7136
 7137
 7138
 7139
 7140
 7141
 7142
 7143
 7144
 7145
 7146
 7147
 7148
 7149
 7150
 7151
 7152
 7153
 7154
 7155
 7156
 7157
 7158
 7159
 7160
 7161
 7162
 7163
 7164
 7165
 7166
 7167
 7168
 7169
 7170
 7171
 7172
 7173
 7174
 7175
 7176
 7177
 7178
 7179
 7180
 7181
 7182
 7183
 7184
 7185
 7186
 7187
 7188
 7189
 7190
 7191
 7192
 7193
 7194
 7195
 7196
 7197
 7198
 7199
 7200
 7201
 7202
 7203
 7204
 7205
 7206
 7207
 7208
 7209
 7210
 7211
 7212
 7213
 7214
 7215
 7216
 7217
 7218
 7219
 7220
 7221
 7222
 7223
 7224
 7225
 7226
 7227
 7228
 7229
 7230
 7231
 7232
 7233
 7234
 7235
 7236
 7237
 7238
 7239
 7240
 7241
 7242
 7243
 7244
 7245
 7246
 7247
 7248
 7249
 7250
 7251
 7252
 7253
 7254
 7255
 7256
 7257
 7258
 7259
 7260
 7261
 7262
 7263
 7264
 7265
 7266
 7267
 7268
 7269
 7270
 7271
 7272
 7273
 7274
 7275
 7276
 7277
 7278
 7279
 7280
 7281
 7282
 7283
 7284
 7285
 7286
 7287
 7288
 7289
 7290
 7291
 7292
 7293
 7294
 7295
 7296
 7297
 7298
 7299
 7300
 7301
 7302
 7303
 7304
 7305
 7306
 7307
 7308
 7309
 7310
 7311
 7312
 7313
 7314
 7315
 7316
 7317
 7318
 7319
 7320
 7321
 7322
 7323
 7324
 7325
 7326
 7327
 7328
 7329
 7330
 7331
 7332
 7333
 7334
 7335
 7336
 7337
 7338
 7339
 7340
 7341
 7342
 7343
 7344
 7345
 7346
 7347
 7348
 7349
 7350
 7351
 7352
 7353
 7354
 7355
 7356
 7357
 7358
 7359
 7360
 7361
 7362
 7363
 7364
 7365
 7366
 7367
 7368
 7369
 7370
 7371
 7372
 7373
 7374
 7375
 7376
 7377
 7378
 7379
 7380
 7381
 7382
 7383
 7384
 7385
 7386
 7387
 7388
 7389
 7390
 7391
 7392
 7393
 7394
 7395
 7396
 7397
 7398
 7399
 7400
 7401
 7402
 7403
 7404
 7405
 7406
 7407
 7408
 7409
 7410
 7411
 7412
 7413
 7414
 7415
 7416
 7417
 7418
 7419
 7420
 7421
 7422
 7423
 7424
 7425
 7426
 7427
 7428
 7429
 7430
 7431
 7432
 7433
 7434
 7435
 7436
 7437
 7438
 7439
 7440
 7441
 7442
 7443
 7444
 7445
 7446
 7447
 7448
 7449
 7450
 7451
 7452
 7453
 7454
 7455
 7456
 7457
 7458
 7459
 7460
 7461
 7462
 7463
 7464
 7465
 7466
 7467
 7468
 7469
 7470
 7471
 7472
 7473
 7474
 7475
 7476
 7477
 7478
 7479
 7480
 7481
 7482
 7483
 7484
 7485
 7486
 7487
 7488
 7489
 7490
 7491
 7492
 7493
 7494
 7495
 7496
 7497
 7498
 7499
 7500
 7501
 7502
 7503
 7504
 7505
 7506
 7507
 7508
 7509
 7510
 7511
 7512
 7513
 7514
 7515
 7516
 7517
 7518
 7519
 7520
 7521
 7522
 7523
 7524
 7525
 7526
 7527
 7528
 7529
 7530
 7531
 7532
 7533
 7534
 7535
 7536
 7537
 7538
 7539
 7540
 7541
 7542
 7543
 7544
 7545
 7546
 7547
 7548
 7549
 7550
 7551
 7552
 7553
 7554
 7555
 7556
 7557
 7558
 7559
 7560
 7561
 7562
 7563
 7564
 7565
 7566
 7567
 7568
 7569
 7570
 7571
 7572
 7573
 7574
 7575
 7576
 7577
 7578
 7579
 7580
 7581
 7582
 7583
 7584
 7585
 7586
 7587
 7588
 7589
 7590
 7591
 7592
 7593
 7594
 7595
 7596
 7597
 7598
 7599
 7600
 7601
 7602
 7603
 7604
 7605
 7606
 7607
 7608
 7609
 7610
 7611
 7612
 7613
 7614
 7615
 7616
 7617
 7618
 7619
 7620
 7621
 7622
 7623
 7624
 7625
 7626
 7627
 7628
 7629
 7630
 7631
 7632
 7633
 7634
 7635
 7636
 7637
 7638
 7639
 7640
 7641
 7642
 7643
 7644
 7645
 7646
 7647
 7648
 7649
 7650
 7651
 7652
 7653
 7654
 7655
 7656
 7657
 7658
 7659
 7660
 7661
 7662
 7663
 7664
 7665
 7666
 7667
 7668
 7669
 7670
 7671
 7672
 7673
 7674
 7675
 7676
 7677
 7678
 7679
 7680
 7681
 7682
 7683
 7684
 7685
 7686
 7687
 7688
 7689
 7690
 7691
 7692
 7693
 7694
 7695
 7696
 7697
 7698
 7699
 7700
 7701
 7702
 7703
 7704
 7705
 7706
 7707
 7708
 7709
 7710
 7711
 7712
 7713
 7714
 7715
 7716
 7717
 7718
 7719
 7720
 7721
 7722
 7723
 7724
 7725
 7726
 7727
 7728
 7729
 7730
 7731
 7732
 7733
 7734
 7735
 7736
 7737
 7738
 7739
 7740
 7741
 7742
 7743
 7744
 7745
 7746
 7747
 7748
 7749
 7750
 7751
 7752
 7753
 7754
 7755
 7756
 7757
 7758
 7759
 7760
 7761
 7762
 7763
 7764
 7765
 7766
 7767
 7768
 7769
 7770
 7771
 7772
 7773
 7774
 7775
 7776
 7777
 7778
 7779
 7780
 7781
 7782
 7783
 7784
 7785
 7786
 7787
 7788
 7789
 7790
 7791
 7792
 7793
 7794
 7795
 7796
 7797
 7798
 7799
 7800
 7801
 7802
 7803
 7804
 7805
 7806
 7807
 7808
 7809
 7810
 7811
 7812
 7813
 7814
 7815
 7816
 7817
 7818
 7819
 7820
 7821
 7822
 7823
 7824
 7825
 7826
 7827
 7828
 7829
 7830
 7831
 7832
 7833
 7834
 7835
 7836
 7837
 7838
 7839
 7840
 7841
 7842
 7843
 7844
 7845
 7846
 7847
 7848
 7849
 7850
 7851
 7852
 7853
 7854
 7855
 7856
 7857
 7858
 7859
 7860
 7861
 7862
 7863
 7864
 7865
 7866
 7867
 7868
 7869
 7870
 7871
 7872
 7873
 7874
 7875
 7876
 7877
 7878
 7879
 7880
 7881
 7882
 7883
 7884
 7885
 7886
 7887
 7888
 7889
 7890
 7891
 7892
 7893
 7894
 7895
 7896
 7897
 7898
 7899
 7900
 7901
 7902
 7903
 7904
 7905
 7906
 7907
 7908
 7909
 7910
 7911
 7912
 7913
 7914
 7915
 7916
 7917
 7918
 7919
 7920
 7921
 7922
 7923
 7924
 7925
 7926
 7927
 7928
 7929
 7930
 7931
 7932
 7933
 7934
 7935
 7936
 7937
 7938
 7939
 7940
 7941
 7942
 7943
 7944
 7945
 7946
 7947
 7948
 7949
 7950
 7951
 7952
 7953
 7954
 7955
 7956
 7957
 7958
 7959
 7960
 7961
 7962
 7963
 7964
 7965
 7966
 7967
 7968
 7969
 7970
 7971
 7972
 7973
 7974
 7975
 7976
 7977
 7978
 7979
 7980
 7981
 7982
 7983
 7984
 7985
 7986
 7987
 7988
 7989
 7990
 7991
 7992
 7993
 7994
 7995
 7996
 7997
 7998
 7999
 8000
 8001
 8002
 8003
 8004
 8005
 8006
 8007
 8008
 8009
 8010
 8011
 8012
 8013
 8014
 8015
 8016
 8017
 8018
 8019
 8020
 8021
 8022
 8023
 8024
 8025
 8026
 8027
 8028
 8029
 8030
 8031
 8032
 8033
 8034
 8035
 8036
 8037
 8038
 8039
 8040
 8041
 8042
 8043
 8044
 8045
 8046
 8047
 8048
 8049
 8050
 8051
 8052
 8053
 8054
 8055
 8056
 8057
 8058
 8059
 8060
 8061
 8062
 8063
 8064
 8065
 8066
 8067
 8068
 8069
 8070
 8071
 8072
 8073
 8074
 8075
 8076
 8077
 8078
 8079
 8080
 8081
 8082
 8083
 8084
 8085
 8086
 8087
 8088
 8089
 8090
 8091
 8092
 8093
 8094
 8095
 8096
 8097
 8098
 8099
 8100
 8101
 8102
 8103
 8104
 8105
 8106
 8107
 8108
 8109
 8110
 8111
 8112
 8113
 8114
 8115
 8116
 8117
 8118
 8119
 8120
 8121
 8122
 8123
 8124
 8125
 8126
 8127
 8128
 8129
 8130
 8131
 8132
 8133
 8134
 8135
 8136
 8137
 8138
 8139
 8140
 8141
 8142
 8143
 8144
 8145
 8146
 8147
 8148
 8149
 8150
 8151
 8152
 8153
 8154
 8155
 8156
 8157
 8158
 8159
 8160
 8161
 8162
 8163
 8164
 8165
 8166
 8167
 8168
 8169
 8170
 8171
 8172
 8173
 8174
 8175
 8176
 8177
 8178
 8179
 8180
 8181
 8182
 8183
 8184
 8185
 8186
 8187
 8188
 8189
 8190
 8191
 8192
 8193
 8194
 8195
 8196
 8197
 8198
 8199
 8200
 8201
 8202
 8203
 8204
 8205
 8206
 8207
 8208
 8209
 8210
 8211
 8212
 8213
 8214
 8215
 8216
 8217
 8218
 8219
 8220
 8221
 8222
 8223
 8224
 8225
 8226
 8227
 8228
 8229
 8230
 8231
 8232
 8233
 8234
 8235
 8236
 8237
 8238
 8239
 8240
 8241
 8242
 8243
 8244
 8245
 8246
 8247
 8248
 8249
 8250
 8251
 8252
 8253
 8254
 8255
 8256
 8257
 8258
 8259
 8260
 8261
 8262
 8263
 8264
 8265
 8266
 8267
 8268
 8269
 8270
 8271
 8272
 8273
 8274
 8275
 8276
 8277
 8278
 8279
 8280
 8281
 8282
 8283
 8284
 8285
 8286
 8287
 8288
 8289
 8290
 8291
 8292
 8293
 8294
 8295
 8296
 8297
 8298
 8299
 8300
 8301
 8302
 8303
 8304
 8305
 8306
 8307
 8308
 8309
 8310
 8311
 8312
 8313
 8314
 8315
 8316
 8317
 8318
 8319
 8320
 8321
 8322
 8323
 8324
 8325
 8326
 8327
 8328
 8329
 8330
 8331
 8332
 8333
 8334
 8335
 8336
 8337
 8338
 8339
 8340
 8341
 8342
 8343
 8344
 8345
 8346
 8347
 8348
 8349
 8350
 8351
 8352
 8353
 8354
 8355
 8356
 8357
 8358
 8359
 8360
 8361
 8362
 8363
 8364
 8365
 8366
 8367
 8368
 8369
 8370
 8371
 8372
 8373
 8374
 8375
 8376
 8377
 8378
 8379
 8380
 8381
 8382
 8383
 8384
 8385
 8386
 8387
 8388
 8389
 8390
 8391
 8392
 8393
 8394
 8395
 8396
 8397
 8398
 8399
 8400
 8401
 8402
 8403
 8404
 8405
 8406
 8407
 8408
 8409
 8410
 8411
 8412
 8413
 8414
 8415
 8416
 8417
 8418
 8419
 8420
 8421
 8422
 8423
 8424
 8425
 8426
 8427
 8428
 8429
 8430
 8431
 8432
 8433
 8434
 8435
 8436
 8437
 8438
 8439
 8440
 8441
 8442
 8443
 8444
 8445
 8446
 8447
 8448
 8449
 8450
 8451
 8452
 8453
 8454
 8455
 8456
 8457
 8458
 8459
 8460
 8461
 8462
 8463
 8464
 8465
 8466
 8467
 8468
 8469
 8470
 8471
 8472
 8473
 8474
 8475
 8476
 8477
 8478
 8479
 8480
 8481
 8482
 8483
 8484
 8485
 8486
 8487
 8488
 8489
 8490
 8491
 8492
 8493
 8494
 8495
 8496
 8497
 8498
 8499
 8500
 8501
 8502
 8503
 8504
 8505
 8506
 8507
 8508
 8509
 8510
 8511
 8512
 8513
 8514
 8515
 8516
 8517
 8518
 8519
 8520
 8521
 8522
 8523
 8524
 8525
 8526
 8527
 8528
 8529
 8530
 8531
 8532
 8533
 8534
 8535
 8536
 8537
 8538
 8539
 8540
 8541
 8542
 8543
 8544
 8545
 8546
 8547
 8548
 8549
 8550
 8551
 8552
 8553
 8554
 8555
 8556
 8557
 8558
 8559
 8560
 8561
 8562
 8563
 8564
 8565
 8566
 8567
 8568
 8569
 8570
 8571
 8572
 8573
 8574
 8575
 8576
 8577
 8578
 8579
 8580
 8581
 8582
 8583
 8584
 8585
 8586
 8587
 8588
 8589
 8590
 8591
 8592
 8593
 8594
 8595
 8596
 8597
 8598
 8599
 8600
 8601
 8602
 8603
 8604
 8605
 8606
 8607
 8608
 8609
 8610
 8611
 8612
 8613
 8614
 8615
 8616
 8617
 8618
 8619
 8620
 8621
 8622
 8623
 8624
 8625
 8626
 8627
 8628
 8629
 8630
 8631
 8632
 8633
 8634
 8635
 8636
 8637
 8638
 8639
 8640
 8641
 8642
 8643
 8644
 8645
 8646
 8647
 8648
 8649
 8650
 8651
 8652
 8653
 8654
 8655
 8656
 8657
 8658
 8659
 8660
 8661
 8662
 8663
 8664
 8665
 8666
 8667
 8668
 8669
 8670
 8671
 8672
 8673
 8674
 8675
 8676
 8677
 8678
 8679
 8680
 8681
 8682
 8683
 8684
 8685
 8686
 8687
 8688
 8689
 8690
 8691
 8692
 8693
 8694
 8695
 8696
 8697
 8698
 8699
 8700
 8701
 8702
 8703
 8704
 8705
 8706
 8707
 8708
 8709
 8710
 8711
 8712
 8713
 8714
 8715
 8716
 8717
 8718
 8719
 8720
 8721
 8722
 8723
 8724
 8725
 8726
 8727
 8728
 8729
 8730
 8731
 8732
 8733
 8734
 8735
 8736
 8737
 8738
 8739
 8740
 8741
 8742
 8743
 8744
 8745
 8746
 8747
 8748
 8749
 8750
 8751
 8752
 8753
 8754
 8755
 8756
 8757
 8758
 8759
 8760
 8761
 8762
 8763
 8764
 8765
 8766
 8767
 8768
 8769
 8770
 8771
 8772
 8773
 8774
 8775
 8776
 8777
 8778
 8779
 8780
 8781
 8782
 8783
 8784
 8785
 8786
 8787
 8788
 8789
 8790
 8791
 8792
 8793
 8794
 8795
 8796
 8797
 8798
 8799
 8800
 8801
 8802
 8803
 8804
 8805
 8806
 8807
 8808
 8809
 8810
 8811
 8812
 8813
 8814
 8815
 8816
 8817
 8818
 8819
 8820
 8821
 8822
 8823
 8824
 8825
 8826
 8827
 8828
 8829
 8830
 8831
 8832
 8833
 8834
 8835
 8836
 8837
 8838
 8839
 8840
 8841
 8842
 8843
 8844
 8845
 8846
 8847
 8848
 8849
 8850
 8851
 8852
 8853
 8854
 8855
 8856
 8857
 8858
 8859
 8860
 8861
 8862
 8863
 8864
 8865
 8866
 8867
 8868
 8869
 8870
 8871
 8872
 8873
 8874
 8875
 8876
 8877
 8878
 8879
 8880
 8881
 8882
 8883
 8884
 8885
 8886
 8887
 8888
 8889
 8890
 8891
 8892
 8893
 8894
 8895
 8896
 8897
 8898
 8899
 8900
 8901
 8902
 8903
 8904
 8905
 8906
 8907
 8908
 8909
 8910
 8911
 8912
 8913
 8914
 8915
 8916
 8917
 8918
 8919
 8920
 8921
 8922
 8923
 8924
 8925
 8926
 8927
 8928
 8929
 8930
 8931
 8932
 8933
 8934
 8935
 8936
 8937
 8938
 8939
 8940
 8941
 8942
 8943
 8944
 8945
 8946
 8947
 8948
 8949
 8950
 8951
 8952
 8953
 8954
 8955
 8956
 8957
 8958
 8959
 8960
 8961
 8962
 8963
 8964
 8965
 8966
 8967
 8968
 8969
 8970
 8971
 8972
 8973
 8974
 8975
 8976
 8977
 8978
 8979
 8980
 8981
 8982
 8983
 8984
 8985
 8986
 8987
 8988
 8989
 8990
 8991
 8992
 8993
 8994
 8995
 8996
 8997
 8998
 8999
 9000
 9001
 9002
 9003
 9004
 9005
 9006
 9007
 9008
 9009
 9010
 9011
 9012
 9013
 9014
 9015
 9016
 9017
 9018
 9019
 9020
 9021
 9022
 9023
 9024
 9025
 9026
 9027
 9028
 9029
 9030
 9031
 9032
 9033
 9034
 9035
 9036
 9037
 9038
 9039
 9040
 9041
 9042
 9043
 9044
 9045
 9046
 9047
 9048
 9049
 9050
 9051
 9052
 9053
 9054
 9055
 9056
 9057
 9058
 9059
 9060
 9061
 9062
 9063
 9064
 9065
 9066
 9067
 9068
 9069
 9070
 9071
 9072
 9073
 9074
 9075
 9076
 9077
 9078
 9079
 9080
 9081
 9082
 9083
 9084
 9085
 9086
 9087
 9088
 9089
 9090
 9091
 9092
 9093
 9094
 9095
 9096
 9097
 9098
 9099
 9100
 9101
 9102
 9103
 9104
 9105
 9106
 9107
 9108
 9109
 9110
 9111
 9112
 9113
 9114
 9115
 9116
 9117
 9118
 9119
 9120
 9121
 9122
 9123
 9124
 9125
 9126
 9127
 9128
 9129
 9130
 9131
 9132
 9133
 9134
 9135
 9136
 9137
 9138
 9139
 9140
 9141
 9142
 9143
 9144
 9145
 9146
 9147
 9148
 9149
 9150
 9151
 9152
 9153
 9154
 9155
 9156
 9157
 9158
 9159
 9160
 9161
 9162
 9163
 9164
 9165
 9166
 9167
 9168
 9169
 9170
 9171
 9172
 9173
 9174
 9175
 9176
 9177
 9178
 9179
 9180
 9181
 9182
 9183
 9184
 9185
 9186
 9187
 9188
 9189
 9190
 9191
 9192
 9193
 9194
 9195
 9196
 9197
 9198
 9199
 9200
 9201
 9202
 9203
 9204
 9205
 9206
 9207
 9208
 9209
 9210
 9211
 9212
 9213
 9214
 9215
 9216
 9217
 9218
 9219
 9220
 9221
 9222
 9223
 9224
 9225
 9226
 9227
 9228
 9229
 9230
 9231
 9232
 9233
 9234
 9235
 9236
 9237
 9238
 9239
 9240
 9241
 9242
 9243
 9244
 9245
 9246
 9247
 9248
 9249
 9250
 9251
 9252
 9253
 9254
 9255
 9256
 9257
 9258
 9259
 9260
 9261
 9262
 9263
 9264
 9265
 9266
 9267
 9268
 9269
 9270
 9271
 9272
 9273
 9274
 9275
 9276
 9277
 9278
 9279
 9280
 9281
 9282
 9283
 9284
 9285
 9286
 9287
 9288
 9289
 9290
 9291
 9292
 9293
 9294
 9295
 9296
 9297
 9298
 9299
 9300
 9301
 9302
 9303
 9304
 9305
 9306
 9307
 9308
 9309
 9310
 9311
 9312
 9313
 9314
 9315
 9316
 9317
 9318
 9319
 9320
 9321
 9322
 9323
 9324
 9325
 9326
 9327
 9328
 9329
 9330
 9331
 9332
 9333
 9334
 9335
 9336
 9337
 9338
 9339
 9340
 9341
 9342
 9343
 9344
 9345
 9346
 9347
 9348
 9349
 9350
 9351
 9352
 9353
 9354
 9355
 9356
 9357
 9358
 9359
 9360
 9361
 9362
 9363
 9364
 9365
 9366
 9367
 9368
 9369
 9370
 9371
 9372
 9373
 9374
 9375
 9376
 9377
 9378
 9379
 9380
 9381
 9382
 9383
 9384
 9385
 9386
 9387
 9388
 9389
 9390
 9391
 9392
 9393
 9394
 9395
 9396
 9397
 9398
 9399
 9400
 9401
 9402
 9403
 9404
 9405
 9406
 9407
 9408
 9409
 9410
 9411
 9412
 9413
 9414
 9415
 9416
 9417
 9418
 9419
 9420
 9421
 9422
 9423
 9424
 9425
 9426
 9427
 9428
 9429
 9430
 9431
 9432
 9433
 9434
 9435
 9436
 9437
 9438
 9439
 9440
 9441
 9442
 9443
 9444
 9445
 9446
 9447
 9448
 9449
 9450
 9451
 9452
 9453
 9454
 9455
 9456
 9457
 9458
 9459
 9460
 9461
 9462
 9463
 9464
 9465
 9466
 9467
 9468
 9469
 9470
 9471
 9472
 9473
 9474
 9475
 9476
 9477
 9478
 9479
 9480
 9481
 9482
 9483
 9484
 9485
 9486
 9487
 9488
 9489
 9490
 9491
 9492
 9493
 9494
 9495
 9496
 9497
 9498
 9499
 9500
 9501
 9502
 9503
 9504
 9505
 9506
 9507
 9508
 9509
 9510
 9511
 9512
 9513
 9514
 9515
 9516
 9517
 9518
 9519
 9520
 9521
 9522
 9523
 9524
 9525
 9526
 9527
 9528
 9529
 9530
 9531
 9532
 9533
 9534
 9535
 9536
 9537
 9538
 9539
 9540
 9541
 9542
 9543
 9544
 9545
 9546
 9547
 9548
 9549
 9550
 9551
 9552
 9553
 9554
 9555
 9556
 9557
 9558
 9559
 9560
 9561
 9562
 9563
 9564
 9565
 9566
 9567
 9568
 9569
 9570
 9571
 9572
 9573
 9574
 9575
 9576
 9577
 9578
 9579
 9580
 9581
 9582
 9583
 9584
 9585
 9586
 9587
 9588
 9589
 9590
 9591
 9592
 9593
 9594
 9595
 9596
 9597
 9598
 9599
 9600
 9601
 9602
 9603
 9604
 9605
 9606
 9607
 9608
 9609
 9610
 9611
 9612
 9613
 9614
 9615
 9616
 9617
 9618
 9619
 9620
 9621
 9622
 9623
 9624
 9625
 9626
 9627
 9628
 9629
 9630
 9631
 9632
 9633
 9634
 9635
 9636
 9637
 9638
 9639
 9640
 9641
 9642
 9643
 9644
 9645
 9646
 9647
 9648
 9649
 9650
 9651
 9652
 9653
 9654
 9655
 9656
 9657
 9658
 9659
 9660
 9661
 9662
 9663
 9664
 9665
 9666
 9667
 9668
 9669
 9670
 9671
 9672
 9673
 9674
 9675
 9676
 9677
 9678
 9679
 9680
 9681
 9682
 9683
 9684
 9685
 9686
 9687
 9688
 9689
 9690
 9691
 9692
 9693
 9694
 9695
 9696
 9697
 9698
 9699
 9700
 9701
 9702
 9703
 9704
 9705
 9706
 9707
 9708
 9709
 9710
 9711
 9712
 9713
 9714
 9715
 9716
 9717
 9718
 9719
 9720
 9721
 9722
 9723
 9724
 9725
 9726
 9727
 9728
 9729
 9730
 9731
 9732
 9733
 9734
 9735
 9736
 9737
 9738
 9739
 9740
 9741
 9742
 9743
 9744
 9745
 9746
 9747
 9748
 9749
 9750
 9751
 9752
 9753
 9754
 9755
 9756
 9757
 9758
 9759
 9760
 9761
 9762
 9763
 9764
 9765
 9766
 9767
 9768
 9769
 9770
 9771
 9772
 9773
 9774
 9775
 9776
 9777
 9778
 9779
 9780
 9781
 9782
 9783
 9784
 9785
 9786
 9787
 9788
 9789
 9790
 9791
 9792
 9793
 9794
 9795
 9796
 9797
 9798
 9799
 9800
 9801
 9802
 9803
 9804
 9805
 9806
 9807
 9808
 9809
 9810
 9811
 9812
 9813
 9814
 9815
 9816
 9817
 9818
 9819
 9820
 9821
 9822
 9823
 9824
 9825
 9826
 9827
 9828
 9829
 9830
 9831
 9832
 9833
 9834
 9835
 9836
 9837
 9838
 9839
 9840
 9841
 9842
 9843
 9844
 9845
 9846
 9847
 9848
 9849
 9850
 9851
 9852
 9853
 9854
 9855
 9856
 9857
 9858
 9859
 9860
 9861
 9862
 9863
 9864
 9865
 9866
 9867
 9868
 9869
 9870
 9871
 9872
 9873
 9874
 9875
 9876
 9877
 9878
 9879
 9880
 9881
 9882
 9883
 9884
 9885
 9886
 9887
 9888
 9889
 9890
 9891
 9892
 9893
 9894
 9895
 9896
 9897
 9898
 9899
 9900
 9901
 9902
 9903
 9904
 9905
 9906
 9907
 9908
 9909
 9910
 9911
 9912
 9913
 9914
 9915
 9916
 9917
 9918
 9919
 9920
 9921
 9922
 9923
 9924
 9925
 9926
 9927
 9928
 9929
 9930
 9931
 9932
 9933
 9934
 9935
 9936
 9937
 9938
 9939
 9940
 9941
 9942
 9943
 9944
 9945
 9946
 9947
 9948
 9949
 9950
 9951
 9952
 9953
 9954
 9955
 9956
 9957
 9958
 9959
 9960
 9961
 9962
 9963
 9964
 9965
 9966
 9967
 9968
 9969
 9970
 9971
 9972
 9973
 9974
 9975
 9976
 9977
 9978
 9979
 9980
 9981
 9982
 9983
 9984
 9985
 9986
 9987
 9988
 9989
 9990
 9991
 9992
 9993
 9994
 9995
 9996
 9997
 9998
 9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">

<html>

<head>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">

<title>Debian Policy Manual</title>

<link href="#index" rel="start">
<link href="#contents" rel="contents">
<link href="#copyright" rel="copyright">
<link href="#ch-scope" rel="chapter" title="1 About this manual">
<link href="#ch-archive" rel="chapter" title="2 The Debian Archive">
<link href="#ch-binary" rel="chapter" title="3 Binary packages">
<link href="#ch-source" rel="chapter" title="4 Source packages">
<link href="#ch-controlfields" rel="chapter" title="5 Control files and their fields">
<link href="#ch-maintainerscripts" rel="chapter" title="6 Package maintainer scripts and installation procedure">
<link href="#ch-relationships" rel="chapter" title="7 Declaring relationships between packages">
<link href="#ch-sharedlibs" rel="chapter" title="8 Shared libraries">
<link href="#ch-opersys" rel="chapter" title="9 The Operating System">
<link href="#ch-files" rel="chapter" title="10 Files">
<link href="#ch-customized-programs" rel="chapter" title="11 Customized programs">
<link href="#ch-docs" rel="chapter" title="12 Documentation">
<link href="#ap-pkg-scope" rel="appendix" title="A Introduction and scope of these appendices">
<link href="#ap-pkg-binarypkg" rel="appendix" title="B Binary packages (from old Packaging Manual)">
<link href="#ap-pkg-sourcepkg" rel="appendix" title="C Source packages (from old Packaging Manual)">
<link href="#ap-pkg-controlfields" rel="appendix" title="D Control files and their fields (from old Packaging Manual)">
<link href="#ap-pkg-conffiles" rel="appendix" title="E Configuration file handling (from old Packaging Manual)">
<link href="#ap-pkg-alternatives" rel="appendix" title="F Alternative versions of an interface - update-alternatives (from old Packaging Manual)">
<link href="#ap-pkg-diversions" rel="appendix" title="G Diversions - overriding a package's version of a file (from old Packaging Manual)">
<link href="#s1.1" rel="section" title="1.1 Scope">
<link href="#s1.2" rel="section" title="1.2 New versions of this document">
<link href="#s-authors" rel="section" title="1.3 Authors and Maintainers">
<link href="#s-related" rel="section" title="1.4 Related documents">
<link href="#s-definitions" rel="section" title="1.5 Definitions">
<link href="#s-dfsg" rel="section" title="2.1 The Debian Free Software Guidelines">
<link href="#s-sections" rel="section" title="2.2 Archive areas">
<link href="#s-pkgcopyright" rel="section" title="2.3 Copyright considerations">
<link href="#s-subsections" rel="section" title="2.4 Sections">
<link href="#s-priorities" rel="section" title="2.5 Priorities">
<link href="#s3.1" rel="section" title="3.1 The package name">
<link href="#s-versions" rel="section" title="3.2 The version of a package">
<link href="#s-maintainer" rel="section" title="3.3 The maintainer of a package">
<link href="#s-descriptions" rel="section" title="3.4 The description of a package">
<link href="#s-dependencies" rel="section" title="3.5 Dependencies">
<link href="#s-virtual_pkg" rel="section" title="3.6 Virtual packages">
<link href="#s3.7" rel="section" title="3.7 Base system">
<link href="#s3.8" rel="section" title="3.8 Essential packages">
<link href="#s-maintscripts" rel="section" title="3.9 Maintainer Scripts">
<link href="#s-standardsversion" rel="section" title="4.1 Standards conformance">
<link href="#s-pkg-relations" rel="section" title="4.2 Package relationships">
<link href="#s4.3" rel="section" title="4.3 Changes to the upstream sources">
<link href="#s-dpkgchangelog" rel="section" title="4.4 Debian changelog: debian/changelog">
<link href="#s-dpkgcopyright" rel="section" title="4.5 Copyright: debian/copyright">
<link href="#s4.6" rel="section" title="4.6 Error trapping in makefiles">
<link href="#s-timestamps" rel="section" title="4.7 Time Stamps">
<link href="#s-restrictions" rel="section" title="4.8 Restrictions on objects in source packages">
<link href="#s-debianrules" rel="section" title="4.9 Main building script: debian/rules">
<link href="#s-substvars" rel="section" title="4.10 Variable substitutions: debian/substvars">
<link href="#s-debianwatch" rel="section" title="4.11 Optional upstream source location: debian/watch">
<link href="#s-debianfiles" rel="section" title="4.12 Generated files list: debian/files">
<link href="#s-embeddedfiles" rel="section" title="4.13 Convenience copies of code">
<link href="#s-readmesource" rel="section" title="4.14 Source package handling: debian/README.source">
<link href="#s-controlsyntax" rel="section" title="5.1 Syntax of control files">
<link href="#s-sourcecontrolfiles" rel="section" title="5.2 Source package control files -- debian/control">
<link href="#s-binarycontrolfiles" rel="section" title="5.3 Binary package control files -- DEBIAN/control">
<link href="#s-debiansourcecontrolfiles" rel="section" title="5.4 Debian source control files -- .dsc">
<link href="#s-debianchangesfiles" rel="section" title="5.5 Debian changes files -- .changes">
<link href="#s-controlfieldslist" rel="section" title="5.6 List of fields">
<link href="#s5.7" rel="section" title="5.7 User-defined fields">
<link href="#s-obsolete-control-data-fields" rel="section" title="5.8 Obsolete fields">
<link href="#s6.1" rel="section" title="6.1 Introduction to package maintainer scripts">
<link href="#s-idempotency" rel="section" title="6.2 Maintainer scripts idempotency">
<link href="#s-controllingterminal" rel="section" title="6.3 Controlling terminal for maintainer scripts">
<link href="#s-exitstatus" rel="section" title="6.4 Exit status">
<link href="#s-mscriptsinstact" rel="section" title="6.5 Summary of ways maintainer scripts are called">
<link href="#s-unpackphase" rel="section" title="6.6 Details of unpack phase of installation or upgrade">
<link href="#s-configdetails" rel="section" title="6.7 Details of configuration">
<link href="#s-removedetails" rel="section" title="6.8 Details of removal and/or configuration purging">
<link href="#s-depsyntax" rel="section" title="7.1 Syntax of relationship fields">
<link href="#s-binarydeps" rel="section" title="7.2 Binary Dependencies - Depends, Recommends, Suggests, Enhances, Pre-Depends">
<link href="#s-breaks" rel="section" title="7.3 Packages which break other packages - Breaks">
<link href="#s-conflicts" rel="section" title="7.4 Conflicting binary packages - Conflicts">
<link href="#s-virtual" rel="section" title="7.5 Virtual packages - Provides">
<link href="#s-replaces" rel="section" title="7.6 Overwriting files and replacing packages - Replaces">
<link href="#s-sourcebinarydeps" rel="section" title="7.7 Relationships between source and binary packages - Build-Depends, Build-Depends-Indep, Build-Conflicts, Build-Conflicts-Indep">
<link href="#s-built-using" rel="section" title="7.8 Additional source packages used to build the binary - Built-Using">
<link href="#s-sharedlibs-runtime" rel="section" title="8.1 Run-time shared libraries">
<link href="#s-sharedlibs-support-files" rel="section" title="8.2 Shared library support files">
<link href="#s-sharedlibs-static" rel="section" title="8.3 Static libraries">
<link href="#s-sharedlibs-dev" rel="section" title="8.4 Development files">
<link href="#s-sharedlibs-intradeps" rel="section" title="8.5 Dependencies between the packages of the same library">
<link href="#s-sharedlibs-depends" rel="section" title="8.6 Dependencies between the library and other packages">
<link href="#s9.1" rel="section" title="9.1 File system hierarchy">
<link href="#s9.2" rel="section" title="9.2 Users and groups">
<link href="#s-sysvinit" rel="section" title="9.3 System run levels and init.d scripts">
<link href="#s9.4" rel="section" title="9.4 Console messages from init.d scripts">
<link href="#s-cron-jobs" rel="section" title="9.5 Cron jobs">
<link href="#s-menus" rel="section" title="9.6 Menus">
<link href="#s-mime" rel="section" title="9.7 Multimedia handlers">
<link href="#s9.8" rel="section" title="9.8 Keyboard configuration">
<link href="#s9.9" rel="section" title="9.9 Environment variables">
<link href="#s-doc-base" rel="section" title="9.10 Registering Documents using doc-base">
<link href="#s-alternateinit" rel="section" title="9.11 Alternate init systems">
<link href="#s-binaries" rel="section" title="10.1 Binaries">
<link href="#s-libraries" rel="section" title="10.2 Libraries">
<link href="#s10.3" rel="section" title="10.3 Shared libraries">
<link href="#s-scripts" rel="section" title="10.4 Scripts">
<link href="#s10.5" rel="section" title="10.5 Symbolic links">
<link href="#s10.6" rel="section" title="10.6 Device files">
<link href="#s-config-files" rel="section" title="10.7 Configuration files">
<link href="#s10.8" rel="section" title="10.8 Log files">
<link href="#s-permissions-owners" rel="section" title="10.9 Permissions and owners">
<link href="#s-filenames" rel="section" title="10.10 File names">
<link href="#s-arch-spec" rel="section" title="11.1 Architecture specification strings">
<link href="#s11.2" rel="section" title="11.2 Daemons">
<link href="#s11.3" rel="section" title="11.3 Using pseudo-ttys and modifying wtmp, utmp and lastlog">
<link href="#s11.4" rel="section" title="11.4 Editors and pagers">
<link href="#s-web-appl" rel="section" title="11.5 Web servers and applications">
<link href="#s-mail-transport-agents" rel="section" title="11.6 Mail transport, delivery and user agents">
<link href="#s11.7" rel="section" title="11.7 News system configuration">
<link href="#s11.8" rel="section" title="11.8 Programs for the X Window System">
<link href="#s-perl" rel="section" title="11.9 Perl programs and modules">
<link href="#s-emacs" rel="section" title="11.10 Emacs lisp programs">
<link href="#s11.11" rel="section" title="11.11 Games">
<link href="#s12.1" rel="section" title="12.1 Manual pages">
<link href="#s12.2" rel="section" title="12.2 Info documents">
<link href="#s-docs-additional" rel="section" title="12.3 Additional documentation">
<link href="#s12.4" rel="section" title="12.4 Preferred documentation formats">
<link href="#s-copyrightfile" rel="section" title="12.5 Copyright information">
<link href="#s12.6" rel="section" title="12.6 Examples">
<link href="#s-changelogs" rel="section" title="12.7 Changelog files">
<link href="#s-pkg-bincreating" rel="section" title="B.1 Creating package files - dpkg-deb">
<link href="#s-pkg-controlarea" rel="section" title="B.2 Package control information files">
<link href="#s-pkg-controlfile" rel="section" title="B.3 The main control information file: control">
<link href="#sB.4" rel="section" title="B.4 Time Stamps">
<link href="#s-pkg-sourcetools" rel="section" title="C.1 Tools for processing source packages">
<link href="#s-pkg-sourcetree" rel="section" title="C.2 The Debian package source tree">
<link href="#s-pkg-sourcearchives" rel="section" title="C.3 Source packages as archives">
<link href="#sC.4" rel="section" title="C.4 Unpacking a Debian source package without dpkg-source">
<link href="#sD.1" rel="section" title="D.1 Syntax of control files">
<link href="#sD.2" rel="section" title="D.2 List of fields">
<link href="#sE.1" rel="section" title="E.1 Automatic handling of configuration files by dpkg">
<link href="#sE.2" rel="section" title="E.2 Fully-featured maintainer script configuration handling">
<link href="#s-main" rel="subsection" title="2.2.1 The main archive area">
<link href="#s-contrib" rel="subsection" title="2.2.2 The contrib archive area">
<link href="#s-non-free" rel="subsection" title="2.2.3 The non-free archive area">
<link href="#s3.2.1" rel="subsection" title="3.2.1 Version numbers based on dates">
<link href="#s-synopsis" rel="subsection" title="3.4.1 The single line synopsis">
<link href="#s-extendeddesc" rel="subsection" title="3.4.2 The extended description">
<link href="#s-maintscriptprompt" rel="subsection" title="3.9.1 Prompting in maintainer scripts">
<link href="#s-debianrules-options" rel="subsection" title="4.9.1 debian/rules and DEB_BUILD_OPTIONS">
<link href="#s-f-Source" rel="subsection" title="5.6.1 Source">
<link href="#s-f-Maintainer" rel="subsection" title="5.6.2 Maintainer">
<link href="#s-f-Uploaders" rel="subsection" title="5.6.3 Uploaders">
<link href="#s-f-Changed-By" rel="subsection" title="5.6.4 Changed-By">
<link href="#s-f-Section" rel="subsection" title="5.6.5 Section">
<link href="#s-f-Priority" rel="subsection" title="5.6.6 Priority">
<link href="#s-f-Package" rel="subsection" title="5.6.7 Package">
<link href="#s-f-Architecture" rel="subsection" title="5.6.8 Architecture">
<link href="#s-f-Essential" rel="subsection" title="5.6.9 Essential">
<link href="#s5.6.10" rel="subsection" title="5.6.10 Package interrelationship fields: Depends, Pre-Depends, Recommends, Suggests, Breaks, Conflicts, Provides, Replaces, Enhances">
<link href="#s-f-Standards-Version" rel="subsection" title="5.6.11 Standards-Version">
<link href="#s-f-Version" rel="subsection" title="5.6.12 Version">
<link href="#s-f-Description" rel="subsection" title="5.6.13 Description">
<link href="#s-f-Distribution" rel="subsection" title="5.6.14 Distribution">
<link href="#s-f-Date" rel="subsection" title="5.6.15 Date">
<link href="#s-f-Format" rel="subsection" title="5.6.16 Format">
<link href="#s-f-Urgency" rel="subsection" title="5.6.17 Urgency">
<link href="#s-f-Changes" rel="subsection" title="5.6.18 Changes">
<link href="#s-f-Binary" rel="subsection" title="5.6.19 Binary">
<link href="#s-f-Installed-Size" rel="subsection" title="5.6.20 Installed-Size">
<link href="#s-f-Files" rel="subsection" title="5.6.21 Files">
<link href="#s-f-Closes" rel="subsection" title="5.6.22 Closes">
<link href="#s-f-Homepage" rel="subsection" title="5.6.23 Homepage">
<link href="#s-f-Checksums" rel="subsection" title="5.6.24 Checksums-Sha1 and Checksums-Sha256">
<link href="#s5.6.25" rel="subsection" title="5.6.25 DM-Upload-Allowed">
<link href="#s-f-VCS-fields" rel="subsection" title="5.6.26 Version Control System (VCS) fields">
<link href="#s-f-Package-List" rel="subsection" title="5.6.27 Package-List">
<link href="#s-f-Package-Type" rel="subsection" title="5.6.28 Package-Type">
<link href="#s-f-Dgit" rel="subsection" title="5.6.29 Dgit">
<link href="#s-f-DM-Upload-Allowed" rel="subsection" title="5.8.1 DM-Upload-Allowed">
<link href="#s7.6.1" rel="subsection" title="7.6.1 Overwriting files in other packages">
<link href="#s7.6.2" rel="subsection" title="7.6.2 Replacing whole packages, forcing their removal">
<link href="#s-ldconfig" rel="subsection" title="8.1.1 ldconfig">
<link href="#s-dpkg-shlibdeps" rel="subsection" title="8.6.1 Generating dependencies on shared libraries">
<link href="#s-sharedlibs-updates" rel="subsection" title="8.6.2 Shared library ABI changes">
<link href="#s-sharedlibs-symbols" rel="subsection" title="8.6.3 The symbols system">
<link href="#s-symbols-paths" rel="subsection" title="8.6.3.1 The symbols files present on the system">
<link href="#s-symbols" rel="subsection" title="8.6.3.2 The symbols File Format">
<link href="#s-providing-symbols" rel="subsection" title="8.6.3.3 Providing a symbols file">
<link href="#s-sharedlibs-shlibdeps" rel="subsection" title="8.6.4 The shlibs system">
<link href="#s-shlibs-paths" rel="subsection" title="8.6.4.1 The shlibs files present on the system">
<link href="#s-shlibs" rel="subsection" title="8.6.4.2 The shlibs File Format">
<link href="#s8.6.4.3" rel="subsection" title="8.6.4.3 Providing a shlibs file">
<link href="#s-fhs" rel="subsection" title="9.1.1 File System Structure">
<link href="#s9.1.2" rel="subsection" title="9.1.2 Site-specific programs">
<link href="#s9.1.3" rel="subsection" title="9.1.3 The system-wide mail directory">
<link href="#s-fhs-run" rel="subsection" title="9.1.4 /run and /run/lock">
<link href="#s9.2.1" rel="subsection" title="9.2.1 Introduction">
<link href="#s9.2.2" rel="subsection" title="9.2.2 UID and GID classes">
<link href="#s-/etc/init.d" rel="subsection" title="9.3.1 Introduction">
<link href="#s-writing-init" rel="subsection" title="9.3.2 Writing the scripts">
<link href="#s9.3.3" rel="subsection" title="9.3.3 Interfacing with the initscript system">
<link href="#s9.3.3.1" rel="subsection" title="9.3.3.1 Managing the links">
<link href="#s9.3.3.2" rel="subsection" title="9.3.3.2 Running initscripts">
<link href="#s9.3.4" rel="subsection" title="9.3.4 Boot-time initialization">
<link href="#s9.3.5" rel="subsection" title="9.3.5 Example">
<link href="#s-cron-files" rel="subsection" title="9.5.1 Cron job file names">
<link href="#s-media-types-freedesktop" rel="subsection" title="9.7.1 Registration of media type handlers with desktop entries">
<link href="#s-mailcap" rel="subsection" title="9.7.2 Registration of media type handlers with mailcap entries">
<link href="#s-file-media-type" rel="subsection" title="9.7.3 Providing media types to files">
<link href="#s-upstart" rel="subsection" title="9.11.1 Event-based boot with upstart">
<link href="#s10.7.1" rel="subsection" title="10.7.1 Definitions">
<link href="#s10.7.2" rel="subsection" title="10.7.2 Location">
<link href="#s10.7.3" rel="subsection" title="10.7.3 Behavior">
<link href="#s10.7.4" rel="subsection" title="10.7.4 Sharing configuration files">
<link href="#s10.7.5" rel="subsection" title="10.7.5 User configuration files (&quot;dotfiles&quot;)">
<link href="#s10.9.1" rel="subsection" title="10.9.1 The use of dpkg-statoverride">
<link href="#s-arch-wildcard-spec" rel="subsection" title="11.1.1 Architecture wildcards">
<link href="#s11.8.1" rel="subsection" title="11.8.1 Providing X support and package priorities">
<link href="#s11.8.2" rel="subsection" title="11.8.2 Packages providing an X server">
<link href="#s11.8.3" rel="subsection" title="11.8.3 Packages providing a terminal emulator">
<link href="#s11.8.4" rel="subsection" title="11.8.4 Packages providing a window manager">
<link href="#s11.8.5" rel="subsection" title="11.8.5 Packages providing fonts">
<link href="#s-appdefaults" rel="subsection" title="11.8.6 Application defaults files">
<link href="#s11.8.7" rel="subsection" title="11.8.7 Installation directory issues">
<link href="#s-copyrightformat" rel="subsection" title="12.5.1 Machine-readable copyright information">
<link href="#s-pkg-dpkg-source" rel="subsection" title="C.1.1 dpkg-source - packs and unpacks Debian source packages">
<link href="#s-pkg-dpkg-buildpackage" rel="subsection" title="C.1.2 dpkg-buildpackage - overall package-building control script">
<link href="#s-pkg-dpkg-gencontrol" rel="subsection" title="C.1.3 dpkg-gencontrol - generates binary package control files">
<link href="#s-pkg-dpkg-shlibdeps" rel="subsection" title="C.1.4 dpkg-shlibdeps - calculates shared library dependencies">
<link href="#s-pkg-dpkg-distaddfile" rel="subsection" title="C.1.5 dpkg-distaddfile - adds a file to debian/files">
<link href="#s-pkg-dpkg-genchanges" rel="subsection" title="C.1.6 dpkg-genchanges - generates a .changes upload control file">
<link href="#s-pkg-dpkg-parsechangelog" rel="subsection" title="C.1.7 dpkg-parsechangelog - produces parsed representation of a changelog">
<link href="#s-pkg-dpkg-architecture" rel="subsection" title="C.1.8 dpkg-architecture - information about the build and host system">
<link href="#s-pkg-debianrules" rel="subsection" title="C.2.1 debian/rules - the main building script">
<link href="#s-pkg-srcsubstvars" rel="subsection" title="C.2.2 debian/substvars and variable substitutions">
<link href="#sC.2.3" rel="subsection" title="C.2.3 debian/files">
<link href="#sC.2.4" rel="subsection" title="C.2.4 debian/tmp">
<link href="#sC.4.1" rel="subsection" title="C.4.1 Restrictions on objects in source packages">
<link href="#s-pkg-f-Filename" rel="subsection" title="D.2.1 Filename and MSDOS-Filename">
<link href="#s-pkg-f-Size" rel="subsection" title="D.2.2 Size and MD5sum">
<link href="#s-pkg-f-Status" rel="subsection" title="D.2.3 Status">
<link href="#s-pkg-f-Config-Version" rel="subsection" title="D.2.4 Config-Version">
<link href="#s-pkg-f-Conffiles" rel="subsection" title="D.2.5 Conffiles">
<link href="#sD.2.6" rel="subsection" title="D.2.6 Obsolete fields">

</head>

<body>

<p><a name="index"></a></p>
<hr>

<p>
[ <a href="#ap-pkg-diversions">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-scope">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br></h1>

<hr>

<h2 id="abstract">Abstract</h2>

<p>
This manual describes the policy requirements for the Debian distribution.
This includes the structure and contents of the Debian archive and several
design issues of the operating system, as well as technical requirements that
each package must satisfy to be included in the distribution.
</p>

<hr>

<h2 id="copyright">Copyright Notice</h2>

<p>
Copyright &copy; 1996,1997,1998 Ian Jackson and Christian Schwarz.
</p>

<p>
These are the copyright dates of the original Policy manual.  Since then, this
manual has been updated by many others.  No comprehensive collection of
copyright notices for subsequent work exists.
</p>

<p>
This manual is free software; you may redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version.
</p>

<p>
This is distributed in the hope that it will be useful, but <em>without any
warranty</em>; without even the implied warranty of merchantability or fitness
for a particular purpose.  See the GNU General Public License for more details.
</p>

<p>
A copy of the GNU General Public License is available as
<code>/usr/share/common-licenses/GPL</code> in the Debian distribution or on
the World Wide Web at <code><a href="http://www.gnu.org/copyleft/gpl.html">the
GNU General Public Licence</a></code>.  You can also obtain it by writing to
the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301, USA.
</p>

<hr>

<h2 id="contents">Contents</h2>

<ul>
<li><a href="#ch-scope">1 About this manual</a>
  <ul>
  <li><a href="#s1.1">1.1 Scope</a></li>
  <li><a href="#s1.2">1.2 New versions of this document</a></li>
  <li><a href="#s-authors">1.3 Authors and Maintainers</a></li>
  <li><a href="#s-related">1.4 Related documents</a></li>
  <li><a href="#s-definitions">1.5 Definitions</a>
  </ul></li>
<li><a href="#ch-archive">2 The Debian Archive</a>
  <ul>
  <li><a href="#s-dfsg">2.1 The Debian Free Software Guidelines</a></li>
  <li><a href="#s-sections">2.2 Archive areas</a>
    <ul>
    <li><a href="#s-main">2.2.1 The main archive area</a></li>
    <li><a href="#s-contrib">2.2.2 The contrib archive area</a></li>
    <li><a href="#s-non-free">2.2.3 The non-free archive area</a>
    </ul></li>
  <li><a href="#s-pkgcopyright">2.3 Copyright considerations</a></li>
  <li><a href="#s-subsections">2.4 Sections</a></li>
  <li><a href="#s-priorities">2.5 Priorities</a>
  </ul></li>
<li><a href="#ch-binary">3 Binary packages</a>
  <ul>
  <li><a href="#s3.1">3.1 The package name</a></li>
  <li><a href="#s-versions">3.2 The version of a package</a>
    <ul>
    <li><a href="#s3.2.1">3.2.1 Version numbers based on dates</a>
    </ul></li>
  <li><a href="#s-maintainer">3.3 The maintainer of a package</a></li>
  <li><a href="#s-descriptions">3.4 The description of a package</a>
    <ul>
    <li><a href="#s-synopsis">3.4.1 The single line synopsis</a></li>
    <li><a href="#s-extendeddesc">3.4.2 The extended description</a>
    </ul></li>
  <li><a href="#s-dependencies">3.5 Dependencies</a></li>
  <li><a href="#s-virtual_pkg">3.6 Virtual packages</a></li>
  <li><a href="#s3.7">3.7 Base system</a></li>
  <li><a href="#s3.8">3.8 Essential packages</a></li>
  <li><a href="#s-maintscripts">3.9 Maintainer Scripts</a>
    <ul>
    <li><a href="#s-maintscriptprompt">3.9.1 Prompting in maintainer scripts</a>
    </ul></li>
  </ul></li>
<li><a href="#ch-source">4 Source packages</a>
  <ul>
  <li><a href="#s-standardsversion">4.1 Standards conformance</a></li>
  <li><a href="#s-pkg-relations">4.2 Package relationships</a></li>
  <li><a href="#s4.3">4.3 Changes to the upstream sources</a></li>
  <li><a href="#s-dpkgchangelog">4.4 Debian changelog: <code>debian/changelog</code></a></li>
  <li><a href="#s-dpkgcopyright">4.5 Copyright: <code>debian/copyright</code></a></li>
  <li><a href="#s4.6">4.6 Error trapping in makefiles</a></li>
  <li><a href="#s-timestamps">4.7 Time Stamps</a></li>
  <li><a href="#s-restrictions">4.8 Restrictions on objects in source packages</a></li>
  <li><a href="#s-debianrules">4.9 Main building script: <code>debian/rules</code></a>
    <ul>
    <li><a href="#s-debianrules-options">4.9.1 <code>debian/rules</code> and <samp>DEB_BUILD_OPTIONS</samp></a>
    </ul></li>
  <li><a href="#s-substvars">4.10 Variable substitutions: <code>debian/substvars</code></a></li>
  <li><a href="#s-debianwatch">4.11 Optional upstream source location: <code>debian/watch</code></a></li>
  <li><a href="#s-debianfiles">4.12 Generated files list: <code>debian/files</code></a></li>
  <li><a href="#s-embeddedfiles">4.13 Convenience copies of code</a></li>
  <li><a href="#s-readmesource">4.14 Source package handling: <code>debian/README.source</code></a>
  </ul></li>
<li><a href="#ch-controlfields">5 Control files and their fields</a>
  <ul>
  <li><a href="#s-controlsyntax">5.1 Syntax of control files</a></li>
  <li><a href="#s-sourcecontrolfiles">5.2 Source package control files -- <code>debian/control</code></a></li>
  <li><a href="#s-binarycontrolfiles">5.3 Binary package control files -- <code>DEBIAN/control</code></a></li>
  <li><a href="#s-debiansourcecontrolfiles">5.4 Debian source control files -- <samp>.dsc</samp></a></li>
  <li><a href="#s-debianchangesfiles">5.5 Debian changes files -- <code>.changes</code></a></li>
  <li><a href="#s-controlfieldslist">5.6 List of fields</a>
    <ul>
    <li><a href="#s-f-Source">5.6.1 <samp>Source</samp></a></li>
    <li><a href="#s-f-Maintainer">5.6.2 <samp>Maintainer</samp></a></li>
    <li><a href="#s-f-Uploaders">5.6.3 <samp>Uploaders</samp></a></li>
    <li><a href="#s-f-Changed-By">5.6.4 <samp>Changed-By</samp></a></li>
    <li><a href="#s-f-Section">5.6.5 <samp>Section</samp></a></li>
    <li><a href="#s-f-Priority">5.6.6 <samp>Priority</samp></a></li>
    <li><a href="#s-f-Package">5.6.7 <samp>Package</samp></a></li>
    <li><a href="#s-f-Architecture">5.6.8 <samp>Architecture</samp></a></li>
    <li><a href="#s-f-Essential">5.6.9 <samp>Essential</samp></a></li>
    <li><a href="#s5.6.10">5.6.10 Package interrelationship fields: <samp>Depends</samp>, <samp>Pre-Depends</samp>, <samp>Recommends</samp>, <samp>Suggests</samp>, <samp>Breaks</samp>, <samp>Conflicts</samp>, <samp>Provides</samp>, <samp>Replaces</samp>, <samp>Enhances</samp></a></li>
    <li><a href="#s-f-Standards-Version">5.6.11 <samp>Standards-Version</samp></a></li>
    <li><a href="#s-f-Version">5.6.12 <samp>Version</samp></a></li>
    <li><a href="#s-f-Description">5.6.13 <samp>Description</samp></a></li>
    <li><a href="#s-f-Distribution">5.6.14 <samp>Distribution</samp></a></li>
    <li><a href="#s-f-Date">5.6.15 <samp>Date</samp></a></li>
    <li><a href="#s-f-Format">5.6.16 <samp>Format</samp></a></li>
    <li><a href="#s-f-Urgency">5.6.17 <samp>Urgency</samp></a></li>
    <li><a href="#s-f-Changes">5.6.18 <samp>Changes</samp></a></li>
    <li><a href="#s-f-Binary">5.6.19 <samp>Binary</samp></a></li>
    <li><a href="#s-f-Installed-Size">5.6.20 <samp>Installed-Size</samp></a></li>
    <li><a href="#s-f-Files">5.6.21 <samp>Files</samp></a></li>
    <li><a href="#s-f-Closes">5.6.22 <samp>Closes</samp></a></li>
    <li><a href="#s-f-Homepage">5.6.23 <samp>Homepage</samp></a></li>
    <li><a href="#s-f-Checksums">5.6.24 <samp>Checksums-Sha1</samp> and <samp>Checksums-Sha256</samp></a></li>
    <li><a href="#s5.6.25">5.6.25 <samp>DM-Upload-Allowed</samp></a></li>
    <li><a href="#s-f-VCS-fields">5.6.26 Version Control System (VCS) fields</a></li>
    <li><a href="#s-f-Package-List">5.6.27 <samp>Package-List</samp></a></li>
    <li><a href="#s-f-Package-Type">5.6.28 <samp>Package-Type</samp></a></li>
    <li><a href="#s-f-Dgit">5.6.29 <samp>Dgit</samp></a>
    </ul></li>
  <li><a href="#s5.7">5.7 User-defined fields</a></li>
  <li><a href="#s-obsolete-control-data-fields">5.8 Obsolete fields</a>
    <ul>
    <li><a href="#s-f-DM-Upload-Allowed">5.8.1 <samp>DM-Upload-Allowed</samp></a>
    </ul></li>
  </ul></li>
<li><a href="#ch-maintainerscripts">6 Package maintainer scripts and installation procedure</a>
  <ul>
  <li><a href="#s6.1">6.1 Introduction to package maintainer scripts</a></li>
  <li><a href="#s-idempotency">6.2 Maintainer scripts idempotency</a></li>
  <li><a href="#s-controllingterminal">6.3 Controlling terminal for maintainer scripts</a></li>
  <li><a href="#s-exitstatus">6.4 Exit status</a></li>
  <li><a href="#s-mscriptsinstact">6.5 Summary of ways maintainer scripts are called</a></li>
  <li><a href="#s-unpackphase">6.6 Details of unpack phase of installation or upgrade</a></li>
  <li><a href="#s-configdetails">6.7 Details of configuration</a></li>
  <li><a href="#s-removedetails">6.8 Details of removal and/or configuration purging</a>
  </ul></li>
<li><a href="#ch-relationships">7 Declaring relationships between packages</a>
  <ul>
  <li><a href="#s-depsyntax">7.1 Syntax of relationship fields</a></li>
  <li><a href="#s-binarydeps">7.2 Binary Dependencies - <samp>Depends</samp>, <samp>Recommends</samp>, <samp>Suggests</samp>, <samp>Enhances</samp>, <samp>Pre-Depends</samp></a></li>
  <li><a href="#s-breaks">7.3 Packages which break other packages - <samp>Breaks</samp></a></li>
  <li><a href="#s-conflicts">7.4 Conflicting binary packages - <samp>Conflicts</samp></a></li>
  <li><a href="#s-virtual">7.5 Virtual packages - <samp>Provides</samp></a></li>
  <li><a href="#s-replaces">7.6 Overwriting files and replacing packages - <samp>Replaces</samp></a>
    <ul>
    <li><a href="#s7.6.1">7.6.1 Overwriting files in other packages</a></li>
    <li><a href="#s7.6.2">7.6.2 Replacing whole packages, forcing their removal</a>
    </ul></li>
  <li><a href="#s-sourcebinarydeps">7.7 Relationships between source and binary packages - <samp>Build-Depends</samp>, <samp>Build-Depends-Indep</samp>, <samp>Build-Conflicts</samp>, <samp>Build-Conflicts-Indep</samp></a></li>
  <li><a href="#s-built-using">7.8 Additional source packages used to build the binary - <samp>Built-Using</samp></a>
  </ul></li>
<li><a href="#ch-sharedlibs">8 Shared libraries</a>
  <ul>
  <li><a href="#s-sharedlibs-runtime">8.1 Run-time shared libraries</a>
    <ul>
    <li><a href="#s-ldconfig">8.1.1 <samp>ldconfig</samp></a>
    </ul></li>
  <li><a href="#s-sharedlibs-support-files">8.2 Shared library support files</a></li>
  <li><a href="#s-sharedlibs-static">8.3 Static libraries</a></li>
  <li><a href="#s-sharedlibs-dev">8.4 Development files</a></li>
  <li><a href="#s-sharedlibs-intradeps">8.5 Dependencies between the packages of the same library</a></li>
  <li><a href="#s-sharedlibs-depends">8.6 Dependencies between the library and other packages</a>
    <ul>
    <li><a href="#s-dpkg-shlibdeps">8.6.1 Generating dependencies on shared libraries</a></li>
    <li><a href="#s-sharedlibs-updates">8.6.2 Shared library ABI changes</a></li>
    <li><a href="#s-sharedlibs-symbols">8.6.3 The <samp>symbols</samp> system</a></li>
    <li><a href="#s-sharedlibs-shlibdeps">8.6.4 The <samp>shlibs</samp> system</a>
    </ul></li>
  </ul></li>
<li><a href="#ch-opersys">9 The Operating System</a>
  <ul>
  <li><a href="#s9.1">9.1 File system hierarchy</a>
    <ul>
    <li><a href="#s-fhs">9.1.1 File System Structure</a></li>
    <li><a href="#s9.1.2">9.1.2 Site-specific programs</a></li>
    <li><a href="#s9.1.3">9.1.3 The system-wide mail directory</a></li>
    <li><a href="#s-fhs-run">9.1.4 <code>/run</code> and <code>/run/lock</code></a>
    </ul></li>
  <li><a href="#s9.2">9.2 Users and groups</a>
    <ul>
    <li><a href="#s9.2.1">9.2.1 Introduction</a></li>
    <li><a href="#s9.2.2">9.2.2 UID and GID classes</a>
    </ul></li>
  <li><a href="#s-sysvinit">9.3 System run levels and <code>init.d</code> scripts</a>
    <ul>
    <li><a href="#s-/etc/init.d">9.3.1 Introduction</a></li>
    <li><a href="#s-writing-init">9.3.2 Writing the scripts</a></li>
    <li><a href="#s9.3.3">9.3.3 Interfacing with the initscript system</a></li>
    <li><a href="#s9.3.4">9.3.4 Boot-time initialization</a></li>
    <li><a href="#s9.3.5">9.3.5 Example</a>
    </ul></li>
  <li><a href="#s9.4">9.4 Console messages from <code>init.d</code> scripts</a></li>
  <li><a href="#s-cron-jobs">9.5 Cron jobs</a>
    <ul>
    <li><a href="#s-cron-files">9.5.1 Cron job file names</a>
    </ul></li>
  <li><a href="#s-menus">9.6 Menus</a></li>
  <li><a href="#s-mime">9.7 Multimedia handlers</a>
    <ul>
    <li><a href="#s-media-types-freedesktop">9.7.1 Registration of media type handlers with desktop entries</a></li>
    <li><a href="#s-mailcap">9.7.2 Registration of media type handlers with mailcap entries</a></li>
    <li><a href="#s-file-media-type">9.7.3 Providing media types to files</a>
    </ul></li>
  <li><a href="#s9.8">9.8 Keyboard configuration</a></li>
  <li><a href="#s9.9">9.9 Environment variables</a></li>
  <li><a href="#s-doc-base">9.10 Registering Documents using doc-base</a></li>
  <li><a href="#s-alternateinit">9.11 Alternate init systems</a>
    <ul>
    <li><a href="#s-upstart">9.11.1 Event-based boot with upstart</a>
    </ul></li>
  </ul></li>
<li><a href="#ch-files">10 Files</a>
  <ul>
  <li><a href="#s-binaries">10.1 Binaries</a></li>
  <li><a href="#s-libraries">10.2 Libraries</a></li>
  <li><a href="#s10.3">10.3 Shared libraries</a></li>
  <li><a href="#s-scripts">10.4 Scripts</a></li>
  <li><a href="#s10.5">10.5 Symbolic links</a></li>
  <li><a href="#s10.6">10.6 Device files</a></li>
  <li><a href="#s-config-files">10.7 Configuration files</a>
    <ul>
    <li><a href="#s10.7.1">10.7.1 Definitions</a></li>
    <li><a href="#s10.7.2">10.7.2 Location</a></li>
    <li><a href="#s10.7.3">10.7.3 Behavior</a></li>
    <li><a href="#s10.7.4">10.7.4 Sharing configuration files</a></li>
    <li><a href="#s10.7.5">10.7.5 User configuration files (&quot;dotfiles&quot;)</a>
    </ul></li>
  <li><a href="#s10.8">10.8 Log files</a></li>
  <li><a href="#s-permissions-owners">10.9 Permissions and owners</a>
    <ul>
    <li><a href="#s10.9.1">10.9.1 The use of <code>dpkg-statoverride</code></a>
    </ul></li>
  <li><a href="#s-filenames">10.10 File names</a>
  </ul></li>
<li><a href="#ch-customized-programs">11 Customized programs</a>
  <ul>
  <li><a href="#s-arch-spec">11.1 Architecture specification strings</a>
    <ul>
    <li><a href="#s-arch-wildcard-spec">11.1.1 Architecture wildcards</a>
    </ul></li>
  <li><a href="#s11.2">11.2 Daemons</a></li>
  <li><a href="#s11.3">11.3 Using pseudo-ttys and modifying wtmp, utmp and lastlog</a></li>
  <li><a href="#s11.4">11.4 Editors and pagers</a></li>
  <li><a href="#s-web-appl">11.5 Web servers and applications</a></li>
  <li><a href="#s-mail-transport-agents">11.6 Mail transport, delivery and user agents</a></li>
  <li><a href="#s11.7">11.7 News system configuration</a></li>
  <li><a href="#s11.8">11.8 Programs for the X Window System</a>
    <ul>
    <li><a href="#s11.8.1">11.8.1 Providing X support and package priorities</a></li>
    <li><a href="#s11.8.2">11.8.2 Packages providing an X server</a></li>
    <li><a href="#s11.8.3">11.8.3 Packages providing a terminal emulator</a></li>
    <li><a href="#s11.8.4">11.8.4 Packages providing a window manager</a></li>
    <li><a href="#s11.8.5">11.8.5 Packages providing fonts</a></li>
    <li><a href="#s-appdefaults">11.8.6 Application defaults files</a></li>
    <li><a href="#s11.8.7">11.8.7 Installation directory issues</a>
    </ul></li>
  <li><a href="#s-perl">11.9 Perl programs and modules</a></li>
  <li><a href="#s-emacs">11.10 Emacs lisp programs</a></li>
  <li><a href="#s11.11">11.11 Games</a>
  </ul></li>
<li><a href="#ch-docs">12 Documentation</a>
  <ul>
  <li><a href="#s12.1">12.1 Manual pages</a></li>
  <li><a href="#s12.2">12.2 Info documents</a></li>
  <li><a href="#s-docs-additional">12.3 Additional documentation</a></li>
  <li><a href="#s12.4">12.4 Preferred documentation formats</a></li>
  <li><a href="#s-copyrightfile">12.5 Copyright information</a>
    <ul>
    <li><a href="#s-copyrightformat">12.5.1 Machine-readable copyright information</a>
    </ul></li>
  <li><a href="#s12.6">12.6 Examples</a></li>
  <li><a href="#s-changelogs">12.7 Changelog files</a>
  </ul></li>
<li><a href="#ap-pkg-scope">A Introduction and scope of these appendices</a><li><a href="#ap-pkg-binarypkg">B Binary packages (from old Packaging Manual)</a>
  <ul>
  <li><a href="#s-pkg-bincreating">B.1 Creating package files - <code>dpkg-deb</code></a></li>
  <li><a href="#s-pkg-controlarea">B.2 Package control information files</a></li>
  <li><a href="#s-pkg-controlfile">B.3 The main control information file: <samp>control</samp></a></li>
  <li><a href="#sB.4">B.4 Time Stamps</a>
  </ul></li>
<li><a href="#ap-pkg-sourcepkg">C Source packages (from old Packaging Manual)</a>
  <ul>
  <li><a href="#s-pkg-sourcetools">C.1 Tools for processing source packages</a>
    <ul>
    <li><a href="#s-pkg-dpkg-source">C.1.1 <code>dpkg-source</code> - packs and unpacks Debian source packages</a></li>
    <li><a href="#s-pkg-dpkg-buildpackage">C.1.2 <code>dpkg-buildpackage</code> - overall package-building control script</a></li>
    <li><a href="#s-pkg-dpkg-gencontrol">C.1.3 <code>dpkg-gencontrol</code> - generates binary package control files</a></li>
    <li><a href="#s-pkg-dpkg-shlibdeps">C.1.4 <code>dpkg-shlibdeps</code> - calculates shared library dependencies</a></li>
    <li><a href="#s-pkg-dpkg-distaddfile">C.1.5 <code>dpkg-distaddfile</code> - adds a file to <code>debian/files</code></a></li>
    <li><a href="#s-pkg-dpkg-genchanges">C.1.6 <code>dpkg-genchanges</code> - generates a <code>.changes</code> upload control file</a></li>
    <li><a href="#s-pkg-dpkg-parsechangelog">C.1.7 <code>dpkg-parsechangelog</code> - produces parsed representation of a changelog</a></li>
    <li><a href="#s-pkg-dpkg-architecture">C.1.8 <code>dpkg-architecture</code> - information about the build and host system</a>
    </ul></li>
  <li><a href="#s-pkg-sourcetree">C.2 The Debian package source tree</a>
    <ul>
    <li><a href="#s-pkg-debianrules">C.2.1 <code>debian/rules</code> - the main building script</a></li>
    <li><a href="#s-pkg-srcsubstvars">C.2.2 <code>debian/substvars</code> and variable substitutions</a></li>
    <li><a href="#sC.2.3">C.2.3 <code>debian/files</code></a></li>
    <li><a href="#sC.2.4">C.2.4 <code>debian/tmp</code></a>
    </ul></li>
  <li><a href="#s-pkg-sourcearchives">C.3 Source packages as archives</a></li>
  <li><a href="#sC.4">C.4 Unpacking a Debian source package without <code>dpkg-source</code></a>
    <ul>
    <li><a href="#sC.4.1">C.4.1 Restrictions on objects in source packages</a>
    </ul></li>
  </ul></li>
<li><a href="#ap-pkg-controlfields">D Control files and their fields (from old Packaging Manual)</a>
  <ul>
  <li><a href="#sD.1">D.1 Syntax of control files</a></li>
  <li><a href="#sD.2">D.2 List of fields</a>
    <ul>
    <li><a href="#s-pkg-f-Filename">D.2.1 <samp>Filename</samp> and <samp>MSDOS-Filename</samp></a></li>
    <li><a href="#s-pkg-f-Size">D.2.2 <samp>Size</samp> and <samp>MD5sum</samp></a></li>
    <li><a href="#s-pkg-f-Status">D.2.3 <samp>Status</samp></a></li>
    <li><a href="#s-pkg-f-Config-Version">D.2.4 <samp>Config-Version</samp></a></li>
    <li><a href="#s-pkg-f-Conffiles">D.2.5 <samp>Conffiles</samp></a></li>
    <li><a href="#sD.2.6">D.2.6 Obsolete fields</a>
    </ul></li>
  </ul></li>
<li><a href="#ap-pkg-conffiles">E Configuration file handling (from old Packaging Manual)</a>
  <ul>
  <li><a href="#sE.1">E.1 Automatic handling of configuration files by <code>dpkg</code></a></li>
  <li><a href="#sE.2">E.2 Fully-featured maintainer script configuration handling</a>
  </ul></li>
<li><a href="#ap-pkg-alternatives">F Alternative versions of an interface - <code>update-alternatives</code> (from old Packaging Manual)</a><li><a href="#ap-pkg-diversions">G Diversions - overriding a package's version of a file (from old Packaging Manual)</a></li>
</ul>

<p><a name="ch-scope"></a></p>
<hr>

<p>
[ <a href="#index">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ 1 ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-archive">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 1 - About this manual
</h1>

<hr>

<h2 id="s1.1">1.1 Scope</h2>

<p>
This manual describes the policy requirements for the Debian distribution.
This includes the structure and contents of the Debian archive and several
design issues of the operating system, as well as technical requirements that
each package must satisfy to be included in the distribution.
</p>

<p>
This manual also describes Debian policy as it relates to creating Debian
packages.  It is not a tutorial on how to build packages, nor is it exhaustive
where it comes to describing the behavior of the packaging system.  Instead,
this manual attempts to define the interface to the package management system
that the developers have to be conversant with.[<a href="#f1" name="fr1">1</a>]
</p>

<p>
The footnotes present in this manual are merely informative, and are not part
of Debian policy itself.
</p>

<p>
The appendices to this manual are not necessarily normative, either.  Please
see <a href="#ap-pkg-scope">Introduction and scope of these appendices,
Appendix A</a> for more information.
</p>

<p>
In the normative part of this manual, the words <em>must</em>, <em>should</em>
and <em>may</em>, and the adjectives <em>required</em>, <em>recommended</em>
and <em>optional</em>, are used to distinguish the significance of the various
guidelines in this policy document.  Packages that do not conform to the
guidelines denoted by <em>must</em> (or <em>required</em>) will generally not
be considered acceptable for the Debian distribution.  Non-conformance with
guidelines denoted by <em>should</em> (or <em>recommended</em>) will generally
be considered a bug, but will not necessarily render a package unsuitable for
distribution.  Guidelines denoted by <em>may</em> (or <em>optional</em>) are
truly optional and adherence is left to the maintainer's discretion.
</p>

<p>
These classifications are roughly equivalent to the bug severities
<em>serious</em> (for <em>must</em> or <em>required</em> directive violations),
<em>minor</em>, <em>normal</em> or <em>important</em> (for <em>should</em> or
<em>recommended</em> directive violations) and <em>wishlist</em> (for
<em>optional</em> items).  [<a href="#f2" name="fr2">2</a>]
</p>

<p>
Much of the information presented in this manual will be useful even when
building a package which is to be distributed in some other way or is intended
for local use only.
</p>

<p>
udebs (stripped-down binary packages used by the Debian Installer) do not
comply with all of the requirements discussed here.  See the <code><a
href="http://d-i.alioth.debian.org/doc/internals/ch03.html">Debian Installer
internals manual</a></code> for more information about them.
</p>

<hr>

<h2 id="s1.2">1.2 New versions of this document</h2>

<p>
This manual is distributed via the Debian package <code><code><a
href="http://packages.debian.org/debian-policy">debian-policy</a></code></code>
(<code>packages.debian.org</code> <code><a
href="http://packages.debian.org/debian-policy">http://packages.debian.org/debian-policy</a></code>).
</p>

<p>
The current version of this document is also available from the Debian web
mirrors at <samp><code><a
href="http://www.debian.org/doc/debian-policy/">/doc/debian-policy/</a></code></samp>.
( <code>www.debian.org</code> <code><a
href="http://www.debian.org/doc/debian-policy/">http://www.debian.org/doc/debian-policy/</a></code>)
Also available from the same directory are several other formats:
<code>policy.html.tar.gz</code> (<code><a
href="http://www.debian.org/doc/debian-policy/policy.html.tar.gz">http://www.debian.org/doc/debian-policy/policy.html.tar.gz</a></code>),
<code>policy.pdf.gz</code> (<code><a
href="http://www.debian.org/doc/debian-policy/policy.pdf.gz">http://www.debian.org/doc/debian-policy/policy.pdf.gz</a></code>)
and <code>policy.ps.gz</code> (<code><a
href="http://www.debian.org/doc/debian-policy/policy.ps.gz">http://www.debian.org/doc/debian-policy/policy.ps.gz</a></code>).
</p>

<p>
The <code>debian-policy</code> package also includes the file
<code>upgrading-checklist.txt.gz</code> which indicates policy changes between
versions of this document.
</p>

<hr>

<h2 id="s-authors">1.3 Authors and Maintainers</h2>

<p>
Originally called &quot;Debian GNU/Linux Policy Manual&quot;, this manual was
initially written in 1996 by Ian Jackson.  It was revised on November 27th,
1996 by David A.  Morris.  Christian Schwarz added new sections on March 15th,
1997, and reworked/restructured it in April-July 1997.  Christoph Lameter
contributed the &quot;Web Standard&quot;.  Julian Gilbey largely restructured
it in 2001.
</p>

<p>
Since September 1998, the responsibility for the contents of this document lies
on the <code><a href="mailto:debian-policy@lists.debian.org">debian-policy
mailing list</a></code>.  Proposals are discussed there and inserted into
policy after a certain consensus is established.  The actual editing is done by
a group of maintainers that have no editorial powers.  These are the current
maintainers:
</p>
<ol type="1" start="1" >
<li>
<p>
Russ Allbery
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
Bill Allombert
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
Andreas Barth
</p>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
Jonathan Nieder
</p>
</li>
</ol>

<p>
While the authors of this document have tried hard to avoid typos and other
errors, these do still occur.  If you discover an error in this manual or if
you want to give any comments, suggestions, or criticisms please send an email
to the Debian Policy List, <code><a
href="mailto:debian-policy@lists.debian.org">mailto:debian-policy@lists.debian.org</a></code>,
or submit a bug report against the <samp>debian-policy</samp> package.
</p>

<p>
Please do not try to reach the individual authors or maintainers of the Policy
Manual regarding changes to the Policy.
</p>

<hr>

<h2 id="s-related">1.4 Related documents</h2>

<p>
There are several other documents other than this Policy Manual that are
necessary to fully understand some Debian policies and procedures.
</p>

<p>
The external &quot;sub-policy&quot; documents are referred to in:
</p>
<ul>
<li>
<p>
<a href="#s-fhs">File System Structure, Section 9.1.1</a>
</p>
</li>
<li>
<p>
<a href="#s-virtual_pkg">Virtual packages, Section 3.6</a>
</p>
</li>
<li>
<p>
<a href="#s-menus">Menus, Section 9.6</a>
</p>
</li>
<li>
<p>
<a href="#s-perl">Perl programs and modules, Section 11.9</a>
</p>
</li>
<li>
<p>
<a href="#s-maintscriptprompt">Prompting in maintainer scripts, Section
3.9.1</a>
</p>
</li>
<li>
<p>
<a href="#s-emacs">Emacs lisp programs, Section 11.10</a>
</p>
</li>
</ul>

<p>
In addition to those, which carry the weight of policy, there is the Debian
Developer's Reference.  This document describes procedures and resources for
Debian developers, but it is <em>not</em> normative; rather, it includes things
that don't belong in the Policy, such as best practices for developers.
</p>

<p>
The Developer's Reference is available in the <code>developers-reference</code>
package.  It's also available from the Debian web mirrors at <samp><code><a
href="http://www.debian.org/doc/developers-reference/">/doc/developers-reference/</a></code></samp>.
</p>

<p>
Finally, a <a href="#s-copyrightformat">specification for machine-readable
copyright files</a> is maintained as part of the <code>debian-policy</code>
package using the same procedure as the other policy documents.  Use of this
format is optional.
</p>

<hr>

<h2 id="s-definitions">1.5 Definitions</h2>

<p>
The following terms are used in this Policy Manual:
</p>
<dl>
<dt>ASCII</dt>
<dd>
<p>
The character encoding specified by ANSI X3.4-1986 and its predecessor
standards, referred to in MIME as US-ASCII, and corresponding to an encoding in
eight bits per character of the first 128 <code><a
href="http://www.unicode.org/">Unicode</a></code> characters, with the eighth
bit always zero.
</p>
</dd>
</dl>
<dl>
<dt>UTF-8</dt>
<dd>
<p>
The transformation format (sometimes called encoding) of <code><a
href="http://www.unicode.org/">Unicode</a></code> defined by <code><a
href="http://www.rfc-editor.org/rfc/rfc3629.txt">RFC 3629</a></code>.  UTF-8
has the useful property of having ASCII as a subset, so any text encoded in
ASCII is trivially also valid UTF-8.
</p>
</dd>
</dl>

<p><a name="ch-archive"></a></p>
<hr>

<p>
[ <a href="#ch-scope">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ 2 ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-binary">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 2 - The Debian Archive
</h1>

<hr>

<p>
The Debian system is maintained and distributed as a collection of
<em>packages</em>.  Since there are so many of them (currently well over
15000), they are split into <em>sections</em> and given <em>priorities</em> to
simplify the handling of them.
</p>

<p>
The effort of the Debian project is to build a free operating system, but not
every package we want to make accessible is <em>free</em> in our sense (see the
Debian Free Software Guidelines, below), or may be imported/exported without
restrictions.  Thus, the archive is split into areas[<a href="#f3"
name="fr3">3</a>] based on their licenses and other restrictions.
</p>

<p>
The aims of this are:
</p>
<ul>
<li>
<p>
to allow us to make as much software available as we can
</p>
</li>
<li>
<p>
to allow us to encourage everyone to write free software, and
</p>
</li>
<li>
<p>
to allow us to make it easy for people to produce CD-ROMs of our system without
violating any licenses, import/export restrictions, or any other laws.
</p>
</li>
</ul>

<p>
The <em>main</em> archive area forms the <em>Debian distribution</em>.
</p>

<p>
Packages in the other archive areas (<samp>contrib</samp>,
<samp>non-free</samp>) are not considered to be part of the Debian
distribution, although we support their use and provide infrastructure for them
(such as our bug-tracking system and mailing lists).  This Debian Policy Manual
applies to these packages as well.
</p>

<hr>

<h2 id="s-dfsg">2.1 The Debian Free Software Guidelines</h2>

<p>
The Debian Free Software Guidelines (DFSG) form our definition of &quot;free
software&quot;.  These are:
</p>
<dl>
<dt>1. Free Redistribution</dt>
<dd>
<p>
The license of a Debian component may not restrict any party from selling or
giving away the software as a component of an aggregate software distribution
containing programs from several different sources.  The license may not
require a royalty or other fee for such sale.
</p>
</dd>
</dl>
<dl>
<dt>2. Source Code</dt>
<dd>
<p>
The program must include source code, and must allow distribution in source
code as well as compiled form.
</p>
</dd>
</dl>
<dl>
<dt>3. Derived Works</dt>
<dd>
<p>
The license must allow modifications and derived works, and must allow them to
be distributed under the same terms as the license of the original software.
</p>
</dd>
</dl>
<dl>
<dt>4. Integrity of The Author's Source Code</dt>
<dd>
<p>
The license may restrict source-code from being distributed in modified form
<em>only</em> if the license allows the distribution of &quot;patch files&quot;
with the source code for the purpose of modifying the program at build time.
The license must explicitly permit distribution of software built from modified
source code.  The license may require derived works to carry a different name
or version number from the original software.  (This is a compromise.  The
Debian Project encourages all authors to not restrict any files, source or
binary, from being modified.)
</p>
</dd>
</dl>
<dl>
<dt>5. No Discrimination Against Persons or Groups</dt>
<dd>
<p>
The license must not discriminate against any person or group of persons.
</p>
</dd>
</dl>
<dl>
<dt>6. No Discrimination Against Fields of Endeavor</dt>
<dd>
<p>
The license must not restrict anyone from making use of the program in a
specific field of endeavor.  For example, it may not restrict the program from
being used in a business, or from being used for genetic research.
</p>
</dd>
</dl>
<dl>
<dt>7. Distribution of License</dt>
<dd>
<p>
The rights attached to the program must apply to all to whom the program is
redistributed without the need for execution of an additional license by those
parties.
</p>
</dd>
</dl>
<dl>
<dt>8. License Must Not Be Specific to Debian</dt>
<dd>
<p>
The rights attached to the program must not depend on the program's being part
of a Debian system.  If the program is extracted from Debian and used or
distributed without Debian but otherwise within the terms of the program's
license, all parties to whom the program is redistributed must have the same
rights as those that are granted in conjunction with the Debian system.
</p>
</dd>
</dl>
<dl>
<dt>9. License Must Not Contaminate Other Software</dt>
<dd>
<p>
The license must not place restrictions on other software that is distributed
along with the licensed software.  For example, the license must not insist
that all other programs distributed on the same medium must be free software.
</p>
</dd>
</dl>
<dl>
<dt>10. Example Licenses</dt>
<dd>
<p>
The &quot;GPL,&quot; &quot;BSD,&quot; and &quot;Artistic&quot; licenses are
examples of licenses that we consider <em>free</em>.
</p>
</dd>
</dl>

<hr>

<h2 id="s-sections">2.2 Archive areas</h2>

<hr>

<h3 id="s-main">2.2.1 The main archive area</h3>

<p>
The <em>main</em> archive area comprises the Debian distribution.  Only the
packages in this area are considered part of the distribution.  None of the
packages in the <em>main</em> archive area require software outside of that
area to function.  Anyone may use, share, modify and redistribute the packages
in this archive area freely[<a href="#f4" name="fr4">4</a>].
</p>

<p>
Every package in <em>main</em> must comply with the DFSG (Debian Free Software
Guidelines).
</p>

<p>
In addition, the packages in <em>main</em>
</p>
<ul>
<li>
<p>
must not require or recommend a package outside of <em>main</em> for
compilation or execution (thus, the package must not declare a
&quot;Pre-Depends&quot;, &quot;Depends&quot;, &quot;Recommends&quot;,
&quot;Build-Depends&quot;, or &quot;Build-Depends-Indep&quot; relationship on a
non-<em>main</em> package),
</p>
</li>
<li>
<p>
must not be so buggy that we refuse to support them, and
</p>
</li>
<li>
<p>
must meet all policy requirements presented in this manual.
</p>
</li>
</ul>

<hr>

<h3 id="s-contrib">2.2.2 The contrib archive area</h3>

<p>
The <em>contrib</em> archive area contains supplemental packages intended to
work with the Debian distribution, but which require software outside of the
distribution to either build or function.
</p>

<p>
Every package in <em>contrib</em> must comply with the DFSG.
</p>

<p>
In addition, the packages in <em>contrib</em>
</p>
<ul>
<li>
<p>
must not be so buggy that we refuse to support them, and
</p>
</li>
<li>
<p>
must meet all policy requirements presented in this manual.
</p>
</li>
</ul>

<p>
Examples of packages which would be included in <em>contrib</em> are:
</p>
<ul>
<li>
<p>
free packages which require <em>contrib</em>, <em>non-free</em> packages or
packages which are not in our archive at all for compilation or execution, and
</p>
</li>
<li>
<p>
wrapper packages or other sorts of free accessories for non-free programs.
</p>
</li>
</ul>

<hr>

<h3 id="s-non-free">2.2.3 The non-free archive area</h3>

<p>
The <em>non-free</em> archive area contains supplemental packages intended to
work with the Debian distribution that do not comply with the DFSG or have
other problems that make their distribution problematic.  They may not comply
with all of the policy requirements in this manual due to restrictions on
modifications or other limitations.
</p>

<p>
Packages must be placed in <em>non-free</em> if they are not compliant with the
DFSG or are encumbered by patents or other legal issues that make their
distribution problematic.
</p>

<p>
In addition, the packages in <em>non-free</em>
</p>
<ul>
<li>
<p>
must not be so buggy that we refuse to support them, and
</p>
</li>
<li>
<p>
must meet all policy requirements presented in this manual that it is possible
for them to meet.  [<a href="#f5" name="fr5">5</a>]
</p>
</li>
</ul>

<hr>

<h2 id="s-pkgcopyright">2.3 Copyright considerations</h2>

<p>
Every package must be accompanied by a verbatim copy of its copyright
information and distribution license in the file
<code>/usr/share/doc/<var>package</var>/copyright</code> (see <a
href="#s-copyrightfile">Copyright information, Section 12.5</a> for further
details).
</p>

<p>
We reserve the right to restrict files from being included anywhere in our
archives if
</p>
<ul>
<li>
<p>
their use or distribution would break a law,
</p>
</li>
<li>
<p>
there is an ethical conflict in their distribution or use,
</p>
</li>
<li>
<p>
we would have to sign a license for them, or
</p>
</li>
<li>
<p>
their distribution would conflict with other project policies.
</p>
</li>
</ul>

<p>
Programs whose authors encourage the user to make donations are fine for the
main distribution, provided that the authors do not claim that not donating is
immoral, unethical, illegal or something similar; in such a case they must go
in <em>non-free</em>.
</p>

<p>
Packages whose copyright permission notices (or patent problems) do not even
allow redistribution of binaries only, and where no special permission has been
obtained, must not be placed on the Debian FTP site and its mirrors at all.
</p>

<p>
Note that under international copyright law (this applies in the United States,
too), <em>no</em> distribution or modification of a work is allowed without an
explicit notice saying so.  Therefore a program without a copyright notice
<em>is</em> copyrighted and you may not do anything to it without risking being
sued!  Likewise if a program has a copyright notice but no statement saying
what is permitted then nothing is permitted.
</p>

<p>
Many authors are unaware of the problems that restrictive copyrights (or lack
of copyright notices) can cause for the users of their supposedly-free
software.  It is often worthwhile contacting such authors diplomatically to ask
them to modify their license terms.  However, this can be a politically
difficult thing to do and you should ask for advice on the
<samp>debian-legal</samp> mailing list first, as explained below.
</p>

<p>
When in doubt about a copyright, send mail to <code><a
href="mailto:debian-legal@lists.debian.org">mailto:debian-legal@lists.debian.org</a></code>.
Be prepared to provide us with the copyright statement.  Software covered by
the GPL, public domain software and BSD-like copyrights are safe; be wary of
the phrases &quot;commercial use prohibited&quot; and &quot;distribution
restricted&quot;.
</p>

<hr>

<h2 id="s-subsections">2.4 Sections</h2>

<p>
The packages in the archive areas <em>main</em>, <em>contrib</em> and
<em>non-free</em> are grouped further into <em>sections</em> to simplify
handling.
</p>

<p>
The archive area and section for each package should be specified in the
package's <samp>Section</samp> control record (see <a
href="#s-f-Section"><samp>Section</samp>, Section 5.6.5</a>).  However, the
maintainer of the Debian archive may override this selection to ensure the
consistency of the Debian distribution.  The <samp>Section</samp> field should
be of the form:
</p>
<ul>
<li>
<p>
<em>section</em> if the package is in the <em>main</em> archive area,
</p>
</li>
<li>
<p>
<em>area/section</em> if the package is in the <em>contrib</em> or
<em>non-free</em> archive areas.
</p>
</li>
</ul>

<p>
The Debian archive maintainers provide the authoritative list of sections.  At
present, they are: admin, cli-mono, comm, database, debug, devel, doc, editors,
education, electronics, embedded, fonts, games, gnome, gnu-r, gnustep,
graphics, hamradio, haskell, httpd, interpreters, introspection, java, kde,
kernel, libdevel, libs, lisp, localization, mail, math, metapackages, misc,
net, news, ocaml, oldlibs, otherosfs, perl, php, python, ruby, science, shells,
sound, tasks, tex, text, utils, vcs, video, web, x11, xfce, zope.  The
additional section <em>debian-installer</em> contains special packages used by
the installer and is not used for normal Debian packages.
</p>

<p>
For more information about the sections and their definitions, see the <code><a
href="http://packages.debian.org/unstable/">list of sections in
unstable</a></code>.
</p>

<hr>

<h2 id="s-priorities">2.5 Priorities</h2>

<p>
Each package should have a <em>priority</em> value, which is included in the
package's <em>control record</em> (see <a
href="#s-f-Priority"><samp>Priority</samp>, Section 5.6.6</a>).  This
information is used by the Debian package management tools to separate
high-priority packages from less-important packages.
</p>

<p>
The following <em>priority levels</em> are recognized by the Debian package
management tools.
</p>
<dl>
<dt><samp>required</samp></dt>
<dd>
<p>
Packages which are necessary for the proper functioning of the system (usually,
this means that dpkg functionality depends on these packages).  Removing a
<samp>required</samp> package may cause your system to become totally broken
and you may not even be able to use <code>dpkg</code> to put things back, so
only do so if you know what you are doing.  Systems with only the
<samp>required</samp> packages are probably unusable, but they do have enough
functionality to allow the sysadmin to boot and install more software.
</p>
</dd>
</dl>
<dl>
<dt><samp>important</samp></dt>
<dd>
<p>
Important programs, including those which one would expect to find on any
Unix-like system.  If the expectation is that an experienced Unix person who
found it missing would say &quot;What on earth is going on, where is
<code>foo</code>?&quot;, it must be an <samp>important</samp> package.[<a
href="#f6" name="fr6">6</a>] Other packages without which the system will not
run well or be usable must also have priority <samp>important</samp>.  This
does <em>not</em> include Emacs, the X Window System, TeX or any other large
applications.  The <samp>important</samp> packages are just a bare minimum of
commonly-expected and necessary tools.
</p>
</dd>
</dl>
<dl>
<dt><samp>standard</samp></dt>
<dd>
<p>
These packages provide a reasonably small but not too limited character-mode
system.  This is what will be installed by default if the user doesn't select
anything else.  It doesn't include many large applications.
</p>
</dd>
</dl>
<dl>
<dt><samp>optional</samp></dt>
<dd>
<p>
(In a sense everything that isn't required is optional, but that's not what is
meant here.) This is all the software that you might reasonably want to install
if you didn't know what it was and don't have specialized requirements.  This
is a much larger system and includes the X Window System, a full TeX
distribution, and many applications.  Note that optional packages should not
conflict with each other.
</p>
</dd>
</dl>
<dl>
<dt><samp>extra</samp></dt>
<dd>
<p>
This contains all packages that conflict with others with required, important,
standard or optional priorities, or are only likely to be useful if you already
know what they are or have specialized requirements (such as packages
containing only detached debugging symbols).
</p>
</dd>
</dl>

<p>
Packages must not depend on packages with lower priority values (excluding
build-time dependencies).  In order to ensure this, the priorities of one or
more packages may need to be adjusted.
</p>

<p><a name="ch-binary"></a></p>
<hr>

<p>
[ <a href="#ch-archive">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ 3 ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-source">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 3 - Binary packages
</h1>

<hr>

<p>
The Debian distribution is based on the Debian package management system,
called <code>dpkg</code>.  Thus, all packages in the Debian distribution must
be provided in the <samp>.deb</samp> file format.
</p>

<p>
A <samp>.deb</samp> package contains two sets of files: a set of files to
install on the system when the package is installed, and a set of files that
provide additional metadata about the package or which are executed when the
package is installed or removed.  This second set of files is called
<em>control information files</em>.  Among those files are the package
maintainer scripts and <code>control</code>, the <a
href="#s-binarycontrolfiles">binary package control file</a> that contains the
control fields for the package.  Other control information files include the <a
href="#s-sharedlibs-symbols"><code>symbols</code> file</a> or <a
href="#s-sharedlibs-shlibdeps"><code>shlibs</code> file</a> used to store
shared library dependency information and the <code>conffiles</code> file that
lists the package's configuration files (described in <a
href="#s-config-files">Configuration files, Section 10.7</a>).
</p>

<p>
There is unfortunately a collision of terminology here between control
information files and files in the Debian control file format.  Throughout this
document, a <em>control file</em> refers to a file in the Debian control file
format.  These files are documented in <a href="#ch-controlfields">Control
files and their fields, Chapter 5</a>.  Only files referred to specifically as
<em>control information files</em> are the files included in the control
information file member of the <code>.deb</code> file format used by binary
packages.  Most control information files are not in the Debian control file
format.
</p>

<hr>

<h2 id="s3.1">3.1 The package name</h2>

<p>
Every package must have a name that's unique within the Debian archive.
</p>

<p>
The package name is included in the control field <samp>Package</samp>, the
format of which is described in <a href="#s-f-Package"><samp>Package</samp>,
Section 5.6.7</a>.  The package name is also included as a part of the file
name of the <samp>.deb</samp> file.
</p>

<hr>

<h2 id="s-versions">3.2 The version of a package</h2>

<p>
Every package has a version number recorded in its <samp>Version</samp> control
file field, described in <a href="#s-f-Version"><samp>Version</samp>, Section
5.6.12</a>.
</p>

<p>
The package management system imposes an ordering on version numbers, so that
it can tell whether packages are being up- or downgraded and so that package
system front end applications can tell whether a package it finds available is
newer than the one installed on the system.  The version number format has the
most significant parts (as far as comparison is concerned) at the beginning.
</p>

<p>
If an upstream package has problematic version numbers they should be converted
to a sane form for use in the <samp>Version</samp> field.
</p>

<hr>

<h3 id="s3.2.1">3.2.1 Version numbers based on dates</h3>

<p>
In general, Debian packages should use the same version numbers as the upstream
sources.  However, upstream version numbers based on some date formats
(sometimes used for development or &quot;snapshot&quot; releases) will not be
ordered correctly by the package management software.  For example,
<code>dpkg</code> will consider &quot;96May01&quot; to be greater than
&quot;96Dec24&quot;.
</p>

<p>
To prevent having to use epochs for every new upstream version, the date-based
portion of any upstream version number should be given in a way that sorts
correctly: four-digit year first, followed by a two-digit numeric month,
followed by a two-digit numeric date, possibly with punctuation between the
components.
</p>

<p>
Native Debian packages (i.e., packages which have been written especially for
Debian) whose version numbers include dates should also follow these rules.  If
punctuation is desired between the date components, remember that hyphen
(<samp>-</samp>) cannot be used in native package versions.  Period
(<samp>.</samp>) is normally a good choice.
</p>

<hr>

<h2 id="s-maintainer">3.3 The maintainer of a package</h2>

<p>
Every package must have a maintainer, except for orphaned packages as described
below.  The maintainer may be one person or a group of people reachable from a
common email address, such as a mailing list.  The maintainer is responsible
for maintaining the Debian packaging files, evaluating and responding
appropriately to reported bugs, uploading new versions of the package (either
directly or through a sponsor), ensuring that the package is placed in the
appropriate archive area and included in Debian releases as appropriate for the
stability and utility of the package, and requesting removal of the package
from the Debian distribution if it is no longer useful or maintainable.
</p>

<p>
The maintainer must be specified in the <samp>Maintainer</samp> control field
with their correct name and a working email address.  The email address given
in the <samp>Maintainer</samp> control field must accept mail from those role
accounts in Debian used to send automated mails regarding the package.  This
includes non-spam mail from the bug-tracking system, all mail from the Debian
archive maintenance software, and other role accounts or automated processes
that are commonly agreed on by the project.[<a href="#f7" name="fr7">7</a>] If
one person or team maintains several packages, they should use the same form of
their name and email address in the <samp>Maintainer</samp> fields of those
packages.
</p>

<p>
The format of the <samp>Maintainer</samp> control field is described in <a
href="#s-f-Maintainer"><samp>Maintainer</samp>, Section 5.6.2</a>.
</p>

<p>
If the maintainer of the package is a team of people with a shared email
address, the <samp>Uploaders</samp> control field must be present and must
contain at least one human with their personal email address.  See <a
href="#s-f-Uploaders"><samp>Uploaders</samp>, Section 5.6.3</a> for the syntax
of that field.
</p>

<p>
An orphaned package is one with no current maintainer.  Orphaned packages
should have their <samp>Maintainer</samp> control field set to <samp>Debian QA
Group &lt;packages@qa.debian.org&gt;</samp>.  These packages are considered
maintained by the Debian project as a whole until someone else volunteers to
take over maintenance.[<a href="#f8" name="fr8">8</a>]
</p>

<hr>

<h2 id="s-descriptions">3.4 The description of a package</h2>

<p>
Every Debian package must have a <samp>Description</samp> control field which
contains a synopsis and extended description of the package.  Technical
information about the format of the <samp>Description</samp> field is in <a
href="#s-f-Description"><samp>Description</samp>, Section 5.6.13</a>.
</p>

<p>
The description should describe the package (the program) to a user (system
administrator) who has never met it before so that they have enough information
to decide whether they want to install it.  This description should not just be
copied verbatim from the program's documentation.
</p>

<p>
Put important information first, both in the synopsis and extended description.
Sometimes only the first part of the synopsis or of the description will be
displayed.  You can assume that there will usually be a way to see the whole
extended description.
</p>

<p>
The description should also give information about the significant dependencies
and conflicts between this package and others, so that the user knows why these
dependencies and conflicts have been declared.
</p>

<p>
Instructions for configuring or using the package should not be included (that
is what installation scripts, manual pages, info files, etc., are for).
Copyright statements and other administrivia should not be included either
(that is what the copyright file is for).
</p>

<hr>

<h3 id="s-synopsis">3.4.1 The single line synopsis</h3>

<p>
The single line synopsis should be kept brief - certainly under 80 characters.
</p>

<p>
Do not include the package name in the synopsis line.  The display software
knows how to display this already, and you do not need to state it.  Remember
that in many situations the user may only see the synopsis line - make it as
informative as you can.
</p>

<hr>

<h3 id="s-extendeddesc">3.4.2 The extended description</h3>

<p>
Do not try to continue the single line synopsis into the extended description.
This will not work correctly when the full description is displayed, and makes
no sense where only the summary (the single line synopsis) is available.
</p>

<p>
The extended description should describe what the package does and how it
relates to the rest of the system (in terms of, for example, which subsystem it
is which part of).
</p>

<p>
The description field needs to make sense to anyone, even people who have no
idea about any of the things the package deals with.[<a href="#f9"
name="fr9">9</a>]
</p>

<hr>

<h2 id="s-dependencies">3.5 Dependencies</h2>

<p>
Every package must specify the dependency information about other packages that
are required for the first to work correctly.
</p>

<p>
For example, a dependency entry must be provided for any shared libraries
required by a dynamically-linked executable binary in a package.
</p>

<p>
Packages are not required to declare any dependencies they have on other
packages which are marked <samp>Essential</samp> (see below), and should not do
so unless they depend on a particular version of that package.[<a href="#f10"
name="fr10">10</a>]
</p>

<p>
Sometimes, unpacking one package requires that another package be first
unpacked <em>and</em> configured.  In this case, the depending package must
specify this dependency in the <samp>Pre-Depends</samp> control field.
</p>

<p>
You should not specify a <samp>Pre-Depends</samp> entry for a package before
this has been discussed on the <samp>debian-devel</samp> mailing list and a
consensus about doing that has been reached.
</p>

<p>
The format of the package interrelationship control fields is described in <a
href="#ch-relationships">Declaring relationships between packages, Chapter
7</a>.
</p>

<hr>

<h2 id="s-virtual_pkg">3.6 Virtual packages</h2>

<p>
Sometimes, there are several packages which offer more-or-less the same
functionality.  In this case, it's useful to define a <em>virtual package</em>
whose name describes that common functionality.  (The virtual packages only
exist logically, not physically; that's why they are called <em>virtual</em>.)
The packages with this particular function will then <em>provide</em> the
virtual package.  Thus, any other package requiring that function can simply
depend on the virtual package without having to specify all possible packages
individually.
</p>

<p>
All packages should use virtual package names where appropriate, and arrange to
create new ones if necessary.  They should not use virtual package names
(except privately, amongst a cooperating group of packages) unless they have
been agreed upon and appear in the list of virtual package names.  (See also <a
href="#s-virtual">Virtual packages - <samp>Provides</samp>, Section 7.5</a>)
</p>

<p>
The latest version of the authoritative list of virtual package names can be
found in the <samp>debian-policy</samp> package.  It is also available from the
Debian web mirrors at <samp><code><a
href="http://www.debian.org/doc/packaging-manuals/virtual-package-names-list.txt">/doc/packaging-manuals/virtual-package-names-list.txt</a></code></samp>.
</p>

<p>
The procedure for updating the list is described in the preface to the list.
</p>

<hr>

<h2 id="s3.7">3.7 Base system</h2>

<p>
The <samp>base system</samp> is a minimum subset of the Debian system that is
installed before everything else on a new system.  Only very few packages are
allowed to form part of the base system, in order to keep the required disk
usage very small.
</p>

<p>
The base system consists of all those packages with priority
<samp>required</samp> or <samp>important</samp>.  Many of them will be tagged
<samp>essential</samp> (see below).
</p>

<hr>

<h2 id="s3.8">3.8 Essential packages</h2>

<p>
Essential is defined as the minimal set of functionality that must be available
and usable on the system at all times, even when packages are in the
&quot;Unpacked&quot; state.  Packages are tagged <samp>essential</samp> for a
system using the <samp>Essential</samp> control field.  The format of the
<samp>Essential</samp> control field is described in <a
href="#s-f-Essential"><samp>Essential</samp>, Section 5.6.9</a>.
</p>

<p>
Since these packages cannot be easily removed (one has to specify an extra
<em>force option</em> to <code>dpkg</code> to do so), this flag must not be
used unless absolutely necessary.  A shared library package must not be tagged
<samp>essential</samp>; dependencies will prevent its premature removal, and we
need to be able to remove it when it has been superseded.
</p>

<p>
Since dpkg will not prevent upgrading of other packages while an
<samp>essential</samp> package is in an unconfigured state, all
<samp>essential</samp> packages must supply all of their core functionality
even when unconfigured.  If the package cannot satisfy this requirement it must
not be tagged as essential, and any packages depending on this package must
instead have explicit dependency fields as appropriate.
</p>

<p>
Maintainers should take great care in adding any programs, interfaces, or
functionality to <samp>essential</samp> packages.  Packages may assume that
functionality provided by <samp>essential</samp> packages is always available
without declaring explicit dependencies, which means that removing
functionality from the Essential set is very difficult and is almost never
done.  Any capability added to an <samp>essential</samp> package therefore
creates an obligation to support that capability as part of the Essential set
in perpetuity.
</p>

<p>
You must not tag any packages <samp>essential</samp> before this has been
discussed on the <samp>debian-devel</samp> mailing list and a consensus about
doing that has been reached.
</p>

<hr>

<h2 id="s-maintscripts">3.9 Maintainer Scripts</h2>

<p>
The package installation scripts should avoid producing output which is
unnecessary for the user to see and should rely on <code>dpkg</code> to stave
off boredom on the part of a user installing many packages.  This means,
amongst other things, not passing the <samp>--verbose</samp> option to
<code>update-alternatives</code>.
</p>

<p>
Errors which occur during the execution of an installation script must be
checked and the installation must not continue after an error.
</p>

<p>
Note that in general <a href="#s-scripts">Scripts, Section 10.4</a> applies to
package maintainer scripts, too.
</p>

<p>
You should not use <code>dpkg-divert</code> on a file belonging to another
package without consulting the maintainer of that package first.  When adding
or removing diversions, package maintainer scripts must provide the
<samp>--package</samp> flag to <code>dpkg-divert</code> and must not use
<samp>--local</samp>.
</p>

<p>
All packages which supply an instance of a common command name (or, in general,
filename) should generally use <code>update-alternatives</code>, so that they
may be installed together.  If <code>update-alternatives</code> is not used,
then each package must use <samp>Conflicts</samp> to ensure that other packages
are removed.  (In this case, it may be appropriate to specify a conflict
against earlier versions of something that previously did not use
<code>update-alternatives</code>; this is an exception to the usual rule that
versioned conflicts should be avoided.)
</p>

<hr>

<h3 id="s-maintscriptprompt">3.9.1 Prompting in maintainer scripts</h3>

<p>
Package maintainer scripts may prompt the user if necessary.  Prompting must be
done by communicating through a program, such as <code>debconf</code>, which
conforms to the Debian Configuration Management Specification, version 2 or
higher.
</p>

<p>
Packages which are essential, or which are dependencies of essential packages,
may fall back on another prompting method if no such interface is available
when they are executed.
</p>

<p>
The Debian Configuration Management Specification is included in the
<code>debconf_specification</code> files in the <code>debian-policy</code>
package.  It is also available from the Debian web mirrors at <samp><code><a
href="http://www.debian.org/doc/packaging-manuals/debconf_specification.html">/doc/packaging-manuals/debconf_specification.html</a></code></samp>.
</p>

<p>
Packages which use the Debian Configuration Management Specification may
contain the additional control information files <code>config</code> and
<code>templates</code>.  <code>config</code> is an additional maintainer script
used for package configuration, and <code>templates</code> contains templates
used for user prompting.  The <code>config</code> script might be run before
the <code>preinst</code> script and before the package is unpacked or any of
its dependencies or pre-dependencies are satisfied.  Therefore it must work
using only the tools present in <em>essential</em> packages.[<a href="#f11"
name="fr11">11</a>]
</p>

<p>
Packages which use the Debian Configuration Management Specification must allow
for translation of their user-visible messages by using a gettext-based system
such as the one provided by the <code>po-debconf</code> package.
</p>

<p>
Packages should try to minimize the amount of prompting they need to do, and
they should ensure that the user will only ever be asked each question once.
This means that packages should try to use appropriate shared configuration
files (such as <code>/etc/papersize</code> and <code>/etc/news/server</code>),
and shared <code>debconf</code> variables rather than each prompting for their
own list of required pieces of information.
</p>

<p>
It also means that an upgrade should not ask the same questions again, unless
the user has used <samp>dpkg --purge</samp> to remove the package's
configuration.  The answers to configuration questions should be stored in an
appropriate place in <code>/etc</code> so that the user can modify them, and
how this has been done should be documented.
</p>

<p>
If a package has a vitally important piece of information to pass to the user
(such as &quot;don't run me as I am, you must edit the following configuration
files first or you risk your system emitting badly-formatted messages&quot;),
it should display this in the <code>config</code> or <code>postinst</code>
script and prompt the user to hit return to acknowledge the message.  Copyright
messages do not count as vitally important (they belong in
<code>/usr/share/doc/<var>package</var>/copyright</code>); neither do
instructions on how to use a program (these should be in on-line documentation,
where all the users can see them).
</p>

<p>
Any necessary prompting should almost always be confined to the
<code>config</code> or <code>postinst</code> script.  If it is done in the
<code>postinst</code>, it should be protected with a conditional so that
unnecessary prompting doesn't happen if a package's installation fails and the
<code>postinst</code> is called with <samp>abort-upgrade</samp>,
<samp>abort-remove</samp> or <samp>abort-deconfigure</samp>.
</p>

<p><a name="ch-source"></a></p>
<hr>

<p>
[ <a href="#ch-binary">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ 4 ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-controlfields">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 4 - Source packages
</h1>

<hr>

<h2 id="s-standardsversion">4.1 Standards conformance</h2>

<p>
Source packages should specify the most recent version number of this policy
document with which your package complied when it was last updated.
</p>

<p>
This information may be used to file bug reports automatically if your package
becomes too much out of date.
</p>

<p>
The version is specified in the <samp>Standards-Version</samp> control field.
The format of the <samp>Standards-Version</samp> field is described in <a
href="#s-f-Standards-Version"><samp>Standards-Version</samp>, Section
5.6.11</a>.
</p>

<p>
You should regularly, and especially if your package has become out of date,
check for the newest Policy Manual available and update your package, if
necessary.  When your package complies with the new standards you should update
the <samp>Standards-Version</samp> source package field and release it.[<a
href="#f12" name="fr12">12</a>]
</p>

<hr>

<h2 id="s-pkg-relations">4.2 Package relationships</h2>

<p>
Source packages should specify which binary packages they require to be
installed or not to be installed in order to build correctly.  For example, if
building a package requires a certain compiler, then the compiler should be
specified as a build-time dependency.
</p>

<p>
It is not necessary to explicitly specify build-time relationships on a minimal
set of packages that are always needed to compile, link and put in a Debian
package a standard &quot;Hello World!&quot; program written in C or C++.  The
required packages are called <em>build-essential</em>, and an informational
list can be found in <code>/usr/share/doc/build-essential/list</code> (which is
contained in the <samp>build-essential</samp> package).[<a href="#f13"
name="fr13">13</a>]
</p>

<p>
When specifying the set of build-time dependencies, one should list only those
packages explicitly required by the build.  It is not necessary to list
packages which are required merely because some other package in the list of
build-time dependencies depends on them.[<a href="#f14" name="fr14">14</a>]
</p>

<p>
If build-time dependencies are specified, it must be possible to build the
package and produce working binaries on a system with only essential and
build-essential packages installed and also those required to satisfy the
build-time relationships (including any implied relationships).  In particular,
this means that version clauses should be used rigorously in build-time
relationships so that one cannot produce bad or inconsistently configured
packages when the relationships are properly satisfied.
</p>

<p>
<a href="#ch-relationships">Declaring relationships between packages, Chapter
7</a> explains the technical details.
</p>

<hr>

<h2 id="s4.3">4.3 Changes to the upstream sources</h2>

<p>
If changes to the source code are made that are not specific to the needs of
the Debian system, they should be sent to the upstream authors in whatever form
they prefer so as to be included in the upstream version of the package.
</p>

<p>
If you need to configure the package differently for Debian or for Linux, and
the upstream source doesn't provide a way to do so, you should add such
configuration facilities (for example, a new <code>autoconf</code> test or
<samp>#define</samp>) and send the patch to the upstream authors, with the
default set to the way they originally had it.  You can then easily override
the default in your <code>debian/rules</code> or wherever is appropriate.
</p>

<p>
You should make sure that the <code>configure</code> utility detects the
correct architecture specification string (refer to <a
href="#s-arch-spec">Architecture specification strings, Section 11.1</a> for
details).
</p>

<p>
If you need to edit a <code>Makefile</code> where GNU-style
<code>configure</code> scripts are used, you should edit the <code>.in</code>
files rather than editing the <code>Makefile</code> directly.  This allows the
user to reconfigure the package if necessary.  You should <em>not</em>
configure the package and edit the generated <code>Makefile</code>!  This makes
it impossible for someone else to later reconfigure the package without losing
the changes you made.
</p>

<hr>

<h2 id="s-dpkgchangelog">4.4 Debian changelog: <code>debian/changelog</code></h2>

<p>
Changes in the Debian version of the package should be briefly explained in the
Debian changelog file <code>debian/changelog</code>.[<a href="#f15"
name="fr15">15</a>] This includes modifications made in the Debian package
compared to the upstream one as well as other changes and updates to the
package.  [<a href="#f16" name="fr16">16</a>]
</p>

<p>
The format of the <code>debian/changelog</code> allows the package building
tools to discover which version of the package is being built and find out
other release-specific information.
</p>

<p>
That format is a series of entries like this:
</p>
<pre>
     <var>package</var> (<var>version</var>) <var>distribution(s)</var>; urgency=<var>urgency</var>
     	    <var>[optional blank line(s), stripped]</var>
       * <var>change details</var>
         <var>more change details</var>
     	    <var>[blank line(s), included in output of dpkg-parsechangelog]</var>
       * <var>even more change details</var>
     	    <var>[optional blank line(s), stripped]</var>
      -- <var>maintainer name</var> &lt;<var>email address</var>&gt;<var>[two spaces]</var>  <var>date</var>
</pre>

<p>
<var>package</var> and <var>version</var> are the source package name and
version number.
</p>

<p>
<var>distribution(s)</var> lists the distributions where this version should be
installed when it is uploaded - it is copied to the <samp>Distribution</samp>
field in the <code>.changes</code> file.  See <a
href="#s-f-Distribution"><samp>Distribution</samp>, Section 5.6.14</a>.
</p>

<p>
<var>urgency</var> is the value for the <samp>Urgency</samp> field in the
<code>.changes</code> file for the upload (see <a
href="#s-f-Urgency"><samp>Urgency</samp>, Section 5.6.17</a>).  It is not
possible to specify an urgency containing commas; commas are used to separate
<samp><var>keyword</var>=<var>value</var></samp> settings in the
<code>dpkg</code> changelog format (though there is currently only one useful
<var>keyword</var>, <samp>urgency</samp>).
</p>

<p>
The change details may in fact be any series of lines starting with at least
two spaces, but conventionally each change starts with an asterisk and a
separating space and continuation lines are indented so as to bring them in
line with the start of the text above.  Blank lines may be used here to
separate groups of changes, if desired.
</p>

<p>
If this upload resolves bugs recorded in the Bug Tracking System (BTS), they
may be automatically closed on the inclusion of this package into the Debian
archive by including the string: <samp>closes: Bug#<var>nnnnn</var></samp> in
the change details.[<a href="#f17" name="fr17">17</a>] This information is
conveyed via the <samp>Closes</samp> field in the <samp>.changes</samp> file
(see <a href="#s-f-Closes"><samp>Closes</samp>, Section 5.6.22</a>).
</p>

<p>
The maintainer name and email address used in the changelog should be the
details of the person who prepared this release of the package.  They are
<em>not</em> necessarily those of the uploader or usual package maintainer.[<a
href="#f18" name="fr18">18</a>] The information here will be copied to the
<samp>Changed-By</samp> field in the <samp>.changes</samp> file (see <a
href="#s-f-Changed-By"><samp>Changed-By</samp>, Section 5.6.4</a>), and then
later used to send an acknowledgement when the upload has been installed.
</p>

<p>
The <var>date</var> has the following format[<a href="#f19" name="fr19">19</a>]
(compatible and with the same semantics of RFC 2822 and RFC 5322):
</p>

<pre>
     day-of-week, dd month yyyy hh:mm:ss +zzzz
</pre>

<p>
where:
</p>
<ul>
<li>
<p>
day-of week is one of: Mon, Tue, Wed, Thu, Fri, Sat, Sun
</p>
</li>
<li>
<p>
dd is a one- or two-digit day of the month (01-31)
</p>
</li>
<li>
<p>
month is one of: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
</p>
</li>
<li>
<p>
yyyy is the four-digit year (e.g.  2010)
</p>
</li>
<li>
<p>
hh is the two-digit hour (00-23)
</p>
</li>
<li>
<p>
mm is the two-digit minutes (00-59)
</p>
</li>
<li>
<p>
ss is the two-digit seconds (00-60)
</p>
</li>
<li>
<p>
+zzzz or -zzzz is the the time zone offset from Coordinated Universal Time
(UTC).  &quot;+&quot; indicates that the time is ahead of (i.e., east of) UTC
and &quot;-&quot; indicates that the time is behind (i.e., west of) UTC.  The
first two digits indicate the hour difference from UTC and the last two digits
indicate the number of additional minutes difference from UTC.  The last two
digits must be in the range 00-59.
</p>
</li>
</ul>

<p>
The first &quot;title&quot; line with the package name must start at the left
hand margin.  The &quot;trailer&quot; line with the maintainer and date details
must be preceded by exactly one space.  The maintainer details and the date
must be separated by exactly two spaces.
</p>

<p>
The entire changelog must be encoded in UTF-8.
</p>

<p>
For more information on placement of the changelog files within binary
packages, please see <a href="#s-changelogs">Changelog files, Section 12.7</a>.
</p>

<hr>

<h2 id="s-dpkgcopyright">4.5 Copyright: <code>debian/copyright</code></h2>

<p>
Every package must be accompanied by a verbatim copy of its copyright
information and distribution license in the file
<code>/usr/share/doc/<var>package</var>/copyright</code> (see <a
href="#s-copyrightfile">Copyright information, Section 12.5</a> for further
details).  Also see <a href="#s-pkgcopyright">Copyright considerations, Section
2.3</a> for further considerations related to copyrights for packages.
</p>

<hr>

<h2 id="s4.6">4.6 Error trapping in makefiles</h2>

<p>
When <code>make</code> invokes a command in a makefile (including your
package's upstream makefiles and <code>debian/rules</code>), it does so using
<code>sh</code>.  This means that <code>sh</code>'s usual bad error handling
properties apply: if you include a miniature script as one of the commands in
your makefile you'll find that if you don't do anything about it then errors
are not detected and <code>make</code> will blithely continue after problems.
</p>

<p>
Every time you put more than one shell command (this includes using a loop) in
a makefile command you must make sure that errors are trapped.  For simple
compound commands, such as changing directory and then running a program, using
<samp>&amp;&amp;</samp> rather than semicolon as a command separator is
sufficient.  For more complex commands including most loops and conditionals
you should include a separate <samp>set -e</samp> command at the start of every
makefile command that's actually one of these miniature shell scripts.
</p>

<hr>

<h2 id="s-timestamps">4.7 Time Stamps</h2>

<p>
Maintainers should preserve the modification times of the upstream source files
in a package, as far as is reasonably possible.[<a href="#f20"
name="fr20">20</a>]
</p>

<hr>

<h2 id="s-restrictions">4.8 Restrictions on objects in source packages</h2>

<p>
The source package may not contain any hard links[<a href="#f21"
name="fr21">21</a>], device special files, sockets or setuid or setgid
files.[<a href="#f22" name="fr22">22</a>]
</p>

<hr>

<h2 id="s-debianrules">4.9 Main building script: <code>debian/rules</code></h2>

<p>
This file must be an executable makefile, and contains the package-specific
recipes for compiling the package and building binary package(s) from the
source.
</p>

<p>
It must start with the line <samp>#!/usr/bin/make -f</samp>, so that it can be
invoked by saying its name rather than invoking <code>make</code> explicitly.
That is, invoking either of <samp>make -f debian/rules <em>args...</em></samp>
or <samp>./debian/rules <em>args...</em></samp> must result in identical
behavior.
</p>

<p>
The following targets are required and must be implemented by
<code>debian/rules</code>: <samp>clean</samp>, <samp>binary</samp>,
<samp>binary-arch</samp>, <samp>binary-indep</samp>, <samp>build</samp>,
<samp>build-arch</samp> and <samp>build-indep</samp>.  These are the targets
called by <code>dpkg-buildpackage</code>.
</p>

<p>
Since an interactive <code>debian/rules</code> script makes it impossible to
auto-compile that package and also makes it hard for other people to reproduce
the same binary package, all required targets must be non-interactive.  It also
follows that any target that these targets depend on must also be
non-interactive.
</p>

<p>
For packages in the main archive, no required targets may attempt network
access.
</p>

<p>
The targets are as follows:
</p>
<dl>
<dt><samp>build</samp> (required)</dt>
<dd>
<p>
The <samp>build</samp> target should perform all the configuration and
compilation of the package.  If a package has an interactive pre-build
configuration routine, the Debian source package must either be built after
this has taken place (so that the binary package can be built without rerunning
the configuration) or the configuration routine modified to become
non-interactive.  (The latter is preferable if there are architecture-specific
features detected by the configuration routine.)
</p>

<p>
For some packages, notably ones where the same source tree is compiled in
different ways to produce two binary packages, the <samp>build</samp> target
does not make much sense.  For these packages it is good enough to provide two
(or more) targets (<samp>build-a</samp> and <samp>build-b</samp> or whatever)
for each of the ways of building the package, and a <samp>build</samp> target
that does nothing.  The <samp>binary</samp> target will have to build the
package in each of the possible ways and make the binary package out of each.
</p>

<p>
The <samp>build</samp> target must not do anything that might require root
privilege.
</p>

<p>
The <samp>build</samp> target may need to run the <samp>clean</samp> target
first - see below.
</p>

<p>
When a package has a configuration and build routine which takes a long time,
or when the makefiles are poorly designed, or when <samp>build</samp> needs to
run <samp>clean</samp> first, it is a good idea to <samp>touch build</samp>
when the build process is complete.  This will ensure that if
<samp>debian/rules build</samp> is run again it will not rebuild the whole
program.[<a href="#f23" name="fr23">23</a>]
</p>
</dd>
</dl>
<dl>
<dt><samp>build-arch</samp> (required), <samp>build-indep</samp> (required)</dt>
<dd>
<p>
The <samp>build-arch</samp> target must perform all the configuration and
compilation required for producing all architecture-dependant binary packages
(those packages for which the body of the <samp>Architecture</samp> field in
<samp>debian/control</samp> is not <samp>all</samp>).  Similarly, the
<samp>build-indep</samp> target must perform all the configuration and
compilation required for producing all architecture-independent binary packages
(those packages for which the body of the <samp>Architecture</samp> field in
<samp>debian/control</samp> is <samp>all</samp>).  The <samp>build</samp>
target should either depend on those targets or take the same actions as
invoking those targets would perform.[<a href="#f24" name="fr24">24</a>]
</p>

<p>
The <samp>build-arch</samp> and <samp>build-indep</samp> targets must not do
anything that might require root privilege.
</p>
</dd>
</dl>
<dl>
<dt><samp>binary</samp> (required), <samp>binary-arch</samp> (required), <samp>binary-indep</samp> (required)</dt>
<dd>
<p>
The <samp>binary</samp> target must be all that is necessary for the user to
build the binary package(s) produced from this source package.  It is split
into two parts: <code>binary-arch</code> builds the binary packages which are
specific to a particular architecture, and <samp>binary-indep</samp> builds
those which are not.
</p>

<p>
<samp>binary</samp> may be (and commonly is) a target with no commands which
simply depends on <samp>binary-arch</samp> and <samp>binary-indep</samp>.
</p>

<p>
Both <samp>binary-*</samp> targets should depend on the <samp>build</samp>
target, or on the appropriate <samp>build-arch</samp> or
<samp>build-indep</samp> target, if provided, so that the package is built if
it has not been already.  It should then create the relevant binary package(s),
using <code>dpkg-gencontrol</code> to make their control files and
<code>dpkg-deb</code> to build them and place them in the parent of the top
level directory.
</p>

<p>
Both the <samp>binary-arch</samp> and <samp>binary-indep</samp> targets
<em>must</em> exist.  If one of them has nothing to do (which will always be
the case if the source generates only a single binary package, whether
architecture-dependent or not), it must still exist and must always succeed.
</p>

<p>
The <samp>binary</samp> targets must be invoked as root.[<a href="#f25"
name="fr25">25</a>]
</p>
</dd>
</dl>
<dl>
<dt><samp>clean</samp> (required)</dt>
<dd>
<p>
This must undo any effects that the <samp>build</samp> and <samp>binary</samp>
targets may have had, except that it should leave alone any output files
created in the parent directory by a run of a <samp>binary</samp> target.
</p>

<p>
If a <samp>build</samp> file is touched at the end of the <samp>build</samp>
target, as suggested above, it should be removed as the first action that
<samp>clean</samp> performs, so that running <samp>build</samp> again after an
interrupted <samp>clean</samp> doesn't think that everything is already done.
</p>

<p>
The <samp>clean</samp> target may need to be invoked as root if
<samp>binary</samp> has been invoked since the last <samp>clean</samp>, or if
<samp>build</samp> has been invoked as root (since <samp>build</samp> may
create directories, for example).
</p>
</dd>
</dl>
<dl>
<dt><samp>get-orig-source</samp> (optional)</dt>
<dd>
<p>
This target fetches the most recent version of the original source package from
a canonical archive site (via FTP or WWW, for example), does any necessary
rearrangement to turn it into the original source tar file format described
below, and leaves it in the current directory.
</p>

<p>
This target may be invoked in any directory, and should take care to clean up
any temporary files it may have left.
</p>

<p>
This target is optional, but providing it if possible is a good idea.
</p>
</dd>
</dl>
<dl>
<dt><samp>patch</samp> (optional)</dt>
<dd>
<p>
This target performs whatever additional actions are required to make the
source ready for editing (unpacking additional upstream archives, applying
patches, etc.).  It is recommended to be implemented for any package where
<samp>dpkg-source -x</samp> does not result in source ready for additional
modification.  See <a href="#s-readmesource">Source package handling:
<code>debian/README.source</code>, Section 4.14</a>.
</p>
</dd>
</dl>

<p>
The <samp>build</samp>, <samp>binary</samp> and <samp>clean</samp> targets must
be invoked with the current directory being the package's top-level directory.
</p>

<p>
Additional targets may exist in <code>debian/rules</code>, either as published
or undocumented interfaces or for the package's internal use.
</p>

<p>
The architectures we build on and build for are determined by <code>make</code>
variables using the utility <code>dpkg-architecture</code>.  You can determine
the Debian architecture and the GNU style architecture specification string for
the build architecture as well as for the host architecture.  The build
architecture is the architecture on which <code>debian/rules</code> is run and
the package build is performed.  The host architecture is the architecture on
which the resulting package will be installed and run.  These are normally the
same, but may be different in the case of cross-compilation (building packages
for one architecture on machines of a different architecture).
</p>

<p>
Here is a list of supported <code>make</code> variables:
</p>
<ul>
<li>
<p>
<samp>DEB_*_ARCH</samp> (the Debian architecture)
</p>
</li>
<li>
<p>
<samp>DEB_*_ARCH_CPU</samp> (the Debian CPU name)
</p>
</li>
<li>
<p>
<samp>DEB_*_ARCH_OS</samp> (the Debian System name)
</p>
</li>
<li>
<p>
<samp>DEB_*_GNU_TYPE</samp> (the GNU style architecture specification string)
</p>
</li>
<li>
<p>
<samp>DEB_*_GNU_CPU</samp> (the CPU part of <samp>DEB_*_GNU_TYPE</samp>)
</p>
</li>
<li>
<p>
<samp>DEB_*_GNU_SYSTEM</samp> (the System part of <samp>DEB_*_GNU_TYPE</samp>)
</p>
</li>
</ul>

<p>
where <samp>*</samp> is either <samp>BUILD</samp> for specification of the
build architecture or <samp>HOST</samp> for specification of the host
architecture.
</p>

<p>
Backward compatibility can be provided in the rules file by setting the needed
variables to suitable default values; please refer to the documentation of
<code>dpkg-architecture</code> for details.
</p>

<p>
It is important to understand that the <samp>DEB_*_ARCH</samp> string only
determines which Debian architecture we are building on or for.  It should not
be used to get the CPU or system information; the <samp>DEB_*_ARCH_CPU</samp>
and <samp>DEB_*_ARCH_OS</samp> variables should be used for that.  GNU style
variables should generally only be used with upstream build systems.
</p>

<hr>

<h3 id="s-debianrules-options">4.9.1 <code>debian/rules</code> and <samp>DEB_BUILD_OPTIONS</samp></h3>

<p>
Supporting the standardized environment variable <samp>DEB_BUILD_OPTIONS</samp>
is recommended.  This variable can contain several flags to change how a
package is compiled and built.  Each flag must be in the form <var>flag</var>
or <var>flag</var>=<var>options</var>.  If multiple flags are given, they must
be separated by whitespace.[<a href="#f26" name="fr26">26</a>] <var>flag</var>
must start with a lowercase letter (<samp>a-z</samp>) and consist only of
lowercase letters, numbers (<samp>0-9</samp>), and the characters
<samp>-</samp> and <samp>_</samp> (hyphen and underscore).  <var>options</var>
must not contain whitespace.  The same tag should not be given multiple times
with conflicting values.  Package maintainers may assume that
<samp>DEB_BUILD_OPTIONS</samp> will not contain conflicting tags.
</p>

<p>
The meaning of the following tags has been standardized:
</p>
<dl>
<dt>nocheck</dt>
<dd>
<p>
This tag says to not run any build-time test suite provided by the package.
</p>
</dd>
</dl>
<dl>
<dt>noopt</dt>
<dd>
<p>
The presence of this tag means that the package should be compiled with a
minimum of optimization.  For C programs, it is best to add <samp>-O0</samp> to
<samp>CFLAGS</samp> (although this is usually the default).  Some programs
might fail to build or run at this level of optimization; it may be necessary
to use <samp>-O1</samp>, for example.
</p>
</dd>
</dl>
<dl>
<dt>nostrip</dt>
<dd>
<p>
This tag means that the debugging symbols should not be stripped from the
binary during installation, so that debugging information may be included in
the package.
</p>
</dd>
</dl>
<dl>
<dt>parallel=n</dt>
<dd>
<p>
This tag means that the package should be built using up to <samp>n</samp>
parallel processes if the package build system supports this.[<a href="#f27"
name="fr27">27</a>] If the package build system does not support parallel
builds, this string must be ignored.  If the package build system only supports
a lower level of concurrency than <var>n</var>, the package should be built
using as many parallel processes as the package build system supports.  It is
up to the package maintainer to decide whether the package build times are long
enough and the package build system is robust enough to make supporting
parallel builds worthwhile.
</p>
</dd>
</dl>

<p>
Unknown flags must be ignored by <code>debian/rules</code>.
</p>

<p>
The following makefile snippet is an example of how one may implement the build
options; you will probably have to massage this example in order to make it
work for your package.
</p>
<pre>
     CFLAGS = -Wall -g
     INSTALL = install
     INSTALL_FILE    = $(INSTALL) -p    -o root -g root  -m  644
     INSTALL_PROGRAM = $(INSTALL) -p    -o root -g root  -m  755
     INSTALL_SCRIPT  = $(INSTALL) -p    -o root -g root  -m  755
     INSTALL_DIR     = $(INSTALL) -p -d -o root -g root  -m  755
     
     ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
         CFLAGS += -O0
     else
         CFLAGS += -O2
     endif
     ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
         INSTALL_PROGRAM += -s
     endif
     ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
         NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
         MAKEFLAGS += -j$(NUMJOBS)
     endif
     
     build:
     	# ...
     ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
     	# Code to run the package test suite.
     endif
</pre>

<hr>

<h2 id="s-substvars">4.10 Variable substitutions: <code>debian/substvars</code></h2>

<p>
When <code>dpkg-gencontrol</code> generates <a
href="#s-binarycontrolfiles">binary package control files</a>
(<code>DEBIAN/control</code>), it performs variable substitutions on its output
just before writing it.  Variable substitutions have the form
<samp>${<var>variable</var>}</samp>.  The optional file
<code>debian/substvars</code> contains variable substitutions to be used;
variables can also be set directly from <code>debian/rules</code> using the
<samp>-V</samp> option to the source packaging commands, and certain predefined
variables are also available.
</p>

<p>
The <code>debian/substvars</code> file is usually generated and modified
dynamically by <code>debian/rules</code> targets, in which case it must be
removed by the <samp>clean</samp> target.
</p>

<p>
See <code>deb-substvars(5)</code> for full details about source variable
substitutions, including the format of <code>debian/substvars</code>.
</p>

<hr>

<h2 id="s-debianwatch">4.11 Optional upstream source location: <code>debian/watch</code></h2>

<p>
This is an optional, recommended configuration file for the <samp>uscan</samp>
utility which defines how to automatically scan ftp or http sites for newly
available updates of the package.  This is used Debian QA tools to help with
quality control and maintenance of the distribution as a whole.
</p>

<hr>

<h2 id="s-debianfiles">4.12 Generated files list: <code>debian/files</code></h2>

<p>
This file is not a permanent part of the source tree; it is used while building
packages to record which files are being generated.
<code>dpkg-genchanges</code> uses it when it generates a <code>.changes</code>
file.
</p>

<p>
It should not exist in a shipped source package, and so it (and any backup
files or temporary files such as <code>files.new</code>[<a href="#f28"
name="fr28">28</a>]) should be removed by the <samp>clean</samp> target.  It
may also be wise to ensure a fresh start by emptying or removing it at the
start of the <samp>binary</samp> target.
</p>

<p>
When <code>dpkg-gencontrol</code> is run for a binary package, it adds an entry
to <code>debian/files</code> for the <code>.deb</code> file that will be
created when <samp>dpkg-deb --build</samp> is run for that binary package.  So
for most packages all that needs to be done with this file is to delete it in
the <samp>clean</samp> target.
</p>

<p>
If a package upload includes files besides the source package and any binary
packages whose control files were made with <code>dpkg-gencontrol</code> then
they should be placed in the parent of the package's top-level directory and
<code>dpkg-distaddfile</code> should be called to add the file to the list in
<code>debian/files</code>.
</p>

<hr>

<h2 id="s-embeddedfiles">4.13 Convenience copies of code</h2>

<p>
Some software packages include in their distribution convenience copies of code
from other software packages, generally so that users compiling from source
don't have to download multiple packages.  Debian packages should not make use
of these convenience copies unless the included package is explicitly intended
to be used in this way.[<a href="#f29" name="fr29">29</a>] If the included code
is already in the Debian archive in the form of a library, the Debian packaging
should ensure that binary packages reference the libraries already in Debian
and the convenience copy is not used.  If the included code is not already in
Debian, it should be packaged separately as a prerequisite if possible.  [<a
href="#f30" name="fr30">30</a>]
</p>

<hr>

<h2 id="s-readmesource">4.14 Source package handling: <code>debian/README.source</code></h2>

<p>
If running <code>dpkg-source -x</code> on a source package doesn't produce the
source of the package, ready for editing, and allow one to make changes and run
<code>dpkg-buildpackage</code> to produce a modified package without taking any
additional steps, creating a <code>debian/README.source</code> documentation
file is recommended.  This file should explain how to do all of the following:
</p>
<ol type="1" start="1" >
<li>
<p>
Generate the fully patched source, in a form ready for editing, that would be
built to create Debian packages.  Doing this with a <samp>patch</samp> target
in <code>debian/rules</code> is recommended; see <a href="#s-debianrules">Main
building script: <code>debian/rules</code>, Section 4.9</a>.
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
Modify the source and save those modifications so that they will be applied
when building the package.
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
Remove source modifications that are currently being applied when building the
package.
</p>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
Optionally, document what steps are necessary to upgrade the Debian source
package to a new upstream version, if applicable.
</p>
</li>
</ol>

<p>
This explanation should include specific commands and mention any additional
required Debian packages.  It should not assume familiarity with any specific
Debian packaging system or patch management tools.
</p>

<p>
This explanation may refer to a documentation file installed by one of the
package's build dependencies provided that the referenced documentation clearly
explains these tasks and is not a general reference manual.
</p>

<p>
<code>debian/README.source</code> may also include any other information that
would be helpful to someone modifying the source package.  Even if the package
doesn't fit the above description, maintainers are encouraged to document in a
<code>debian/README.source</code> file any source package with a particularly
complex or unintuitive source layout or build system (for example, a package
that builds the same source multiple times to generate different binary
packages).
</p>

<p><a name="ch-controlfields"></a></p>
<hr>

<p>
[ <a href="#ch-source">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ 5 ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-maintainerscripts">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 5 - Control files and their fields
</h1>

<p>
The package management system manipulates data represented in a common format,
known as <em>control data</em>, stored in <em>control files</em>.  Control
files are used for source packages, binary packages and the
<code>.changes</code> files which control the installation of uploaded files[<a
href="#f31" name="fr31">31</a>].
</p>

<hr>

<h2 id="s-controlsyntax">5.1 Syntax of control files</h2>

<p>
A control file consists of one or more paragraphs of fields[<a href="#f32"
name="fr32">32</a>].  The paragraphs are separated by empty lines.  Parsers may
accept lines consisting solely of spaces and tabs as paragraph separators, but
control files should use empty lines.  Some control files allow only one
paragraph; others allow several, in which case each paragraph usually refers to
a different package.  (For example, in source packages, the first paragraph
refers to the source package, and later paragraphs refer to binary packages
generated from the source.) The ordering of the paragraphs in control files is
significant.
</p>

<p>
Each paragraph consists of a series of data fields.  Each field consists of the
field name followed by a colon and then the data/value associated with that
field.  The field name is composed of US-ASCII characters excluding control
characters, space, and colon (i.e., characters in the ranges 33-57 and 59-126,
inclusive).  Field names must not begin with the comment character,
<samp>#</samp>, nor with the hyphen character, <samp>-</samp>.
</p>

<p>
The field ends at the end of the line or at the end of the last continuation
line (see below).  Horizontal whitespace (spaces and tabs) may occur
immediately before or after the value and is ignored there; it is conventional
to put a single space after the colon.  For example, a field might be:
</p>
<pre>
     Package: libc6
</pre>

<p>
the field name is <samp>Package</samp> and the field value <samp>libc6</samp>.
</p>

<p>
Empty field values are only permitted in source package control files
(<code>debian/control</code>).  Such fields are ignored.
</p>

<p>
A paragraph must not contain more than one instance of a particular field name.
</p>

<p>
There are three types of fields:
</p>
<dl>
<dt>simple</dt>
<dd>
<p>
The field, including its value, must be a single line.  Folding of the field is
not permitted.  This is the default field type if the definition of the field
does not specify a different type.
</p>
</dd>
</dl>
<dl>
<dt>folded</dt>
<dd>
<p>
The value of a folded field is a logical line that may span several lines.  The
lines after the first are called continuation lines and must start with a space
or a tab.  Whitespace, including any newlines, is not significant in the field
values of folded fields.[<a href="#f33" name="fr33">33</a>]
</p>
</dd>
</dl>
<dl>
<dt>multiline</dt>
<dd>
<p>
The value of a multiline field may comprise multiple continuation lines.  The
first line of the value, the part on the same line as the field name, often has
special significance or may have to be empty.  Other lines are added following
the same syntax as the continuation lines of the folded fields.  Whitespace,
including newlines, is significant in the values of multiline fields.
</p>
</dd>
</dl>

<p>
Whitespace must not appear inside names (of packages, architectures, files or
anything else) or version numbers, or between the characters of multi-character
version relationships.
</p>

<p>
The presence and purpose of a field, and the syntax of its value may differ
between types of control files.
</p>

<p>
Field names are not case-sensitive, but it is usual to capitalize the field
names using mixed case as shown below.  Field values are case-sensitive unless
the description of the field says otherwise.
</p>

<p>
Paragraph separators (empty lines) and lines consisting only of spaces and tabs
are not allowed within field values or between fields.  Empty lines in field
values are usually escaped by representing them by a space followed by a dot.
</p>

<p>
Lines starting with # without any preceding whitespace are comments lines that
are only permitted in source package control files
(<code>debian/control</code>).  These comment lines are ignored, even between
two continuation lines.  They do not end logical lines.
</p>

<p>
All control files must be encoded in UTF-8.
</p>

<hr>

<h2 id="s-sourcecontrolfiles">5.2 Source package control files -- <code>debian/control</code></h2>

<p>
The <code>debian/control</code> file contains the most vital (and
version-independent) information about the source package and about the binary
packages it creates.
</p>

<p>
The first paragraph of the control file contains information about the source
package in general.  The subsequent sets each describe a binary package that
the source tree builds.
</p>

<p>
The fields in the general paragraph (the first one, for the source package)
are:
</p>
<ul>
<li>
<p>
<a href="#s-f-Source"><samp>Source</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Maintainer"><samp>Maintainer</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Uploaders"><samp>Uploaders</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Section"><samp>Section</samp></a> (recommended)
</p>
</li>
<li>
<p>
<a href="#s-f-Priority"><samp>Priority</samp></a> (recommended)
</p>
</li>
<li>
<p>
<a href="#s-sourcebinarydeps"><samp>Build-Depends</samp> et al</a>
</p>
</li>
<li>
<p>
<a href="#s-f-Standards-Version"><samp>Standards-Version</samp></a>
(recommended)
</p>
</li>
<li>
<p>
<a href="#s-f-Homepage"><samp>Homepage</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-VCS-fields"><samp>Vcs-Browser</samp>, <samp>Vcs-Git</samp>, et
al.</a>
</p>
</li>
</ul>

<p>
The fields in the binary package paragraphs are:
</p>
<ul>
<li>
<p>
<a href="#s-f-Package"><samp>Package</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Architecture"><samp>Architecture</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Section"><samp>Section</samp></a> (recommended)
</p>
</li>
<li>
<p>
<a href="#s-f-Priority"><samp>Priority</samp></a> (recommended)
</p>
</li>
<li>
<p>
<a href="#s-f-Essential"><samp>Essential</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-binarydeps"><samp>Depends</samp> et al</a>
</p>
</li>
<li>
<p>
<a href="#s-f-Description"><samp>Description</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Homepage"><samp>Homepage</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-built-using"><samp>Built-Using</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Package-Type"><samp>Package-Type</samp></a>
</p>
</li>
</ul>

<p>
The syntax and semantics of the fields are described below.
</p>

<p>
These fields are used by <code>dpkg-gencontrol</code> to generate control files
for binary packages (see below), by <code>dpkg-genchanges</code> to generate
the <code>.changes</code> file to accompany the upload, and by
<code>dpkg-source</code> when it creates the <code>.dsc</code> source control
file as part of a source archive.  Some fields are folded in
<code>debian/control</code>, but not in any other control file.  These tools
are responsible for removing the line breaks from such fields when using fields
from <code>debian/control</code> to generate other control files.  They are
also responsible for discarding empty fields.
</p>

<p>
The fields here may contain variable references - their values will be
substituted by <code>dpkg-gencontrol</code>, <code>dpkg-genchanges</code> or
<code>dpkg-source</code> when they generate output control files.  See <a
href="#s-substvars">Variable substitutions: <code>debian/substvars</code>,
Section 4.10</a> for details.
</p>

<hr>

<h2 id="s-binarycontrolfiles">5.3 Binary package control files -- <code>DEBIAN/control</code></h2>

<p>
The <code>DEBIAN/control</code> file contains the most vital (and
version-dependent) information about a binary package.  It consists of a single
paragraph.
</p>

<p>
The fields in this file are:
</p>
<ul>
<li>
<p>
<a href="#s-f-Package"><samp>Package</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Source"><samp>Source</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Version"><samp>Version</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Section"><samp>Section</samp></a> (recommended)
</p>
</li>
<li>
<p>
<a href="#s-f-Priority"><samp>Priority</samp></a> (recommended)
</p>
</li>
<li>
<p>
<a href="#s-f-Architecture"><samp>Architecture</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Essential"><samp>Essential</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-binarydeps"><samp>Depends</samp> et al</a>
</p>
</li>
<li>
<p>
<a href="#s-f-Installed-Size"><samp>Installed-Size</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Maintainer"><samp>Maintainer</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Description"><samp>Description</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Homepage"><samp>Homepage</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-built-using"><samp>Built-Using</samp></a>
</p>
</li>
</ul>

<hr>

<h2 id="s-debiansourcecontrolfiles">5.4 Debian source control files -- <samp>.dsc</samp></h2>

<p>
This file consists of a single paragraph, possibly surrounded by a PGP
signature.  The fields of that paragraph are listed below.  Their syntax is
described above, in <a href="#s-controlsyntax">Syntax of control files, Section
5.1</a>.
</p>
<ul>
<li>
<p>
<a href="#s-f-Format"><samp>Format</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Source"><samp>Source</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Binary"><samp>Binary</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Architecture"><samp>Architecture</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Version"><samp>Version</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Maintainer"><samp>Maintainer</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Uploaders"><samp>Uploaders</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Homepage"><samp>Homepage</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-VCS-fields"><samp>Vcs-Browser</samp>, <samp>Vcs-Git</samp>, et
al.</a>
</p>
</li>
<li>
<p>
<a href="#s-f-Dgit"><samp>Dgit</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Standards-Version"><samp>Standards-Version</samp></a>
(recommended)
</p>
</li>
<li>
<p>
<a href="#s-sourcebinarydeps"><samp>Build-Depends</samp> et al</a>
</p>
</li>
<li>
<p>
<a href="#s-f-Package-List"><samp>Package-List</samp></a> (recommended)
</p>
</li>
<li>
<p>
<a href="#s-f-Checksums"><samp>Checksums-Sha1</samp> and
<samp>Checksums-Sha256</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Files"><samp>Files</samp></a> (mandatory)
</p>
</li>
</ul>

<p>
The Debian source control file is generated by <code>dpkg-source</code> when it
builds the source archive, from other files in the source package, described
above.  When unpacking, it is checked against the files and directories in the
other parts of the source package.
</p>

<hr>

<h2 id="s-debianchangesfiles">5.5 Debian changes files -- <code>.changes</code></h2>

<p>
The <code>.changes</code> files are used by the Debian archive maintenance
software to process updates to packages.  They consist of a single paragraph,
possibly surrounded by a PGP signature.  That paragraph contains information
from the <code>debian/control</code> file and other data about the source
package gathered via <code>debian/changelog</code> and
<code>debian/rules</code>.
</p>

<p>
<code>.changes</code> files have a format version that is incremented whenever
the documented fields or their meaning change.  This document describes format
1.8.
</p>

<p>
The fields in this file are:
</p>
<ul>
<li>
<p>
<a href="#s-f-Format"><samp>Format</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Date"><samp>Date</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Source"><samp>Source</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Binary"><samp>Binary</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Architecture"><samp>Architecture</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Version"><samp>Version</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Distribution"><samp>Distribution</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Urgency"><samp>Urgency</samp></a> (recommended)
</p>
</li>
<li>
<p>
<a href="#s-f-Maintainer"><samp>Maintainer</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Changed-By"><samp>Changed-By</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Description"><samp>Description</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Closes"><samp>Closes</samp></a>
</p>
</li>
<li>
<p>
<a href="#s-f-Changes"><samp>Changes</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Checksums"><samp>Checksums-Sha1</samp> and
<samp>Checksums-Sha256</samp></a> (mandatory)
</p>
</li>
<li>
<p>
<a href="#s-f-Files"><samp>Files</samp></a> (mandatory)
</p>
</li>
</ul>

<hr>

<h2 id="s-controlfieldslist">5.6 List of fields</h2>

<hr>

<h3 id="s-f-Source">5.6.1 <samp>Source</samp></h3>

<p>
This field identifies the source package name.
</p>

<p>
In <code>debian/control</code> or a <code>.dsc</code> file, this field must
contain only the name of the source package.
</p>

<p>
In a binary package control file or a <code>.changes</code> file, the source
package name may be followed by a version number in parentheses[<a href="#f34"
name="fr34">34</a>].  This version number may be omitted (and is, by
<code>dpkg-gencontrol</code>) if it has the same value as the
<samp>Version</samp> field of the binary package in question.  The field itself
may be omitted from a binary package control file when the source package has
the same name and version as the binary package.
</p>

<p>
Package names (both source and binary, see <a
href="#s-f-Package"><samp>Package</samp>, Section 5.6.7</a>) must consist only
of lower case letters (<samp>a-z</samp>), digits (<samp>0-9</samp>), plus
(<samp>+</samp>) and minus (<samp>-</samp>) signs, and periods
(<samp>.</samp>).  They must be at least two characters long and must start
with an alphanumeric character.
</p>

<hr>

<h3 id="s-f-Maintainer">5.6.2 <samp>Maintainer</samp></h3>

<p>
The package maintainer's name and email address.  The name must come first,
then the email address inside angle brackets <samp>&lt;&gt;</samp> (in RFC822
format).
</p>

<p>
If the maintainer's name contains a full stop then the whole field will not
work directly as an email address due to a misfeature in the syntax specified
in RFC822; a program using this field as an address must check for this and
correct the problem if necessary (for example by putting the name in round
brackets and moving it to the end, and bringing the email address forward).
</p>

<p>
See <a href="#s-maintainer">The maintainer of a package, Section 3.3</a> for
additional requirements and information about package maintainers.
</p>

<hr>

<h3 id="s-f-Uploaders">5.6.3 <samp>Uploaders</samp></h3>

<p>
List of the names and email addresses of co-maintainers of the package, if any.
If the package has other maintainers besides the one named in the <a
href="#s-f-Maintainer">Maintainer field</a>, their names and email addresses
should be listed here.  The format of each entry is the same as that of the
Maintainer field, and multiple entries must be comma separated.
</p>

<p>
This is normally an optional field, but if the <samp>Maintainer</samp> control
field names a group of people and a shared email address, the
<samp>Uploaders</samp> field must be present and must contain at least one
human with their personal email address.
</p>

<p>
The Uploaders field in <code>debian/control</code> can be folded.
</p>

<hr>

<h3 id="s-f-Changed-By">5.6.4 <samp>Changed-By</samp></h3>

<p>
The name and email address of the person who prepared this version of the
package, usually a maintainer.  The syntax is the same as for the <a
href="#s-f-Maintainer">Maintainer field</a>.
</p>

<hr>

<h3 id="s-f-Section">5.6.5 <samp>Section</samp></h3>

<p>
This field specifies an application area into which the package has been
classified.  See <a href="#s-subsections">Sections, Section 2.4</a>.
</p>

<p>
When it appears in the <code>debian/control</code> file, it gives the value for
the subfield of the same name in the <samp>Files</samp> field of the
<code>.changes</code> file.  It also gives the default for the same field in
the binary packages.
</p>

<hr>

<h3 id="s-f-Priority">5.6.6 <samp>Priority</samp></h3>

<p>
This field represents how important it is that the user have the package
installed.  See <a href="#s-priorities">Priorities, Section 2.5</a>.
</p>

<p>
When it appears in the <code>debian/control</code> file, it gives the value for
the subfield of the same name in the <samp>Files</samp> field of the
<code>.changes</code> file.  It also gives the default for the same field in
the binary packages.
</p>

<hr>

<h3 id="s-f-Package">5.6.7 <samp>Package</samp></h3>

<p>
The name of the binary package.
</p>

<p>
Binary package names must follow the same syntax and restrictions as source
package names.  See <a href="#s-f-Source"><samp>Source</samp>, Section
5.6.1</a> for the details.
</p>

<hr>

<h3 id="s-f-Architecture">5.6.8 <samp>Architecture</samp></h3>

<p>
Depending on context and the control file used, the <samp>Architecture</samp>
field can include the following sets of values:
</p>
<ul>
<li>
<p>
A unique single word identifying a Debian machine architecture as described in
<a href="#s-arch-spec">Architecture specification strings, Section 11.1</a>.
</p>
</li>
</ul>
<ul>
<li>
<p>
An architecture wildcard identifying a set of Debian machine architectures, see
<a href="#s-arch-wildcard-spec">Architecture wildcards, Section 11.1.1</a>.
<samp>any</samp> matches all Debian machine architectures and is the most
frequently used.
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>all</samp>, which indicates an architecture-independent package.
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>source</samp>, which indicates a source package.
</p>
</li>
</ul>

<p>
In the main <code>debian/control</code> file in the source package, this field
may contain the special value <samp>all</samp>, the special architecture
wildcard <samp>any</samp>, or a list of specific and wildcard architectures
separated by spaces.  If <samp>all</samp> or <samp>any</samp> appears, that
value must be the entire contents of the field.  Most packages will use either
<samp>all</samp> or <samp>any</samp>.
</p>

<p>
Specifying a specific list of architectures indicates that the source will
build an architecture-dependent package only on architectures included in the
list.  Specifying a list of architecture wildcards indicates that the source
will build an architecture-dependent package on only those architectures that
match any of the specified architecture wildcards.  Specifying a list of
architectures or architecture wildcards other than <samp>any</samp> is for the
minority of cases where a program is not portable or is not useful on some
architectures.  Where possible, the program should be made portable instead.
</p>

<p>
In the Debian source control file <code>.dsc</code>, this field contains a list
of architectures and architecture wildcards separated by spaces.  When the list
contains the architecture wildcard <samp>any</samp>, the only other value
allowed in the list is <samp>all</samp>.
</p>

<p>
The list may include (or consist solely of) the special value <samp>all</samp>.
In other words, in <code>.dsc</code> files unlike the
<code>debian/control</code>, <samp>all</samp> may occur in combination with
specific architectures.  The <samp>Architecture</samp> field in the Debian
source control file <code>.dsc</code> is generally constructed from the
<samp>Architecture</samp> fields in the <code>debian/control</code> in the
source package.
</p>

<p>
Specifying only <samp>any</samp> indicates that the source package isn't
dependent on any particular architecture and should compile fine on any one.
The produced binary package(s) will be specific to whatever the current build
architecture is.
</p>

<p>
Specifying only <samp>all</samp> indicates that the source package will only
build architecture-independent packages.
</p>

<p>
Specifying <samp>any all</samp> indicates that the source package isn't
dependent on any particular architecture.  The set of produced binary packages
will include at least one architecture-dependant package and one
architecture-independent package.
</p>

<p>
Specifying a list of architectures or architecture wildcards indicates that the
source will build an architecture-dependent package, and will only work
correctly on the listed or matching architectures.  If the source package also
builds at least one architecture-independent package, <samp>all</samp> will
also be included in the list.
</p>

<p>
In a <code>.changes</code> file, the <samp>Architecture</samp> field lists the
architecture(s) of the package(s) currently being uploaded.  This will be a
list; if the source for the package is also being uploaded, the special entry
<samp>source</samp> is also present.  <samp>all</samp> will be present if any
architecture-independent packages are being uploaded.  Architecture wildcards
such as <samp>any</samp> must never occur in the <samp>Architecture</samp>
field in the <code>.changes</code> file.
</p>

<p>
See <a href="#s-debianrules">Main building script: <code>debian/rules</code>,
Section 4.9</a> for information on how to get the architecture for the build
process.
</p>

<hr>

<h3 id="s-f-Essential">5.6.9 <samp>Essential</samp></h3>

<p>
This is a boolean field which may occur only in the control file of a binary
package or in a per-package fields paragraph of a source package control file.
</p>

<p>
If set to <samp>yes</samp> then the package management system will refuse to
remove the package (upgrading and replacing it is still possible).  The other
possible value is <samp>no</samp>, which is the same as not having the field at
all.
</p>

<hr>

<h3 id="s5.6.10">5.6.10 Package interrelationship fields: <samp>Depends</samp>, <samp>Pre-Depends</samp>, <samp>Recommends</samp>, <samp>Suggests</samp>, <samp>Breaks</samp>, <samp>Conflicts</samp>, <samp>Provides</samp>, <samp>Replaces</samp>, <samp>Enhances</samp></h3>

<p>
These fields describe the package's relationships with other packages.  Their
syntax and semantics are described in <a href="#ch-relationships">Declaring
relationships between packages, Chapter 7</a>.
</p>

<hr>

<h3 id="s-f-Standards-Version">5.6.11 <samp>Standards-Version</samp></h3>

<p>
The most recent version of the standards (the policy manual and associated
texts) with which the package complies.
</p>

<p>
The version number has four components: major and minor version number and
major and minor patch level.  When the standards change in a way that requires
every package to change the major number will be changed.  Significant changes
that will require work in many packages will be signaled by a change to the
minor number.  The major patch level will be changed for any change to the
meaning of the standards, however small; the minor patch level will be changed
when only cosmetic, typographical or other edits are made which neither change
the meaning of the document nor affect the contents of packages.
</p>

<p>
Thus only the first three components of the policy version are significant in
the <em>Standards-Version</em> control field, and so either these three
components or all four components may be specified.[<a href="#f35"
name="fr35">35</a>]
</p>

<hr>

<h3 id="s-f-Version">5.6.12 <samp>Version</samp></h3>

<p>
The version number of a package.  The format is:
[<var>epoch</var><samp>:</samp>]<var>upstream_version</var>[<samp>-</samp><var>debian_revision</var>]
</p>

<p>
The three components here are:
</p>
<dl>
<dt><var>epoch</var></dt>
<dd>
<p>
This is a single (generally small) unsigned integer.  It may be omitted, in
which case zero is assumed.  If it is omitted then the
<var>upstream_version</var> may not contain any colons.
</p>

<p>
It is provided to allow mistakes in the version numbers of older versions of a
package, and also a package's previous version numbering schemes, to be left
behind.
</p>
</dd>
</dl>
<dl>
<dt><var>upstream_version</var></dt>
<dd>
<p>
This is the main part of the version number.  It is usually the version number
of the original (&quot;upstream&quot;) package from which the <code>.deb</code>
file has been made, if this is applicable.  Usually this will be in the same
format as that specified by the upstream author(s); however, it may need to be
reformatted to fit into the package management system's format and comparison
scheme.
</p>

<p>
The comparison behavior of the package management system with respect to the
<var>upstream_version</var> is described below.  The
<var>upstream_version</var> portion of the version number is mandatory.
</p>

<p>
The <var>upstream_version</var> may contain only alphanumerics[<a href="#f36"
name="fr36">36</a>] and the characters <samp>.</samp> <samp>+</samp>
<samp>-</samp> <samp>:</samp> <samp>~</samp> (full stop, plus, hyphen, colon,
tilde) and should start with a digit.  If there is no
<var>debian_revision</var> then hyphens are not allowed; if there is no
<var>epoch</var> then colons are not allowed.
</p>
</dd>
</dl>
<dl>
<dt><var>debian_revision</var></dt>
<dd>
<p>
This part of the version number specifies the version of the Debian package
based on the upstream version.  It may contain only alphanumerics and the
characters <samp>+</samp> <samp>.</samp> <samp>~</samp> (plus, full stop,
tilde) and is compared in the same way as the <var>upstream_version</var> is.
</p>

<p>
It is optional; if it isn't present then the <var>upstream_version</var> may
not contain a hyphen.  This format represents the case where a piece of
software was written specifically to be a Debian package, where the Debian
package source must always be identical to the pristine source and therefore no
revision indication is required.
</p>

<p>
It is conventional to restart the <var>debian_revision</var> at <samp>1</samp>
each time the <var>upstream_version</var> is increased.
</p>

<p>
The package management system will break the version number apart at the last
hyphen in the string (if there is one) to determine the
<var>upstream_version</var> and <var>debian_revision</var>.  The absence of a
<var>debian_revision</var> is equivalent to a <var>debian_revision</var> of
<samp>0</samp>.
</p>
</dd>
</dl>

<p>
When comparing two version numbers, first the <var>epoch</var> of each are
compared, then the <var>upstream_version</var> if <var>epoch</var> is equal,
and then <var>debian_revision</var> if <var>upstream_version</var> is also
equal.  <var>epoch</var> is compared numerically.  The
<var>upstream_version</var> and <var>debian_revision</var> parts are compared
by the package management system using the following algorithm:
</p>

<p>
The strings are compared from left to right.
</p>

<p>
First the initial part of each string consisting entirely of non-digit
characters is determined.  These two parts (one of which may be empty) are
compared lexically.  If a difference is found it is returned.  The lexical
comparison is a comparison of ASCII values modified so that all the letters
sort earlier than all the non-letters and so that a tilde sorts before
anything, even the end of a part.  For example, the following parts are in
sorted order from earliest to latest: <samp>~~</samp>, <samp>~~a</samp>,
<samp>~</samp>, the empty part, <samp>a</samp>.[<a href="#f37"
name="fr37">37</a>]
</p>

<p>
Then the initial part of the remainder of each string which consists entirely
of digit characters is determined.  The numerical values of these two parts are
compared, and any difference found is returned as the result of the comparison.
For these purposes an empty string (which can only occur at the end of one or
both version strings being compared) counts as zero.
</p>

<p>
These two steps (comparing and removing initial non-digit strings and initial
digit strings) are repeated until a difference is found or both strings are
exhausted.
</p>

<p>
Note that the purpose of epochs is to allow us to leave behind mistakes in
version numbering, and to cope with situations where the version numbering
scheme changes.  It is <em>not</em> intended to cope with version numbers
containing strings of letters which the package management system cannot
interpret (such as <samp>ALPHA</samp> or <samp>pre-</samp>), or with silly
orderings.[<a href="#f38" name="fr38">38</a>]
</p>

<hr>

<h3 id="s-f-Description">5.6.13 <samp>Description</samp></h3>

<p>
In a source or binary control file, the <samp>Description</samp> field contains
a description of the binary package, consisting of two parts, the synopsis or
the short description, and the long description.  It is a multiline field with
the following format:
</p>

<pre>
     	Description: &lt;single line synopsis&gt;
     	 &lt;extended description over several lines&gt;
</pre>

<p>
The lines in the extended description can have these formats:
</p>
<ul>
<li>
<p>
Those starting with a single space are part of a paragraph.  Successive lines
of this form will be word-wrapped when displayed.  The leading space will
usually be stripped off.  The line must contain at least one non-whitespace
character.
</p>
</li>
</ul>
<ul>
<li>
<p>
Those starting with two or more spaces.  These will be displayed verbatim.  If
the display cannot be panned horizontally, the displaying program will line
wrap them &quot;hard&quot; (i.e., without taking account of word breaks).  If
it can they will be allowed to trail off to the right.  None, one or two
initial spaces may be deleted, but the number of spaces deleted from each line
will be the same (so that you can have indenting work correctly, for example).
The line must contain at least one non-whitespace character.
</p>
</li>
</ul>
<ul>
<li>
<p>
Those containing a single space followed by a single full stop character.
These are rendered as blank lines.  This is the <em>only</em> way to get a
blank line[<a href="#f39" name="fr39">39</a>].
</p>
</li>
</ul>
<ul>
<li>
<p>
Those containing a space, a full stop and some more characters.  These are for
future expansion.  Do not use them.
</p>
</li>
</ul>

<p>
Do not use tab characters.  Their effect is not predictable.
</p>

<p>
See <a href="#s-descriptions">The description of a package, Section 3.4</a> for
further information on this.
</p>

<p>
In a <code>.changes</code> file, the <samp>Description</samp> field contains a
summary of the descriptions for the packages being uploaded.  For this case,
the first line of the field value (the part on the same line as
<samp>Description:</samp>) is always empty.  It is a multiline field, with one
line per package.  Each line is indented by one space and contains the name of
a binary package, a space, a hyphen (<samp>-</samp>), a space, and the short
description line from that package.
</p>

<hr>

<h3 id="s-f-Distribution">5.6.14 <samp>Distribution</samp></h3>

<p>
In a <code>.changes</code> file or parsed changelog output this contains the
(space-separated) name(s) of the distribution(s) where this version of the
package should be installed.  Valid distributions are determined by the archive
maintainers.[<a href="#f40" name="fr40">40</a>] The Debian archive software
only supports listing a single distribution.  Migration of packages to other
distributions is handled outside of the upload process.
</p>

<hr>

<h3 id="s-f-Date">5.6.15 <samp>Date</samp></h3>

<p>
This field includes the date the package was built or last edited.  It must be
in the same format as the <var>date</var> in a <code>debian/changelog</code>
entry.
</p>

<p>
The value of this field is usually extracted from the
<code>debian/changelog</code> file - see <a href="#s-dpkgchangelog">Debian
changelog: <code>debian/changelog</code>, Section 4.4</a>).
</p>

<hr>

<h3 id="s-f-Format">5.6.16 <samp>Format</samp></h3>

<p>
In <a href="#s-debianchangesfiles"><code>.changes</code></a> files, this field
declares the format version of that file.  The syntax of the field value is the
same as that of a <a href="#s-f-Version">package version number</a> except that
no epoch or Debian revision is allowed.  The format described in this document
is <samp>1.8</samp>.
</p>

<p>
In <a href="#s-debiansourcecontrolfiles"><code>.dsc</code> Debian source
control</a> files, this field declares the format of the source package.  The
field value is used by programs acting on a source package to interpret the
list of files in the source package and determine how to unpack it.  The syntax
of the field value is a numeric major revision, a period, a numeric minor
revision, and then an optional subtype after whitespace, which if specified is
an alphanumeric word in parentheses.  The subtype is optional in the syntax but
may be mandatory for particular source format revisions.  [<a href="#f41"
name="fr41">41</a>]
</p>

<hr>

<h3 id="s-f-Urgency">5.6.17 <samp>Urgency</samp></h3>

<p>
This is a description of how important it is to upgrade to this version from
previous ones.  It consists of a single keyword taking one of the values
<samp>low</samp>, <samp>medium</samp>, <samp>high</samp>,
<samp>emergency</samp>, or <samp>critical</samp>[<a href="#f42"
name="fr42">42</a>] (not case-sensitive) followed by an optional commentary
(separated by a space) which is usually in parentheses.  For example:
</p>

<pre>
       Urgency: low (HIGH for users of diversions)
</pre>

<p>
The value of this field is usually extracted from the
<code>debian/changelog</code> file - see <a href="#s-dpkgchangelog">Debian
changelog: <code>debian/changelog</code>, Section 4.4</a>.
</p>

<hr>

<h3 id="s-f-Changes">5.6.18 <samp>Changes</samp></h3>

<p>
This multiline field contains the human-readable changes data, describing the
differences between the last version and the current one.
</p>

<p>
The first line of the field value (the part on the same line as
<samp>Changes:</samp>) is always empty.  The content of the field is expressed
as continuation lines, with each line indented by at least one space.  Blank
lines must be represented by a line consisting only of a space and a full stop
(<samp>.</samp>).
</p>

<p>
The value of this field is usually extracted from the
<code>debian/changelog</code> file - see <a href="#s-dpkgchangelog">Debian
changelog: <code>debian/changelog</code>, Section 4.4</a>).
</p>

<p>
Each version's change information should be preceded by a &quot;title&quot;
line giving at least the version, distribution(s) and urgency, in a
human-readable way.
</p>

<p>
If data from several versions is being returned the entry for the most recent
version should be returned first, and entries should be separated by the
representation of a blank line (the &quot;title&quot; line may also be followed
by the representation of a blank line).
</p>

<hr>

<h3 id="s-f-Binary">5.6.19 <samp>Binary</samp></h3>

<p>
This folded field is a list of binary packages.  Its syntax and meaning varies
depending on the control file in which it appears.
</p>

<p>
When it appears in the <code>.dsc</code> file, it lists binary packages which a
source package can produce, separated by commas[<a href="#f43"
name="fr43">43</a>].  The source package does not necessarily produce all of
these binary packages for every architecture.  The source control file doesn't
contain details of which architectures are appropriate for which of the binary
packages.
</p>

<p>
When it appears in a <code>.changes</code> file, it lists the names of the
binary packages being uploaded, separated by whitespace (not commas).
</p>

<hr>

<h3 id="s-f-Installed-Size">5.6.20 <samp>Installed-Size</samp></h3>

<p>
This field appears in the control files of binary packages, and in the
<code>Packages</code> files.  It gives an estimate of the total amount of disk
space required to install the named package.  Actual installed size may vary
based on block size, file system properties, or actions taken by package
maintainer scripts.
</p>

<p>
The disk space is given as the integer value of the estimated installed size in
bytes, divided by 1024 and rounded up.
</p>

<hr>

<h3 id="s-f-Files">5.6.21 <samp>Files</samp></h3>

<p>
This field contains a list of files with information about each one.  The exact
information and syntax varies with the context.
</p>

<p>
In all cases, Files is a multiline field.  The first line of the field value
(the part on the same line as <samp>Files:</samp>) is always empty.  The
content of the field is expressed as continuation lines, one line per file.
Each line must be indented by one space and contain a number of sub-fields,
separated by spaces, as described below.
</p>

<p>
In the <code>.dsc</code> file, each line contains the MD5 checksum, size and
filename of the tar file and (if applicable) diff file which make up the
remainder of the source package[<a href="#f44" name="fr44">44</a>].  For
example:
</p>

<pre>
     Files:
      c6f698f19f2a2aa07dbb9bbda90a2754 571925 example_1.2.orig.tar.gz
      938512f08422f3509ff36f125f5873ba 6220 example_1.2-1.diff.gz
</pre>

<p>
The exact forms of the filenames are described in <a
href="#s-pkg-sourcearchives">Source packages as archives, Section C.3</a>.
</p>

<p>
In the <code>.changes</code> file this contains one line per file being
uploaded.  Each line contains the MD5 checksum, size, section and priority and
the filename.  For example:
</p>

<pre>
     Files:
      4c31ab7bfc40d3cf49d7811987390357 1428 text extra example_1.2-1.dsc
      c6f698f19f2a2aa07dbb9bbda90a2754 571925 text extra example_1.2.orig.tar.gz
      938512f08422f3509ff36f125f5873ba 6220 text extra example_1.2-1.diff.gz
      7c98fe853b3bbb47a00e5cd129b6cb56 703542 text extra example_1.2-1_i386.deb
</pre>

<p>
The <a href="#s-f-Section">section</a> and <a href="#s-f-Priority">priority</a>
are the values of the corresponding fields in the main source control file.  If
no section or priority is specified then <samp>-</samp> should be used, though
section and priority values must be specified for new packages to be installed
properly.
</p>

<p>
The special value <samp>byhand</samp> for the section in a
<samp>.changes</samp> file indicates that the file in question is not an
ordinary package file and must be installed by hand by the distribution
maintainers.  If the section is <samp>byhand</samp> the priority should be
<samp>-</samp>.
</p>

<p>
If a new Debian revision of a package is being shipped and no new original
source archive is being distributed the <samp>.dsc</samp> must still contain
the <samp>Files</samp> field entry for the original source archive
<code><var>package</var>_<var>upstream-version</var>.orig.tar.gz</code>, but
the <code>.changes</code> file should leave it out.  In this case the original
source archive on the distribution site must match exactly, byte-for-byte, the
original source archive which was used to generate the <code>.dsc</code> file
and diff which are being uploaded.
</p>

<hr>

<h3 id="s-f-Closes">5.6.22 <samp>Closes</samp></h3>

<p>
A space-separated list of bug report numbers that the upload governed by the
.changes file closes.
</p>

<hr>

<h3 id="s-f-Homepage">5.6.23 <samp>Homepage</samp></h3>

<p>
The URL of the web site for this package, preferably (when applicable) the site
from which the original source can be obtained and any additional upstream
documentation or information may be found.  The content of this field is a
simple URL without any surrounding characters such as <samp>&lt;&gt;</samp>.
</p>

<hr>

<h3 id="s-f-Checksums">5.6.24 <samp>Checksums-Sha1</samp> and <samp>Checksums-Sha256</samp></h3>

<p>
These multiline fields contain a list of files with a checksum and size for
each one.  Both <samp>Checksums-Sha1</samp> and <samp>Checksums-Sha256</samp>
have the same syntax and differ only in the checksum algorithm used: SHA-1 for
<samp>Checksums-Sha1</samp> and SHA-256 for <samp>Checksums-Sha256</samp>.
</p>

<p>
<samp>Checksums-Sha1</samp> and <samp>Checksums-Sha256</samp> are multiline
fields.  The first line of the field value (the part on the same line as
<samp>Checksums-Sha1:</samp> or <samp>Checksums-Sha256:</samp>) is always
empty.  The content of the field is expressed as continuation lines, one line
per file.  Each line consists of the checksum, a space, the file size, a space,
and the file name.  For example (from a <code>.changes</code> file):
</p>

<pre>
     Checksums-Sha1:
      1f418afaa01464e63cc1ee8a66a05f0848bd155c 1276 example_1.0-1.dsc
      a0ed1456fad61116f868b1855530dbe948e20f06 171602 example_1.0.orig.tar.gz
      5e86ecf0671e113b63388dac81dd8d00e00ef298 6137 example_1.0-1.debian.tar.gz
      71a0ff7da0faaf608481195f9cf30974b142c183 548402 example_1.0-1_i386.deb
     Checksums-Sha256:
      ac9d57254f7e835bed299926fd51bf6f534597cc3fcc52db01c4bffedae81272 1276 example_1.0-1.dsc
      0d123be7f51e61c4bf15e5c492b484054be7e90f3081608a5517007bfb1fd128 171602 example_1.0.orig.tar.gz
      f54ae966a5f580571ae7d9ef5e1df0bd42d63e27cb505b27957351a495bc6288 6137 example_1.0-1.debian.tar.gz
      3bec05c03974fdecd11d020fc2e8250de8404867a8a2ce865160c250eb723664 548402 example_1.0-1_i386.deb
</pre>

<p>
In the <code>.dsc</code> file, these fields list all files that make up the
source package.  In the <code>.changes</code> file, these fields list all files
being uploaded.  The list of files in these fields must match the list of files
in the <samp>Files</samp> field.
</p>

<hr>

<h3 id="s5.6.25">5.6.25 <samp>DM-Upload-Allowed</samp></h3>

<p>
Obsolete, see <a href="#s-f-DM-Upload-Allowed">below</a>.
</p>

<hr>

<h3 id="s-f-VCS-fields">5.6.26 Version Control System (VCS) fields</h3>

<p>
Debian source packages are increasingly developed using VCSs.  The purpose of
the following fields is to indicate a publicly accessible repository where the
Debian source package is developed.
</p>
<dl>
<dt><samp>Vcs-Browser</samp></dt>
<dd>
<p>
URL of a web interface for browsing the repository.
</p>
</dd>
</dl>
<dl>
<dt><samp>Vcs-Arch</samp>, <samp>Vcs-Bzr</samp> (Bazaar), <samp>Vcs-Cvs</samp>, <samp>Vcs-Darcs</samp>, <samp>Vcs-Git</samp>, <samp>Vcs-Hg</samp> (Mercurial), <samp>Vcs-Mtn</samp> (Monotone), <samp>Vcs-Svn</samp> (Subversion)</dt>
<dd>
<p>
The field name identifies the VCS.  The field's value uses the version control
system's conventional syntax for describing repository locations and should be
sufficient to locate the repository used for packaging.  Ideally, it also
locates the branch used for development of new versions of the Debian package.
</p>

<p>
In the case of Git, the value consists of a URL, optionally followed by the
word <samp>-b</samp> and the name of a branch in the indicated repository,
following the syntax of the <samp>git clone</samp> command.  If no branch is
specified, the packaging should be on the default branch.
</p>

<p>
More than one different VCS may be specified for the same package.
</p>
</dd>
</dl>

<hr>

<h3 id="s-f-Package-List">5.6.27 <samp>Package-List</samp></h3>

<p>
Multiline field listing all the packages that can be built from the source
package, considering every architecture.  The first line of the field value is
empty.  Each one of the next lines describes one binary package, by listing its
name, type, section and priority separated by spaces.  Fifth and subsequent
space-separated items may be present and parsers must allow them.  See the <a
href="#s-f-Package-Type">Package-Type</a> field for a list of package types.
</p>

<hr>

<h3 id="s-f-Package-Type">5.6.28 <samp>Package-Type</samp></h3>

<p>
Simple field containing a word indicating the type of package: <samp>deb</samp>
for binary packages and <samp>udeb</samp> for micro binary packages.  Other
types not defined here may be indicated.  In source package control files, the
<samp>Package-Type</samp> field should be omitted instead of giving it a value
of <samp>deb</samp>, as this value is assumed for paragraphs lacking this
field.
</p>

<hr>

<h3 id="s-f-Dgit">5.6.29 <samp>Dgit</samp></h3>

<p>
Folded field containing a single git commit hash, presented in full, followed
optionally by whitespace and other data to be defined in future extensions.
</p>

<p>
Declares that the source package corresponds exactly to a referenced commit in
a Git repository available at the canonical location called
<em>dgit-repos</em>, used by <code>dgit</code>, a bidirectional gateway between
the Debian archive and Git.  The commit is reachable from at least one
reference whose name matches <samp>refs/dgit/*</samp>.  See the manual page of
<code>dgit</code> for further details.
</p>

<hr>

<h2 id="s5.7">5.7 User-defined fields</h2>

<p>
Additional user-defined fields may be added to the source package control file.
Such fields will be ignored, and not copied to (for example) binary or Debian
source control files or upload control files.
</p>

<p>
If you wish to add additional unsupported fields to these output files you
should use the mechanism described here.
</p>

<p>
Fields in the main source control information file with names starting
<samp>X</samp>, followed by one or more of the letters <samp>BCS</samp> and a
hyphen <samp>-</samp>, will be copied to the output files.  Only the part of
the field name after the hyphen will be used in the output file.  Where the
letter <samp>B</samp> is used the field will appear in binary package control
files, where the letter <samp>S</samp> is used in Debian source control files
and where <samp>C</samp> is used in upload control (<samp>.changes</samp>)
files.
</p>

<p>
For example, if the main source information control file contains the field
</p>

<pre>
       XBS-Comment: I stand between the candle and the star.
</pre>

<p>
then the binary and Debian source control files will contain the field
</p>

<pre>
       Comment: I stand between the candle and the star.
</pre>

<hr>

<h2 id="s-obsolete-control-data-fields">5.8 Obsolete fields</h2>

<p>
The following fields have been obsoleted and may be found in packages
conforming with previous versions of the Policy.
</p>

<hr>

<h3 id="s-f-DM-Upload-Allowed">5.8.1 <samp>DM-Upload-Allowed</samp></h3>

<p>
Indicates that Debian Maintainers may upload this package to the Debian
archive.  The only valid value is <samp>yes</samp>.  This field was used to
regulate uploads by Debian Maintainers, See the General Resolution <code><a
href="http://www.debian.org/vote/2007/vote_003">Endorse the concept of Debian
Maintainers</a></code> for more details.
</p>

<p><a name="ch-maintainerscripts"></a></p>
<hr>

<p>
[ <a href="#ch-controlfields">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ 6 ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-relationships">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 6 - Package maintainer scripts and installation procedure
</h1>

<hr>

<h2 id="s6.1">6.1 Introduction to package maintainer scripts</h2>

<p>
It is possible to supply scripts as part of a package which the package
management system will run for you when your package is installed, upgraded or
removed.
</p>

<p>
These scripts are the control information files <code>preinst</code>,
<code>postinst</code>, <code>prerm</code> and <code>postrm</code>.  They must
be proper executable files; if they are scripts (which is recommended), they
must start with the usual <samp>#!</samp> convention.  They should be readable
and executable by anyone, and must not be world-writable.
</p>

<p>
The package management system looks at the exit status from these scripts.  It
is important that they exit with a non-zero status if there is an error, so
that the package management system can stop its processing.  For shell scripts
this means that you <em>almost always</em> need to use <samp>set -e</samp>
(this is usually true when writing shell scripts, in fact).  It is also
important, of course, that they exit with a zero status if everything went
well.
</p>

<p>
Additionally, packages interacting with users using <code>debconf</code> in the
<code>postinst</code> script should install a <code>config</code> script as a
control information file.  See <a href="#s-maintscriptprompt">Prompting in
maintainer scripts, Section 3.9.1</a> for details.
</p>

<p>
When a package is upgraded a combination of the scripts from the old and new
packages is called during the upgrade procedure.  If your scripts are going to
be at all complicated you need to be aware of this, and may need to check the
arguments to your scripts.
</p>

<p>
Broadly speaking the <code>preinst</code> is called before (a particular
version of) a package is unpacked, and the <code>postinst</code> afterwards;
the <code>prerm</code> before (a version of) a package is removed and the
<code>postrm</code> afterwards.
</p>

<p>
Programs called from maintainer scripts should not normally have a path
prepended to them.  Before installation is started, the package management
system checks to see if the programs <code>ldconfig</code>,
<code>start-stop-daemon</code>, and <code>update-rc.d</code> can be found via
the <samp>PATH</samp> environment variable.  Those programs, and any other
program that one would expect to be in the <samp>PATH</samp>, should thus be
invoked without an absolute pathname.  Maintainer scripts should also not reset
the <samp>PATH</samp>, though they might choose to modify it by prepending or
appending package-specific directories.  These considerations really apply to
all shell scripts.
</p>

<hr>

<h2 id="s-idempotency">6.2 Maintainer scripts idempotency</h2>

<p>
It is necessary for the error recovery procedures that the scripts be
idempotent.  This means that if it is run successfully, and then it is called
again, it doesn't bomb out or cause any harm, but just ensures that everything
is the way it ought to be.  If the first call failed, or aborted half way
through for some reason, the second call should merely do the things that were
left undone the first time, if any, and exit with a success status if
everything is OK.[<a href="#f45" name="fr45">45</a>]
</p>

<hr>

<h2 id="s-controllingterminal">6.3 Controlling terminal for maintainer scripts</h2>

<p>
Maintainer scripts are not guaranteed to run with a controlling terminal and
may not be able to interact with the user.  They must be able to fall back to
noninteractive behavior if no controlling terminal is available.  Maintainer
scripts that prompt via a program conforming to the Debian Configuration
Management Specification (see <a href="#s-maintscriptprompt">Prompting in
maintainer scripts, Section 3.9.1</a>) may assume that program will handle
falling back to noninteractive behavior.
</p>

<p>
For high-priority prompts without a reasonable default answer, maintainer
scripts may abort if there is no controlling terminal.  However, this situation
should be avoided if at all possible, since it prevents automated or unattended
installs.  In most cases, users will consider this to be a bug in the package.
</p>

<hr>

<h2 id="s-exitstatus">6.4 Exit status</h2>

<p>
Each script must return a zero exit status for success, or a nonzero one for
failure, since the package management system looks for the exit status of these
scripts and determines what action to take next based on that datum.
</p>

<hr>

<h2 id="s-mscriptsinstact">6.5 Summary of ways maintainer scripts are called</h2>

<p>
What follows is a summary of all the ways in which maintainer scripts may be
called along with what facilities those scripts may rely on being available at
that time.  Script names preceded by <var>new-</var> are the scripts from the
new version of a package being installed, upgraded to, or downgraded to.
Script names preceded by <var>old-</var> are the scripts from the old version
of a package that is being upgraded from or downgraded from.
</p>

<p>
The <code>preinst</code> script may be called in the following ways:
</p>
<dl>
<dt><var>new-preinst</var> <samp>install</samp></dt>
<dt><var>new-preinst</var> <samp>install</samp> <var>old-version</var></dt>
<dt><var>new-preinst</var> <samp>upgrade</samp> <var>old-version</var></dt>
<dd>
<p>
The package will not yet be unpacked, so the <code>preinst</code> script cannot
rely on any files included in its package.  Only essential packages and
pre-dependencies (<samp>Pre-Depends</samp>) may be assumed to be available.
Pre-dependencies will have been configured at least once, but at the time the
<code>preinst</code> is called they may only be in an &quot;Unpacked&quot; or
&quot;Half-Configured&quot; state if a previous version of the pre-dependency
was completely configured and has not been removed since then.
</p>
</dd>
</dl>
<dl>
<dt><var>old-preinst</var> <samp>abort-upgrade</samp> <var>new-version</var></dt>
<dd>
<p>
Called during error handling of an upgrade that failed after unpacking the new
package because the <samp>postrm upgrade</samp> action failed.  The unpacked
files may be partly from the new version or partly missing, so the script
cannot rely on files included in the package.  Package dependencies may not be
available.  Pre-dependencies will be at least &quot;Unpacked&quot; following
the same rules as above, except they may be only &quot;Half-Installed&quot; if
an upgrade of the pre-dependency failed.[<a href="#f46" name="fr46">46</a>]
</p>
</dd>
</dl>

<p>
The <code>postinst</code> script may be called in the following ways:
</p>
<dl>
<dt><var>postinst</var> <samp>configure</samp> <var>most-recently-configured-version</var></dt>
<dd>
<p>
The files contained in the package will be unpacked.  All package dependencies
will at least be &quot;Unpacked&quot;.  If there are no circular dependencies
involved, all package dependencies will be configured.  For behavior in the
case of circular dependencies, see the discussion in <a
href="#s-binarydeps">Binary Dependencies - <samp>Depends</samp>,
<samp>Recommends</samp>, <samp>Suggests</samp>, <samp>Enhances</samp>,
<samp>Pre-Depends</samp>, Section 7.2</a>.
</p>
</dd>
</dl>
<dl>
<dt><var>old-postinst</var> <samp>abort-upgrade</samp> <var>new-version</var></dt>
<dt><var>conflictor's-postinst</var> <samp>abort-remove</samp> <samp>in-favour</samp> <var>package</var> <var>new-version</var></dt>
<dt><var>postinst</var> <samp>abort-remove</samp></dt>
<dt><var>deconfigured's-postinst</var> <samp>abort-deconfigure</samp> <samp>in-favour</samp> <var>failed-install-package</var> <var>version</var> [<samp>removing</samp> <var>conflicting-package</var> <var>version</var>]</dt>
<dd>
<p>
The files contained in the package will be unpacked.  All package dependencies
will at least be &quot;Half-Installed&quot; and will have previously been
configured and not removed.  However, dependencies may not be configured or
even fully unpacked in some error situations.[<a href="#f47"
name="fr47">47</a>] The <code>postinst</code> should still attempt any actions
for which its dependencies are required, since they will normally be available,
but consider the correct error handling approach if those actions fail.
Aborting the <code>postinst</code> action if commands or facilities from the
package dependencies are not available is often the best approach.
</p>
</dd>
</dl>

<p>
The <code>prerm</code> script may be called in the following ways:
</p>
<dl>
<dt><var>prerm</var> <samp>remove</samp></dt>
<dt><var>old-prerm</var> <samp>upgrade</samp><var>new-version</var></dt>
<dt><var>conflictor's-prerm</var> <samp>remove</samp> <samp>in-favour</samp> <var>package</var> <var>new-version</var></dt>
<dt><var>deconfigured's-prerm</var> <samp>deconfigure</samp> <samp>in-favour</samp> <var>package-being-installed</var> <var>version</var> [<samp>removing</samp> <var>conflicting-package</var> <var>version</var>]</dt>
<dd>
<p>
The package whose <code>prerm</code> is being called will be at least
&quot;Half-Installed&quot;.  All package dependencies will at least be
&quot;Half-Installed&quot; and will have previously been configured and not
removed.  If there was no error, all dependencies will at least be
&quot;Unpacked&quot;, but these actions may be called in various error states
where dependencies are only &quot;Half-Installed&quot; due to a partial
upgrade.
</p>
</dd>
</dl>
<dl>
<dt><var>new-prerm</var> <samp>failed-upgrade</samp> <var>old-version</var></dt>
<dd>
<p>
Called during error handling when <samp>prerm upgrade</samp> fails.  The new
package will not yet be unpacked, and all the same constraints as for
<samp>preinst upgrade</samp> apply.
</p>
</dd>
</dl>

<p>
The <code>postrm</code> script may be called in the following ways:
</p>
<dl>
<dt><var>postrm</var> <samp>remove</samp></dt>
<dt><var>postrm</var> <samp>purge</samp></dt>
<dt><var>old-postrm</var> <samp>upgrade</samp> <var>new-version</var></dt>
<dt><var>disappearer's-postrm</var> <samp>disappear</samp> <var>overwriter</var> <var>overwriter-version</var></dt>
<dd>
<p>
The <code>postrm</code> script is called after the package's files have been
removed or replaced.  The package whose <code>postrm</code> is being called may
have previously been deconfigured and only be &quot;Unpacked&quot;, at which
point subsequent package changes do not consider its dependencies.  Therefore,
all <code>postrm</code> actions may only rely on essential packages and must
gracefully skip any actions that require the package's dependencies if those
dependencies are unavailable.[<a href="#f48" name="fr48">48</a>]
</p>
</dd>
</dl>
<dl>
<dt><var>new-postrm</var> <samp>failed-upgrade</samp> <var>old-version</var></dt>
<dd>
<p>
Called when the old <samp>postrm upgrade</samp> action fails.  The new package
will be unpacked, but only essential packages and pre-dependencies can be
relied on.  Pre-dependencies will either be configured or will be
&quot;Unpacked&quot; or &quot;Half-Configured&quot; but previously had been
configured and was never removed.
</p>
</dd>
</dl>
<dl>
<dt><var>new-postrm</var> <samp>abort-install</samp></dt>
<dt><var>new-postrm</var> <samp>abort-install</samp> <var>old-version</var></dt>
<dt><var>new-postrm</var> <samp>abort-upgrade</samp> <var>old-version</var></dt>
<dd>
<p>
Called before unpacking the new package as part of the error handling of
<code>preinst</code> failures.  May assume the same state as
<code>preinst</code> can assume.
</p>
</dd>
</dl>

<hr>

<h2 id="s-unpackphase">6.6 Details of unpack phase of installation or upgrade</h2>

<p>
The procedure on installation/upgrade/overwrite/disappear (i.e., when running
<samp>dpkg --unpack</samp>, or the unpack stage of <samp>dpkg --install</samp>)
is as follows.  In each case, if a major error occurs (unless listed below) the
actions are, in general, run backwards - this means that the maintainer scripts
are run with different arguments in reverse order.  These are the &quot;error
unwind&quot; calls listed below.
</p>
<ol type="1" start="1" >
<li>
<ol type="1" start="1" >
<li>
<p>
If a version of the package is already &quot;Installed&quot;, call
</p>
<pre>
     <var>old-prerm</var> upgrade <var>new-version</var>
</pre>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
If the script runs but exits with a non-zero exit status, <code>dpkg</code>
will attempt:
</p>
<pre>
     <var>new-prerm</var> failed-upgrade <var>old-version</var>
</pre>

<p>
If this works, the upgrade continues.  If this does not work, the error unwind:
</p>
<pre>
     <var>old-postinst</var> abort-upgrade <var>new-version</var>
</pre>

<p>
If this works, then the old-version is &quot;Installed&quot;, if not, the old
version is in a &quot;Half-Configured&quot; state.
</p>
</li>
</ol>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
If a &quot;conflicting&quot; package is being removed at the same time, or if
any package will be broken (due to <samp>Breaks</samp>):
</p>
<ol type="1" start="1" >
<li>
<p>
If <samp>--auto-deconfigure</samp> is specified, call, for each package to be
deconfigured due to <samp>Breaks</samp>:
</p>
<pre>
     <var>deconfigured's-prerm</var> deconfigure \
       in-favour <var>package-being-installed</var> <var>version</var>
</pre>

<p>
Error unwind:
</p>
<pre>
     <var>deconfigured's-postinst</var> abort-deconfigure \
       in-favour <var>package-being-installed-but-failed</var> <var>version</var>
</pre>

<p>
The deconfigured packages are marked as requiring configuration, so that if
<samp>--install</samp> is used they will be configured again if possible.
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
If any packages depended on a conflicting package being removed and
<samp>--auto-deconfigure</samp> is specified, call, for each such package:
</p>
<pre>
     <var>deconfigured's-prerm</var> deconfigure \
       in-favour <var>package-being-installed</var> <var>version</var> \
         removing <var>conflicting-package</var> <var>version</var>
</pre>

<p>
Error unwind:
</p>
<pre>
     <var>deconfigured's-postinst</var> abort-deconfigure \
       in-favour <var>package-being-installed-but-failed</var> <var>version</var> \
         removing <var>conflicting-package</var> <var>version</var>
</pre>

<p>
The deconfigured packages are marked as requiring configuration, so that if
<samp>--install</samp> is used they will be configured again if possible.
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
To prepare for removal of each conflicting package, call:
</p>
<pre>
     <var>conflictor's-prerm</var> remove \
       in-favour <var>package</var> <var>new-version</var>
</pre>

<p>
Error unwind:
</p>
<pre>
     <var>conflictor's-postinst</var> abort-remove \
       in-favour <var>package</var> <var>new-version</var>
</pre>
</li>
</ol>
</li>
</ol>
<ol type="1" start="3" >
<li>
<ol type="1" start="1" >
<li>
<p>
If the package is being upgraded, call:
</p>
<pre>
     <var>new-preinst</var> upgrade <var>old-version</var>
</pre>

<p>
If this fails, we call:
</p>

<pre>
     <var>new-postrm</var> abort-upgrade <var>old-version</var>
</pre>
<ol type="1" start="1" >
<li>
<p>
If that works, then
</p>

<pre>
     <var>old-postinst</var> abort-upgrade <var>new-version</var>
</pre>

<p>
is called.  If this works, then the old version is in an &quot;Installed&quot;
state, or else it is left in an &quot;Unpacked&quot; state.
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
If it fails, then the old version is left in an &quot;Half-Installed&quot;
state.
</p>
</li>
</ol>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
Otherwise, if the package had some configuration files from a previous version
installed (i.e., it is in the &quot;Config-Files&quot; state):
</p>
<pre>
     <var>new-preinst</var> install <var>old-version</var>
</pre>

<p>
Error unwind:
</p>

<pre>
     <var>new-postrm</var> abort-install <var>old-version</var>
</pre>

<p>
If this fails, the package is left in a &quot;Half-Installed&quot; state, which
requires a reinstall.  If it works, the packages is left in a
&quot;Config-Files&quot; state.
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
Otherwise (i.e., the package was completely purged):
</p>
<pre>
     <var>new-preinst</var> install
</pre>

<p>
Error unwind:
</p>
<pre>
     <var>new-postrm</var> abort-install
</pre>

<p>
If the error-unwind fails, the package is in a &quot;Half-Installed&quot;
phase, and requires a reinstall.  If the error unwind works, the package is in
the &quot;Not-Installed&quot; state.
</p>
</li>
</ol>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
The new package's files are unpacked, overwriting any that may be on the system
already, for example any from the old version of the same package or from
another package.  Backups of the old files are kept temporarily, and if
anything goes wrong the package management system will attempt to put them back
as part of the error unwind.
</p>

<p>
It is an error for a package to contain files which are on the system in
another package, unless <samp>Replaces</samp> is used (see <a
href="#s-replaces">Overwriting files and replacing packages -
<samp>Replaces</samp>, Section 7.6</a>).
</p>

<p>
It is a more serious error for a package to contain a plain file or other kind
of non-directory where another package has a directory (again, unless
<samp>Replaces</samp> is used).  This error can be overridden if desired using
<samp>--force-overwrite-dir</samp>, but this is not advisable.
</p>

<p>
Packages which overwrite each other's files produce behavior which, though
deterministic, is hard for the system administrator to understand.  It can
easily lead to &quot;missing&quot; programs if, for example, a package is
unpacked which overwrites a file from another package, and is then removed
again.[<a href="#f49" name="fr49">49</a>]
</p>

<p>
A directory will never be replaced by a symbolic link to a directory or vice
versa; instead, the existing state (symlink or not) will be left alone and
<code>dpkg</code> will follow the symlink if there is one.
</p>
</li>
</ol>
<ol type="1" start="5" >
<li>
<ol type="1" start="1" >
<li>
<p>
If the package is being upgraded, call
</p>
<pre>
     <var>old-postrm</var> upgrade <var>new-version</var>
</pre>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
If this fails, <code>dpkg</code> will attempt:
</p>
<pre>
     <var>new-postrm</var> failed-upgrade <var>old-version</var>
</pre>

<p>
If this works, installation continues.  If not, Error unwind:
</p>
<pre>
     <var>old-preinst</var> abort-upgrade <var>new-version</var>
</pre>

<p>
If this fails, the old version is left in a &quot;Half-Installed&quot; state.
If it works, dpkg now calls:
</p>
<pre>
     <var>new-postrm</var> abort-upgrade <var>old-version</var>
</pre>

<p>
If this fails, the old version is left in a &quot;Half-Installed&quot; state.
If it works, dpkg now calls:
</p>
<pre>
     <var>old-postinst</var> abort-upgrade <var>new-version</var>
</pre>

<p>
If this fails, the old version is in an &quot;Unpacked&quot; state.
</p>
</li>
</ol>

<p>
This is the point of no return - if <code>dpkg</code> gets this far, it won't
back off past this point if an error occurs.  This will leave the package in a
fairly bad state, which will require a successful re-installation to clear up,
but it's when <code>dpkg</code> starts doing things that are irreversible.
</p>
</li>
</ol>
<ol type="1" start="6" >
<li>
<p>
Any files which were in the old version of the package but not in the new are
removed.
</p>
</li>
</ol>
<ol type="1" start="7" >
<li>
<p>
The new file list replaces the old.
</p>
</li>
</ol>
<ol type="1" start="8" >
<li>
<p>
The new maintainer scripts replace the old.
</p>
</li>
</ol>
<ol type="1" start="9" >
<li>
<p>
Any packages all of whose files have been overwritten during the installation,
and which aren't required for dependencies, are considered to have been
removed.  For each such package
</p>
<ol type="1" start="1" >
<li>
<p>
<code>dpkg</code> calls:
</p>
<pre>
     <var>disappearer's-postrm</var> disappear \
       <var>overwriter</var> <var>overwriter-version</var>
</pre>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
The package's maintainer scripts are removed.
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
It is noted in the status database as being in a sane state, namely
&quot;Not-Installed&quot; (any conffiles it may have are ignored, rather than
being removed by <code>dpkg</code>).  Note that disappearing packages do not
have their prerm called, because <code>dpkg</code> doesn't know in advance that
the package is going to vanish.
</p>
</li>
</ol>
</li>
</ol>
<ol type="1" start="10" >
<li>
<p>
Any files in the package we're unpacking that are also listed in the file lists
of other packages are removed from those lists.  (This will lobotomize the file
list of the &quot;conflicting&quot; package if there is one.)
</p>
</li>
</ol>
<ol type="1" start="11" >
<li>
<p>
The backup files made during installation, above, are deleted.
</p>
</li>
</ol>
<ol type="1" start="12" >
<li>
<p>
The new package's status is now sane, and recorded as &quot;Unpacked&quot;.
</p>

<p>
Here is another point of no return - if the conflicting package's removal fails
we do not unwind the rest of the installation; the conflicting package is left
in a half-removed limbo.
</p>
</li>
</ol>
<ol type="1" start="13" >
<li>
<p>
If there was a conflicting package we go and do the removal actions (described
below), starting with the removal of the conflicting package's files (any that
are also in the package being unpacked have already been removed from the
conflicting package's file list, and so do not get removed now).
</p>
</li>
</ol>

<hr>

<h2 id="s-configdetails">6.7 Details of configuration</h2>

<p>
When we configure a package (this happens with <samp>dpkg --install</samp> and
<samp>dpkg --configure</samp>), we first update any <samp>conffile</samp>s and
then call:
</p>
<pre>
     <var>postinst</var> configure <var>most-recently-configured-version</var>
</pre>

<p>
No attempt is made to unwind after errors during configuration.  If the
configuration fails, the package is in a &quot;Half-Configured&quot; state, and
an error message is generated.
</p>

<p>
If there is no most recently configured version <code>dpkg</code> will pass a
null argument.  [<a href="#f50" name="fr50">50</a>]
</p>

<hr>

<h2 id="s-removedetails">6.8 Details of removal and/or configuration purging</h2>
<ol type="1" start="1" >
<li>
<pre>
     <var>prerm</var> remove
</pre>

<p>
If prerm fails during replacement due to conflict
</p>

<pre>
     <var>conflictor's-postinst</var> abort-remove \
       in-favour <var>package</var> <var>new-version</var>
</pre>

<p>
Or else we call:
</p>

<pre>
     <var>postinst</var> abort-remove
</pre>

<p>
If this fails, the package is in a &quot;Half-Configured&quot; state, or else
it remains &quot;Installed&quot;.
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
The package's files are removed (except <samp>conffile</samp>s).
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<pre>
     <var>postrm</var> remove
</pre>

<p>
If it fails, there's no error unwind, and the package is in an
&quot;Half-Installed&quot; state.
</p>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
All the maintainer scripts except the <code>postrm</code> are removed.
</p>

<p>
If we aren't purging the package we stop here.  Note that packages which have
no <code>postrm</code> and no <samp>conffile</samp>s are automatically purged
when removed, as there is no difference except for the <code>dpkg</code>
status.
</p>
</li>
</ol>
<ol type="1" start="5" >
<li>
<p>
The <samp>conffile</samp>s and any backup files (<samp>~</samp>-files,
<samp>#*#</samp> files, <samp>%</samp>-files, <samp>.dpkg-{old,new,tmp}</samp>,
etc.) are removed.
</p>
</li>
</ol>
<ol type="1" start="6" >
<li>
<pre>
     <var>postrm</var> purge
</pre>

<p>
If this fails, the package remains in a &quot;Config-Files&quot; state.
</p>
</li>
</ol>
<ol type="1" start="7" >
<li>
<p>
The package's file list is removed.
</p>
</li>
</ol>

<p><a name="ch-relationships"></a></p>
<hr>

<p>
[ <a href="#ch-maintainerscripts">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ 7 ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-sharedlibs">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 7 - Declaring relationships between packages
</h1>

<hr>

<h2 id="s-depsyntax">7.1 Syntax of relationship fields</h2>

<p>
These fields all have a uniform syntax.  They are a list of package names
separated by commas.
</p>

<p>
In the <samp>Depends</samp>, <samp>Recommends</samp>, <samp>Suggests</samp>,
<samp>Pre-Depends</samp>, <samp>Build-Depends</samp> and
<samp>Build-Depends-Indep</samp> control fields of the package, which declare
dependencies on other packages, the package names listed may also include lists
of alternative package names, separated by vertical bar (pipe) symbols
<samp>|</samp>.  In such a case, that part of the dependency can be satisfied
by any one of the alternative packages.
</p>

<p>
All of the fields except for <samp>Provides</samp> may restrict their
applicability to particular versions of each named package.  This is done in
parentheses after each individual package name; the parentheses should contain
a relation from the list below followed by a version number, in the format
described in <a href="#s-f-Version"><samp>Version</samp>, Section 5.6.12</a>.
</p>

<p>
The relations allowed are <samp>&lt;&lt;</samp>, <samp>&lt;=</samp>,
<samp>=</samp>, <samp>&gt;=</samp> and <samp>&gt;&gt;</samp> for strictly
earlier, earlier or equal, exactly equal, later or equal and strictly later,
respectively.  The deprecated forms <samp>&lt;</samp> and <samp>&gt;</samp>
were confusingly used to mean earlier/later or equal, rather than strictly
earlier/later, and must not appear in new packages (though <code>dpkg</code>
still supports them with a warning).
</p>

<p>
Whitespace may appear at any point in the version specification subject to the
rules in <a href="#s-controlsyntax">Syntax of control files, Section 5.1</a>,
and must appear where it's necessary to disambiguate; it is not otherwise
significant.  All of the relationship fields can only be folded in source
package control files.  For consistency and in case of future changes to
<code>dpkg</code> it is recommended that a single space be used after a version
relationship and before a version number; it is also conventional to put a
single space after each comma, on either side of each vertical bar, and before
each open parenthesis.  When opening a continuation line in a relationship
field, it is conventional to do so after a comma and before the space following
that comma.
</p>

<p>
For example, a list of dependencies might appear as:
</p>
<pre>
     Package: mutt
     Version: 1.3.17-1
     Depends: libc6 (&gt;= 2.2.1), exim | mail-transport-agent
</pre>

<p>
Relationships may be restricted to a certain set of architectures.  This is
indicated in brackets after each individual package name and the optional
version specification.  The brackets enclose a non-empty list of Debian
architecture names in the format described in <a
href="#s-arch-spec">Architecture specification strings, Section 11.1</a>,
separated by whitespace.  Exclamation marks may be prepended to each of the
names.  (It is not permitted for some names to be prepended with exclamation
marks while others aren't.)
</p>

<p>
For build relationship fields (<samp>Build-Depends</samp>,
<samp>Build-Depends-Indep</samp>, <samp>Build-Conflicts</samp> and
<samp>Build-Conflicts-Indep</samp>), if the current Debian host architecture is
not in this list and there are no exclamation marks in the list, or it is in
the list with a prepended exclamation mark, the package name and the associated
version specification are ignored completely for the purposes of defining the
relationships.
</p>

<p>
For example:
</p>
<pre>
     Source: glibc
     Build-Depends-Indep: texinfo
     Build-Depends: kernel-headers-2.2.10 [!hurd-i386],
       hurd-dev [hurd-i386], gnumach-dev [hurd-i386]
</pre>

<p>
requires <samp>kernel-headers-2.2.10</samp> on all architectures other than
hurd-i386 and requires <samp>hurd-dev</samp> and <samp>gnumach-dev</samp> only
on hurd-i386.
</p>

<p>
For binary relationship fields and the <samp>Built-Using</samp> field, the
architecture restriction syntax is only supported in the source package control
file <code>debian/control</code>.  When the corresponding binary package
control file is generated, the relationship will either be omitted or included
without the architecture restriction based on the architecture of the binary
package.  This means that architecture restrictions must not be used in binary
relationship fields for architecture-independent packages (<samp>Architecture:
all</samp>).
</p>

<p>
For example:
</p>
<pre>
     Depends: foo [i386], bar [amd64]
</pre>

<p>
becomes <samp>Depends: foo</samp> when the package is built on the
<samp>i386</samp> architecture, <samp>Depends: bar</samp> when the package is
built on the <samp>amd64</samp> architecture, and omitted entirely in binary
packages built on all other architectures.
</p>

<p>
If the architecture-restricted dependency is part of a set of alternatives
using <samp>|</samp>, that alternative is ignored completely on architectures
that do not match the restriction.  For example:
</p>
<pre>
     Build-Depends: foo [!i386] | bar [!amd64]
</pre>

<p>
is equivalent to <samp>bar</samp> on the i386 architecture, to <samp>foo</samp>
on the amd64 architecture, and to <samp>foo | bar</samp> on all other
architectures.
</p>

<p>
Relationships may also be restricted to a certain set of architectures using
architecture wildcards in the format described in <a
href="#s-arch-wildcard-spec">Architecture wildcards, Section 11.1.1</a>.  The
syntax for declaring such restrictions is the same as declaring restrictions
using a certain set of architectures without architecture wildcards.  For
example:
</p>
<pre>
     Build-Depends: foo [linux-any], bar [any-i386], baz [!linux-any]
</pre>

<p>
is equivalent to <samp>foo</samp> on architectures using the Linux kernel and
any cpu, <samp>bar</samp> on architectures using any kernel and an i386 cpu,
and <samp>baz</samp> on any architecture using a kernel other than Linux.
</p>

<p>
Note that the binary package relationship fields such as <samp>Depends</samp>
appear in one of the binary package sections of the control file, whereas the
build-time relationships such as <samp>Build-Depends</samp> appear in the
source package section of the control file (which is the first section).
</p>

<hr>

<h2 id="s-binarydeps">7.2 Binary Dependencies - <samp>Depends</samp>, <samp>Recommends</samp>, <samp>Suggests</samp>, <samp>Enhances</samp>, <samp>Pre-Depends</samp></h2>

<p>
Packages can declare in their control file that they have certain relationships
to other packages - for example, that they may not be installed at the same
time as certain other packages, and/or that they depend on the presence of
others.
</p>

<p>
This is done using the <samp>Depends</samp>, <samp>Pre-Depends</samp>,
<samp>Recommends</samp>, <samp>Suggests</samp>, <samp>Enhances</samp>,
<samp>Breaks</samp> and <samp>Conflicts</samp> control fields.
<samp>Breaks</samp> is described in <a href="#s-breaks">Packages which break
other packages - <samp>Breaks</samp>, Section 7.3</a>, and
<samp>Conflicts</samp> is described in <a href="#s-conflicts">Conflicting
binary packages - <samp>Conflicts</samp>, Section 7.4</a>.  The rest are
described below.
</p>

<p>
These seven fields are used to declare a dependency relationship by one package
on another.  Except for <samp>Enhances</samp> and <samp>Breaks</samp>, they
appear in the depending (binary) package's control file.
(<samp>Enhances</samp> appears in the recommending package's control file, and
<samp>Breaks</samp> appears in the version of depended-on package which causes
the named package to break).
</p>

<p>
A <samp>Depends</samp> field takes effect <em>only</em> when a package is to be
configured.  It does not prevent a package being on the system in an
unconfigured state while its dependencies are unsatisfied, and it is possible
to replace a package whose dependencies are satisfied and which is properly
installed with a different version whose dependencies are not and cannot be
satisfied; when this is done the depending package will be left unconfigured
(since attempts to configure it will give errors) and will not function
properly.  If it is necessary, a <samp>Pre-Depends</samp> field can be used,
which has a partial effect even when a package is being unpacked, as explained
in detail below.  (The other three dependency fields, <samp>Recommends</samp>,
<samp>Suggests</samp> and <samp>Enhances</samp>, are only used by the various
front-ends to <code>dpkg</code> such as <code>apt-get</code>,
<code>aptitude</code>, and <code>dselect</code>.)
</p>

<p>
Since <samp>Depends</samp> only places requirements on the order in which
packages are configured, packages in an installation run are usually all
unpacked first and all configured later.  [<a href="#f51" name="fr51">51</a>]
</p>

<p>
If there is a circular dependency among packages being installed or removed,
installation or removal order honoring the dependency order is impossible,
requiring the dependency loop be broken at some point and the dependency
requirements violated for at least one package.  Packages involved in circular
dependencies may not be able to rely on their dependencies being configured
before they themselves are configured, depending on which side of the break of
the circular dependency loop they happen to be on.  If one of the packages in
the loop has no <code>postinst</code> script, then the cycle will be broken at
that package; this ensures that all <code>postinst</code> scripts are run with
their dependencies properly configured if this is possible.  Otherwise the
breaking point is arbitrary.  Packages should therefore avoid circular
dependencies where possible, particularly if they have <code>postinst</code>
scripts.
</p>

<p>
The meaning of the five dependency fields is as follows:
</p>
<dl>
<dt><samp>Depends</samp></dt>
<dd>
<p>
This declares an absolute dependency.  A package will not be configured unless
all of the packages listed in its <samp>Depends</samp> field have been
correctly configured (unless there is a circular dependency as described
above).
</p>

<p>
The <samp>Depends</samp> field should be used if the depended-on package is
required for the depending package to provide a significant amount of
functionality.
</p>

<p>
The <samp>Depends</samp> field should also be used if the <code>postinst</code>
or <code>prerm</code> scripts require the depended-on package to be unpacked or
configured in order to run.  In the case of <samp>postinst configure</samp>,
the depended-on packages will be unpacked and configured first.  (If both
packages are involved in a dependency loop, this might not work as expected;
see the explanation a few paragraphs back.) In the case of <code>prerm</code>
or other <code>postinst</code> actions, the package dependencies will normally
be at least unpacked, but they may be only &quot;Half-Installed&quot; if a
previous upgrade of the dependency failed.
</p>

<p>
Finally, the <samp>Depends</samp> field should be used if the depended-on
package is needed by the <code>postrm</code> script to fully clean up after the
package removal.  There is no guarantee that package dependencies will be
available when <code>postrm</code> is run, but the depended-on package is more
likely to be available if the package declares a dependency (particularly in
the case of <samp>postrm remove</samp>).  The <code>postrm</code> script must
gracefully skip actions that require a dependency if that dependency isn't
available.
</p>
</dd>
</dl>
<dl>
<dt><samp>Recommends</samp></dt>
<dd>
<p>
This declares a strong, but not absolute, dependency.
</p>

<p>
The <samp>Recommends</samp> field should list packages that would be found
together with this one in all but unusual installations.
</p>
</dd>
</dl>
<dl>
<dt><samp>Suggests</samp></dt>
<dd>
<p>
This is used to declare that one package may be more useful with one or more
others.  Using this field tells the packaging system and the user that the
listed packages are related to this one and can perhaps enhance its usefulness,
but that installing this one without them is perfectly reasonable.
</p>
</dd>
</dl>
<dl>
<dt><samp>Enhances</samp></dt>
<dd>
<p>
This field is similar to Suggests but works in the opposite direction.  It is
used to declare that a package can enhance the functionality of another
package.
</p>
</dd>
</dl>
<dl>
<dt><samp>Pre-Depends</samp></dt>
<dd>
<p>
This field is like <samp>Depends</samp>, except that it also forces
<code>dpkg</code> to complete installation of the packages named before even
starting the installation of the package which declares the pre-dependency, as
follows:
</p>

<p>
When a package declaring a pre-dependency is about to be <em>unpacked</em> the
pre-dependency can be satisfied if the depended-on package is either fully
configured, <em>or even if</em> the depended-on package(s) are only in the
&quot;Unpacked&quot; or the &quot;Half-Configured&quot; state, provided that
they have been configured correctly at some point in the past (and not removed
or partially removed since).  In this case, both the previously-configured and
currently &quot;Unpacked&quot; or &quot;Half-Configured&quot; versions must
satisfy any version clause in the <samp>Pre-Depends</samp> field.
</p>

<p>
When the package declaring a pre-dependency is about to be <em>configured</em>,
the pre-dependency will be treated as a normal <samp>Depends</samp>.  It will
be considered satisfied only if the depended-on package has been correctly
configured.  However, unlike with <samp>Depends</samp>,
<samp>Pre-Depends</samp> does not permit circular dependencies to be broken.
If a circular dependency is encountered while attempting to honor
<samp>Pre-Depends</samp>, the installation will be aborted.
</p>

<p>
<samp>Pre-Depends</samp> are also required if the <code>preinst</code> script
depends on the named package.  It is best to avoid this situation if possible.
</p>

<p>
<samp>Pre-Depends</samp> should be used sparingly, preferably only by packages
whose premature upgrade or installation would hamper the ability of the system
to continue with any upgrade that might be in progress.
</p>

<p>
You should not specify a <samp>Pre-Depends</samp> entry for a package before
this has been discussed on the <samp>debian-devel</samp> mailing list and a
consensus about doing that has been reached.  See <a
href="#s-dependencies">Dependencies, Section 3.5</a>.
</p>
</dd>
</dl>

<p>
When selecting which level of dependency to use you should consider how
important the depended-on package is to the functionality of the one declaring
the dependency.  Some packages are composed of components of varying degrees of
importance.  Such a package should list using <samp>Depends</samp> the
package(s) which are required by the more important components.  The other
components' requirements may be mentioned as Suggestions or Recommendations, as
appropriate to the components' relative importance.
</p>

<hr>

<h2 id="s-breaks">7.3 Packages which break other packages - <samp>Breaks</samp></h2>

<p>
When one binary package declares that it breaks another, <code>dpkg</code> will
refuse to allow the package which declares <samp>Breaks</samp> to be unpacked
unless the broken package is deconfigured first, and it will refuse to allow
the broken package to be reconfigured.
</p>

<p>
A package will not be regarded as causing breakage merely because its
configuration files are still installed; it must be at least
&quot;Half-Installed&quot;.
</p>

<p>
A special exception is made for packages which declare that they break their
own package name or a virtual package which they provide (see below): this does
not count as a real breakage.
</p>

<p>
Normally a <samp>Breaks</samp> entry will have an &quot;earlier than&quot;
version clause; such a <samp>Breaks</samp> is introduced in the version of an
(implicit or explicit) dependency which violates an assumption or reveals a bug
in earlier versions of the broken package, or which takes over a file from
earlier versions of the package named in <samp>Breaks</samp>.  This use of
<samp>Breaks</samp> will inform higher-level package management tools that the
broken package must be upgraded before the new one.
</p>

<p>
If the breaking package also overwrites some files from the older package, it
should use <samp>Replaces</samp> to ensure this goes smoothly.  See <a
href="#s-replaces">Overwriting files and replacing packages -
<samp>Replaces</samp>, Section 7.6</a> for a full discussion of taking over
files from other packages, including how to use <samp>Breaks</samp> in those
cases.
</p>

<p>
Many of the cases where <samp>Breaks</samp> should be used were previously
handled with <samp>Conflicts</samp> because <samp>Breaks</samp> did not yet
exist.  Many <samp>Conflicts</samp> fields should now be <samp>Breaks</samp>.
See <a href="#s-conflicts">Conflicting binary packages -
<samp>Conflicts</samp>, Section 7.4</a> for more information about the
differences.
</p>

<hr>

<h2 id="s-conflicts">7.4 Conflicting binary packages - <samp>Conflicts</samp></h2>

<p>
When one binary package declares a conflict with another using a
<samp>Conflicts</samp> field, <code>dpkg</code> will refuse to allow them to be
unpacked on the system at the same time.  This is a stronger restriction than
<samp>Breaks</samp>, which prevents the broken package from being configured
while the breaking package is in the &quot;Unpacked&quot; state but allows both
packages to be unpacked at the same time.
</p>

<p>
If one package is to be unpacked, the other must be removed first.  If the
package being unpacked is marked as replacing (see <a
href="#s-replaces">Overwriting files and replacing packages -
<samp>Replaces</samp>, Section 7.6</a>, but note that <samp>Breaks</samp>
should normally be used in this case) the one on the system, or the one on the
system is marked as deselected, or both packages are marked
<samp>Essential</samp>, then <code>dpkg</code> will automatically remove the
package which is causing the conflict.  Otherwise, it will halt the
installation of the new package with an error.  This mechanism is specifically
designed to produce an error when the installed package is
<samp>Essential</samp>, but the new package is not.
</p>

<p>
A package will not cause a conflict merely because its configuration files are
still installed; it must be at least &quot;Half-Installed&quot;.
</p>

<p>
A special exception is made for packages which declare a conflict with their
own package name, or with a virtual package which they provide (see below):
this does not prevent their installation, and allows a package to conflict with
others providing a replacement for it.  You use this feature when you want the
package in question to be the only package providing some feature.
</p>

<p>
Normally, <samp>Breaks</samp> should be used instead of <samp>Conflicts</samp>
since <samp>Conflicts</samp> imposes a stronger restriction on the ordering of
package installation or upgrade and can make it more difficult for the package
manager to find a correct solution to an upgrade or installation problem.
<samp>Breaks</samp> should be used
</p>
<ul>
<li>
<p>
when moving a file from one package to another (see <a
href="#s-replaces">Overwriting files and replacing packages -
<samp>Replaces</samp>, Section 7.6</a>),
</p>
</li>
</ul>
<ul>
<li>
<p>
when splitting a package (a special case of the previous one), or
</p>
</li>
</ul>
<ul>
<li>
<p>
when the breaking package exposes a bug in or interacts badly with particular
versions of the broken package.
</p>
</li>
</ul>

<p>
<samp>Conflicts</samp> should be used
</p>
<ul>
<li>
<p>
when two packages provide the same file and will continue to do so,
</p>
</li>
</ul>
<ul>
<li>
<p>
in conjunction with <samp>Provides</samp> when only one package providing a
given virtual facility may be unpacked at a time (see <a
href="#s-virtual">Virtual packages - <samp>Provides</samp>, Section 7.5</a>),
</p>
</li>
</ul>
<ul>
<li>
<p>
in other cases where one must prevent simultaneous installation of two packages
for reasons that are ongoing (not fixed in a later version of one of the
packages) or that must prevent both packages from being unpacked at the same
time, not just configured.
</p>
</li>
</ul>

<p>
Be aware that adding <samp>Conflicts</samp> is normally not the best solution
when two packages provide the same files.  Depending on the reason for that
conflict, using alternatives or renaming the files is often a better approach.
See, for example, <a href="#s-binaries">Binaries, Section 10.1</a>.
</p>

<p>
Neither <samp>Breaks</samp> nor <samp>Conflicts</samp> should be used unless
two packages cannot be installed at the same time or installing them both
causes one of them to be broken or unusable.  Having similar functionality or
performing the same tasks as another package is not sufficient reason to
declare <samp>Breaks</samp> or <samp>Conflicts</samp> with that package.
</p>

<p>
A <samp>Conflicts</samp> entry may have an &quot;earlier than&quot; version
clause if the reason for the conflict is corrected in a later version of one of
the packages.  However, normally the presence of an &quot;earlier than&quot;
version clause is a sign that <samp>Breaks</samp> should have been used
instead.  An &quot;earlier than&quot; version clause in <samp>Conflicts</samp>
prevents <code>dpkg</code> from upgrading or installing the package which
declares such a conflict until the upgrade or removal of the conflicted-with
package has been completed, which is a strong restriction.
</p>

<hr>

<h2 id="s-virtual">7.5 Virtual packages - <samp>Provides</samp></h2>

<p>
As well as the names of actual (&quot;concrete&quot;) packages, the package
relationship fields <samp>Depends</samp>, <samp>Recommends</samp>,
<samp>Suggests</samp>, <samp>Enhances</samp>, <samp>Pre-Depends</samp>,
<samp>Breaks</samp>, <samp>Conflicts</samp>, <samp>Build-Depends</samp>,
<samp>Build-Depends-Indep</samp>, <samp>Build-Conflicts</samp> and
<samp>Build-Conflicts-Indep</samp> may mention &quot;virtual packages&quot;.
</p>

<p>
A <em>virtual package</em> is one which appears in the <samp>Provides</samp>
control field of another package.  The effect is as if the package(s) which
provide a particular virtual package name had been listed by name everywhere
the virtual package name appears.  (See also <a href="#s-virtual_pkg">Virtual
packages, Section 3.6</a>)
</p>

<p>
If there are both concrete and virtual packages of the same name, then the
dependency may be satisfied (or the conflict caused) by either the concrete
package with the name in question or any other concrete package which provides
the virtual package with the name in question.  This is so that, for example,
supposing we have
</p>
<pre>
     Package: foo
     Depends: bar
</pre>

<p>
and someone else releases an enhanced version of the <samp>bar</samp> package
they can say:
</p>
<pre>
     Package: bar-plus
     Provides: bar
</pre>

<p>
and the <samp>bar-plus</samp> package will now also satisfy the dependency for
the <samp>foo</samp> package.
</p>

<p>
If a relationship field has a version number attached, only real packages will
be considered to see whether the relationship is satisfied (or the prohibition
violated, for a conflict or breakage).  In other words, if a version number is
specified, this is a request to ignore all <samp>Provides</samp> for that
package name and consider only real packages.  The package manager will assume
that a package providing that virtual package is not of the &quot;right&quot;
version.  A <samp>Provides</samp> field may not contain version numbers, and
the version number of the concrete package which provides a particular virtual
package will not be considered when considering a dependency on or conflict
with the virtual package name.[<a href="#f52" name="fr52">52</a>]
</p>

<p>
To specify which of a set of real packages should be the default to satisfy a
particular dependency on a virtual package, list the real package as an
alternative before the virtual one.
</p>

<p>
If the virtual package represents a facility that can only be provided by one
real package at a time, such as the <code>mail-transport-agent</code> virtual
package that requires installation of a binary that would conflict with all
other providers of that virtual package (see <a
href="#s-mail-transport-agents">Mail transport, delivery and user agents,
Section 11.6</a>), all packages providing that virtual package should also
declare a conflict with it using <samp>Conflicts</samp>.  This will ensure that
at most one provider of that virtual package is unpacked or installed at a
time.
</p>

<hr>

<h2 id="s-replaces">7.6 Overwriting files and replacing packages - <samp>Replaces</samp></h2>

<p>
Packages can declare in their control file that they should overwrite files in
certain other packages, or completely replace other packages.  The
<samp>Replaces</samp> control field has these two distinct purposes.
</p>

<hr>

<h3 id="s7.6.1">7.6.1 Overwriting files in other packages</h3>

<p>
It is usually an error for a package to contain files which are on the system
in another package.  However, if the overwriting package declares that it
<samp>Replaces</samp> the one containing the file being overwritten, then
<code>dpkg</code> will replace the file from the old package with that from the
new.  The file will no longer be listed as &quot;owned&quot; by the old package
and will be taken over by the new package.  Normally, <samp>Breaks</samp>
should be used in conjunction with <samp>Replaces</samp>.[<a href="#f53"
name="fr53">53</a>]
</p>

<p>
For example, if a package <code>foo</code> is split into <code>foo</code> and
<code>foo-data</code> starting at version 1.2-3, <code>foo-data</code> would
have the fields
</p>
<pre>
     Replaces: foo (&lt;&lt; 1.2-3)
     Breaks: foo (&lt;&lt; 1.2-3)
</pre>

<p>
in its control file.  The new version of the package <code>foo</code> would
normally have the field
</p>
<pre>
     Depends: foo-data (&gt;= 1.2-3)
</pre>

<p>
(or possibly <samp>Recommends</samp> or even <samp>Suggests</samp> if the files
moved into <code>foo-data</code> are not required for normal operation).
</p>

<p>
If a package is completely replaced in this way, so that <code>dpkg</code> does
not know of any files it still contains, it is considered to have
&quot;disappeared&quot;.  It will be marked as not wanted on the system
(selected for removal) and &quot;Not-Installed&quot;.  Any
<samp>conffile</samp>s details noted for the package will be ignored, as they
will have been taken over by the overwriting package.  The package's
<code>postrm</code> script will be run with a special argument to allow the
package to do any final cleanup required.  See <a
href="#s-mscriptsinstact">Summary of ways maintainer scripts are called,
Section 6.5</a>.  [<a href="#f54" name="fr54">54</a>]
</p>

<p>
For this usage of <samp>Replaces</samp>, virtual packages (see <a
href="#s-virtual">Virtual packages - <samp>Provides</samp>, Section 7.5</a>)
are not considered when looking at a <samp>Replaces</samp> field.  The packages
declared as being replaced must be mentioned by their real names.
</p>

<p>
This usage of <samp>Replaces</samp> only takes effect when both packages are at
least partially on the system at once.  It is not relevant if the packages
conflict unless the conflict has been overridden.
</p>

<hr>

<h3 id="s7.6.2">7.6.2 Replacing whole packages, forcing their removal</h3>

<p>
Second, <samp>Replaces</samp> allows the packaging system to resolve which
package should be removed when there is a conflict (see <a
href="#s-conflicts">Conflicting binary packages - <samp>Conflicts</samp>,
Section 7.4</a>).  This usage only takes effect when the two packages
<em>do</em> conflict, so that the two usages of this field do not interfere
with each other.
</p>

<p>
In this situation, the package declared as being replaced can be a virtual
package, so for example, all mail transport agents (MTAs) would have the
following fields in their control files:
</p>
<pre>
     Provides: mail-transport-agent
     Conflicts: mail-transport-agent
     Replaces: mail-transport-agent
</pre>

<p>
ensuring that only one MTA can be unpacked at any one time.  See <a
href="#s-virtual">Virtual packages - <samp>Provides</samp>, Section 7.5</a> for
more information about this example.
</p>

<hr>

<h2 id="s-sourcebinarydeps">7.7 Relationships between source and binary packages - <samp>Build-Depends</samp>, <samp>Build-Depends-Indep</samp>, <samp>Build-Conflicts</samp>, <samp>Build-Conflicts-Indep</samp></h2>

<p>
Source packages that require certain binary packages to be installed or absent
at the time of building the package can declare relationships to those binary
packages.
</p>

<p>
This is done using the <samp>Build-Depends</samp>,
<samp>Build-Depends-Indep</samp>, <samp>Build-Conflicts</samp> and
<samp>Build-Conflicts-Indep</samp> control fields.
</p>

<p>
Build-dependencies on &quot;build-essential&quot; binary packages can be
omitted.  Please see <a href="#s-pkg-relations">Package relationships, Section
4.2</a> for more information.
</p>

<p>
The dependencies and conflicts they define must be satisfied (as defined
earlier for binary packages) in order to invoke the targets in
<samp>debian/rules</samp>, as follows:[<a href="#f55" name="fr55">55</a>]
</p>
<dl>
<dt><samp>clean</samp>, <samp>build-arch</samp>, and <samp>binary-arch</samp></dt>
<dd>
<p>
Only the <samp>Build-Depends</samp> and <samp>Build-Conflicts</samp> fields
must be satisfied when these targets are invoked.
</p>
</dd>
</dl>
<dl>
<dt><samp>build</samp>, <samp>build-indep</samp>, <samp>binary</samp>, and <samp>binary-indep</samp></dt>
<dd>
<p>
The <samp>Build-Depends</samp>, <samp>Build-Conflicts</samp>,
<samp>Build-Depends-Indep</samp>, and <samp>Build-Conflicts-Indep</samp> fields
must be satisfied when these targets are invoked.
</p>
</dd>
</dl>

<hr>

<h2 id="s-built-using">7.8 Additional source packages used to build the binary - <samp>Built-Using</samp></h2>

<p>
Some binary packages incorporate parts of other packages when built but do not
have to depend on those packages.  Examples include linking with static
libraries or incorporating source code from another package during the build.
In this case, the source packages of those other packages are a required part
of the complete source (the binary package is not reproducible without them).
</p>

<p>
A <samp>Built-Using</samp> field must list the corresponding source package for
any such binary package incorporated during the build [<a href="#f56"
name="fr56">56</a>], including an &quot;exactly equal&quot; (&quot;=&quot;)
version relation on the version that was used to build that binary package[<a
href="#f57" name="fr57">57</a>].
</p>

<p>
A package using the source code from the gcc-4.6-source binary package built
from the gcc-4.6 source package would have this field in its control file:
</p>
<pre>
     Built-Using: gcc-4.6 (= 4.6.0-11)
</pre>

<p>
A package including binaries from grub2 and loadlin would have this field in
its control file:
</p>
<pre>
     Built-Using: grub2 (= 1.99-9), loadlin (= 1.6e-1)
</pre>

<p><a name="ch-sharedlibs"></a></p>
<hr>

<p>
[ <a href="#ch-relationships">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ 8 ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-opersys">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 8 - Shared libraries
</h1>

<hr>

<p>
Packages containing shared libraries must be constructed with a little care to
make sure that the shared library is always available.  This is especially
important for packages whose shared libraries are vitally important, such as
the C library (currently <samp>libc6</samp>).
</p>

<p>
This section deals only with public shared libraries: shared libraries that are
placed in directories searched by the dynamic linker by default or which are
intended to be linked against normally and possibly used by other, independent
packages.  Shared libraries that are internal to a particular package or that
are only loaded as dynamic modules are not covered by this section and are not
subject to its requirements.
</p>

<p>
A shared library is identified by the <samp>SONAME</samp> attribute stored in
its dynamic section.  When a binary is linked against a shared library, the
<samp>SONAME</samp> of the shared library is recorded in the binary's
<samp>NEEDED</samp> section so that the dynamic linker knows that library must
be loaded at runtime.  The shared library file's full name (which usually
contains additional version information not needed in the <samp>SONAME</samp>)
is therefore normally not referenced directly.  Instead, the shared library is
loaded by its <samp>SONAME</samp>, which exists on the file system as a symlink
pointing to the full name of the shared library.  This symlink must be provided
by the package.  <a href="#s-sharedlibs-runtime">Run-time shared libraries,
Section 8.1</a> describes how to do this.  [<a href="#f58" name="fr58">58</a>]
</p>

<p>
When linking a binary or another shared library against a shared library, the
<samp>SONAME</samp> for that shared library is not yet known.  Instead, the
shared library is found by looking for a file matching the library name with
<samp>.so</samp> appended.  This file exists on the file system as a symlink
pointing to the shared library.
</p>

<p>
Shared libraries are normally split into several binary packages.  The
<samp>SONAME</samp> symlink is installed by the runtime shared library package,
and the bare <samp>.so</samp> symlink is installed in the development package
since it's only used when linking binaries or shared libraries.  However, there
are some exceptions for unusual shared libraries or for shared libraries that
are also loaded as dynamic modules by other programs.
</p>

<p>
This section is primarily concerned with how the separation of shared libraries
into multiple packages should be done and how dependencies on and between
shared library binary packages are managed in Debian.  <a
href="#s-libraries">Libraries, Section 10.2</a> should be read in conjunction
with this section and contains additional rules for the files contained in the
shared library packages.
</p>

<hr>

<h2 id="s-sharedlibs-runtime">8.1 Run-time shared libraries</h2>

<p>
The run-time shared library must be placed in a package whose name changes
whenever the <samp>SONAME</samp> of the shared library changes.  This allows
several versions of the shared library to be installed at the same time,
allowing installation of the new version of the shared library without
immediately breaking binaries that depend on the old version.  Normally, the
run-time shared library and its <samp>SONAME</samp> symlink should be placed in
a package named <code><var>libraryname</var><var>soversion</var></code>, where
<var>soversion</var> is the version number in the <samp>SONAME</samp> of the
shared library.  Alternatively, if it would be confusing to directly append
<var>soversion</var> to <var>libraryname</var> (if, for example,
<var>libraryname</var> itself ends in a number), you should use
<code><var>libraryname</var>-<var>soversion</var></code> instead.
</p>

<p>
To determine the <var>soversion</var>, look at the <samp>SONAME</samp> of the
library, stored in the ELF <samp>SONAME</samp> attribute.  It is usually of the
form <samp><var>name</var>.so.<var>major-version</var></samp> (for example,
<samp>libz.so.1</samp>).  The version part is the part which comes after
<samp>.so.</samp>, so in that example it is <samp>1</samp>.  The soname may
instead be of the form
<samp><var>name</var>-<var>major-version</var>.so</samp>, such as
<samp>libdb-5.1.so</samp>, in which case the name would be <samp>libdb</samp>
and the version would be <samp>5.1</samp>.
</p>

<p>
If you have several shared libraries built from the same source tree, you may
lump them all together into a single shared library package provided that all
of their <samp>SONAME</samp>s will always change together.  Be aware that this
is not normally the case, and if the <samp>SONAME</samp>s do not change
together, upgrading such a merged shared library package will be unnecessarily
difficult because of file conflicts with the old version of the package.  When
in doubt, always split shared library packages so that each binary package
installs a single shared library.
</p>

<p>
Every time the shared library ABI changes in a way that may break binaries
linked against older versions of the shared library, the <samp>SONAME</samp> of
the library and the corresponding name for the binary package containing the
runtime shared library should change.  Normally, this means the
<samp>SONAME</samp> should change any time an interface is removed from the
shared library or the signature of an interface (the number of parameters or
the types of parameters that it takes, for example) is changed.  This practice
is vital to allowing clean upgrades from older versions of the package and
clean transitions between the old ABI and new ABI without having to upgrade
every affected package simultaneously.
</p>

<p>
The <samp>SONAME</samp> and binary package name need not, and indeed normally
should not, change if new interfaces are added but none are removed or changed,
since this will not break binaries linked against the old shared library.
Correct versioning of dependencies on the newer shared library by binaries that
use the new interfaces is handled via the <a
href="#s-sharedlibs-depends"><samp>symbols</samp> or <samp>shlibs</samp>
system</a>.
</p>

<p>
The package should install the shared libraries under their normal names.  For
example, the <code>libgdbm3</code> package should install
<code>libgdbm.so.3.0.0</code> as <code>/usr/lib/libgdbm.so.3.0.0</code>.  The
files should not be renamed or re-linked by any <code>prerm</code> or
<code>postrm</code> scripts; <code>dpkg</code> will take care of renaming
things safely without affecting running programs, and attempts to interfere
with this are likely to lead to problems.
</p>

<p>
Shared libraries should not be installed executable, since the dynamic linker
does not require this and trying to execute a shared library usually results in
a core dump.
</p>

<p>
The run-time library package should include the symbolic link for the
<samp>SONAME</samp> that <code>ldconfig</code> would create for the shared
libraries.  For example, the <code>libgdbm3</code> package should include a
symbolic link from <code>/usr/lib/libgdbm.so.3</code> to
<code>libgdbm.so.3.0.0</code>.  This is needed so that the dynamic linker (for
example <code>ld.so</code> or <code>ld-linux.so.*</code>) can find the library
between the time that <code>dpkg</code> installs it and the time that
<code>ldconfig</code> is run in the <code>postinst</code> script.[<a
href="#f59" name="fr59">59</a>]
</p>

<hr>

<h3 id="s-ldconfig">8.1.1 <samp>ldconfig</samp></h3>

<p>
Any package installing shared libraries in one of the default library
directories of the dynamic linker (which are currently <code>/usr/lib</code>
and <code>/lib</code>) or a directory that is listed in
<code>/etc/ld.so.conf</code>[<a href="#f60" name="fr60">60</a>] must use
<code>ldconfig</code> to update the shared library system.
</p>

<p>
The package maintainer scripts must only call <code>ldconfig</code> under these
circumstances:
</p>
<ul>
<li>
<p>
When the <code>postinst</code> script is run with a first argument of
<samp>configure</samp>, the script must call <code>ldconfig</code>, and may
optionally invoke <code>ldconfig</code> at other times.
</p>
</li>
<li>
<p>
When the <code>postrm</code> script is run with a first argument of
<samp>remove</samp>, the script should call <code>ldconfig</code>.
</p>
</li>
</ul>

<p>
[<a href="#f61" name="fr61">61</a>]
</p>

<hr>

<h2 id="s-sharedlibs-support-files">8.2 Shared library support files</h2>

<p>
If your package contains files whose names do not change with each change in
the library shared object version, you must not put them in the shared library
package.  Otherwise, several versions of the shared library cannot be installed
at the same time without filename clashes, making upgrades and transitions
unnecessarily difficult.
</p>

<p>
It is recommended that supporting files and run-time support programs that do
not need to be invoked manually by users, but are nevertheless required for the
package to function, be placed (if they are binary) in a subdirectory of
<code>/usr/lib</code>, preferably under
<code>/usr/lib/</code><var>package-name</var>.  If the program or file is
architecture independent, the recommendation is for it to be placed in a
subdirectory of <code>/usr/share</code> instead, preferably under
<code>/usr/share/</code><var>package-name</var>.  Following the
<var>package-name</var> naming convention ensures that the file names change
when the shared object version changes.
</p>

<p>
Run-time support programs that use the shared library but are not required for
the library to function or files used by the shared library that can be used by
any version of the shared library package should instead be put in a separate
package.  This package might typically be named
<code><var>libraryname</var>-tools</code>; note the absence of the
<var>soversion</var> in the package name.
</p>

<p>
Files and support programs only useful when compiling software against the
library should be included in the development package for the library.[<a
href="#f62" name="fr62">62</a>]
</p>

<hr>

<h2 id="s-sharedlibs-static">8.3 Static libraries</h2>

<p>
The static library (<code><var>libraryname.a</var></code>) is usually provided
in addition to the shared version.  It is placed into the development package
(see below).
</p>

<p>
In some cases, it is acceptable for a library to be available in static form
only; these cases include:
</p>
<ul>
<li>
<p>
libraries for languages whose shared library support is immature or unstable
</p>
</li>
</ul>
<ul>
<li>
<p>
libraries whose interfaces are in flux or under development (commonly the case
when the library's major version number is zero, or where the ABI breaks across
patchlevels)
</p>
</li>
</ul>
<ul>
<li>
<p>
libraries which are explicitly intended to be available only in static form by
their upstream author(s)
</p>
</li>
</ul>

<hr>

<h2 id="s-sharedlibs-dev">8.4 Development files</h2>

<p>
If there are development files associated with a shared library, the source
package needs to generate a binary development package named
<code><var>libraryname</var><var>soversion</var>-dev</code>, or if you prefer
only to support one development version at a time,
<code><var>libraryname</var>-dev</code>.  Installing the development package
must result in installation of all the development files necessary for
compiling programs against that shared library.[<a href="#f63"
name="fr63">63</a>]
</p>

<p>
In case several development versions of a library exist, you may need to use
<code>dpkg</code>'s Conflicts mechanism (see <a href="#s-conflicts">Conflicting
binary packages - <samp>Conflicts</samp>, Section 7.4</a>) to ensure that the
user only installs one development version at a time (as different development
versions are likely to have the same header files in them, which would cause a
filename clash if both were unpacked).
</p>

<p>
The development package should contain a symlink for the associated shared
library without a version number.  For example, the <code>libgdbm-dev</code>
package should include a symlink from <code>/usr/lib/libgdbm.so</code> to
<code>libgdbm.so.3.0.0</code>.  This symlink is needed by the linker
(<code>ld</code>) when compiling packages, as it will only look for
<code>libgdbm.so</code> when compiling dynamically.
</p>

<p>
If the package provides Ada Library Information (<code>*.ali</code>) files for
use with GNAT, these files must be installed read-only (mode 0444) so that GNAT
will not attempt to recompile them.  This overrides the normal file mode
requirements given in <a href="#s-permissions-owners">Permissions and owners,
Section 10.9</a>.
</p>

<hr>

<h2 id="s-sharedlibs-intradeps">8.5 Dependencies between the packages of the same library</h2>

<p>
Typically the development version should have an exact version dependency on
the runtime library, to make sure that compilation and linking happens
correctly.  The <samp>${binary:Version}</samp> substitution variable can be
useful for this purpose.  [<a href="#f64" name="fr64">64</a>]
</p>

<hr>

<h2 id="s-sharedlibs-depends">8.6 Dependencies between the library and other packages</h2>

<p>
If a package contains a binary or library which links to a shared library, we
must ensure that, when the package is installed on the system, all of the
libraries needed are also installed.  These dependencies must be added to the
binary package when it is built, since they may change based on which version
of a shared library the binary or library was linked with even if there are no
changes to the source of the binary (for example, symbol versions change,
macros become functions or vice versa, or the binary package may determine at
compile-time whether new library interfaces are available and can be called).
To allow these dependencies to be constructed, shared libraries must provide
either a <code>symbols</code> file or a <code>shlibs</code> file.  These
provide information on the package dependencies required to ensure the presence
of interfaces provided by this library.  Any package with binaries or libraries
linking to a shared library must use these files to determine the required
dependencies when it is built.  Other packages which use a shared library (for
example using <samp>dlopen()</samp>) should compute appropriate dependencies
using these files at build time as well.
</p>

<p>
The two mechanisms differ in the degree of detail that they provide.  A
<code>symbols</code> file documents, for each symbol exported by a library, the
minimal version of the package any binary using this symbol will need.  This is
typically the version of the package in which the symbol was introduced.  This
information permits detailed analysis of the symbols used by a particular
package and construction of an accurate dependency, but it requires the package
maintainer to track more information about the shared library.
</p>

<p>
A <code>shlibs</code> file, in contrast, only documents the last time the
library ABI changed in any way.  It only provides information about the library
as a whole, not individual symbols.  When a package is built using a shared
library with only a <code>shlibs</code> file, the generated dependency will
require a version of the shared library equal to or newer than the version of
the last ABI change.  This generates unnecessarily restrictive dependencies
compared to <code>symbols</code> files if none of the symbols used by the
package have changed.  This, in turn, may make upgrades needlessly complex and
unnecessarily restrict use of the package on systems with older versions of the
shared libraries.
</p>

<p>
<code>shlibs</code> files also only support a limited range of library SONAMEs,
making it difficult to use <code>shlibs</code> files in some unusual corner
cases.[<a href="#f65" name="fr65">65</a>]
</p>

<p>
<code>symbols</code> files are therefore recommended for most shared library
packages since they provide more accurate dependencies.  For most C libraries,
the additional detail required by <code>symbols</code> files is not too
difficult to maintain.  However, maintaining exhaustive symbols information for
a C++ library can be quite onerous, so <code>shlibs</code> files may be more
appropriate for most C++ libraries.  Libraries with a corresponding udeb must
also provide a <code>shlibs</code> file, since the udeb infrastructure does not
use <code>symbols</code> files.
</p>

<hr>

<h3 id="s-dpkg-shlibdeps">8.6.1 Generating dependencies on shared libraries</h3>

<p>
When a package that contains any shared libraries or compiled binaries is
built, it must run <code>dpkg-shlibdeps</code> on each shared library and
compiled binary to determine the libraries used and hence the dependencies
needed by the package.[<a href="#f66" name="fr66">66</a>] To do this, put a
call to <code>dpkg-shlibdeps</code> into your <code>debian/rules</code> file in
the source package.  List all of the compiled binaries, libraries, or loadable
modules in your package.[<a href="#f67" name="fr67">67</a>]
<code>dpkg-shlibdeps</code> will use the <code>symbols</code> or
<code>shlibs</code> files installed by the shared libraries to generate
dependency information.  The package must then provide a substitution variable
into which the discovered dependency information can be placed.
</p>

<p>
If you are creating a udeb for use in the Debian Installer, you will need to
specify that <code>dpkg-shlibdeps</code> should use the dependency line of type
<samp>udeb</samp> by adding the <samp>-tudeb</samp> option[<a href="#f68"
name="fr68">68</a>].  If there is no dependency line of type <samp>udeb</samp>
in the <code>shlibs</code> file, <code>dpkg-shlibdeps</code> will fall back to
the regular dependency line.
</p>

<p>
<code>dpkg-shlibdeps</code> puts the dependency information into the
<code>debian/substvars</code> file by default, which is then used by
<code>dpkg-gencontrol</code>.  You will need to place a
<samp>${shlibs:Depends}</samp> variable in the <samp>Depends</samp> field in
the control file of every binary package built by this source package that
contains compiled binaries, libraries, or loadable modules.  If you have
multiple binary packages, you will need to call <code>dpkg-shlibdeps</code> on
each one which contains compiled libraries or binaries.  For example, you could
use the <samp>-T</samp> option to the <samp>dpkg</samp> utilities to specify a
different <code>substvars</code> file for each binary package.[<a href="#f69"
name="fr69">69</a>]
</p>

<p>
For more details on <code>dpkg-shlibdeps</code>, see
<code>dpkg-shlibdeps(1)</code>.
</p>

<p>
We say that a binary <samp>foo</samp> <em>directly</em> uses a library
<samp>libbar</samp> if it is explicitly linked with that library (that is, the
library is listed in the ELF <samp>NEEDED</samp> attribute, caused by adding
<samp>-lbar</samp> to the link line when the binary is created).  Other
libraries that are needed by <samp>libbar</samp> are linked <em>indirectly</em>
to <samp>foo</samp>, and the dynamic linker will load them automatically when
it loads <samp>libbar</samp>.  A package should depend on the libraries it
directly uses, but not the libraries it only uses indirectly.  The dependencies
for the libraries used directly will automatically pull in the indirectly-used
libraries.  <code>dpkg-shlibdeps</code> will handle this logic automatically,
but package maintainers need to be aware of this distinction between directly
and indirectly using a library if they have to override its results for some
reason.  [<a href="#f70" name="fr70">70</a>]
</p>

<hr>

<h3 id="s-sharedlibs-updates">8.6.2 Shared library ABI changes</h3>

<p>
Maintaining a shared library package using either <code>symbols</code> or
<code>shlibs</code> files requires being aware of the exposed ABI of the shared
library and any changes to it.  Both <code>symbols</code> and
<code>shlibs</code> files record every change to the ABI of the shared library;
<code>symbols</code> files do so per public symbol, whereas <code>shlibs</code>
files record only the last change for the entire library.
</p>

<p>
There are two types of ABI changes: ones that are backward-compatible and ones
that are not.  An ABI change is backward-compatible if any reasonable program
or library that was linked with the previous version of the shared library will
still work correctly with the new version of the shared library.[<a href="#f71"
name="fr71">71</a>] Adding new symbols to the shared library is a
backward-compatible change.  Removing symbols from the shared library is not.
Changing the behavior of a symbol may or may not be backward-compatible
depending on the change; for example, changing a function to accept a new enum
constant not previously used by the library is generally backward-compatible,
but changing the members of a struct that is passed into library functions is
generally not unless the library takes special precautions to accept old
versions of the data structure.
</p>

<p>
ABI changes that are not backward-compatible normally require changing the
<samp>SONAME</samp> of the library and therefore the shared library package
name, which forces rebuilding all packages using that shared library to update
their dependencies and allow them to use the new version of the shared library.
For more information, see <a href="#s-sharedlibs-runtime">Run-time shared
libraries, Section 8.1</a>.  The remainder of this section will deal with
backward-compatible changes.
</p>

<p>
Backward-compatible changes require either updating or recording the
<var>minimal-version</var> for that symbol in <code>symbols</code> files or
updating the version in the <var>dependencies</var> in <code>shlibs</code>
files.  For more information on how to do this in the two formats, see <a
href="#s-symbols">The <code>symbols</code> File Format, Section 8.6.3.2</a> and
<a href="#s-shlibs">The <code>shlibs</code> File Format, Section 8.6.4.2</a>.
Below are general rules that apply to both files.
</p>

<p>
The easy case is when a public symbol is added.  Simply add the version at
which the symbol was introduced (for <code>symbols</code> files) or update the
dependency version (for <code>shlibs</code>) files.  But special care should be
taken to update dependency versions when the behavior of a public symbol
changes.  This is easy to neglect, since there is no automated method of
determining such changes, but failing to update versions in this case may
result in binary packages with too-weak dependencies that will fail at runtime,
possibly in ways that can cause security vulnerabilities.  If the package
maintainer believes that a symbol behavior change may have occurred but isn't
sure, it's safer to update the version rather than leave it unmodified.  This
may result in unnecessarily strict dependencies, but it ensures that packages
whose dependencies are satisfied will work properly.
</p>

<p>
A common example of when a change to the dependency version is required is a
function that takes an enum or struct argument that controls what the function
does.  For example:
</p>

<pre>
     	      enum library_op { OP_FOO, OP_BAR };
     	      int library_do_operation(enum library_op);
</pre>

<p>
If a new operation, <samp>OP_BAZ</samp>, is added, the
<var>minimal-version</var> of <samp>library_do_operation</samp> (for
<code>symbols</code> files) or the version in the dependency for the shared
library (for <code>shlibs</code> files) must be increased to the version at
which <samp>OP_BAZ</samp> was introduced.  Otherwise, a binary built against
the new version of the library (having detected at compile-time that the
library supports <samp>OP_BAZ</samp>) may be installed with a shared library
that doesn't support <samp>OP_BAZ</samp> and will fail at runtime when it tries
to pass <samp>OP_BAZ</samp> into this function.
</p>

<p>
Dependency versions in either <code>symbols</code> or <code>shlibs</code> files
normally should not contain the Debian revision of the package, since the
library behavior is normally fixed for a particular upstream version and any
Debian packaging of that upstream version will have the same behavior.  In the
rare case that the library behavior was changed in a particular Debian
revision, appending <samp>~</samp> to the end of the version that includes the
Debian revision is recommended, since this allows backports of the shared
library package using the normal backport versioning convention to satisfy the
dependency.
</p>

<hr>

<h3 id="s-sharedlibs-symbols">8.6.3 The <samp>symbols</samp> system</h3>

<p>
In the following sections, we will first describe where the various
<code>symbols</code> files are to be found, then the <code>symbols</code> file
format, and finally how to create <code>symbols</code> files if your package
contains a shared library.
</p>

<hr>

<h4 id="s-symbols-paths">8.6.3.1 The <code>symbols</code> files present on the system</h4>

<p>
<code>symbols</code> files for a shared library are normally provided by the
shared library package as a control file, but there are several override paths
that are checked first in case that information is wrong or missing.  The
following list gives them in the order in which they are read by
<code>dpkg-shlibdeps</code> The first one that contains the required
information is used.
</p>
<ul>
<li>
<p>
<code>debian/*/DEBIAN/symbols</code>
</p>

<p>
During the package build, if the package itself contains shared libraries with
<code>symbols</code> files, they will be generated in these staging directories
by <code>dpkg-gensymbols</code> (see <a href="#s-providing-symbols">Providing a
<code>symbols</code> file, Section 8.6.3.3</a>).  <code>symbols</code> files
found in the build tree take precedence over <code>symbols</code> files from
other binary packages.
</p>

<p>
These files must exist before <code>dpkg-shlibdeps</code> is run or the
dependencies of binaries and libraries from a source package on other libraries
from that same source package will not be correct.  In practice, this means
that <code>dpkg-gensymbols</code> must be run before
<code>dpkg-shlibdeps</code> during the package build.[<a href="#f72"
name="fr72">72</a>]
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>/etc/dpkg/symbols/<var>package</var>.symbols.<var>arch</var></code> and
<code>/etc/dpkg/symbols/<var>package</var>.symbols</code>
</p>

<p>
Per-system overrides of shared library dependencies.  These files normally do
not exist.  They are maintained by the local system administrator and must not
be created by any Debian package.
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>symbols</code> control files for packages installed on the system
</p>

<p>
The <code>symbols</code> control files for all the packages currently installed
on the system are searched last.  This will be the most common source of shared
library dependency information.  These are normally found in
<code>/var/lib/dpkg/info/*.symbols</code>, but packages should not rely on this
and instead should use <samp>dpkg-query --control-path <var>package</var>
symbols</samp> if for some reason these files need to be examined.
</p>
</li>
</ul>

<p>
Be aware that if a <code>debian/shlibs.local</code> exists in the source
package, it will override any <code>symbols</code> files.  This is the only
case where a <code>shlibs</code> is used despite <code>symbols</code> files
being present.  See <a href="#s-shlibs-paths">The <code>shlibs</code> files
present on the system, Section 8.6.4.1</a> and <a
href="#s-sharedlibs-shlibdeps">The <samp>shlibs</samp> system, Section
8.6.4</a> for more information.
</p>

<hr>

<h4 id="s-symbols">8.6.3.2 The <code>symbols</code> File Format</h4>

<p>
The following documents the format of the <code>symbols</code> control file as
included in binary packages.  These files are built from template
<code>symbols</code> files in the source package by
<code>dpkg-gensymbols</code>.  The template files support a richer syntax that
allows <code>dpkg-gensymbols</code> to do some of the tedious work involved in
maintaining <code>symbols</code> files, such as handling C++ symbols or
optional symbols that may not exist on particular architectures.  When writing
<code>symbols</code> files for a shared library package, refer to
<code>dpkg-gensymbols(1)</code> for the richer syntax.
</p>

<p>
A <code>symbols</code> may contain one or more entries, one for each shared
library contained in the package corresponding to that <code>symbols</code>.
Each entry has the following format:
</p>

<pre>
     		<var>library-soname</var> <var>main-dependency-template</var>
     		[| <var>alternative-dependency-template</var>]
     		[...]
     		[* <var>field-name</var>: <var>field-value</var>]
     		[...]
     		<var>symbol</var> <var>minimal-version</var>[ <var>id-of-dependency-template</var> ]
</pre>

<p>
To explain this format, we'll use the the <samp>zlib1g</samp> package as an
example, which (at the time of writing) installs the shared library
<code>/usr/lib/libz.so.1.2.3.4</code>.  Mandatory lines will be described
first, followed by optional lines.
</p>

<p>
<var>library-soname</var> must contain exactly the value of the ELF
<samp>SONAME</samp> attribute of the shared library.  In our example, this is
<samp>libz.so.1</samp>.[<a href="#f73" name="fr73">73</a>]
</p>

<p>
<var>main-dependency-template</var> has the same syntax as a dependency field
in a binary package control file, except that the string <samp>#MINVER#</samp>
is replaced by a version restriction like <samp>(&gt;=
<var>version</var>)</samp> or by nothing if an unversioned dependency is deemed
sufficient.  The version restriction will be based on which symbols from the
shared library are referenced and the version at which they were introduced
(see below).  In nearly all cases, <var>main-dependency-template</var> will be
<samp><var>package</var> #MINVER#</samp>, where <var>package</var> is the name
of the binary package containing the shared library.  This adds a simple,
possibly-versioned dependency on the shared library package.  In some rare
cases, such as when multiple packages provide the same shared library ABI, the
dependency template may need to be more complex.
</p>

<p>
In our example, the first line of the <samp>zlib1g</samp> <code>symbols</code>
file would be:
</p>
<pre>
     		libz.so.1 zlib1g #MINVER#
</pre>

<p>
Each public symbol exported by the shared library must have a corresponding
symbol line, indented by one space.  <var>symbol</var> is the exported symbol
(which, for C++, means the mangled symbol) followed by <samp>@</samp> and the
symbol version, or the string <samp>Base</samp> if there is no symbol version.
<var>minimal-version</var> is the most recent version of the shared library
that changed the behavior of that symbol, whether by adding it, changing its
function signature (the parameters, their types, or the return type), or
changing its behavior in a way that is visible to a caller.
<var>id-of-dependency-template</var> is an optional field that references an
<var>alternative-dependency-template</var>; see below for a full description.
</p>

<p>
For example, <samp>libz.so.1</samp> contains the symbols <samp>compress</samp>
and <samp>compressBound</samp>.  <samp>compress</samp> has no symbol version
and last changed its behavior in upstream version <samp>1:1.1.4</samp>.
<samp>compressBound</samp> has the symbol version <samp>ZLIB_1.2.0</samp>, was
introduced in upstream version <samp>1:1.2.0</samp>, and has not changed its
behavior.  Its <code>symbols</code> file therefore contains the lines:
</p>
<pre>
     		compress@Base 1:1.1.4
     		compressBound@ZLIB_1.2.0 1:1.2.0
</pre>

<p>
Packages using only <samp>compress</samp> would then get a dependency on
<samp>zlib1g (&gt;= 1:1.1.4)</samp>, but packages using
<samp>compressBound</samp> would get a dependency on <samp>zlib1g (&gt;=
1:1.2.0)</samp>.
</p>

<p>
One or more <var>alternative-dependency-template</var> lines may be provided.
These are used in cases where some symbols in the shared library should use one
dependency template while others should use a different template.  The
alternative dependency templates are used only if a symbol line contains the
<var>id-of-dependency-template</var> field.  The first alternative dependency
template is numbered 1, the second 2, and so forth.[<a href="#f74"
name="fr74">74</a>]
</p>

<p>
Finally, the entry for the library may contain one or more metadata fields.
Currently, the only supported <var>field-name</var> is
<samp>Build-Depends-Package</samp>, whose value lists the <a
href="#s-sharedlibs-dev">library development package</a> on which packages
using this shared library declare a build dependency.  If this field is
present, <code>dpkg-shlibdeps</code> uses it to ensure that the resulting
binary package dependency on the shared library is at least as strict as the
source package dependency on the shared library development package.[<a
href="#f75" name="fr75">75</a>] For our example, the <samp>zlib1g</samp>
<code>symbols</code> file would contain:
</p>
<pre>
     		* Build-Depends-Package: zlib1g-dev
</pre>

<p>
Also see <code>deb-symbols(5)</code>.
</p>

<hr>

<h4 id="s-providing-symbols">8.6.3.3 Providing a <code>symbols</code> file</h4>

<p>
If your package provides a shared library, you should arrange to include a
<code>symbols</code> control file following the format described above in that
package.  You must include either a <code>symbols</code> control file or a
<code>shlibs</code> control file.
</p>

<p>
Normally, this is done by creating a <code>symbols</code> in the source package
named <code>debian/<var>package</var>.symbols</code> or
<code>debian/symbols</code>, possibly with <code>.<var>arch</var></code>
appended if the symbols information varies by architecture.  This file may use
the extended syntax documented in <code>dpkg-gensymbols(1)</code>.  Then, call
<code>dpkg-gensymbols</code> as part of the package build process.  It will
create <code>symbols</code> files in the package staging area based on the
binaries and libraries in the package staging area and the <code>symbols</code>
files in the source package.[<a href="#f76" name="fr76">76</a>]
</p>

<p>
Packages that provide <code>symbols</code> files must keep them up-to-date to
ensure correct dependencies in packages that use the shared libraries.  This
means updating the <code>symbols</code> file whenever a new public symbol is
added, changing the <var>minimal-version</var> field whenever a symbol changes
behavior or signature in a backward-compatible way (see <a
href="#s-sharedlibs-updates">Shared library ABI changes, Section 8.6.2</a>),
and changing the <var>library-soname</var> and
<var>main-dependency-template</var>, and probably all of the
<var>minimal-version</var> fields, when the library changes
<samp>SONAME</samp>.  Removing a public symbol from the <code>symbols</code>
file because it's no longer provided by the library normally requires changing
the <samp>SONAME</samp> of the library.  See <a
href="#s-sharedlibs-runtime">Run-time shared libraries, Section 8.1</a> for
more information on <samp>SONAME</samp>s.
</p>

<hr>

<h3 id="s-sharedlibs-shlibdeps">8.6.4 The <samp>shlibs</samp> system</h3>

<p>
The <samp>shlibs</samp> system is a simpler alternative to the
<samp>symbols</samp> system for declaring dependencies for shared libraries.
It may be more appropriate for C++ libraries and other cases where tracking
individual symbols is too difficult.  It predated the <samp>symbols</samp>
system and is therefore frequently seen in older packages.  It is also required
for udebs, which do not support <samp>symbols</samp>.
</p>

<p>
In the following sections, we will first describe where the various
<code>shlibs</code> files are to be found, then how to use
<code>dpkg-shlibdeps</code>, and finally the <code>shlibs</code> file format
and how to create them.
</p>

<hr>

<h4 id="s-shlibs-paths">8.6.4.1 The <code>shlibs</code> files present on the system</h4>

<p>
There are several places where <samp>shlibs</samp> files are found.  The
following list gives them in the order in which they are read by
<code>dpkg-shlibdeps</code>.  (The first one which gives the required
information is used.)
</p>
<ul>
<li>
<p>
<code>debian/shlibs.local</code>
</p>

<p>
This lists overrides for this package.  This file should normally not be used,
but may be needed temporarily in unusual situations to work around bugs in
other packages, or in unusual cases where the normally declared dependency
information in the installed <code>shlibs</code> file for a library cannot be
used.  This file overrides information obtained from any other source.
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>/etc/dpkg/shlibs.override</code>
</p>

<p>
This lists global overrides.  This list is normally empty.  It is maintained by
the local system administrator.
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>DEBIAN/shlibs</code> files in the &quot;build directory&quot;
</p>

<p>
These files are generated as part of the package build process and staged for
inclusion as control files in the binary packages being built.  They provide
details of any shared libraries included in the same package.
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>shlibs</code> control files for packages installed on the system
</p>

<p>
The <code>shlibs</code> control files for all the packages currently installed
on the system.  These are normally found in
<code>/var/lib/dpkg/info/*.shlibs</code>, but packages should not rely on this
and instead should use <samp>dpkg-query --control-path <var>package</var>
shlibs</samp> if for some reason these files need to be examined.
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>/etc/dpkg/shlibs.default</code>
</p>

<p>
This file lists any shared libraries whose packages have failed to provide
correct <code>shlibs</code> files.  It was used when the <code>shlibs</code>
setup was first introduced, but it is now normally empty.  It is maintained by
the <samp>dpkg</samp> maintainer.
</p>
</li>
</ul>

<p>
If a <code>symbols</code> file for a shared library package is available,
<code>dpkg-shlibdeps</code> will always use it in preference to a
<code>shlibs</code>, with the exception of <code>debian/shlibs.local</code>.
The latter overrides any other <code>shlibs</code> or <code>symbols</code>
files.
</p>

<hr>

<h4 id="s-shlibs">8.6.4.2 The <code>shlibs</code> File Format</h4>

<p>
Each <code>shlibs</code> file has the same format.  Lines beginning with
<samp>#</samp> are considered to be comments and are ignored.  Each line is of
the form:
</p>
<pre>
     		[<var>type</var>: ]<var>library-name</var> <var>soname-version</var> <var>dependencies ...</var>
</pre>

<p>
We will explain this by reference to the example of the <samp>zlib1g</samp>
package, which (at the time of writing) installs the shared library
<code>/usr/lib/libz.so.1.2.3.4</code>.
</p>

<p>
<var>type</var> is an optional element that indicates the type of package for
which the line is valid.  The only type currently in use is <samp>udeb</samp>.
The colon and space after the type are required.
</p>

<p>
<var>library-name</var> is the name of the shared library, in this case
<samp>libz</samp>.  (This must match the name part of the soname, see below.)
</p>

<p>
<var>soname-version</var> is the version part of the ELF <samp>SONAME</samp>
attribute of the library, determined the same way that the <var>soversion</var>
component of the recommended shared library package name is determined.  See <a
href="#s-sharedlibs-runtime">Run-time shared libraries, Section 8.1</a> for the
details.
</p>

<p>
<var>dependencies</var> has the same syntax as a dependency field in a binary
package control file.  It should give details of which packages are required to
satisfy a binary built against the version of the library contained in the
package.  See <a href="#s-depsyntax">Syntax of relationship fields, Section
7.1</a> for details on the syntax, and <a href="#s-sharedlibs-updates">Shared
library ABI changes, Section 8.6.2</a> for details on how to maintain the
dependency version constraint.
</p>

<p>
In our example, if the last change to the <samp>zlib1g</samp> package that
could change behavior for a client of that library was in version
<samp>1:1.2.3.3.dfsg-1</samp>, then the <samp>shlibs</samp> entry for this
library could say:
</p>
<pre>
     		libz 1 zlib1g (&gt;= 1:1.2.3.3.dfsg)
</pre>

<p>
This version restriction must be new enough that any binary built against the
current version of the library will work with any version of the shared library
that satisfies that dependency.
</p>

<p>
As zlib1g also provides a udeb containing the shared library, there would also
be a second line:
</p>
<pre>
     		udeb: libz 1 zlib1g-udeb (&gt;= 1:1.2.3.3.dfsg)
</pre>

<hr>

<h4 id="s8.6.4.3">8.6.4.3 Providing a <code>shlibs</code> file</h4>

<p>
To provide a <code>shlibs</code> file for a shared library binary package,
create a <code>shlibs</code> file following the format described above and
place it in the <code>DEBIAN</code> directory for that package during the
build.  It will then be included as a control file for that package[<a
href="#f77" name="fr77">77</a>].
</p>

<p>
Since <code>dpkg-shlibdeps</code> reads the <code>DEBIAN/shlibs</code> files in
all of the binary packages being built from this source package, all of the
<code>DEBIAN/shlibs</code> files should be installed before
<code>dpkg-shlibdeps</code> is called on any of the binary packages.
</p>

<p><a name="ch-opersys"></a></p>
<hr>

<p>
[ <a href="#ch-sharedlibs">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ 9 ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-files">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 9 - The Operating System
</h1>

<hr>

<h2 id="s9.1">9.1 File system hierarchy</h2>

<hr>

<h3 id="s-fhs">9.1.1 File System Structure</h3>

<p>
The location of all files and directories must comply with the Filesystem
Hierarchy Standard (FHS), version 2.3, with the exceptions noted below, and
except where doing so would violate other terms of Debian Policy.  The
following exceptions to the FHS apply:
</p>
<ol type="1" start="1" >
<li>
<p>
The FHS requirement that architecture-independent application-specific static
files be located in <code>/usr/share</code> is relaxed to a suggestion.  In
particular, a subdirectory of <code>/usr/lib</code> may be used by a package
(or a collection of packages) to hold a mixture of architecture-independent and
architecture-dependent files.  However, when a directory is entirely composed
of architecture-independent files, it should be located in
<code>/usr/share</code>.
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
The optional rules related to user specific configuration files for
applications are stored in the user's home directory are relaxed.  It is
recommended that such files start with the '<samp>.</samp>' character (a
&quot;dot file&quot;), and if an application needs to create more than one dot
file then the preferred placement is in a subdirectory with a name starting
with a '.'  character, (a &quot;dot directory&quot;).  In this case it is
recommended the configuration files not start with the '.'  character.
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
The requirement for amd64 to use <code>/lib64</code> for 64 bit binaries is
removed.
</p>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
The requirement for object files, internal binaries, and libraries, including
<code>libc.so.*</code>, to be located directly under <code>/lib{,32}</code> and
<code>/usr/lib{,32}</code> is amended, permitting files to instead be installed
to <code>/lib/<var>triplet</var></code> and
<code>/usr/lib/<var>triplet</var></code>, where <samp><var>triplet</var></samp>
is the value returned by <samp>dpkg-architecture -qDEB_HOST_MULTIARCH</samp>
for the architecture of the package.  Packages may <em>not</em> install files
to any <var>triplet</var> path other than the one matching the architecture of
that package; for instance, an <samp>Architecture: amd64</samp> package
containing 32-bit x86 libraries may not install these libraries to
<code>/usr/lib/i386-linux-gnu</code>.  [<a href="#f78" name="fr78">78</a>]
</p>

<p>
The requirement for C and C++ headers files to be accessible through the search
path <code>/usr/include/</code> is amended, permitting files to be accessible
through the search path <code>/usr/include/<var>triplet</var></code> where
<samp><var>triplet</var></samp> is as above.  [<a href="#f79"
name="fr79">79</a>]
</p>

<p>
Applications may also use a single subdirectory under
<code>/usr/lib/<var>triplet</var></code>.
</p>

<p>
The execution time linker/loader, ld*, must still be made available in the
existing location under /lib or /lib64 since this is part of the ELF ABI for
the architecture.
</p>
</li>
</ol>
<ol type="1" start="5" >
<li>
<p>
The requirement that <code>/usr/local/share/man</code> be
&quot;synonymous&quot; with <code>/usr/local/man</code> is relaxed to a
recommendation
</p>
</li>
</ol>
<ol type="1" start="6" >
<li>
<p>
The requirement that windowmanagers with a single configuration file call it
<code>system.*wmrc</code> is removed, as is the restriction that the window
manager subdirectory be named identically to the window manager name itself.
</p>
</li>
</ol>
<ol type="1" start="7" >
<li>
<p>
The requirement that boot manager configuration files live in
<code>/etc</code>, or at least are symlinked there, is relaxed to a
recommendation.
</p>
</li>
</ol>
<ol type="1" start="8" >
<li>
<p>
The additional directory <code>/run</code> in the root file system is allowed.
<code>/run</code> replaces <code>/var/run</code>, and the subdirectory
<code>/run/lock</code> replaces <code>/var/lock</code>, with the
<code>/var</code> directories replaced by symlinks for backwards compatibility.
<code>/run</code> and <code>/run/lock</code> must follow all of the
requirements in the FHS for <code>/var/run</code> and <code>/var/lock</code>,
respectively, such as file naming conventions, file format requirements, or the
requirement that files be cleared during the boot process.  Files and
directories residing in <code>/run</code> should be stored on a temporary file
system.
</p>

<p>
Packages must not assume the <code>/run</code> directory exists or is usable
without a dependency on <samp>initscripts (&gt;= 2.88dsf-13.3)</samp> until the
stable release of Debian supports <code>/run</code>.
</p>
</li>
</ol>
<ol type="1" start="9" >
<li>
<p>
The <code>/sys</code> directory in the root filesystem is additionally allowed.
[<a href="#f80" name="fr80">80</a>]
</p>
</li>
</ol>
<ol type="1" start="10" >
<li>
<p>
The <code>/var/www</code> directory is additionally allowed.
</p>
</li>
</ol>
<ol type="1" start="11" >
<li>
<p>
The requirement for <code>/usr/local/lib&lt;qual&gt;</code> to exist if
<code>/lib&lt;qual&gt;</code> or <code>/usr/lib&lt;qual&gt;</code> exists
(where <code>lib&lt;qual&gt;</code> is a variant of <code>lib</code> such as
<code>lib32</code> or <code>lib64</code>) is removed.
</p>
</li>
</ol>
<ol type="1" start="12" >
<li>
<p>
On GNU/Hurd systems, the following additional directories are allowed in the
root filesystem: <code>/hurd</code> and <code>/servers</code>.[<a href="#f81"
name="fr81">81</a>]
</p>
</li>
</ol>

<p>
The version of this document referred here can be found in the
<samp>debian-policy</samp> package or on <code><a
href="http://www.debian.org/doc/packaging-manuals/fhs/">FHS (Debian
copy)</a></code> alongside this manual (or, if you have the
<code>debian-policy</code> installed, you can try <code><a
href="file:///usr/share/doc/debian-policy/fhs/">FHS (local copy)</a></code>).
The latest version, which may be a more recent version, may be found on
<code><a href="http://www.pathname.com/fhs/">FHS (upstream)</a></code>.
Specific questions about following the standard may be asked on the
<samp>debian-devel</samp> mailing list, or referred to the FHS mailing list
(see the <code><a href="http://www.pathname.com/fhs/">FHS web site</a></code>
for more information).
</p>

<hr>

<h3 id="s9.1.2">9.1.2 Site-specific programs</h3>

<p>
As mandated by the FHS, packages must not place any files in
<code>/usr/local</code>, either by putting them in the file system archive to
be unpacked by <code>dpkg</code> or by manipulating them in their maintainer
scripts.
</p>

<p>
However, the package may create empty directories below <code>/usr/local</code>
so that the system administrator knows where to place site-specific files.
These are not directories <em>in</em> <code>/usr/local</code>, but are children
of directories in <code>/usr/local</code>.  These directories
(<code>/usr/local/*/dir/</code>) should be removed on package removal if they
are empty.
</p>

<p>
Note that this applies only to directories <em>below</em>
<code>/usr/local</code>, not <em>in</em> <code>/usr/local</code>.  Packages
must not create sub-directories in the directory <code>/usr/local</code>
itself, except those listed in FHS, section 4.5.  However, you may create
directories below them as you wish.  You must not remove any of the directories
listed in 4.5, even if you created them.
</p>

<p>
Since <code>/usr/local</code> can be mounted read-only from a remote server,
these directories must be created and removed by the <code>postinst</code> and
<code>prerm</code> maintainer scripts and not be included in the
<code>.deb</code> archive.  These scripts must not fail if either of these
operations fail.
</p>

<p>
For example, the <samp>emacsen-common</samp> package could contain something
like
</p>
<pre>
     if [ ! -e /usr/local/share/emacs ]; then
       if mkdir /usr/local/share/emacs 2&gt;/dev/null; then
         if chown root:staff /usr/local/share/emacs; then
           chmod 2775 /usr/local/share/emacs || true
         fi
       fi
     fi
</pre>

<p>
in its <code>postinst</code> script, and
</p>
<pre>
     rmdir /usr/local/share/emacs/site-lisp 2&gt;/dev/null || true
     rmdir /usr/local/share/emacs 2&gt;/dev/null || true
</pre>

<p>
in the <code>prerm</code> script.  (Note that this form is used to ensure that
if the script is interrupted, the directory <code>/usr/local/share/emacs</code>
will still be removed.)
</p>

<p>
If you do create a directory in <code>/usr/local</code> for local additions to
a package, you should ensure that settings in <code>/usr/local</code> take
precedence over the equivalents in <code>/usr</code>.
</p>

<p>
However, because <code>/usr/local</code> and its contents are for exclusive use
of the local administrator, a package must not rely on the presence or absence
of files or directories in <code>/usr/local</code> for normal operation.
</p>

<p>
The <code>/usr/local</code> directory itself and all the subdirectories created
by the package should (by default) have permissions 2775 (group-writable and
set-group-id) and be owned by <samp>root:staff</samp>.
</p>

<hr>

<h3 id="s9.1.3">9.1.3 The system-wide mail directory</h3>

<p>
The system-wide mail directory is <code>/var/mail</code>.  This directory is
part of the base system and should not be owned by any particular mail agents.
The use of the old location <code>/var/spool/mail</code> is deprecated, even
though the spool may still be physically located there.
</p>

<hr>

<h3 id="s-fhs-run">9.1.4 <code>/run</code> and <code>/run/lock</code></h3>

<p>
The directory <code>/run</code> is cleared at boot, normally by being a mount
point for a temporary file system.  Packages therefore must not assume that any
files or directories under <code>/run</code> other than <code>/run/lock</code>
exist unless the package has arranged to create those files or directories
since the last reboot.  Normally, this is done by the package via an init
script.  See <a href="#s-writing-init">Writing the scripts, Section 9.3.2</a>
for more information.
</p>

<p>
Packages must not include files or directories under <code>/run</code>, or
under the older <code>/var/run</code> and <code>/var/lock</code> paths.  The
latter paths will normally be symlinks or other redirections to
<code>/run</code> for backwards compatibility.
</p>

<hr>

<h2 id="s9.2">9.2 Users and groups</h2>

<hr>

<h3 id="s9.2.1">9.2.1 Introduction</h3>

<p>
The Debian system can be configured to use either plain or shadow passwords.
</p>

<p>
Some user ids (UIDs) and group ids (GIDs) are reserved globally for use by
certain packages.  Because some packages need to include files which are owned
by these users or groups, or need the ids compiled into binaries, these ids
must be used on any Debian system only for the purpose for which they are
allocated.  This is a serious restriction, and we should avoid getting in the
way of local administration policies.  In particular, many sites allocate users
and/or local system groups starting at 100.
</p>

<p>
Apart from this we should have dynamically allocated ids, which should by
default be arranged in some sensible order, but the behavior should be
configurable.
</p>

<p>
Packages other than <samp>base-passwd</samp> must not modify
<code>/etc/passwd</code>, <code>/etc/shadow</code>, <code>/etc/group</code> or
<code>/etc/gshadow</code>.
</p>

<hr>

<h3 id="s9.2.2">9.2.2 UID and GID classes</h3>

<p>
The UID and GID numbers are divided into classes as follows:
</p>
<dl>
<dt>0-99:</dt>
<dd>
<p>
Globally allocated by the Debian project, the same on every Debian system.
These ids will appear in the <code>passwd</code> and <code>group</code> files
of all Debian systems, new ids in this range being added automatically as the
<samp>base-passwd</samp> package is updated.
</p>

<p>
Packages which need a single statically allocated uid or gid should use one of
these; their maintainers should ask the <samp>base-passwd</samp> maintainer for
ids.
</p>
</dd>
</dl>
<dl>
<dt>100-999:</dt>
<dd>
<p>
Dynamically allocated system users and groups.  Packages which need a user or
group, but can have this user or group allocated dynamically and differently on
each system, should use <samp>adduser --system</samp> to create the group
and/or user.  <code>adduser</code> will check for the existence of the user or
group, and if necessary choose an unused id based on the ranges specified in
<code>adduser.conf</code>.
</p>
</dd>
</dl>
<dl>
<dt>1000-59999:</dt>
<dd>
<p>
Dynamically allocated user accounts.  By default <code>adduser</code> will
choose UIDs and GIDs for user accounts in this range, though
<code>adduser.conf</code> may be used to modify this behavior.
</p>
</dd>
</dl>
<dl>
<dt>60000-64999:</dt>
<dd>
<p>
Globally allocated by the Debian project, but only created on demand.  The ids
are allocated centrally and statically, but the actual accounts are only
created on users' systems on demand.
</p>

<p>
These ids are for packages which are obscure or which require many
statically-allocated ids.  These packages should check for and create the
accounts in <code>/etc/passwd</code> or <code>/etc/group</code> (using
<code>adduser</code> if it has this facility) if necessary.  Packages which are
likely to require further allocations should have a &quot;hole&quot; left after
them in the allocation, to give them room to grow.
</p>
</dd>
</dl>
<dl>
<dt>65000-65533:</dt>
<dd>
<p>
Reserved.
</p>
</dd>
</dl>
<dl>
<dt>65534:</dt>
<dd>
<p>
User <samp>nobody</samp>.  The corresponding gid refers to the group
<samp>nogroup</samp>.
</p>
</dd>
</dl>
<dl>
<dt>65535:</dt>
<dd>
<p>
This value <em>must not</em> be used, because it was the error return sentinel
value when <samp>uid_t</samp> was 16 bits.
</p>
</dd>
</dl>
<dl>
<dt>65536-4294967293:</dt>
<dd>
<p>
Dynamically allocated user accounts.  By default <code>adduser</code> will not
allocate UIDs and GIDs in this range, to ease compatibility with legacy systems
where <samp>uid_t</samp> is still 16 bits.
</p>
</dd>
</dl>
<dl>
<dt>4294967294:</dt>
<dd>
<p>
<samp>(uid_t)(-2) == (gid_t)(-2)</samp> <em>must not</em> be used, because it
is used as the anonymous, unauthenticated user by some NFS implementations.
</p>
</dd>
</dl>
<dl>
<dt>4294967295:</dt>
<dd>
<p>
<samp>(uid_t)(-1) == (gid_t)(-1)</samp> <em>must not</em> be used, because it
is the error return sentinel value.
</p>
</dd>
</dl>

<hr>

<h2 id="s-sysvinit">9.3 System run levels and <code>init.d</code> scripts</h2>

<hr>

<h3 id="s-/etc/init.d">9.3.1 Introduction</h3>

<p>
The <code>/etc/init.d</code> directory contains the scripts executed by
<code>init</code> at boot time and when the init state (or
&quot;runlevel&quot;) is changed (see <code>init(8)</code>).
</p>

<p>
There are at least two different, yet functionally equivalent, ways of handling
these scripts.  For the sake of simplicity, this document describes only the
symbolic link method.  However, it must not be assumed by maintainer scripts
that this method is being used, and any automated manipulation of the various
runlevel behaviors by maintainer scripts must be performed using
<code>update-rc.d</code> as described below and not by manually installing or
removing symlinks.  For information on the implementation details of the other
method, implemented in the <samp>file-rc</samp> package, please refer to the
documentation of that package.
</p>

<p>
These scripts are referenced by symbolic links in the
<code>/etc/rc<var>n</var>.d</code> directories.  When changing runlevels,
<code>init</code> looks in the directory <code>/etc/rc<var>n</var>.d</code> for
the scripts it should execute, where <samp><var>n</var></samp> is the runlevel
that is being changed to, or <samp>S</samp> for the boot-up scripts.
</p>

<p>
The names of the links all have the form
<code>S<var>mm</var><var>script</var></code> or
<code>K<var>mm</var><var>script</var></code> where <var>mm</var> is a two-digit
number and <var>script</var> is the name of the script (this should be the same
as the name of the actual script in <code>/etc/init.d</code>).
</p>

<p>
When <code>init</code> changes runlevel first the targets of the links whose
names start with a <samp>K</samp> are executed, each with the single argument
<samp>stop</samp>, followed by the scripts prefixed with an <samp>S</samp>,
each with the single argument <samp>start</samp>.  (The links are those in the
<code>/etc/rc<var>n</var>.d</code> directory corresponding to the new
runlevel.) The <samp>K</samp> links are responsible for killing services and
the <samp>S</samp> link for starting services upon entering the runlevel.
</p>

<p>
For example, if we are changing from runlevel 2 to runlevel 3, init will first
execute all of the <samp>K</samp> prefixed scripts it finds in
<code>/etc/rc3.d</code>, and then all of the <samp>S</samp> prefixed scripts in
that directory.  The links starting with <samp>K</samp> will cause the
referred-to file to be executed with an argument of <samp>stop</samp>, and the
<samp>S</samp> links with an argument of <samp>start</samp>.
</p>

<p>
The two-digit number <var>mm</var> is used to determine the order in which to
run the scripts: low-numbered links have their scripts run first.  For example,
the <samp>K20</samp> scripts will be executed before the <samp>K30</samp>
scripts.  This is used when a certain service must be started before another.
For example, the name server <code>bind</code> might need to be started before
the news server <code>inn</code> so that <code>inn</code> can set up its access
lists.  In this case, the script that starts <code>bind</code> would have a
lower number than the script that starts <code>inn</code> so that it runs
first:
</p>
<pre>
     /etc/rc2.d/S17bind
     /etc/rc2.d/S70inn
</pre>

<p>
The two runlevels 0 (halt) and 6 (reboot) are slightly different.  In these
runlevels, the links with an <samp>S</samp> prefix are still called after those
with a <samp>K</samp> prefix, but they too are called with the single argument
<samp>stop</samp>.
</p>

<hr>

<h3 id="s-writing-init">9.3.2 Writing the scripts</h3>

<p>
Packages that include daemons for system services should place scripts in
<code>/etc/init.d</code> to start or stop services at boot time or during a
change of runlevel.  These scripts should be named
<code>/etc/init.d/<var>package</var></code>, and they should accept one
argument, saying what to do:
</p>
<dl>
<dt><samp>start</samp></dt>
<dd>
<p>
start the service,
</p>
</dd>
</dl>
<dl>
<dt><samp>stop</samp></dt>
<dd>
<p>
stop the service,
</p>
</dd>
</dl>
<dl>
<dt><samp>restart</samp></dt>
<dd>
<p>
stop and restart the service if it's already running, otherwise start the
service
</p>
</dd>
</dl>
<dl>
<dt><samp>reload</samp></dt>
<dd>
<p>
cause the configuration of the service to be reloaded without actually stopping
and restarting the service,
</p>
</dd>
</dl>
<dl>
<dt><samp>force-reload</samp></dt>
<dd>
<p>
cause the configuration to be reloaded if the service supports this, otherwise
restart the service.
</p>
</dd>
</dl>

<p>
The <samp>start</samp>, <samp>stop</samp>, <samp>restart</samp>, and
<samp>force-reload</samp> options should be supported by all scripts in
<code>/etc/init.d</code>, the <samp>reload</samp> option is optional.
</p>

<p>
The <code>init.d</code> scripts must ensure that they will behave sensibly
(i.e., returning success and not starting multiple copies of a service) if
invoked with <samp>start</samp> when the service is already running, or with
<samp>stop</samp> when it isn't, and that they don't kill unfortunately-named
user processes.  The best way to achieve this is usually to use
<code>start-stop-daemon</code> with the <samp>--oknodo</samp> option.
</p>

<p>
Be careful of using <samp>set -e</samp> in <code>init.d</code> scripts.
Writing correct <code>init.d</code> scripts requires accepting various error
exit statuses when daemons are already running or already stopped without
aborting the <code>init.d</code> script, and common <code>init.d</code>
function libraries are not safe to call with <samp>set -e</samp> in effect[<a
href="#f82" name="fr82">82</a>].  For <samp>init.d</samp> scripts, it's often
easier to not use <samp>set -e</samp> and instead check the result of each
command separately.
</p>

<p>
If a service reloads its configuration automatically (as in the case of
<code>cron</code>, for example), the <samp>reload</samp> option of the
<code>init.d</code> script should behave as if the configuration has been
reloaded successfully.
</p>

<p>
The <code>/etc/init.d</code> scripts must be treated as configuration files,
either (if they are present in the package, that is, in the .deb file) by
marking them as <samp>conffile</samp>s, or, (if they do not exist in the .deb)
by managing them correctly in the maintainer scripts (see <a
href="#s-config-files">Configuration files, Section 10.7</a>).  This is
important since we want to give the local system administrator the chance to
adapt the scripts to the local system, e.g., to disable a service without
de-installing the package, or to specify some special command line options when
starting a service, while making sure their changes aren't lost during the next
package upgrade.
</p>

<p>
These scripts should not fail obscurely when the configuration files remain but
the package has been removed, as configuration files remain on the system after
the package has been removed.  Only when <code>dpkg</code> is executed with the
<samp>--purge</samp> option will configuration files be removed.  In
particular, as the <code>/etc/init.d/<var>package</var></code> script itself is
usually a <samp>conffile</samp>, it will remain on the system if the package is
removed but not purged.  Therefore, you should include a <samp>test</samp>
statement at the top of the script, like this:
</p>
<pre>
     test -f <var>program-executed-later-in-script</var> || exit 0
</pre>

<p>
Often there are some variables in the <code>init.d</code> scripts whose values
control the behavior of the scripts, and which a system administrator is likely
to want to change.  As the scripts themselves are frequently
<samp>conffile</samp>s, modifying them requires that the administrator merge in
their changes each time the package is upgraded and the <samp>conffile</samp>
changes.  To ease the burden on the system administrator, such configurable
values should not be placed directly in the script.  Instead, they should be
placed in a file in <code>/etc/default</code>, which typically will have the
same base name as the <code>init.d</code> script.  This extra file should be
sourced by the script when the script runs.  It must contain only variable
settings and comments in SUSv3 <code>sh</code> format.  It may either be a
<samp>conffile</samp> or a configuration file maintained by the package
maintainer scripts.  See <a href="#s-config-files">Configuration files, Section
10.7</a> for more details.
</p>

<p>
To ensure that vital configurable values are always available, the
<code>init.d</code> script should set default values for each of the shell
variables it uses, either before sourcing the <code>/etc/default/</code> file
or afterwards using something like the <samp>: ${VAR:=default}</samp> syntax.
Also, the <code>init.d</code> script must behave sensibly and not fail if the
<code>/etc/default</code> file is deleted.
</p>

<p>
Files and directories under <code>/run</code>, including ones referred to via
the compatibility paths <code>/var/run</code> and <code>/var/lock</code>, are
normally stored on a temporary filesystem and are normally not persistent
across a reboot.  The <code>init.d</code> scripts must handle this correctly.
This will typically mean creating any required subdirectories dynamically when
the <code>init.d</code> script is run.  See <a
href="#s-fhs-run"><code>/run</code> and <code>/run/lock</code>, Section
9.1.4</a> for more information.
</p>

<hr>

<h3 id="s9.3.3">9.3.3 Interfacing with the initscript system</h3>

<p>
Maintainers should use the abstraction layer provided by the
<code>update-rc.d</code> and <code>invoke-rc.d</code> programs to deal with
initscripts in their packages' scripts such as <code>postinst</code>,
<code>prerm</code> and <code>postrm</code>.
</p>

<p>
Directly managing the /etc/rc?.d links and directly invoking the
<code>/etc/init.d/</code> initscripts should be done only by packages providing
the initscript subsystem (such as <code>sysv-rc</code> and
<code>file-rc</code>).
</p>

<hr>

<h4 id="s9.3.3.1">9.3.3.1 Managing the links</h4>

<p>
The program <code>update-rc.d</code> is provided for package maintainers to
arrange for the proper creation and removal of
<code>/etc/rc<var>n</var>.d</code> symbolic links, or their functional
equivalent if another method is being used.  This may be used by maintainers in
their packages' <code>postinst</code> and <code>postrm</code> scripts.
</p>

<p>
You must not include any <code>/etc/rc<var>n</var>.d</code> symbolic links in
the actual archive or manually create or remove the symbolic links in
maintainer scripts; you must use the <code>update-rc.d</code> program instead.
(The former will fail if an alternative method of maintaining runlevel
information is being used.) You must not include the
<code>/etc/rc<var>n</var>.d</code> directories themselves in the archive
either.  (Only the <samp>sysvinit</samp> package may do so.)
</p>

<p>
By default <code>update-rc.d</code> will start services in each of the
multi-user state runlevels (2, 3, 4, and 5) and stop them in the halt runlevel
(0), the single-user runlevel (1) and the reboot runlevel (6).  The system
administrator will have the opportunity to customize runlevels by simply
adding, moving, or removing the symbolic links in
<code>/etc/rc<var>n</var>.d</code> if symbolic links are being used, or by
modifying <code>/etc/runlevel.conf</code> if the <samp>file-rc</samp> method is
being used.
</p>

<p>
To get the default behavior for your package, put in your <code>postinst</code>
script
</p>
<pre>
     		update-rc.d <var>package</var> defaults
</pre>

<p>
and in your <code>postrm</code>
</p>
<pre>
     		if [ &quot;$1&quot; = purge ]; then
     		update-rc.d <var>package</var> remove
     		fi
</pre>

<p>
.  Note that if your package changes runlevels or priority, you may have to
remove and recreate the links, since otherwise the old links may persist.
Refer to the documentation of <code>update-rc.d</code>.
</p>

<p>
This will use a default sequence number of 20.  If it does not matter when or
in which order the <code>init.d</code> script is run, use this default.  If it
does, then you should talk to the maintainer of the <code>sysvinit</code>
package or post to <samp>debian-devel</samp>, and they will help you choose a
number.
</p>

<p>
For more information about using <samp>update-rc.d</samp>, please consult its
man page <code>update-rc.d(8)</code>.
</p>

<hr>

<h4 id="s9.3.3.2">9.3.3.2 Running initscripts</h4>

<p>
The program <code>invoke-rc.d</code> is provided to make it easier for package
maintainers to properly invoke an initscript, obeying runlevel and other
locally-defined constraints that might limit a package's right to start, stop
and otherwise manage services.  This program may be used by maintainers in
their packages' scripts.
</p>

<p>
The package maintainer scripts must use <code>invoke-rc.d</code> to invoke the
<code>/etc/init.d/*</code> initscripts, instead of calling them directly.
</p>

<p>
By default, <code>invoke-rc.d</code> will pass any action requests (start,
stop, reload, restart...) to the <code>/etc/init.d</code> script, filtering out
requests to start or restart a service out of its intended runlevels.
</p>

<p>
Most packages will simply need to change:
</p>
<pre>
     /etc/init.d/&lt;package&gt;
     	      &lt;action&gt;
</pre>

<p>
in their <code>postinst</code> and <code>prerm</code> scripts to:
</p>
<pre>
     	if which invoke-rc.d &gt;/dev/null 2&gt;&amp;1; then
     		invoke-rc.d <var>package</var> &lt;action&gt;
     	else
     		/etc/init.d/<var>package</var> &lt;action&gt;
     	fi
</pre>

<p>
A package should register its initscript services using
<code>update-rc.d</code> before it tries to invoke them using
<code>invoke-rc.d</code>.  Invocation of unregistered services may fail.
</p>

<p>
For more information about using <code>invoke-rc.d</code>, please consult its
man page <code>invoke-rc.d(8)</code>.
</p>

<hr>

<h3 id="s9.3.4">9.3.4 Boot-time initialization</h3>

<p>
There used to be another directory, <code>/etc/rc.boot</code>, which contained
scripts which were run once per machine boot.  This has been deprecated in
favour of links from <code>/etc/rcS.d</code> to files in
<code>/etc/init.d</code> as described in <a href="#s-/etc/init.d">Introduction,
Section 9.3.1</a>.  Packages must not place files in <code>/etc/rc.boot</code>.
</p>

<hr>

<h3 id="s9.3.5">9.3.5 Example</h3>

<p>
An example on which you can base your <code>/etc/init.d</code> scripts is found
in <code>/etc/init.d/skeleton</code>.
</p>

<hr>

<h2 id="s9.4">9.4 Console messages from <code>init.d</code> scripts</h2>

<p>
This section describes the formats to be used for messages written to standard
output by the <code>/etc/init.d</code> scripts.  The intent is to improve the
consistency of Debian's startup and shutdown look and feel.  For this reason,
please look very carefully at the details.  We want the messages to have the
same format in terms of wording, spaces, punctuation and case of letters.
</p>

<p>
Here is a list of overall rules that should be used for messages generated by
<code>/etc/init.d</code> scripts.
</p>
<ul>
<li>
<p>
The message should fit in one line (fewer than 80 characters), start with a
capital letter and end with a period (<samp>.</samp>) and line feed
(<samp>&quot;\n&quot;</samp>).
</p>
</li>
</ul>
<ul>
<li>
<p>
If the script is performing some time consuming task in the background (not
merely starting or stopping a program, for instance), an ellipsis (three dots:
<samp>...</samp>) should be output to the screen, with no leading or tailing
whitespace or line feeds.
</p>
</li>
</ul>
<ul>
<li>
<p>
The messages should appear as if the computer is telling the user what it is
doing (politely :-), but should not mention &quot;it&quot; directly.  For
example, instead of:
</p>
<pre>
     I'm starting network daemons: nfsd mountd.
</pre>

<p>
the message should say
</p>
<pre>
     Starting network daemons: nfsd mountd.
</pre>
</li>
</ul>

<p>
<samp>init.d</samp> script should use the following standard message formats
for the situations enumerated below.
</p>
<ul>
<li>
<p>
When daemons are started
</p>

<p>
If the script starts one or more daemons, the output should look like this (a
single line, no leading spaces):
</p>
<pre>
     Starting <var>description</var>: <var>daemon-1</var> ... <var>daemon-n</var>.
</pre>

<p>
The <var>description</var> should describe the subsystem the daemon or set of
daemons are part of, while <var>daemon-1</var> up to <var>daemon-n</var> denote
each daemon's name (typically the file name of the program).
</p>

<p>
For example, the output of <code>/etc/init.d/lpd</code> would look like:
</p>
<pre>
     Starting printer spooler: lpd.
</pre>

<p>
This can be achieved by saying
</p>
<pre>
     echo -n &quot;Starting printer spooler: lpd&quot;
     start-stop-daemon --start --quiet --exec /usr/sbin/lpd
     echo &quot;.&quot;
</pre>

<p>
in the script.  If there are more than one daemon to start, the output should
look like this:
</p>
<pre>
     echo -n &quot;Starting remote file system services:&quot;
     echo -n &quot; nfsd&quot;; start-stop-daemon --start --quiet nfsd
     echo -n &quot; mountd&quot;; start-stop-daemon --start --quiet mountd
     echo -n &quot; ugidd&quot;; start-stop-daemon --start --quiet ugidd
     echo &quot;.&quot;
</pre>

<p>
This makes it possible for the user to see what is happening and when the final
daemon has been started.  Care should be taken in the placement of white
spaces: in the example above the system administrators can easily comment out a
line if they don't want to start a specific daemon, while the displayed message
still looks good.
</p>
</li>
</ul>
<ul>
<li>
<p>
When a system parameter is being set
</p>

<p>
If you have to set up different system parameters during the system boot, you
should use this format:
</p>
<pre>
     Setting <var>parameter</var> to &quot;<var>value</var>&quot;.
</pre>

<p>
You can use a statement such as the following to get the quotes right:
</p>
<pre>
     echo &quot;Setting DNS domainname to \&quot;$domainname\&quot;.&quot;
</pre>

<p>
Note that the same symbol (<samp>&quot;</samp>) is used for the left and right
quotation marks.  A grave accent (<samp>`</samp>) is not a quote character;
neither is an apostrophe (<samp>'</samp>).
</p>
</li>
</ul>
<ul>
<li>
<p>
When a daemon is stopped or restarted
</p>

<p>
When you stop or restart a daemon, you should issue a message identical to the
startup message, except that <samp>Starting</samp> is replaced with
<samp>Stopping</samp> or <samp>Restarting</samp> respectively.
</p>

<p>
For example, stopping the printer daemon will look like this:
</p>
<pre>
     Stopping printer spooler: lpd.
</pre>
</li>
</ul>
<ul>
<li>
<p>
When something is executed
</p>

<p>
There are several examples where you have to run a program at system startup or
shutdown to perform a specific task, for example, setting the system's clock
using <code>netdate</code> or killing all processes when the system shuts down.
Your message should look like this:
</p>
<pre>
     Doing something very useful...done.
</pre>

<p>
You should print the <samp>done.</samp> immediately after the job has been
completed, so that the user is informed why they have to wait.  You can get
this behavior by saying
</p>
<pre>
     echo -n &quot;Doing something very useful...&quot;
     do_something
     echo &quot;done.&quot;
</pre>

<p>
in your script.
</p>
</li>
</ul>
<ul>
<li>
<p>
When the configuration is reloaded
</p>

<p>
When a daemon is forced to reload its configuration files you should use the
following format:
</p>
<pre>
     Reloading <var>description</var> configuration...done.
</pre>

<p>
where <var>description</var> is the same as in the daemon starting message.
</p>
</li>
</ul>

<hr>

<h2 id="s-cron-jobs">9.5 Cron jobs</h2>

<p>
Packages must not modify the configuration file <code>/etc/crontab</code>, and
they must not modify the files in <code>/var/spool/cron/crontabs</code>.
</p>

<p>
If a package wants to install a job that has to be executed via cron, it should
place a file named as specified in <a href="#s-cron-files">Cron job file names,
Section 9.5.1</a> into one or more of the following directories:
</p>
<pre>
     /etc/cron.hourly
     /etc/cron.daily
     /etc/cron.weekly
     /etc/cron.monthly
</pre>

<p>
As these directory names imply, the files within them are executed on an
hourly, daily, weekly, or monthly basis, respectively.  The exact times are
listed in <code>/etc/crontab</code>.
</p>

<p>
All files installed in any of these directories must be scripts (e.g., shell
scripts or Perl scripts) so that they can easily be modified by the local
system administrator.  In addition, they must be treated as configuration
files.
</p>

<p>
If a certain job has to be executed at some other frequency or at a specific
time, the package should install a file in <code>/etc/cron.d</code> with a name
as specified in <a href="#s-cron-files">Cron job file names, Section 9.5.1</a>.
This file uses the same syntax as <code>/etc/crontab</code> and is processed by
<code>cron</code> automatically.  The file must also be treated as a
configuration file.  (Note that entries in the <code>/etc/cron.d</code>
directory are not handled by <code>anacron</code>.  Thus, you should only use
this directory for jobs which may be skipped if the system is not running.)
</p>

<p>
Unlike <code>crontab</code> files described in the IEEE Std 1003.1-2008
(POSIX.1) available from <code><a
href="http://www.opengroup.org/onlinepubs/9699919799/">The Open
Group</a></code>, the files in <code>/etc/cron.d</code> and the file
<code>/etc/crontab</code> have seven fields; namely:
</p>
<ol type="1" start="1" >
<li>
<p>
Minute [0,59]
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
Hour [0,23]
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
Day of the month [1,31]
</p>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
Month of the year [1,12]
</p>
</li>
</ol>
<ol type="1" start="5" >
<li>
<p>
Day of the week ([0,6] with 0=Sunday)
</p>
</li>
</ol>
<ol type="1" start="6" >
<li>
<p>
Username
</p>
</li>
</ol>
<ol type="1" start="7" >
<li>
<p>
Command to be run
</p>
</li>
</ol>

<p>
Ranges of numbers are allowed.  Ranges are two numbers separated with a hyphen.
The specified range is inclusive.  Lists are allowed.  A list is a set of
numbers (or ranges) separated by commas.  Step values can be used in
conjunction with ranges.
</p>

<p>
The scripts or <samp>crontab</samp> entries in these directories should check
if all necessary programs are installed before they try to execute them.
Otherwise, problems will arise when a package was removed but not purged since
configuration files are kept on the system in this situation.
</p>

<p>
Any <samp>cron</samp> daemon must provide <code>/usr/bin/crontab</code> and
support normal <samp>crontab</samp> entries as specified in POSIX.  The daemon
must also support names for days and months, ranges, and step values.  It has
to support <code>/etc/crontab</code>, and correctly execute the scripts in
<code>/etc/cron.d</code>.  The daemon must also correctly execute scripts in
<code>/etc/cron.{hourly,daily,weekly,monthly}</code>.
</p>

<hr>

<h3 id="s-cron-files">9.5.1 Cron job file names</h3>

<p>
The file name of a cron job file should normally match the name of the package
from which it comes.
</p>

<p>
If a package supplies multiple cron job files files in the same directory, the
file names should all start with the name of the package (possibly modified as
described below) followed by a hyphen (<samp>-</samp>) and a suitable suffix.
</p>

<p>
A cron job file name must not include any period or plus characters
(<samp>.</samp> or <samp>+</samp>) characters as this will cause cron to ignore
the file.  Underscores (<samp>_</samp>) should be used instead of
<samp>.</samp> and <samp>+</samp> characters.
</p>

<hr>

<h2 id="s-menus">9.6 Menus</h2>

<p>
Packages shipping applications that comply with minimal requirements described
below for integration with desktop environments should register these
applications in the desktop menu, following the <em>FreeDesktop</em> standard,
using text files called <em>desktop entries</em>.  Their format is described in
the <em>Desktop Entry Specification</em> at <code><a
href="http://standards.freedesktop.org/desktop-entry-spec/latest/">http://standards.freedesktop.org/desktop-entry-spec/latest/</a></code>
and complementary information can be found in the <em>Desktop Menu
Specification</em> at <code><a
href="http://standards.freedesktop.org/menu-spec/latest/">http://standards.freedesktop.org/menu-spec/latest/</a></code>.
</p>

<p>
The desktop entry files are installed by the packages in the directory
<code>/usr/share/applications</code> and the FreeDesktop menus are refreshed
using <em>dpkg triggers</em>.  It is therefore not necessary to depend on
packages providing FreeDesktop menu systems.
</p>

<p>
Entries displayed in the FreeDesktop menu should conform to the following
minima for relevance and visual integration.
</p>
<ul>
<li>
<p>
Unless hidden by default, the desktop entry must point to a PNG or SVG icon
with a transparent background, providing at least the 22&times;22 size, and
preferably up to 64&times;64.  The icon should be neutral enough to integrate
well with the default icon themes.  It is encouraged to ship the icon in the
default <em>hicolor</em> icon theme directories, or to use an existing icon
from the <em>hicolor</em> theme.
</p>
</li>
</ul>
<ul>
<li>
<p>
If the menu entry is not useful in the general case as a standalone
application, the desktop entry should set the <samp>NoDisplay</samp> key to
<var>true</var>, so that it can be configured to be displayed only by those who
need it.
</p>
</li>
</ul>
<ul>
<li>
<p>
In doubt, the package maintainer should coordinate with the maintainers of menu
implementations through the <em>debian-desktop</em> mailing list in order to
avoid problems with categories or bad interactions with other icons.
Especially for packages which are part of installation tasks, the contents of
the <samp>NotShowIn</samp>/<samp>OnlyShowIn</samp> keys should be validated by
the maintainers of the relevant environments.
</p>
</li>
</ul>

<p>
Since the FreeDesktop menu is a cross-distribution standard, the desktop
entries written for Debian should be forwarded upstream, where they will
benefit to other users and are more likely to receive extra contributions such
as translations.
</p>

<p>
Packages can, to be compatible with Debian additions to some window managers
that do not support the FreeDesktop standard, also provide a <em>Debian
menu</em> file, following the <em>Debian menu policy</em>, which can be found
in the <samp>menu-policy</samp> files in the <samp>debian-policy</samp>
package.  It is also available from the Debian web mirrors at <samp><code><a
href="http://www.debian.org/doc/packaging-manuals/menu-policy/">/doc/packaging-manuals/menu-policy/</a></code></samp>.
</p>

<hr>

<h2 id="s-mime">9.7 Multimedia handlers</h2>

<p>
Media types (formerly known as MIME types, Multipurpose Internet Mail
Extensions, RFCs 2045-2049) is a mechanism for encoding files and data streams
and providing meta-information about them, in particular their type and format
(e.g.  <samp>image/png</samp>, <samp>text/html</samp>, <samp>audio/ogg</samp>).
</p>

<p>
Registration of media type handlers allows programs like mail user agents and
web browsers to invoke these handlers to view, edit or display media types they
don't support directly.
</p>

<p>
There are two overlapping systems to associate media types to programs which
can handle them.  The <em>mailcap</em> system is found on a large number of
Unix systems.  The <em>FreeDesktop</em> system is aimed at Desktop
environments.  In Debian, FreeDesktop entries are automatically translated in
mailcap entries, therefore packages already using desktop entries should not
use the mailcap system directly.
</p>

<hr>

<h3 id="s-media-types-freedesktop">9.7.1 Registration of media type handlers with desktop entries</h3>

<p>
Packages shipping an application able to view, edit or point to files of a
given media type, or open links with a given URI scheme, should list it in the
<samp>MimeType</samp> key of the application's <a href="#s-menus">desktop
entry</a>.  For URI schemes, the relevant MIME types are
<samp>x-scheme-handler/*</samp> (e.g.  <samp>x-scheme-handler/https</samp>).
</p>

<hr>

<h3 id="s-mailcap">9.7.2 Registration of media type handlers with mailcap entries</h3>

<p>
Packages that are not using desktop entries for registration should install a
file in <code>mailcap(5)</code> format (RFC 1524) in the directory
<code>/usr/lib/mime/packages/</code>.  The file name should be the binary
package's name.
</p>

<p>
The <code>mime-support</code> package provides the <code>update-mime</code>
program, which integrates these registrations in the <code>/etc/mailcap</code>
file, using dpkg triggers[<a href="#f83" name="fr83">83</a>].
</p>

<p>
Packages installing desktop entries should not install mailcap entries for the
same program, because the <code>mime-support</code> package already reads
desktop entries.
</p>

<p>
Packages using these facilities <em>should not</em> depend on, recommend, or
suggest <code>mime-support</code>.
</p>

<hr>

<h3 id="s-file-media-type">9.7.3 Providing media types to files</h3>

<p>
The media type of a file is discovered by inspecting the file's extension or
its <code>magic(5)</code> pattern, and interrogating a database associating
them with media types.
</p>

<p>
To support new associations between media types and files, their characteristic
file extensions and magic patterns should be registered to the IANA (Internet
Assigned Numbers Authority).  See <code><a
href="http://www.iana.org/assignments/media-types">http://www.iana.org/assignments/media-types</a></code>
and RFC 6838 for details.  This information will then propagate to the systems
discovering file media types in Debian, provided by the
<code>shared-mime-info</code>, <code>mime-support</code> and <code>file</code>
packages.  If registration and propagation can not be waited for, support can
be asked to the maintainers of the packages mentioned above.
</p>

<p>
For files that are produced and read by a single application, it is also
possible to declare this association to the <em>Shared MIME Info</em> system by
installing in the directory <code>/usr/share/mime/packages</code> a file in the
XML format specified at <code><a
href="http://standards.freedesktop.org/shared-mime-info-spec/latest/">http://standards.freedesktop.org/shared-mime-info-spec/latest/</a></code>.
</p>

<hr>

<h2 id="s9.8">9.8 Keyboard configuration</h2>

<p>
To achieve a consistent keyboard configuration so that all applications
interpret a keyboard event the same way, all programs in the Debian
distribution must be configured to comply with the following guidelines.
</p>

<p>
The following keys must have the specified interpretations:
</p>
<dl>
<dt><samp>&lt;--</samp></dt>
<dd>
<p>
delete the character to the left of the cursor
</p>
</dd>
</dl>
<dl>
<dt><samp>Delete</samp></dt>
<dd>
<p>
delete the character to the right of the cursor
</p>
</dd>
</dl>
<dl>
<dt><samp>Control+H</samp></dt>
<dd>
<p>
emacs: the help prefix
</p>
</dd>
</dl>

<p>
The interpretation of any keyboard events should be independent of the terminal
that is used, be it a virtual console, an X terminal emulator, an rlogin/telnet
session, etc.
</p>

<p>
The following list explains how the different programs should be set up to
achieve this:
</p>
<ul>
<li>
<p>
<samp>&lt;--</samp> generates <samp>KB_BackSpace</samp> in X.
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>Delete</samp> generates <samp>KB_Delete</samp> in X.
</p>
</li>
</ul>
<ul>
<li>
<p>
X translations are set up to make <samp>KB_Backspace</samp> generate ASCII DEL,
and to make <samp>KB_Delete</samp> generate <samp>ESC [ 3 ~</samp> (this is the
vt220 escape code for the &quot;delete character&quot; key).  This must be done
by loading the X resources using <code>xrdb</code> on all local X displays, not
using the application defaults, so that the translation resources used
correspond to the <code>xmodmap</code> settings.
</p>
</li>
</ul>
<ul>
<li>
<p>
The Linux console is configured to make <samp>&lt;--</samp> generate DEL, and
<samp>Delete</samp> generate <samp>ESC [ 3 ~</samp>.
</p>
</li>
</ul>
<ul>
<li>
<p>
X applications are configured so that <samp>&lt;</samp> deletes left, and
<samp>Delete</samp> deletes right.  Motif applications already work like this.
</p>
</li>
</ul>
<ul>
<li>
<p>
Terminals should have <samp>stty erase ^?</samp> .
</p>
</li>
</ul>
<ul>
<li>
<p>
The <samp>xterm</samp> terminfo entry should have <samp>ESC [ 3 ~</samp> for
<samp>kdch1</samp>, just as for <samp>TERM=linux</samp> and
<samp>TERM=vt220</samp>.
</p>
</li>
</ul>
<ul>
<li>
<p>
Emacs is programmed to map <samp>KB_Backspace</samp> or the <samp>stty
erase</samp> character to <samp>delete-backward-char</samp>, and
<samp>KB_Delete</samp> or <samp>kdch1</samp> to
<samp>delete-forward-char</samp>, and <samp>^H</samp> to <samp>help</samp> as
always.
</p>
</li>
</ul>
<ul>
<li>
<p>
Other applications use the <samp>stty erase</samp> character and
<samp>kdch1</samp> for the two delete keys, with ASCII DEL being &quot;delete
previous character&quot; and <samp>kdch1</samp> being &quot;delete character
under cursor&quot;.
</p>
</li>
</ul>

<p>
This will solve the problem except for the following cases:
</p>
<ul>
<li>
<p>
Some terminals have a <samp>&lt;--</samp> key that cannot be made to produce
anything except <samp>^H</samp>.  On these terminals Emacs help will be
unavailable on <samp>^H</samp> (assuming that the <samp>stty erase</samp>
character takes precedence in Emacs, and has been set correctly).  <samp>M-x
help</samp> or <samp>F1</samp> (if available) can be used instead.
</p>
</li>
</ul>
<ul>
<li>
<p>
Some operating systems use <samp>^H</samp> for <samp>stty erase</samp>.
However, modern telnet versions and all rlogin versions propagate
<samp>stty</samp> settings, and almost all UNIX versions honour <samp>stty
erase</samp>.  Where the <samp>stty</samp> settings are not propagated
correctly, things can be made to work by using <samp>stty</samp> manually.
</p>
</li>
</ul>
<ul>
<li>
<p>
Some systems (including previous Debian versions) use <code>xmodmap</code> to
arrange for both <samp>&lt;--</samp> and <samp>Delete</samp> to generate
<samp>KB_Delete</samp>.  We can change the behavior of their X clients using
the same X resources that we use to do it for our own clients, or configure our
clients using their resources when things are the other way around.  On
displays configured like this <samp>Delete</samp> will not work, but
<samp>&lt;--</samp> will.
</p>
</li>
</ul>
<ul>
<li>
<p>
Some operating systems have different <samp>kdch1</samp> settings in their
<samp>terminfo</samp> database for <samp>xterm</samp> and others.  On these
systems the <samp>Delete</samp> key will not work correctly when you log in
from a system conforming to our policy, but <samp>&lt;--</samp> will.
</p>
</li>
</ul>

<hr>

<h2 id="s9.9">9.9 Environment variables</h2>

<p>
A program must not depend on environment variables to get reasonable defaults.
(That's because these environment variables would have to be set in a
system-wide configuration file like <code>/etc/profile</code>, which is not
supported by all shells.)
</p>

<p>
If a program usually depends on environment variables for its configuration,
the program should be changed to fall back to a reasonable default
configuration if these environment variables are not present.  If this cannot
be done easily (e.g., if the source code of a non-free program is not
available), the program must be replaced by a small &quot;wrapper&quot; shell
script which sets the environment variables if they are not already defined,
and calls the original program.
</p>

<p>
Here is an example of a wrapper script for this purpose:
</p>
<pre>
     #!/bin/sh
     BAR=${BAR:-/var/lib/fubar}
     export BAR
     exec /usr/lib/foo/foo &quot;$@&quot;
</pre>

<p>
Furthermore, as <code>/etc/profile</code> is a configuration file of the
<code>base-files</code> package, other packages must not put any environment
variables or other commands into that file.
</p>

<hr>

<h2 id="s-doc-base">9.10 Registering Documents using doc-base</h2>

<p>
The <code>doc-base</code> package implements a flexible mechanism for handling
and presenting documentation.  The recommended practice is for every Debian
package that provides online documentation (other than just manual pages) to
register these documents with <code>doc-base</code> by installing a
<code>doc-base</code> control file in <code>/usr/share/doc-base/</code>.
</p>

<p>
Please refer to the documentation that comes with the <code>doc-base</code>
package for information and details.
</p>

<hr>

<h2 id="s-alternateinit">9.11 Alternate init systems</h2>

<p>
A number of other init systems are available now in Debian that can be used in
place of <code>sysvinit</code>.  Alternative init implementations must support
running SysV init scripts as described at <a href="#s-sysvinit">System run
levels and <code>init.d</code> scripts, Section 9.3</a> for compatibility.
</p>

<p>
Packages may integrate with these replacement init systems by providing
implementation-specific configuration information about how and when to start a
service or in what order to run certain tasks at boot time.  However, any
package integrating with other init systems must also be backwards-compatible
with <code>sysvinit</code> by providing a SysV-style init script with the same
name as and equivalent functionality to any init-specific job, as this is the
only start-up configuration method guaranteed to be supported by all init
implementations.  An exception to this rule is scripts or jobs provided by the
init implementation itself; such jobs may be required for an
implementation-specific equivalent of the <code>/etc/rcS.d/</code> scripts and
may not have a one-to-one correspondence with the init scripts.
</p>

<hr>

<h3 id="s-upstart">9.11.1 Event-based boot with upstart</h3>

<p>
Packages may integrate with the <code>upstart</code> event-based boot system by
installing job files in the <code>/etc/init</code> directory.  SysV init
scripts for which an equivalent upstart job is available must query the output
of the command <code>initctl version</code> for the string <samp>upstart</samp>
and avoid running in favor of the native upstart job, using a test such as
this:
</p>
<pre>
     if [ &quot;$1&quot; = start ] &amp;&amp; which initctl &gt;/dev/null &amp;&amp; initctl version | grep -q upstart
     then
     	exit 1
     fi
</pre>

<p>
Because packages shipping upstart jobs may be installed on systems that are not
using upstart, maintainer scripts must still use the common
<code>update-rc.d</code> and <code>invoke-rc.d</code> interfaces for
configuring runlevels and for starting and stopping services.  These maintainer
scripts must not call the upstart <code>start</code>, <code>restart</code>,
<code>reload</code>, or <code>stop</code> interfaces directly.  Instead,
implementations of <code>invoke-rc.d</code> must detect when upstart is running
and when an upstart job with the same name as an init script is present, and
perform the requested action using the upstart job instead of the init script.
</p>

<p>
Dependency-based boot managers for SysV init scripts, such as
<code>startpar</code>, may avoid running a given init script entirely when an
equivalent upstart job is present, to avoid unnecessary forking of no-op init
scripts.  In this case, the boot manager should integrate with upstart to
detect when the upstart job in question is started or stopped to know when the
dependency has been satisfied.
</p>

<p><a name="ch-files"></a></p>
<hr>

<p>
[ <a href="#ch-opersys">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ 10 ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-customized-programs">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 10 - Files
</h1>

<hr>

<h2 id="s-binaries">10.1 Binaries</h2>

<p>
Two different packages must not install programs with different functionality
but with the same filenames.  (The case of two programs having the same
functionality but different implementations is handled via
&quot;alternatives&quot; or the &quot;Conflicts&quot; mechanism.  See <a
href="#s-maintscripts">Maintainer Scripts, Section 3.9</a> and <a
href="#s-conflicts">Conflicting binary packages - <samp>Conflicts</samp>,
Section 7.4</a> respectively.) If this case happens, one of the programs must
be renamed.  The maintainers should report this to the
<samp>debian-devel</samp> mailing list and try to find a consensus about which
program will have to be renamed.  If a consensus cannot be reached,
<em>both</em> programs must be renamed.
</p>

<p>
Binary executables must not be statically linked with the GNU C library, since
this prevents the binary from benefiting from fixes and improvements to the C
library without being rebuilt and complicates security updates.  This
requirement may be relaxed for binary executables whose intended purpose is to
diagnose and fix the system in situations where the GNU C library may not be
usable (such as system recovery shells or utilities like ldconfig) or for
binary executables where the security benefits of static linking outweigh the
drawbacks.
</p>

<p>
By default, when a package is being built, any binaries created should include
debugging information, as well as being compiled with optimization.  You should
also turn on as many reasonable compilation warnings as possible; this makes
life easier for porters, who can then look at build logs for possible problems.
For the C programming language, this means the following compilation parameters
should be used:
</p>
<pre>
     CC = gcc
     CFLAGS = -O2 -g -Wall # sane warning options vary between programs
     LDFLAGS = # none
     INSTALL = install -s # (or use strip on the files in debian/tmp)
</pre>

<p>
Note that by default all installed binaries should be stripped, either by using
the <samp>-s</samp> flag to <code>install</code>, or by calling
<code>strip</code> on the binaries after they have been copied into
<code>debian/tmp</code> but before the tree is made into a package.
</p>

<p>
Although binaries in the build tree should be compiled with debugging
information by default, it can often be difficult to debug programs if they are
also subjected to compiler optimization.  For this reason, it is recommended to
support the standardized environment variable <samp>DEB_BUILD_OPTIONS</samp>
(see <a href="#s-debianrules-options"><code>debian/rules</code> and
<samp>DEB_BUILD_OPTIONS</samp>, Section 4.9.1</a>).  This variable can contain
several flags to change how a package is compiled and built.
</p>

<p>
It is up to the package maintainer to decide what compilation options are best
for the package.  Certain binaries (such as computationally-intensive programs)
will function better with certain flags (<samp>-O3</samp>, for example); feel
free to use them.  Please use good judgment here.  Don't use flags for the sake
of it; only use them if there is good reason to do so.  Feel free to override
the upstream author's ideas about which compilation options are best: they are
often inappropriate for our environment.
</p>

<hr>

<h2 id="s-libraries">10.2 Libraries</h2>

<p>
If the package is <strong>architecture: any</strong>, then the shared library
compilation and linking flags must have <samp>-fPIC</samp>, or the package
shall not build on some of the supported architectures[<a href="#f84"
name="fr84">84</a>].  Any exception to this rule must be discussed on the
mailing list <em>debian-devel@lists.debian.org</em>, and a rough consensus
obtained.  The reasons for not compiling with <samp>-fPIC</samp> flag must be
recorded in the file <samp>README.Debian</samp>, and care must be taken to
either restrict the architecture or arrange for <samp>-fPIC</samp> to be used
on architectures where it is required.[<a href="#f85" name="fr85">85</a>]
</p>

<p>
As to the static libraries, the common case is not to have relocatable code,
since there is no benefit, unless in specific cases; therefore the static
version must not be compiled with the <samp>-fPIC</samp> flag.  Any exception
to this rule should be discussed on the mailing list
<em>debian-devel@lists.debian.org</em>, and the reasons for compiling with the
<samp>-fPIC</samp> flag must be recorded in the file
<samp>README.Debian</samp>.  [<a href="#f86" name="fr86">86</a>]
</p>

<p>
In other words, if both a shared and a static library is being built, each
source unit (<samp>*.c</samp>, for example, for C files) will need to be
compiled twice, for the normal case.
</p>

<p>
Libraries should be built with threading support and to be thread-safe if the
library supports this.
</p>

<p>
Although not enforced by the build tools, shared libraries must be linked
against all libraries that they use symbols from in the same way that binaries
are.  This ensures the correct functioning of the <a
href="#s-sharedlibs-symbols">symbols</a> and <a
href="#s-sharedlibs-shlibdeps">shlibs</a> systems and guarantees that all
libraries can be safely opened with <samp>dlopen()</samp>.  Packagers may wish
to use the gcc option <samp>-Wl,-z,defs</samp> when building a shared library.
Since this option enforces symbol resolution at build time, a missing library
reference will be caught early as a fatal build error.
</p>

<p>
All installed shared libraries should be stripped with
</p>
<pre>
     strip --strip-unneeded <var>your-lib</var>
</pre>

<p>
(The option <samp>--strip-unneeded</samp> makes <code>strip</code> remove only
the symbols which aren't needed for relocation processing.) Shared libraries
can function perfectly well when stripped, since the symbols for dynamic
linking are in a separate part of the ELF object file.[<a href="#f87"
name="fr87">87</a>]
</p>

<p>
Note that under some circumstances it may be useful to install a shared library
unstripped, for example when building a separate package to support debugging.
</p>

<p>
Shared object files (often <code>.so</code> files) that are not public
libraries, that is, they are not meant to be linked to by third party
executables (binaries of other packages), should be installed in subdirectories
of the <code>/usr/lib</code> directory.  Such files are exempt from the rules
that govern ordinary shared libraries, except that they must not be installed
executable and should be stripped.[<a href="#f88" name="fr88">88</a>]
</p>

<p>
Packages that use <code>libtool</code> to create and install their shared
libraries install a file containing additional metadata (ending in
<code>.la</code>) alongside the library.  For public libraries intended for use
by other packages, these files normally should not be included in the Debian
package, since the information they include is not necessary to link with the
shared library on Debian and can add unnecessary additional dependencies to
other programs or libraries.[<a href="#f89" name="fr89">89</a>] If the
<code>.la</code> file is required for that library (if, for instance, it's
loaded via <samp>libltdl</samp> in a way that requires that meta-information),
the <samp>dependency_libs</samp> setting in the <code>.la</code> file should
normally be set to the empty string.  If the shared library development package
has historically included the <code>.la</code>, it must be retained in the
development package (with <samp>dependency_libs</samp> emptied) until all
libraries that depend on it have removed or emptied
<samp>dependency_libs</samp> in their <code>.la</code> files to prevent linking
with those other libraries using <code>libtool</code> from failing.
</p>

<p>
If the <code>.la</code> must be included, it should be included in the
development (<samp>-dev</samp>) package, unless the library will be loaded by
<code>libtool</code>'s <samp>libltdl</samp> library.  If it is intended for use
with <samp>libltdl</samp>, the <code>.la</code> files must go in the run-time
library package.
</p>

<p>
These requirements for handling of <code>.la</code> files do not apply to
loadable modules or libraries not installed in directories searched by default
by the dynamic linker.  Packages installing loadable modules will frequently
need to install the <code>.la</code> files alongside the modules so that they
can be loaded by <samp>libltdl</samp>.  <samp>dependency_libs</samp> does not
need to be modified for libraries or modules that are not installed in
directories searched by the dynamic linker by default and not intended for use
by other packages.
</p>

<p>
You must make sure that you use only released versions of shared libraries to
build your packages; otherwise other users will not be able to run your
binaries properly.  Producing source packages that depend on unreleased
compilers is also usually a bad idea.
</p>

<hr>

<h2 id="s10.3">10.3 Shared libraries</h2>

<p>
This section has moved to <a href="#ch-sharedlibs">Shared libraries, Chapter
8</a>.
</p>

<hr>

<h2 id="s-scripts">10.4 Scripts</h2>

<p>
All command scripts, including the package maintainer scripts inside the
package and used by <code>dpkg</code>, should have a <samp>#!</samp> line
naming the shell to be used to interpret them.
</p>

<p>
In the case of Perl scripts this should be <samp>#!/usr/bin/perl</samp>.
</p>

<p>
When scripts are installed into a directory in the system PATH, the script name
should not include an extension such as <samp>.sh</samp> or <samp>.pl</samp>
that denotes the scripting language currently used to implement it.
</p>

<p>
Shell scripts (<code>sh</code> and <code>bash</code>) other than
<code>init.d</code> scripts should almost certainly start with <samp>set
-e</samp> so that errors are detected.  <code>init.d</code> scripts are
something of a special case, due to how frequently they need to call commands
that are allowed to fail, and it may instead be easier to check the exit status
of commands directly.  See <a href="#s-writing-init">Writing the scripts,
Section 9.3.2</a> for more information about writing <code>init.d</code>
scripts.
</p>

<p>
Every script should use <samp>set -e</samp> or check the exit status of
<em>every</em> command.
</p>

<p>
Scripts may assume that <code>/bin/sh</code> implements the SUSv3 Shell Command
Language[<a href="#f90" name="fr90">90</a>] plus the following additional
features not mandated by SUSv3:[<a href="#f91" name="fr91">91</a>]
</p>
<ul>
<li>
<p>
<samp>echo -n</samp>, if implemented as a shell built-in, must not generate a
newline.
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>test</samp>, if implemented as a shell built-in, must support
<samp>-a</samp> and <samp>-o</samp> as binary logical operators.
</p>
</li>
</ul>
<ul>
<li>
<p>
<samp>local</samp> to create a scoped variable must be supported, including
listing multiple variables in a single local command and assigning a value to a
variable at the same time as localizing it.  <samp>local</samp> may or may not
preserve the variable value from an outer scope if no assignment is present.
Uses such as:
</p>
<pre>
     fname () {
         local a b c=delta d
         # ... use a, b, c, d ...
     }
</pre>

<p>
must be supported and must set the value of <samp>c</samp> to
<samp>delta</samp>.
</p>
</li>
</ul>
<ul>
<li>
<p>
The XSI extension to <code>kill</code> allowing <samp>kill
-<var>signal</var></samp>, where <var>signal</var> is either the name of a
signal or one of the numeric signals listed in the XSI extension (0, 1, 2, 3,
6, 9, 14, and 15), must be supported if <code>kill</code> is implemented as a
shell built-in.
</p>
</li>
</ul>
<ul>
<li>
<p>
The XSI extension to <code>trap</code> allowing numeric signals must be
supported.  In addition to the signal numbers listed in the extension, which
are the same as for <code>kill</code> above, 13 (SIGPIPE) must be allowed.
</p>
</li>
</ul>

<p>
If a shell script requires non-SUSv3 features from the shell interpreter other
than those listed above, the appropriate shell must be specified in the first
line of the script (e.g., <samp>#!/bin/bash</samp>) and the package must depend
on the package providing the shell (unless the shell package is marked
&quot;Essential&quot;, as in the case of <code>bash</code>).
</p>

<p>
You may wish to restrict your script to SUSv3 features plus the above set when
possible so that it may use <code>/bin/sh</code> as its interpreter.  Checking
your script with <code>checkbashisms</code> from the <code>devscripts</code>
package or running your script with an alternate shell such as
<code>posh</code> may help uncover violations of the above requirements.  If in
doubt whether a script complies with these requirements, use
<code>/bin/bash</code>.
</p>

<p>
Perl scripts should check for errors when making any system calls, including
<samp>open</samp>, <samp>print</samp>, <samp>close</samp>, <samp>rename</samp>
and <samp>system</samp>.
</p>

<p>
<code>csh</code> and <code>tcsh</code> should be avoided as scripting
languages.  See <em>Csh Programming Considered Harmful</em>, one of the
<samp>comp.unix.*</samp> FAQs, which can be found at <code><a
href="http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/">http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/</a></code>.
If an upstream package comes with <code>csh</code> scripts then you must make
sure that they start with <samp>#!/bin/csh</samp> and make your package depend
on the <code>c-shell</code> virtual package.
</p>

<p>
Any scripts which create files in world-writeable directories (e.g., in
<code>/tmp</code>) must use a mechanism which will fail atomically if a file
with the same name already exists.
</p>

<p>
The Debian base system provides the <code>tempfile</code> and
<code>mktemp</code> utilities for use by scripts for this purpose.
</p>

<hr>

<h2 id="s10.5">10.5 Symbolic links</h2>

<p>
In general, symbolic links within a top-level directory should be relative, and
symbolic links pointing from one top-level directory to or into another should
be absolute.  (A top-level directory is a sub-directory of the root directory
<code>/</code>.) For example, a symbolic link from <code>/usr/lib/foo</code> to
<code>/usr/share/bar</code> should be relative (<code>../share/bar</code>), but
a symbolic link from <code>/var/run</code> to <code>/run</code> should be
absolute.[<a href="#f92" name="fr92">92</a>] Symbolic links must not traverse
above the root directory.
</p>

<p>
In addition, symbolic links should be specified as short as possible, i.e.,
link targets like <code>foo/../bar</code> are deprecated.
</p>

<p>
Note that when creating a relative link using <code>ln</code> it is not
necessary for the target of the link to exist relative to the working directory
you're running <code>ln</code> from, nor is it necessary to change directory to
the directory where the link is to be made.  Simply include the string that
should appear as the target of the link (this will be a pathname relative to
the directory in which the link resides) as the first argument to
<code>ln</code>.
</p>

<p>
For example, in your <code>Makefile</code> or <code>debian/rules</code>, you
can do things like:
</p>
<pre>
     ln -fs gcc $(prefix)/bin/cc
     ln -fs gcc debian/tmp/usr/bin/cc
     ln -fs ../sbin/sendmail $(prefix)/bin/runq
     ln -fs ../sbin/sendmail debian/tmp/usr/bin/runq
</pre>

<p>
A symbolic link pointing to a compressed file (in the sense that it is meant to
be uncompressed with <code>unzip</code> or <code>zless</code> etc.) should
always have the same file extension as the referenced file.  (For example, if a
file <code>foo.gz</code> is referenced by a symbolic link, the filename of the
link has to end with &quot;<code>.gz</code>&quot; too, as in
<code>bar.gz</code>.)
</p>

<hr>

<h2 id="s10.6">10.6 Device files</h2>

<p>
Packages must not include device files or named pipes in the package file tree.
</p>

<p>
If a package needs any special device files that are not included in the base
system, it must call <code>MAKEDEV</code> in the <code>postinst</code> script,
after notifying the user[<a href="#f93" name="fr93">93</a>].
</p>

<p>
Packages must not remove any device files in the <code>postrm</code> or any
other script.  This is left to the system administrator.
</p>

<p>
Debian uses the serial devices <code>/dev/ttyS*</code>.  Programs using the old
<code>/dev/cu*</code> devices should be changed to use <code>/dev/ttyS*</code>.
</p>

<p>
Named pipes needed by the package must be created in the <code>postinst</code>
script[<a href="#f94" name="fr94">94</a>] and removed in the <code>prerm</code>
or <code>postrm</code> script as appropriate.
</p>

<hr>

<h2 id="s-config-files">10.7 Configuration files</h2>

<hr>

<h3 id="s10.7.1">10.7.1 Definitions</h3>
<dl>
<dt>configuration file</dt>
<dd>
<p>
A file that affects the operation of a program, or provides site- or
host-specific information, or otherwise customizes the behavior of a program.
Typically, configuration files are intended to be modified by the system
administrator (if needed or desired) to conform to local policy or to provide
more useful site-specific behavior.
</p>
</dd>
</dl>
<dl>
<dt><samp>conffile</samp></dt>
<dd>
<p>
A file listed in a package's <samp>conffiles</samp> file, and is treated
specially by <code>dpkg</code> (see <a href="#s-configdetails">Details of
configuration, Section 6.7</a>).
</p>
</dd>
</dl>

<p>
The distinction between these two is important; they are not interchangeable
concepts.  Almost all <samp>conffile</samp>s are configuration files, but many
configuration files are not <samp>conffiles</samp>.
</p>

<p>
As noted elsewhere, <code>/etc/init.d</code> scripts, <code>/etc/default</code>
files, scripts installed in
<code>/etc/cron.{hourly,daily,weekly,monthly}</code>, and cron configuration
installed in <code>/etc/cron.d</code> must be treated as configuration files.
In general, any script that embeds configuration information is de-facto a
configuration file and should be treated as such.
</p>

<hr>

<h3 id="s10.7.2">10.7.2 Location</h3>

<p>
Any configuration files created or used by your package must reside in
<code>/etc</code>.  If there are several, consider creating a subdirectory of
<code>/etc</code> named after your package.
</p>

<p>
If your package creates or uses configuration files outside of
<code>/etc</code>, and it is not feasible to modify the package to use
<code>/etc</code> directly, put the files in <code>/etc</code> and create
symbolic links to those files from the location that the package requires.
</p>

<hr>

<h3 id="s10.7.3">10.7.3 Behavior</h3>

<p>
Configuration file handling must conform to the following behavior:
</p>
<ul>
<li>
<p>
local changes must be preserved during a package upgrade, and
</p>
</li>
<li>
<p>
configuration files must be preserved when the package is removed, and only
deleted when the package is purged.
</p>
</li>
</ul>

<p>
Obsolete configuration files without local changes should be removed by the
package during upgrade.[<a href="#f95" name="fr95">95</a>]
</p>

<p>
The easy way to achieve this behavior is to make the configuration file a
<samp>conffile</samp>.  This is appropriate only if it is possible to
distribute a default version that will work for most installations, although
some system administrators may choose to modify it.  This implies that the
default version will be part of the package distribution, and must not be
modified by the maintainer scripts during installation (or at any other time).
</p>

<p>
In order to ensure that local changes are preserved correctly, no package may
contain or make hard links to conffiles.[<a href="#f96" name="fr96">96</a>]
</p>

<p>
The other way to do it is via the maintainer scripts.  In this case, the
configuration file must not be listed as a <samp>conffile</samp> and must not
be part of the package distribution.  If the existence of a file is required
for the package to be sensibly configured it is the responsibility of the
package maintainer to provide maintainer scripts which correctly create, update
and maintain the file and remove it on purge.  (See <a
href="#ch-maintainerscripts">Package maintainer scripts and installation
procedure, Chapter 6</a> for more information.) These scripts must be
idempotent (i.e., must work correctly if <code>dpkg</code> needs to re-run them
due to errors during installation or removal), must cope with all the variety
of ways <code>dpkg</code> can call maintainer scripts, must not overwrite or
otherwise mangle the user's configuration without asking, must not ask
unnecessary questions (particularly during upgrades), and must otherwise be
good citizens.
</p>

<p>
The scripts are not required to configure every possible option for the
package, but only those necessary to get the package running on a given system.
Ideally the sysadmin should not have to do any configuration other than that
done (semi-)automatically by the <code>postinst</code> script.
</p>

<p>
A common practice is to create a script called
<code><var>package</var>-configure</code> and have the package's
<code>postinst</code> call it if and only if the configuration file does not
already exist.  In certain cases it is useful for there to be an example or
template file which the maintainer scripts use.  Such files should be in
<code>/usr/share/<var>package</var></code> or
<code>/usr/lib/<var>package</var></code> (depending on whether they are
architecture-independent or not).  There should be symbolic links to them from
<code>/usr/share/doc/<var>package</var>/examples</code> if they are examples,
and should be perfectly ordinary <code>dpkg</code>-handled files (<em>not</em>
configuration files).
</p>

<p>
These two styles of configuration file handling must not be mixed, for that way
lies madness: <code>dpkg</code> will ask about overwriting the file every time
the package is upgraded.
</p>

<hr>

<h3 id="s10.7.4">10.7.4 Sharing configuration files</h3>

<p>
If two or more packages use the same configuration file and it is reasonable
for both to be installed at the same time, one of these packages must be
defined as <em>owner</em> of the configuration file, i.e., it will be the
package which handles that file as a configuration file.  Other packages that
use the configuration file must depend on the owning package if they require
the configuration file to operate.  If the other package will use the
configuration file if present, but is capable of operating without it, no
dependency need be declared.
</p>

<p>
If it is desirable for two or more related packages to share a configuration
file <em>and</em> for all of the related packages to be able to modify that
configuration file, then the following should be done:
</p>
<!-- ol type="1" start="1"  -->
<li>
<p>
One of the related packages (the &quot;owning&quot; package) will manage the
configuration file with maintainer scripts as described in the previous
section.
</p>
</li>
<li>
<p>
The owning package should also provide a program that the other packages may
use to modify the configuration file.
</p>
</li>
<li>
<p>
The related packages must use the provided program to make any desired
modifications to the configuration file.  They should either depend on the core
package to guarantee that the configuration modifier program is available or
accept gracefully that they cannot modify the configuration file if it is not.
(This is in addition to the fact that the configuration file may not even be
present in the latter scenario.)
</p>
</li>
</ol>

<p>
Sometimes it's appropriate to create a new package which provides the basic
infrastructure for the other packages and which manages the shared
configuration files.  (The <samp>sgml-base</samp> package is a good example.)
</p>

<p>
If the configuration file cannot be shared as described above, the packages
must be marked as conflicting with each other.  Two packages that specify the
same file as a <samp>conffile</samp> must conflict.  This is an instance of the
general rule about not sharing files.  Neither alternatives nor diversions are
likely to be appropriate in this case; in particular, <code>dpkg</code> does
not handle diverted <samp>conffile</samp>s well.
</p>

<p>
When two packages both declare the same <samp>conffile</samp>, they may see
left-over configuration files from each other even though they conflict with
each other.  If a user removes (without purging) one of the packages and
installs the other, the new package will take over the <samp>conffile</samp>
from the old package.  If the file was modified by the user, it will be treated
the same as any other locally modified <samp>conffile</samp> during an upgrade.
</p>

<p>
The maintainer scripts must not alter a <samp>conffile</samp> of <em>any</em>
package, including the one the scripts belong to.
</p>

<hr>

<h3 id="s10.7.5">10.7.5 User configuration files (&quot;dotfiles&quot;)</h3>

<p>
The files in <code>/etc/skel</code> will automatically be copied into new user
accounts by <code>adduser</code>.  No other program should reference the files
in <code>/etc/skel</code>.
</p>

<p>
Therefore, if a program needs a dotfile to exist in advance in
<code>$HOME</code> to work sensibly, that dotfile should be installed in
<code>/etc/skel</code> and treated as a configuration file.
</p>

<p>
However, programs that require dotfiles in order to operate sensibly are a bad
thing, unless they do create the dotfiles themselves automatically.
</p>

<p>
Furthermore, programs should be configured by the Debian default installation
to behave as closely to the upstream default behavior as possible.
</p>

<p>
Therefore, if a program in a Debian package needs to be configured in some way
in order to operate sensibly, that should be done using a site-wide
configuration file placed in <code>/etc</code>.  Only if the program doesn't
support a site-wide default configuration and the package maintainer doesn't
have time to add it may a default per-user file be placed in
<code>/etc/skel</code>.
</p>

<p>
<code>/etc/skel</code> should be as empty as we can make it.  This is
particularly true because there is no easy (or necessarily desirable) mechanism
for ensuring that the appropriate dotfiles are copied into the accounts of
existing users when a package is installed.
</p>

<hr>

<h2 id="s10.8">10.8 Log files</h2>

<p>
Log files should usually be named <code>/var/log/<var>package</var>.log</code>.
If you have many log files, or need a separate directory for permission reasons
(<code>/var/log</code> is writable only by <code>root</code>), you should
usually create a directory named <code>/var/log/<var>package</var></code> and
place your log files there.
</p>

<p>
Log files must be rotated occasionally so that they don't grow indefinitely.
The best way to do this is to install a log rotation configuration file in the
directory <code>/etc/logrotate.d</code>, normally named
<code>/etc/logrotate.d/<var>package</var></code>, and use the facilities
provided by <code>logrotate</code>.  [<a href="#f97" name="fr97">97</a>] Here
is a good example for a logrotate config file (for more information see
<code>logrotate(8)</code>):
</p>
<pre>
     /var/log/foo/*.log {
         rotate 12
         weekly
         compress
         missingok
         postrotate
             start-stop-daemon -K -p /var/run/foo.pid -s HUP -x /usr/sbin/foo -q
         endscript
     }
</pre>

<p>
This rotates all files under <code>/var/log/foo</code>, saves 12 compressed
generations, and tells the daemon to reopen its log files after the log
rotation.  It skips this log rotation (via <samp>missingok</samp>) if no such
log file is present, which avoids errors if the package is removed but not
purged.
</p>

<p>
Log files should be removed when the package is purged (but not when it is only
removed).  This should be done by the <code>postrm</code> script when it is
called with the argument <samp>purge</samp> (see <a
href="#s-removedetails">Details of removal and/or configuration purging,
Section 6.8</a>).
</p>

<hr>

<h2 id="s-permissions-owners">10.9 Permissions and owners</h2>

<p>
The rules in this section are guidelines for general use.  If necessary you may
deviate from the details below.  However, if you do so you must make sure that
what is done is secure and you should try to be as consistent as possible with
the rest of the system.  You should probably also discuss it on
<code>debian-devel</code> first.
</p>

<p>
Files should be owned by <samp>root:root</samp>, and made writable only by the
owner and universally readable (and executable, if appropriate), that is mode
644 or 755.
</p>

<p>
Directories should be mode 755 or (for group-writability) mode 2775.  The
ownership of the directory should be consistent with its mode: if a directory
is mode 2775, it should be owned by the group that needs write access to it.[<a
href="#f98" name="fr98">98</a>]
</p>

<p>
Control information files should be owned by <samp>root:root</samp> and either
mode 644 (for most files) or mode 755 (for executables such as <a
href="#s-maintscripts">maintainer scripts</a>).
</p>

<p>
Setuid and setgid executables should be mode 4755 or 2755 respectively, and
owned by the appropriate user or group.  They should not be made unreadable
(modes like 4711 or 2711 or even 4111); doing so achieves no extra security,
because anyone can find the binary in the freely available Debian package; it
is merely inconvenient.  For the same reason you should not restrict read or
execute permissions on non-set-id executables.
</p>

<p>
Some setuid programs need to be restricted to particular sets of users, using
file permissions.  In this case they should be owned by the uid to which they
are set-id, and by the group which should be allowed to execute them.  They
should have mode 4754; again there is no point in making them unreadable to
those users who must not be allowed to execute them.
</p>

<p>
It is possible to arrange that the system administrator can reconfigure the
package to correspond to their local security policy by changing the
permissions on a binary: they can do this by using
<code>dpkg-statoverride</code>, as described below.[<a href="#f99"
name="fr99">99</a>] Another method you should consider is to create a group for
people allowed to use the program(s) and make any setuid executables executable
only by that group.
</p>

<p>
If you need to create a new user or group for your package there are two
possibilities.  Firstly, you may need to make some files in the binary package
be owned by this user or group, or you may need to compile the user or group id
(rather than just the name) into the binary (though this latter should be
avoided if possible, as in this case you need a statically allocated id).
</p>

<p>
If you need a statically allocated id, you must ask for a user or group id from
the <samp>base-passwd</samp> maintainer, and must not release the package until
you have been allocated one.  Once you have been allocated one you must either
make the package depend on a version of the <samp>base-passwd</samp> package
with the id present in <code>/etc/passwd</code> or <code>/etc/group</code>, or
arrange for your package to create the user or group itself with the correct id
(using <samp>adduser</samp>) in its <code>preinst</code> or
<code>postinst</code>.  (Doing it in the <code>postinst</code> is to be
preferred if it is possible, otherwise a pre-dependency will be needed on the
<samp>adduser</samp> package.)
</p>

<p>
On the other hand, the program might be able to determine the uid or gid from
the user or group name at runtime, so that a dynamically allocated id can be
used.  In this case you should choose an appropriate user or group name,
discussing this on <code>debian-devel</code> and checking with the
<code>base-passwd</code> maintainer that it is unique and that they do not wish
you to use a statically allocated id instead.  When this has been checked you
must arrange for your package to create the user or group if necessary using
<code>adduser</code> in the <code>preinst</code> or <code>postinst</code>
script (again, the latter is to be preferred if it is possible).
</p>

<p>
Note that changing the numeric value of an id associated with a name is very
difficult, and involves searching the file system for all appropriate files.
You need to think carefully whether a static or dynamic id is required, since
changing your mind later will cause problems.
</p>

<hr>

<h3 id="s10.9.1">10.9.1 The use of <code>dpkg-statoverride</code></h3>

<p>
This section is not intended as policy, but as a description of the use of
<code>dpkg-statoverride</code>.
</p>

<p>
If a system administrator wishes to have a file (or directory or other such
thing) installed with owner and permissions different from those in the
distributed Debian package, they can use the <code>dpkg-statoverride</code>
program to instruct <code>dpkg</code> to use the different settings every time
the file is installed.  Thus the package maintainer should distribute the files
with their normal permissions, and leave it for the system administrator to
make any desired changes.  For example, a daemon which is normally required to
be setuid root, but in certain situations could be used without being setuid,
should be installed setuid in the <samp>.deb</samp>.  Then the local system
administrator can change this if they wish.  If there are two standard ways of
doing it, the package maintainer can use <samp>debconf</samp> to find out the
preference, and call <code>dpkg-statoverride</code> in the maintainer script if
necessary to accommodate the system administrator's choice.  Care must be taken
during upgrades to not override an existing setting.
</p>

<p>
Given the above, <code>dpkg-statoverride</code> is essentially a tool for
system administrators and would not normally be needed in the maintainer
scripts.  There is one type of situation, though, where calls to
<code>dpkg-statoverride</code> would be needed in the maintainer scripts, and
that involves packages which use dynamically allocated user or group ids.  In
such a situation, something like the following idiom can be very helpful in the
package's <code>postinst</code>, where <samp>sysuser</samp> is a dynamically
allocated id:
</p>

<pre>
     for i in /usr/bin/foo /usr/sbin/bar
     do
       # only do something when no setting exists
       if ! dpkg-statoverride --list $i &gt;/dev/null 2&gt;&amp;1
       then
         #include: debconf processing, question about foo and bar
         if [ &quot;$RET&quot; = &quot;true&quot; ] ; then
           dpkg-statoverride --update --add sysuser root 4755 $i
         fi
       fi
     done
</pre>

<p>
The corresponding code to remove the override when the package is purged would
be:
</p>

<pre>
     for i in /usr/bin/foo /usr/sbin/bar
     do
       if dpkg-statoverride --list $i &gt;/dev/null 2&gt;&amp;1
       then
         dpkg-statoverride --remove $i
       fi
     done
</pre>

<hr>

<h2 id="s-filenames">10.10 File names</h2>

<p>
The name of the files installed by binary packages in the system PATH (namely
<samp>/bin</samp>, <samp>/sbin</samp>, <samp>/usr/bin</samp>,
<samp>/usr/sbin</samp> and <samp>/usr/games</samp>) must be encoded in ASCII.
</p>

<p>
The name of the files and directories installed by binary packages outside the
system PATH must be encoded in UTF-8 and should be restricted to ASCII when it
is possible to do so.
</p>

<p><a name="ch-customized-programs"></a></p>
<hr>

<p>
[ <a href="#ch-files">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ 11 ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-docs">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 11 - Customized programs
</h1>

<hr>

<h2 id="s-arch-spec">11.1 Architecture specification strings</h2>

<p>
If a program needs to specify an <em>architecture specification string</em> in
some place, it should select one of the strings provided by
<samp>dpkg-architecture -L</samp>.  The strings are in the format
<samp><var>os</var>-<var>arch</var></samp>, though the OS part is sometimes
elided, as when the OS is Linux.
</p>

<p>
Note that we don't want to use <samp><var>arch</var>-debian-linux</samp> to
apply to the rule
<samp><var>architecture</var>-<var>vendor</var>-<var>os</var></samp> since this
would make our programs incompatible with other Linux distributions.  We also
don't use something like <samp><var>arch</var>-unknown-linux</samp>, since the
<samp>unknown</samp> does not look very good.
</p>

<hr>

<h3 id="s-arch-wildcard-spec">11.1.1 Architecture wildcards</h3>

<p>
A package may specify an architecture wildcard.  Architecture wildcards are in
the format <samp>any</samp> (which matches every architecture),
<samp><var>os</var></samp>-any, or any-<samp><var>cpu</var></samp>.  [<a
href="#f100" name="fr100">100</a>]
</p>

<hr>

<h2 id="s11.2">11.2 Daemons</h2>

<p>
The configuration files <code>/etc/services</code>,
<code>/etc/protocols</code>, and <code>/etc/rpc</code> are managed by the
<code>netbase</code> package and must not be modified by other packages.
</p>

<p>
If a package requires a new entry in one of these files, the maintainer should
get in contact with the <code>netbase</code> maintainer, who will add the
entries and release a new version of the <code>netbase</code> package.
</p>

<p>
The configuration file <code>/etc/inetd.conf</code> must not be modified by the
package's scripts except via the <code>update-inetd</code> script or the
<code>DebianNet.pm</code> Perl module.  See their documentation for details on
how to add entries.
</p>

<p>
If a package wants to install an example entry into
<code>/etc/inetd.conf</code>, the entry must be preceded with exactly one hash
character (<samp>#</samp>).  Such lines are treated as &quot;commented out by
user&quot; by the <code>update-inetd</code> script and are not changed or
activated during package updates.
</p>

<hr>

<h2 id="s11.3">11.3 Using pseudo-ttys and modifying wtmp, utmp and lastlog</h2>

<p>
Some programs need to create pseudo-ttys.  This should be done using Unix98
ptys if the C library supports it.  The resulting program must not be installed
setuid root, unless that is required for other functionality.
</p>

<p>
The files <code>/var/run/utmp</code>, <code>/var/log/wtmp</code> and
<code>/var/log/lastlog</code> must be installed writable by group
<samp>utmp</samp>.  Programs which need to modify those files must be installed
setgid <samp>utmp</samp>.
</p>

<hr>

<h2 id="s11.4">11.4 Editors and pagers</h2>

<p>
Some programs have the ability to launch an editor or pager program to edit or
display a text document.  Since there are lots of different editors and pagers
available in the Debian distribution, the system administrator and each user
should have the possibility to choose their preferred editor and pager.
</p>

<p>
In addition, every program should choose a good default editor/pager if none is
selected by the user or system administrator.
</p>

<p>
Thus, every program that launches an editor or pager must use the EDITOR or
PAGER environment variable to determine the editor or pager the user wishes to
use.  If these variables are not set, the programs <code>/usr/bin/editor</code>
and <code>/usr/bin/pager</code> should be used, respectively.
</p>

<p>
These two files are managed through the <code>dpkg</code>
&quot;alternatives&quot; mechanism.  Every package providing an editor or pager
must call the <code>update-alternatives</code> script to register as an
alternative for <code>/usr/bin/editor</code> or <code>/usr/bin/pager</code> as
appropriate.  The alternative should have a slave alternative for
<code>/usr/share/man/man1/editor.1.gz</code> or
<code>/usr/share/man/man1/pager.1.gz</code> pointing to the corresponding
manual page.
</p>

<p>
If it is very hard to adapt a program to make use of the EDITOR or PAGER
variables, that program may be configured to use
<code>/usr/bin/sensible-editor</code> and <code>/usr/bin/sensible-pager</code>
as the editor or pager program respectively.  These are two scripts provided in
the <code>sensible-utils</code> package that check the EDITOR and PAGER
variables and launch the appropriate program, and fall back to
<code>/usr/bin/editor</code> and <code>/usr/bin/pager</code> if the variable is
not set.
</p>

<p>
A program may also use the VISUAL environment variable to determine the user's
choice of editor.  If it exists, it should take precedence over EDITOR.  This
is in fact what <code>/usr/bin/sensible-editor</code> does.
</p>

<p>
It is not required for a package to depend on <samp>editor</samp> and
<samp>pager</samp>, nor is it required for a package to provide such virtual
packages.[<a href="#f101" name="fr101">101</a>]
</p>

<hr>

<h2 id="s-web-appl">11.5 Web servers and applications</h2>

<p>
This section describes the locations and URLs that should be used by all web
servers and web applications in the Debian system.
</p>
<ol type="1" start="1" >
<li>
<p>
Cgi-bin executable files are installed in the directory
</p>
<pre>
     /usr/lib/cgi-bin
</pre>

<p>
or a subdirectory of that directory, and the script
</p>
<pre>
     /usr/lib/cgi-bin/.../<var>cgi-bin-name</var>
</pre>

<p>
should be referred to as
</p>
<pre>
     http://localhost/cgi-bin/.../<var>cgi-bin-name</var>
</pre>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
(Deleted)
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
Access to images
</p>

<p>
It is recommended that images for a package be stored in
<samp>/usr/share/images/<var>package</var></samp> and may be referred to
through an alias <samp>/images/</samp> as
</p>

<pre>
                       http://localhost/images/&lt;package&gt;/&lt;filename&gt;
</pre>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
Web Document Root
</p>

<p>
Web Applications should try to avoid storing files in the Web Document Root.
Instead they should use the /usr/share/doc/<var>package</var> directory for
documents and register the Web Application via the <code>doc-base</code>
package.  If access to the web document root is unavoidable then use
</p>
<pre>
     /var/www/html
</pre>

<p>
as the Document Root.  This might be just a symbolic link to the location where
the system administrator has put the real document root.
</p>
</li>
</ol>
<ol type="1" start="5" >
<li>
<p>
Providing httpd and/or httpd-cgi
</p>

<p>
All web servers should provide the virtual package <samp>httpd</samp>.  If a
web server has CGI support it should provide <samp>httpd-cgi</samp>
additionally.
</p>

<p>
All web applications which do not contain CGI scripts should depend on
<samp>httpd</samp>, all those web applications which <samp>do</samp> contain
CGI scripts, should depend on <samp>httpd-cgi</samp>.
</p>
</li>
</ol>

<hr>

<h2 id="s-mail-transport-agents">11.6 Mail transport, delivery and user agents</h2>

<p>
Debian packages which process electronic mail, whether mail user agents (MUAs)
or mail transport agents (MTAs), must ensure that they are compatible with the
configuration decisions below.  Failure to do this may result in lost mail,
broken <samp>From:</samp> lines, and other serious brain damage!
</p>

<p>
The mail spool is <code>/var/mail</code> and the interface to send a mail
message is <code>/usr/sbin/sendmail</code> (as per the FHS).  On older systems,
the mail spool may be physically located in <code>/var/spool/mail</code>, but
all access to the mail spool should be via the <code>/var/mail</code> symlink.
The mail spool is part of the base system and not part of the MTA package.
</p>

<p>
All Debian MUAs, MTAs, MDAs and other mailbox accessing programs (such as IMAP
daemons) must lock the mailbox in an NFS-safe way.  This means that
<samp>fcntl()</samp> locking must be combined with dot locking.  To avoid
deadlocks, a program should use <samp>fcntl()</samp> first and dot locking
after this, or alternatively implement the two locking methods in a non
blocking way[<a href="#f102" name="fr102">102</a>].  Using the functions
<samp>maillock</samp> and <samp>mailunlock</samp> provided by the
<samp>liblockfile*</samp>[<a href="#f103" name="fr103">103</a>] packages is the
recommended way to realize this.
</p>

<p>
Mailboxes are generally either mode 600 and owned by <var>user</var> or mode
660 and owned by <samp><var>user</var>:mail</samp>[<a href="#f104"
name="fr104">104</a>].  The local system administrator may choose a different
permission scheme; packages should not make assumptions about the permission
and ownership of mailboxes unless required (such as when creating a new
mailbox).  A MUA may remove a mailbox (unless it has nonstandard permissions)
in which case the MTA or another MUA must recreate it if needed.
</p>

<p>
The mail spool is 2775 <samp>root:mail</samp>, and MUAs should be setgid mail
to do the locking mentioned above (and must obviously avoid accessing other
users' mailboxes using this privilege).
</p>

<p>
<code>/etc/aliases</code> is the source file for the system mail aliases (e.g.,
postmaster, usenet, etc.), it is the one which the sysadmin and
<code>postinst</code> scripts may edit.  After <code>/etc/aliases</code> is
edited the program or human editing it must call <code>newaliases</code>.  All
MTA packages must come with a <code>newaliases</code> program, even if it does
nothing, but older MTA packages did not do this so programs should not fail if
<code>newaliases</code> cannot be found.  Note that because of this, all MTA
packages must have <samp>Provides</samp>, <samp>Conflicts</samp> and
<samp>Replaces: mail-transport-agent</samp> control fields.
</p>

<p>
The convention of writing <samp>forward to <var>address</var></samp> in the
mailbox itself is not supported.  Use a <samp>.forward</samp> file instead.
</p>

<p>
The <code>rmail</code> program used by UUCP for incoming mail should be
<code>/usr/sbin/rmail</code>.  Likewise, <code>rsmtp</code>, for receiving
batch-SMTP-over-UUCP, should be <code>/usr/sbin/rsmtp</code> if it is
supported.
</p>

<p>
If your package needs to know what hostname to use on (for example) outgoing
news and mail messages which are generated locally, you should use the file
<code>/etc/mailname</code>.  It will contain the portion after the username and
<samp>@</samp> (at) sign for email addresses of users on the machine (followed
by a newline).
</p>

<p>
Such a package should check for the existence of this file when it is being
configured.  If it exists, it should be used without comment, although an MTA's
configuration script may wish to prompt the user even if it finds that this
file exists.  If the file does not exist, the package should prompt the user
for the value (preferably using <code>debconf</code>) and store it in
<code>/etc/mailname</code> as well as using it in the package's configuration.
The prompt should make it clear that the name will not just be used by that
package.  For example, in this situation the <samp>inn</samp> package could say
something like:
</p>
<pre>
     Please enter the &quot;mail name&quot; of your system.  This is the
     hostname portion of the address to be shown on outgoing
     news and mail messages.  The default is
     <var>syshostname</var>, your system's host name.  Mail
     name [&quot;<var>syshostname</var>&quot;]:
</pre>

<p>
where <var>syshostname</var> is the output of <samp>hostname --fqdn</samp>.
</p>

<hr>

<h2 id="s11.7">11.7 News system configuration</h2>

<p>
All the configuration files related to the NNTP (news) servers and clients
should be located under <code>/etc/news</code>.
</p>

<p>
There are some configuration issues that apply to a number of news clients and
server packages on the machine.  These are:
</p>
<dl>
<dt><code>/etc/news/organization</code></dt>
<dd>
<p>
A string which should appear as the organization header for all messages posted
by NNTP clients on the machine
</p>
</dd>
</dl>
<dl>
<dt><code>/etc/news/server</code></dt>
<dd>
<p>
Contains the FQDN of the upstream NNTP server, or localhost if the local
machine is an NNTP server.
</p>
</dd>
</dl>

<p>
Other global files may be added as required for cross-package news
configuration.
</p>

<hr>

<h2 id="s11.8">11.8 Programs for the X Window System</h2>

<hr>

<h3 id="s11.8.1">11.8.1 Providing X support and package priorities</h3>

<p>
Programs that can be configured with support for the X Window System must be
configured to do so and must declare any package dependencies necessary to
satisfy their runtime requirements when using the X Window System.  If such a
package is of higher priority than the X packages on which it depends, it is
required that either the X-specific components be split into a separate
package, or that an alternative version of the package, which includes X
support, be provided, or that the package's priority be lowered.
</p>

<hr>

<h3 id="s11.8.2">11.8.2 Packages providing an X server</h3>

<p>
Packages that provide an X server that, directly or indirectly, communicates
with real input and display hardware should declare in their
<samp>Provides</samp> control field that they provide the virtual package
<samp>xserver</samp>.[<a href="#f105" name="fr105">105</a>]
</p>

<hr>

<h3 id="s11.8.3">11.8.3 Packages providing a terminal emulator</h3>

<p>
Packages that provide a terminal emulator for the X Window System which meet
the criteria listed below should declare in their <samp>Provides</samp> control
field that they provide the virtual package <samp>x-terminal-emulator</samp>.
They should also register themselves as an alternative for
<code>/usr/bin/x-terminal-emulator</code>, with a priority of 20.  That
alternative should have a slave alternative for
<code>/usr/share/man/man1/x-terminal-emulator.1.gz</code> pointing to the
corresponding manual page.
</p>

<p>
To be an <samp>x-terminal-emulator</samp>, a program must:
</p>
<ul>
<li>
<p>
Be able to emulate a DEC VT100 terminal, or a compatible terminal.
</p>
</li>
<li>
<p>
Support the command-line option <samp>-e <var>command</var></samp>, which
creates a new terminal window[<a href="#f106" name="fr106">106</a>] and runs
the specified <var>command</var>, interpreting the entirety of the rest of the
command line as a command to pass straight to exec, in the manner that
<samp>xterm</samp> does.
</p>
</li>
<li>
<p>
Support the command-line option <samp>-T <var>title</var></samp>, which creates
a new terminal window with the window title <var>title</var>.
</p>
</li>
</ul>

<hr>

<h3 id="s11.8.4">11.8.4 Packages providing a window manager</h3>

<p>
Packages that provide a window manager should declare in their
<samp>Provides</samp> control field that they provide the virtual package
<samp>x-window-manager</samp>.  They should also register themselves as an
alternative for <code>/usr/bin/x-window-manager</code>, with a priority
calculated as follows:
</p>
<ul>
<li>
<p>
Start with a priority of 20.
</p>
</li>
<li>
<p>
If the window manager supports the Debian menu system, add 20 points if this
support is available in the package's default configuration (i.e., no
configuration files belonging to the system or user have to be edited to
activate the feature); if configuration files must be modified, add only 10
points.
</p>
</li>
<li>
<p>
If the window manager complies with <code><a
href="http://www.freedesktop.org/wiki/Specifications/wm-spec">The Window
Manager Specification Project</a></code>, written by the <code><a
href="http://www.freedesktop.org/wiki/">Free Desktop Group</a></code>, add 40
points.
</p>
</li>
<li>
<p>
If the window manager permits the X session to be restarted using a
<em>different</em> window manager (without killing the X server) in its default
configuration, add 10 points; otherwise add none.
</p>
</li>
</ul>

<p>
That alternative should have a slave alternative for
<code>/usr/share/man/man1/x-window-manager.1.gz</code> pointing to the
corresponding manual page.
</p>

<hr>

<h3 id="s11.8.5">11.8.5 Packages providing fonts</h3>

<p>
Packages that provide fonts for the X Window System[<a href="#f107"
name="fr107">107</a>] must do a number of things to ensure that they are both
available without modification of the X or font server configuration, and that
they do not corrupt files used by other font packages to register information
about themselves.
</p>
<ol type="1" start="1" >
<li>
<p>
Fonts of any type supported by the X Window System must be in a separate binary
package from any executables, libraries, or documentation (except that specific
to the fonts shipped, such as their license information).  If one or more of
the fonts so packaged are necessary for proper operation of the package with
which they are associated the font package may be Recommended; if the fonts
merely provide an enhancement, a Suggests relationship may be used.  Packages
must not Depend on font packages.[<a href="#f108" name="fr108">108</a>]
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
BDF fonts must be converted to PCF fonts with the <code>bdftopcf</code> utility
(available in the <samp>xfonts-utils</samp> package, <code>gzip</code>ped, and
placed in a directory that corresponds to their resolution:
</p>
<ul>
<li>
<p>
100 dpi fonts must be placed in <code>/usr/share/fonts/X11/100dpi/</code>.
</p>
</li>
<li>
<p>
75 dpi fonts must be placed in <code>/usr/share/fonts/X11/75dpi/</code>.
</p>
</li>
<li>
<p>
Character-cell fonts, cursor fonts, and other low-resolution fonts must be
placed in <code>/usr/share/fonts/X11/misc/</code>.
</p>
</li>
</ul>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
Type 1 fonts must be placed in <code>/usr/share/fonts/X11/Type1/</code>.  If
font metric files are available, they must be placed here as well.
</p>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
Subdirectories of <code>/usr/share/fonts/X11/</code> other than those listed
above must be neither created nor used.  (The <code>PEX</code>,
<code>CID</code>, <code>Speedo</code>, and <code>cyrillic</code> directories
are excepted for historical reasons, but installation of files into these
directories remains discouraged.)
</p>
</li>
</ol>
<ol type="1" start="5" >
<li>
<p>
Font packages may, instead of placing files directly in the X font directories
listed above, provide symbolic links in that font directory pointing to the
files' actual location in the filesystem.  Such a location must comply with the
FHS.
</p>
</li>
</ol>
<ol type="1" start="6" >
<li>
<p>
Font packages should not contain both 75dpi and 100dpi versions of a font.  If
both are available, they should be provided in separate binary packages with
<samp>-75dpi</samp> or <samp>-100dpi</samp> appended to the names of the
packages containing the corresponding fonts.
</p>
</li>
</ol>
<ol type="1" start="7" >
<li>
<p>
Fonts destined for the <code>misc</code> subdirectory should not be included in
the same package as 75dpi or 100dpi fonts; instead, they should be provided in
a separate package with <samp>-misc</samp> appended to its name.
</p>
</li>
</ol>
<ol type="1" start="8" >
<li>
<p>
Font packages must not provide the files <code>fonts.dir</code>,
<code>fonts.alias</code>, or <code>fonts.scale</code> in a font directory:
</p>
<ul>
<li>
<p>
<code>fonts.dir</code> files must not be provided at all.
</p>
</li>
</ul>
<ul>
<li>
<p>
<code>fonts.alias</code> and <code>fonts.scale</code> files, if needed, should
be provided in the directory
<code>/etc/X11/fonts/<var>fontdir</var>/<var>package</var>.<var>extension</var></code>,
where <var>fontdir</var> is the name of the subdirectory of
<code>/usr/share/fonts/X11/</code> where the package's corresponding fonts are
stored (e.g., <samp>75dpi</samp> or <samp>misc</samp>), <var>package</var> is
the name of the package that provides these fonts, and <var>extension</var> is
either <samp>scale</samp> or <samp>alias</samp>, whichever corresponds to the
file contents.
</p>
</li>
</ul>
</li>
</ol>
<ol type="1" start="9" >
<li>
<p>
Font packages must declare a dependency on <samp>xfonts-utils</samp> in their
<samp>Depends</samp> or <samp>Pre-Depends</samp> control field.
</p>
</li>
</ol>
<ol type="1" start="10" >
<li>
<p>
Font packages that provide one or more <code>fonts.scale</code> files as
described above must invoke <code>update-fonts-scale</code> on each directory
into which they installed fonts <em>before</em> invoking
<code>update-fonts-dir</code> on that directory.  This invocation must occur in
both the <code>postinst</code> (for all arguments) and <code>postrm</code> (for
all arguments except <samp>upgrade</samp>) scripts.
</p>
</li>
</ol>
<ol type="1" start="11" >
<li>
<p>
Font packages that provide one or more <code>fonts.alias</code> files as
described above must invoke <code>update-fonts-alias</code> on each directory
into which they installed fonts.  This invocation must occur in both the
<code>postinst</code> (for all arguments) and <code>postrm</code> (for all
arguments except <samp>upgrade</samp>) scripts.
</p>
</li>
</ol>
<ol type="1" start="12" >
<li>
<p>
Font packages must invoke <code>update-fonts-dir</code> on each directory into
which they installed fonts.  This invocation must occur in both the
<code>postinst</code> (for all arguments) and <code>postrm</code> (for all
arguments except <samp>upgrade</samp>) scripts.
</p>
</li>
</ol>
<ol type="1" start="13" >
<li>
<p>
Font packages must not provide alias names for the fonts they include which
collide with alias names already in use by fonts already packaged.
</p>
</li>
</ol>
<ol type="1" start="14" >
<li>
<p>
Font packages must not provide fonts with the same XLFD registry name as
another font already packaged.
</p>
</li>
</ol>

<hr>

<h3 id="s-appdefaults">11.8.6 Application defaults files</h3>

<p>
Application defaults files must be installed in the directory
<code>/etc/X11/app-defaults/</code> (use of a localized subdirectory of
<code>/etc/X11/</code> as described in the <em>X Toolkit Intrinsics - C
Language Interface</em> manual is also permitted).  They must be registered as
<samp>conffile</samp>s or handled as configuration files.
</p>

<p>
Customization of programs' X resources may also be supported with the provision
of a file with the same name as that of the package placed in the
<code>/etc/X11/Xresources/</code> directory, which must be registered as a
<samp>conffile</samp> or handled as a configuration file.[<a href="#f109"
name="fr109">109</a>]
</p>

<hr>

<h3 id="s11.8.7">11.8.7 Installation directory issues</h3>

<p>
Historically, packages using the X Window System used a separate set of
installation directories from other packages.  This practice has been
discontinued and packages using the X Window System should now generally be
installed in the same directories as any other package.  Specifically, packages
must not install files under the <code>/usr/X11R6/</code> directory and the
<code>/usr/X11R6/</code> directory hierarchy should be regarded as obsolete.
</p>

<p>
Include files previously installed under <code>/usr/X11R6/include/X11/</code>
should be installed into <code>/usr/include/X11/</code>.  For files previously
installed into subdirectories of <code>/usr/X11R6/lib/X11/</code>, package
maintainers should determine if subdirectories of <code>/usr/lib/</code> and
<code>/usr/share/</code> can be used.  If not, a subdirectory of
<code>/usr/lib/X11/</code> should be used.
</p>

<p>
Configuration files for window, display, or session managers or other
applications that are tightly integrated with the X Window System may be placed
in a subdirectory of <code>/etc/X11/</code> corresponding to the package name.
Other X Window System applications should use the <code>/etc/</code> directory
unless otherwise mandated by policy (such as for <a
href="#s-appdefaults">Application defaults files, Section 11.8.6</a>).
</p>

<hr>

<h2 id="s-perl">11.9 Perl programs and modules</h2>

<p>
Perl programs and modules should follow the current Perl policy.
</p>

<p>
The Perl policy can be found in the <samp>perl-policy</samp> files in the
<samp>debian-policy</samp> package.  It is also available from the Debian web
mirrors at <samp><code><a
href="http://www.debian.org/doc/packaging-manuals/perl-policy/">/doc/packaging-manuals/perl-policy/</a></code></samp>.
</p>

<hr>

<h2 id="s-emacs">11.10 Emacs lisp programs</h2>

<p>
Please refer to the &quot;Debian Emacs Policy&quot; for details of how to
package emacs lisp programs.
</p>

<p>
The Emacs policy is available in <code>debian-emacs-policy.gz</code> of the
<code>emacsen-common</code> package.  It is also available from the Debian web
mirrors at <samp><code><a
href="http://www.debian.org/doc/packaging-manuals/debian-emacs-policy">/doc/packaging-manuals/debian-emacs-policy</a></code></samp>.
</p>

<hr>

<h2 id="s11.11">11.11 Games</h2>

<p>
The permissions on <code>/var/games</code> are mode 755, owner
<samp>root</samp> and group <samp>root</samp>.
</p>

<p>
Each game decides on its own security policy.
</p>

<p>
Games which require protected, privileged access to high-score files, saved
games, etc., may be made set-<em>group</em>-id (mode 2755) and owned by
<samp>root:games</samp>, and use files and directories with appropriate
permissions (770 <samp>root:games</samp>, for example).  They must not be made
set-<em>user</em>-id, as this causes security problems.  (If an attacker can
subvert any set-user-id game they can overwrite the executable of any other,
causing other players of these games to run a Trojan horse program.  With a
set-group-id game the attacker only gets access to less important game data,
and if they can get at the other players' accounts at all it will take
considerably more effort.)
</p>

<p>
Some packages, for example some fortune cookie programs, are configured by the
upstream authors to install with their data files or other static information
made unreadable so that they can only be accessed through set-id programs
provided.  You should not do this in a Debian package: anyone can download the
<code>.deb</code> file and read the data from it, so there is no point making
the files unreadable.  Not making the files unreadable also means that you
don't have to make so many programs set-id, which reduces the risk of a
security hole.
</p>

<p>
As described in the FHS, binaries of games should be installed in the directory
<code>/usr/games</code>.  This also applies to games that use the X Window
System.  Manual pages for games (X and non-X games) should be installed in
<code>/usr/share/man/man6</code>.
</p>

<p><a name="ch-docs"></a></p>
<hr>

<p>
[ <a href="#ch-customized-programs">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ 12 ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ap-pkg-scope">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Chapter 12 - Documentation
</h1>

<hr>

<h2 id="s12.1">12.1 Manual pages</h2>

<p>
You should install manual pages in <code>nroff</code> source form, in
appropriate places under <code>/usr/share/man</code>.  You should only use
sections 1 to 9 (see the FHS for more details).  You must not install a
pre-formatted &quot;cat page&quot;.
</p>

<p>
Each program, utility, and function should have an associated manual page
included in the same package.  It is suggested that all configuration files
also have a manual page included as well.  Manual pages for protocols and other
auxiliary things are optional.
</p>

<p>
If no manual page is available, this is considered as a bug and should be
reported to the Debian Bug Tracking System (the maintainer of the package is
allowed to write this bug report themselves, if they so desire).  Do not close
the bug report until a proper man page is available.[<a href="#f110"
name="fr110">110</a>]
</p>

<p>
You may forward a complaint about a missing man page to the upstream authors,
and mark the bug as forwarded in the Debian bug tracking system.  Even though
the GNU Project do not in general consider the lack of a man page to be a bug,
we do; if they tell you that they don't consider it a bug you should leave the
bug in our bug tracking system open anyway.
</p>

<p>
Manual pages should be installed compressed using <samp>gzip -9</samp>.
</p>

<p>
If one man page needs to be accessible via several names it is better to use a
symbolic link than the <code>.so</code> feature, but there is no need to fiddle
with the relevant parts of the upstream source to change from <code>.so</code>
to symlinks: don't do it unless it's easy.  You should not create hard links in
the manual page directories, nor put absolute filenames in <code>.so</code>
directives.  The filename in a <code>.so</code> in a man page should be
relative to the base of the man page tree (usually
<code>/usr/share/man</code>).  If you do not create any links (whether
symlinks, hard links, or <samp>.so</samp> directives) in the file system to the
alternate names of the man page, then you should not rely on <code>man</code>
finding your man page under those names based solely on the information in the
man page's header.[<a href="#f111" name="fr111">111</a>]
</p>

<p>
Manual pages in locale-specific subdirectories of <code>/usr/share/man</code>
should use either UTF-8 or the usual legacy encoding for that language
(normally the one corresponding to the shortest relevant locale name in
<code>/usr/share/i18n/SUPPORTED</code>).  For example, pages under
<code>/usr/share/man/fr</code> should use either UTF-8 or ISO-8859-1.[<a
href="#f112" name="fr112">112</a>]
</p>

<p>
A country name (the <samp>DE</samp> in <samp>de_DE</samp>) should not be
included in the subdirectory name unless it indicates a significant difference
in the language, as this excludes speakers of the language in other
countries.[<a href="#f113" name="fr113">113</a>]
</p>

<p>
If a localized version of a manual page is provided, it should either be
up-to-date or it should be obvious to the reader that it is outdated and the
original manual page should be used instead.  This can be done either by a note
at the beginning of the manual page or by showing the missing or changed
portions in the original language instead of the target language.
</p>

<hr>

<h2 id="s12.2">12.2 Info documents</h2>

<p>
Info documents should be installed in <code>/usr/share/info</code>.  They
should be compressed with <samp>gzip -9</samp>.
</p>

<p>
The <code>install-info</code> program maintains a directory of installed info
documents in <code>/usr/share/info/dir</code> for the use of info readers.
This file must not be included in packages other than
<code>install-info</code>.
</p>

<p>
<code>install-info</code> is automatically invoked when appropriate using dpkg
triggers.  Packages other than <code>install-info</code> <em>should not</em>
invoke <code>install-info</code> directly and <em>should not</em> depend on,
recommend, or suggest <code>install-info</code> for this purpose.
</p>

<p>
Info readers requiring the <code>/usr/share/info/dir</code> file should depend
on <code>install-info</code>.
</p>

<p>
Info documents should contain section and directory entry information in the
document for the use of <code>install-info</code>.  The section should be
specified via a line starting with <samp>INFO-DIR-SECTION</samp> followed by a
space and the section of this info page.  The directory entry or entries should
be included between a <samp>START-INFO-DIR-ENTRY</samp> line and an
<samp>END-INFO-DIR-ENTRY</samp> line.  For example:
</p>

<pre>
     INFO-DIR-SECTION Individual utilities
     START-INFO-DIR-ENTRY
     * example: (example).               An example info directory entry.
     END-INFO-DIR-ENTRY
</pre>

<p>
To determine which section to use, you should look at
<code>/usr/share/info/dir</code> on your system and choose the most relevant
(or create a new section if none of the current sections are relevant).[<a
href="#f114" name="fr114">114</a>]
</p>

<hr>

<h2 id="s-docs-additional">12.3 Additional documentation</h2>

<p>
Any additional documentation that comes with the package may be installed at
the discretion of the package maintainer.  It is often a good idea to include
text information files (<code>README</code>s, FAQs, and so forth) that come
with the source package in the binary package.  However, you don't need to
install the instructions for building and installing the package, of course!
</p>

<p>
Plain text documentation should be compressed with <samp>gzip -9</samp> unless
it is small.
</p>

<p>
If a package comes with large amounts of documentation that many users of the
package will not require, you should create a separate binary package to
contain it so that it does not take up disk space on the machines of users who
do not need or want it installed.  As a special case of this rule, shared
library documentation of any appreciable size should always be packaged with
the library development package (<a href="#s-sharedlibs-dev">Development files,
Section 8.4</a>) or in a separate documentation package, since shared libraries
are frequently installed as dependencies of other packages by users who have
little interest in documentation of the library itself.  The documentation
package for the package <var>package</var> is conventionally named
<var>package</var>-doc (or <var>package</var>-doc-<var>language-code</var> if
there are separate documentation packages for multiple languages).
</p>

<p>
Additional documentation included in the package should be installed under
<code>/usr/share/doc/<var>package</var></code>.  If the documentation is
packaged separately, as <var>package</var>-doc for example, it may be installed
under either that path or into the documentation directory for the separate
documentation package (<code>/usr/share/doc/<var>package</var>-doc</code> in
this example).  However, installing the documentation into the documentation
directory of the main package is preferred since it is independent of the
packaging method and will be easier for users to find.
</p>

<p>
Any separate package providing documentation must still install standard
documentation files in its own <code>/usr/share/doc</code> directory as
specified in the rest of this policy.  See, for example, <a
href="#s-copyrightfile">Copyright information, Section 12.5</a> and <a
href="#s-changelogs">Changelog files, Section 12.7</a>.
</p>

<p>
Packages must not require the existence of any files in
<code>/usr/share/doc/</code> in order to function [<a href="#f115"
name="fr115">115</a>].  Any files that are used or read by programs but are
also useful as stand alone documentation should be installed elsewhere, such as
under <code>/usr/share/<var>package</var>/</code>, and then included via
symbolic links in <code>/usr/share/doc/<var>package</var></code>.
</p>

<p>
<code>/usr/share/doc/<var>package</var></code> may be a symbolic link to
another directory in <code>/usr/share/doc</code> only if the two packages both
come from the same source and the first package Depends on the second.[<a
href="#f116" name="fr116">116</a>]
</p>

<hr>

<h2 id="s12.4">12.4 Preferred documentation formats</h2>

<p>
The unification of Debian documentation is being carried out via HTML.
</p>

<p>
If the package comes with extensive documentation in a markup format that can
be converted to various other formats you should if possible ship HTML versions
in a binary package.[<a href="#f117" name="fr117">117</a>] The documentation
must be installed as specified in <a href="#s-docs-additional">Additional
documentation, Section 12.3</a>.
</p>

<p>
Other formats such as PostScript may be provided at the package maintainer's
discretion.
</p>

<hr>

<h2 id="s-copyrightfile">12.5 Copyright information</h2>

<p>
Every package must be accompanied by a verbatim copy of its copyright
information and distribution license in the file
<code>/usr/share/doc/<var>package</var>/copyright</code>.  This file must
neither be compressed nor be a symbolic link.
</p>

<p>
In addition, the copyright file must say where the upstream sources (if any)
were obtained, and should name the original authors.
</p>

<p>
Packages in the <em>contrib</em> or <em>non-free</em> archive areas should
state in the copyright file that the package is not part of the Debian
distribution and briefly explain why.
</p>

<p>
A copy of the file which will be installed in
<code>/usr/share/doc/<var>package</var>/copyright</code> should be in
<code>debian/copyright</code> in the source package.
</p>

<p>
<code>/usr/share/doc/<var>package</var></code> may be a symbolic link to
another directory in <code>/usr/share/doc</code> only if the two packages both
come from the same source and the first package Depends on the second.  These
rules are important because <code>copyright</code> files must be extractable by
mechanical means.
</p>

<p>
Packages distributed under the Apache license (version 2.0), the Artistic
license, the GNU GPL (versions 1, 2, or 3), the GNU LGPL (versions 2, 2.1, or
3), and the GNU FDL (versions 1.2 or 1.3) should refer to the corresponding
files under <code>/usr/share/common-licenses</code>,[<a href="#f118"
name="fr118">118</a>] rather than quoting them in the copyright file.
</p>

<p>
You should not use the copyright file as a general <code>README</code> file.
If your package has such a file it should be installed in
<code>/usr/share/doc/<var>package</var>/README</code> or
<code>README.Debian</code> or some other appropriate place.
</p>

<p>
All copyright files must be encoded in UTF-8.
</p>

<hr>

<h3 id="s-copyrightformat">12.5.1 Machine-readable copyright information</h3>

<p>
A specification for a standard, machine-readable format for
<code>debian/copyright</code> files is maintained as part of the
<code>debian-policy</code> package.  This document may be found in the
<code>copyright-format</code> files in the <code>debian-policy</code> package.
It is also available from the Debian web mirrors at <samp><code><a
href="http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/">/doc/packaging-manuals/copyright-format/1.0/</a></code></samp>.
</p>

<p>
Use of this format is optional.
</p>

<hr>

<h2 id="s12.6">12.6 Examples</h2>

<p>
Any examples (configurations, source files, whatever), should be installed in a
directory <code>/usr/share/doc/<var>package</var>/examples</code>.  These files
should not be referenced by any program: they're there for the benefit of the
system administrator and users as documentation only.  Architecture-specific
example files should be installed in a directory
<code>/usr/lib/<var>package</var>/examples</code> with symbolic links to them
from <code>/usr/share/doc/<var>package</var>/examples</code>, or the latter
directory itself may be a symbolic link to the former.
</p>

<p>
If the purpose of a package is to provide examples, then the example files may
be installed into <code>/usr/share/doc/<var>package</var></code>.
</p>

<hr>

<h2 id="s-changelogs">12.7 Changelog files</h2>

<p>
Packages that are not Debian-native must contain a compressed copy of the
<code>debian/changelog</code> file from the Debian source tree in
<code>/usr/share/doc/<var>package</var></code> with the name
<code>changelog.Debian.gz</code>.
</p>

<p>
If an upstream changelog is available, it should be accessible as
<code>/usr/share/doc/<var>package</var>/changelog.gz</code> in plain text.  If
the upstream changelog is distributed in HTML, it should be made available in
that form as <code>/usr/share/doc/<var>package</var>/changelog.html.gz</code>
and a plain text <code>changelog.gz</code> should be generated from it using,
for example, <samp>lynx -dump -nolist</samp>.  If the upstream changelog files
do not already conform to this naming convention, then this may be achieved
either by renaming the files, or by adding a symbolic link, at the maintainer's
discretion.[<a href="#f119" name="fr119">119</a>]
</p>

<p>
All of these files should be installed compressed using <samp>gzip -9</samp>,
as they will become large with time even if they start out small.
</p>

<p>
If the package has only one changelog which is used both as the Debian
changelog and the upstream one because there is no separate upstream maintainer
then that changelog should usually be installed as
<code>/usr/share/doc/<var>package</var>/changelog.gz</code>; if there is a
separate upstream maintainer, but no upstream changelog, then the Debian
changelog should still be called <code>changelog.Debian.gz</code>.
</p>

<p>
For details about the format and contents of the Debian changelog file, please
see <a href="#s-dpkgchangelog">Debian changelog: <code>debian/changelog</code>,
Section 4.4</a>.
</p>

<p><a name="ap-pkg-scope"></a></p>
<hr>

<p>
[ <a href="#ch-docs">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ A ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ap-pkg-binarypkg">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Appendix A - Introduction and scope of these appendices</h1>

<hr>

<p>
These appendices are taken essentially verbatim from the now-deprecated
Packaging Manual, version 3.2.1.0.  They are the chapters which are likely to
be of use to package maintainers and which have not already been included in
the policy document itself.  Most of these sections are very likely not
relevant to policy; they should be treated as documentation for the packaging
system.  Please note that these appendices are included for convenience, and
for historical reasons: they used to be part of policy package, and they have
not yet been incorporated into dpkg documentation.  However, they still have
value, and hence they are presented here.
</p>

<p>
They have not yet been checked to ensure that they are compatible with the
contents of policy, and if there are any contradictions, the version in the
main policy document takes precedence.  The remaining chapters of the old
Packaging Manual have also not been read in detail to ensure that there are not
parts which have been left out.  Both of these will be done in due course.
</p>

<p>
Certain parts of the Packaging manual were integrated into the Policy Manual
proper, and removed from the appendices.  Links have been placed from the old
locations to the new ones.
</p>

<p>
<code>dpkg</code> is a suite of programs for creating binary package files and
installing and removing them on Unix systems.[<a href="#f120"
name="fr120">120</a>]
</p>

<p>
The binary packages are designed for the management of installed executable
programs (usually compiled binaries) and their associated data, though source
code examples and documentation are provided as part of some packages.
</p>

<p>
This manual describes the technical aspects of creating Debian binary packages
(<code>.deb</code> files).  It documents the behavior of the package management
programs <code>dpkg</code>, <code>dselect</code> et al.  and the way they
interact with packages.
</p>

<p>
This manual does not go into detail about the options and usage of the package
building and installation tools.  It should therefore be read in conjunction
with those programs' man pages.
</p>

<p>
The utility programs which are provided with <code>dpkg</code> not described in
detail here, are documented in their man pages.
</p>

<p>
It is assumed that the reader is reasonably familiar with the <code>dpkg</code>
System Administrators' manual.  Unfortunately this manual does not yet exist.
</p>

<p>
The Debian version of the FSF's GNU hello program is provided as an example for
people wishing to create Debian packages.  However, while the examples are
helpful, they do not replace the need to read and follow the Policy and
Programmer's Manual.
</p>

<p><a name="ap-pkg-binarypkg"></a></p>
<hr>

<p>
[ <a href="#ap-pkg-scope">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ B ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ap-pkg-sourcepkg">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Appendix B - Binary packages (from old Packaging Manual)</h1>

<hr>

<p>
See <code>deb(5)</code> and <a href="#s-pkg-controlarea">Package control
information files, Section B.2</a>.
</p>

<hr>

<h2 id="s-pkg-bincreating">B.1 Creating package files - <code>dpkg-deb</code></h2>

<p>
All manipulation of binary package files is done by <code>dpkg-deb</code>; it's
the only program that has knowledge of the format.  (<code>dpkg-deb</code> may
be invoked by calling <code>dpkg</code>, as <code>dpkg</code> will spot that
the options requested are appropriate to <code>dpkg-deb</code> and invoke that
instead with the same arguments.)
</p>

<p>
In order to create a binary package you must make a directory tree which
contains all the files and directories you want to have in the file system data
part of the package.  In Debian-format source packages this directory is
usually <code>debian/tmp</code>, relative to the top of the package's source
tree.
</p>

<p>
They should have the locations (relative to the root of the directory tree
you're constructing) ownerships and permissions which you want them to have on
the system when they are installed.
</p>

<p>
With current versions of <code>dpkg</code> the uid/username and gid/groupname
mappings for the users and groups being used should be the same on the system
where the package is built and the one where it is installed.
</p>

<p>
You need to add one special directory to the root of the miniature file system
tree you're creating: <code>DEBIAN</code>.  It should contain the control
information files, notably the binary package control file (see <a
href="#s-pkg-controlfile">The main control information file:
<samp>control</samp>, Section B.3</a>).
</p>

<p>
The <code>DEBIAN</code> directory will not appear in the file system archive of
the package, and so won't be installed by <code>dpkg</code> when the package is
unpacked.
</p>

<p>
When you've prepared the package, you should invoke:
</p>

<pre>
       dpkg --build <var>directory</var>
</pre>

<p>
This will build the package in <code><var>directory</var>.deb</code>.
(<code>dpkg</code> knows that <samp>--build</samp> is a <code>dpkg-deb</code>
option, so it invokes <code>dpkg-deb</code> with the same arguments to build
the package.)
</p>

<p>
See the man page <code>dpkg-deb(8)</code> for details of how to examine the
contents of this newly-created file.  You may find the output of following
commands enlightening:
</p>

<pre>
       dpkg-deb --info <var>filename</var>.deb
       dpkg-deb --contents <var>filename</var>.deb
       dpkg --contents <var>filename</var>.deb
</pre>

<p>
To view the copyright file for a package you could use this command:
</p>

<pre>
       dpkg --fsys-tarfile <var>filename</var>.deb | tar xOf - --wildcards \*/copyright | pager
</pre>

<hr>

<h2 id="s-pkg-controlarea">B.2 Package control information files</h2>

<p>
The control information portion of a binary package is a collection of files
with names known to <code>dpkg</code>.  It will treat the contents of these
files specially - some of them contain information used by <code>dpkg</code>
when installing or removing the package; others are scripts which the package
maintainer wants <code>dpkg</code> to run.
</p>

<p>
It is possible to put other files in the package control information file area,
but this is not generally a good idea (though they will largely be ignored).
</p>

<p>
Here is a brief list of the control information files supported by
<code>dpkg</code> and a summary of what they're used for.
</p>
<dl>
<dt><samp>control</samp></dt>
<dd>
<p>
This is the key description file used by <code>dpkg</code>.  It specifies the
package's name and version, gives its description for the user, states its
relationships with other packages, and so forth.  See <a
href="#s-sourcecontrolfiles">Source package control files --
<code>debian/control</code>, Section 5.2</a> and <a
href="#s-binarycontrolfiles">Binary package control files --
<code>DEBIAN/control</code>, Section 5.3</a>.
</p>

<p>
It is usually generated automatically from information in the source package by
the <code>dpkg-gencontrol</code> program, and with assistance from
<code>dpkg-shlibdeps</code>.  See <a href="#s-pkg-sourcetools">Tools for
processing source packages, Section C.1</a>.
</p>
</dd>
</dl>
<dl>
<dt><samp>postinst</samp>, <samp>preinst</samp>, <samp>postrm</samp>, <samp>prerm</samp></dt>
<dd>
<p>
These are executable files (usually scripts) which <code>dpkg</code> runs
during installation, upgrade and removal of packages.  They allow the package
to deal with matters which are particular to that package or require more
complicated processing than that provided by <code>dpkg</code>.  Details of
when and how they are called are in <a href="#ch-maintainerscripts">Package
maintainer scripts and installation procedure, Chapter 6</a>.
</p>

<p>
It is very important to make these scripts idempotent.  See <a
href="#s-idempotency">Maintainer scripts idempotency, Section 6.2</a>.
</p>

<p>
The maintainer scripts are not guaranteed to run with a controlling terminal
and may not be able to interact with the user.  See <a
href="#s-controllingterminal">Controlling terminal for maintainer scripts,
Section 6.3</a>.
</p>
</dd>
</dl>
<dl>
<dt><samp>conffiles</samp></dt>
<dd>
<p>
This file contains a list of configuration files which are to be handled
automatically by <code>dpkg</code> (see <a
href="#ap-pkg-conffiles">Configuration file handling (from old Packaging
Manual), Appendix E</a>).  Note that not necessarily every configuration file
should be listed here.
</p>
</dd>
</dl>
<dl>
<dt><samp>shlibs</samp></dt>
<dd>
<p>
This file contains a list of the shared libraries supplied by the package, with
dependency details for each.  This is used by <code>dpkg-shlibdeps</code> when
it determines what dependencies are required in a package control file.  The
<samp>shlibs</samp> file format is described on <a href="#s-shlibs">The
<code>shlibs</code> File Format, Section 8.6.4.2</a>.
</p>
</dd>
</dl>

<hr>

<h2 id="s-pkg-controlfile">B.3 The main control information file: <samp>control</samp></h2>

<p>
The most important control information file used by <code>dpkg</code> when it
installs a package is <samp>control</samp>.  It contains all the package's
&quot;vital statistics&quot;.
</p>

<p>
The binary package control files of packages built from Debian sources are made
by a special tool, <code>dpkg-gencontrol</code>, which reads
<code>debian/control</code> and <code>debian/changelog</code> to find the
information it needs.  See <a href="#ap-pkg-sourcepkg">Source packages (from
old Packaging Manual), Appendix C</a> for more details.
</p>

<p>
The fields in binary package control files are listed in <a
href="#s-binarycontrolfiles">Binary package control files --
<code>DEBIAN/control</code>, Section 5.3</a>.
</p>

<p>
A description of the syntax of control files and the purpose of the fields is
available in <a href="#ch-controlfields">Control files and their fields,
Chapter 5</a>.
</p>

<hr>

<h2 id="sB.4">B.4 Time Stamps</h2>

<p>
See <a href="#s-timestamps">Time Stamps, Section 4.7</a>.
</p>

<p><a name="ap-pkg-sourcepkg"></a></p>
<hr>

<p>
[ <a href="#ap-pkg-binarypkg">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ C ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ap-pkg-controlfields">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Appendix C - Source packages (from old Packaging Manual)</h1>

<hr>

<p>
The Debian binary packages in the distribution are generated from Debian
sources, which are in a special format to assist the easy and automatic
building of binaries.
</p>

<hr>

<h2 id="s-pkg-sourcetools">C.1 Tools for processing source packages</h2>

<p>
Various tools are provided for manipulating source packages; they pack and
unpack sources and help build of binary packages and help manage the
distribution of new versions.
</p>

<p>
They are introduced and typical uses described here; see
<code>dpkg-source(1)</code> for full documentation about their arguments and
operation.
</p>

<p>
For examples of how to construct a Debian source package, and how to use those
utilities that are used by Debian source packages, please see the
<code>hello</code> example package.
</p>

<hr>

<h3 id="s-pkg-dpkg-source">C.1.1 <code>dpkg-source</code> - packs and unpacks Debian source packages</h3>

<p>
This program is frequently used by hand, and is also called from
package-independent automated building scripts such as
<code>dpkg-buildpackage</code>.
</p>

<p>
To unpack a package it is typically invoked with
</p>

<pre>
       dpkg-source -x <var>.../path/to/filename</var>.dsc
</pre>

<p>
with the <code><var>filename</var>.tar.gz</code> and
<code><var>filename</var>.diff.gz</code> (if applicable) in the same directory.
It unpacks into <code><var>package</var>-<var>version</var></code>, and if
applicable <code><var>package</var>-<var>version</var>.orig</code>, in the
current directory.
</p>

<p>
To create a packed source archive it is typically invoked:
</p>

<pre>
       dpkg-source -b <var>package</var>-<var>version</var>
</pre>

<p>
This will create the <code>.dsc</code>, <code>.tar.gz</code> and
<code>.diff.gz</code> (if appropriate) in the current directory.
<code>dpkg-source</code> does not clean the source tree first - this must be
done separately if it is required.
</p>

<p>
See also <a href="#s-pkg-sourcearchives">Source packages as archives, Section
C.3</a>.
</p>

<hr>

<h3 id="s-pkg-dpkg-buildpackage">C.1.2 <code>dpkg-buildpackage</code> - overall package-building control script</h3>

<p>
See <code>dpkg-buildpackage(1)</code>.
</p>

<hr>

<h3 id="s-pkg-dpkg-gencontrol">C.1.3 <code>dpkg-gencontrol</code> - generates binary package control files</h3>

<p>
This program is usually called from <code>debian/rules</code> (see <a
href="#s-pkg-sourcetree">The Debian package source tree, Section C.2</a>) in
the top level of the source tree.
</p>

<p>
This is usually done just before the files and directories in the temporary
directory tree where the package is being built have their permissions and
ownerships set and the package is constructed using <code>dpkg-deb/</code> [<a
href="#f121" name="fr121">121</a>].
</p>

<p>
<code>dpkg-gencontrol</code> must be called after all the files which are to go
into the package have been placed in the temporary build directory, so that its
calculation of the installed size of a package is correct.
</p>

<p>
It is also necessary for <code>dpkg-gencontrol</code> to be run after
<code>dpkg-shlibdeps</code> so that the variable substitutions created by
<code>dpkg-shlibdeps</code> in <code>debian/substvars</code> are available.
</p>

<p>
For a package which generates only one binary package, and which builds it in
<code>debian/tmp</code> relative to the top of the source package, it is
usually sufficient to call <code>dpkg-gencontrol</code>.
</p>

<p>
Sources which build several binaries will typically need something like:
</p>

<pre>
       dpkg-gencontrol -Pdebian/tmp-<var>pkg</var> -p<var>package</var>
</pre>

<p>
The <samp>-P</samp> tells <code>dpkg-gencontrol</code> that the package is
being built in a non-default directory, and the <samp>-p</samp> tells it which
package's control file should be generated.
</p>

<p>
<code>dpkg-gencontrol</code> also adds information to the list of files in
<code>debian/files</code>, for the benefit of (for example) a future invocation
of <code>dpkg-genchanges</code>.
</p>

<hr>

<h3 id="s-pkg-dpkg-shlibdeps">C.1.4 <code>dpkg-shlibdeps</code> - calculates shared library dependencies</h3>

<p>
See <code>dpkg-shlibdeps(1)</code>.
</p>

<hr>

<h3 id="s-pkg-dpkg-distaddfile">C.1.5 <code>dpkg-distaddfile</code> - adds a file to <code>debian/files</code></h3>

<p>
Some packages' uploads need to include files other than the source and binary
package files.
</p>

<p>
<code>dpkg-distaddfile</code> adds a file to the <code>debian/files</code> file
so that it will be included in the <code>.changes</code> file when
<code>dpkg-genchanges</code> is run.
</p>

<p>
It is usually invoked from the <samp>binary</samp> target of
<code>debian/rules</code>:
</p>

<pre>
       dpkg-distaddfile <var>filename</var> <var>section</var> <var>priority</var>
</pre>

<p>
The <var>filename</var> is relative to the directory where
<code>dpkg-genchanges</code> will expect to find it - this is usually the
directory above the top level of the source tree.  The
<code>debian/rules</code> target should put the file there just before or just
after calling <code>dpkg-distaddfile</code>.
</p>

<p>
The <var>section</var> and <var>priority</var> are passed unchanged into the
resulting <code>.changes</code> file.
</p>

<hr>

<h3 id="s-pkg-dpkg-genchanges">C.1.6 <code>dpkg-genchanges</code> - generates a <code>.changes</code> upload control file</h3>

<p>
See <code>dpkg-genchanges(1)</code>.
</p>

<hr>

<h3 id="s-pkg-dpkg-parsechangelog">C.1.7 <code>dpkg-parsechangelog</code> - produces parsed representation of a changelog</h3>

<p>
See <code>dpkg-parsechangelog(1)</code>.
</p>

<hr>

<h3 id="s-pkg-dpkg-architecture">C.1.8 <code>dpkg-architecture</code> - information about the build and host system</h3>

<p>
See <code>dpkg-architecture(1)</code>.
</p>

<hr>

<h2 id="s-pkg-sourcetree">C.2 The Debian package source tree</h2>

<p>
The source archive scheme described later is intended to allow a Debian package
source tree with some associated control information to be reproduced and
transported easily.  The Debian package source tree is a version of the
original program with certain files added for the benefit of the packaging
process, and with any other changes required made to the rest of the source
code and installation scripts.
</p>

<p>
The extra files created for Debian are in the subdirectory <code>debian</code>
of the top level of the Debian package source tree.  They are described below.
</p>

<hr>

<h3 id="s-pkg-debianrules">C.2.1 <code>debian/rules</code> - the main building script</h3>

<p>
See <a href="#s-debianrules">Main building script: <code>debian/rules</code>,
Section 4.9</a>.
</p>

<hr>

<h3 id="s-pkg-srcsubstvars">C.2.2 <code>debian/substvars</code> and variable substitutions</h3>

<p>
See <a href="#s-substvars">Variable substitutions:
<code>debian/substvars</code>, Section 4.10</a>.
</p>

<hr>

<h3 id="sC.2.3">C.2.3 <code>debian/files</code></h3>

<p>
See <a href="#s-debianfiles">Generated files list: <code>debian/files</code>,
Section 4.12</a>.
</p>

<hr>

<h3 id="sC.2.4">C.2.4 <code>debian/tmp</code></h3>

<p>
This is the canonical temporary location for the construction of binary
packages by the <samp>binary</samp> target.  The directory <code>tmp</code>
serves as the root of the file system tree as it is being constructed (for
example, by using the package's upstream makefiles install targets and
redirecting the output there), and it also contains the <samp>DEBIAN</samp>
subdirectory.  See <a href="#s-pkg-bincreating">Creating package files -
<code>dpkg-deb</code>, Section B.1</a>.
</p>

<p>
If several binary packages are generated from the same source tree it is usual
to use several <code>debian/tmp<var>something</var></code> directories, for
example <code>tmp-a</code> or <code>tmp-doc</code>.
</p>

<p>
Whatever <code>tmp</code> directories are created and used by
<samp>binary</samp> must of course be removed by the <samp>clean</samp> target.
</p>

<hr>

<h2 id="s-pkg-sourcearchives">C.3 Source packages as archives</h2>

<p>
As it exists on the FTP site, a Debian source package consists of three related
files.  You must have the right versions of all three to be able to use them.
</p>
<dl>
<dt>Debian source control file - <samp>.dsc</samp></dt>
<dd>
<p>
This file is a control file used by <code>dpkg-source</code> to extract a
source package.  See <a href="#s-debiansourcecontrolfiles">Debian source
control files -- <samp>.dsc</samp>, Section 5.4</a>.
</p>
</dd>
</dl>
<dl>
<dt>Original source archive - <code><var>package</var>_<var>upstream-version</var>.orig.tar.gz</code></dt>
<dd>
<p>
This is a compressed (with <samp>gzip -9</samp>) <code>tar</code> file
containing the source code from the upstream authors of the program.
</p>
</dd>
</dl>
<dl>
<dt>Debian package diff - <code><var>package</var>_<var>upstream_version-revision</var>.diff.gz</code></dt>
<dd>
<p>
This is a unified context diff (<samp>diff -u</samp>) giving the changes which
are required to turn the original source into the Debian source.  These changes
may only include editing and creating plain files.  The permissions of files,
the targets of symbolic links and the characteristics of special files or pipes
may not be changed and no files may be removed or renamed.
</p>

<p>
All the directories in the diff must exist, except the <code>debian</code>
subdirectory of the top of the source tree, which will be created by
<code>dpkg-source</code> if necessary when unpacking.
</p>

<p>
The <code>dpkg-source</code> program will automatically make the
<code>debian/rules</code> file executable (see below).
</p>
</dd>
</dl>

<p>
If there is no original source code - for example, if the package is specially
prepared for Debian or the Debian maintainer is the same as the upstream
maintainer - the format is slightly different: then there is no diff, and the
tarfile is named <code><var>package</var>_<var>version</var>.tar.gz</code>, and
preferably contains a directory named
<code><var>package</var>-<var>version</var></code>.
</p>

<hr>

<h2 id="sC.4">C.4 Unpacking a Debian source package without <code>dpkg-source</code></h2>

<p>
<samp>dpkg-source -x</samp> is the recommended way to unpack a Debian source
package.  However, if it is not available it is possible to unpack a Debian
source archive as follows:
</p>
<!-- ol type="1" start="1"  -->
<li>
<p>
Untar the tarfile, which will create a <code>.orig</code> directory.
</p>
</li>
<li>
<p>
Rename the <code>.orig</code> directory to
<code><var>package</var>-<var>version</var></code>.
</p>
</li>
<li>
<p>
Create the subdirectory <code>debian</code> at the top of the source tree.
</p>
</li>
<li>
<p>
Apply the diff using <samp>patch -p0</samp>.
</p>
</li>
<li>
<p>
Untar the tarfile again if you want a copy of the original source code
alongside the Debian version.
</p>
</li>
</ol>

<p>
It is not possible to generate a valid Debian source archive without using
<code>dpkg-source</code>.  In particular, attempting to use <code>diff</code>
directly to generate the <code>.diff.gz</code> file will not work.
</p>

<hr>

<h3 id="sC.4.1">C.4.1 Restrictions on objects in source packages</h3>

<p>
The source package may not contain any hard links [<a href="#f122"
name="fr122">122</a>] [<a href="#f123" name="fr123">123</a>], device special
files, sockets or setuid or setgid files.  [<a href="#f124"
name="fr124">124</a>]
</p>

<p>
The source packaging tools manage the changes between the original and Debian
source using <code>diff</code> and <code>patch</code>.  Turning the original
source tree as included in the <code>.orig.tar.gz</code> into the Debian
package source must not involve any changes which cannot be handled by these
tools.  Problematic changes which cause <code>dpkg-source</code> to halt with
an error when building the source package are:
</p>
<ul>
<li>
<p>
Adding or removing symbolic links, sockets or pipes.
</p>
</li>
<li>
<p>
Changing the targets of symbolic links.
</p>
</li>
<li>
<p>
Creating directories, other than <code>debian</code>.
</p>
</li>
<li>
<p>
Changes to the contents of binary files.
</p>
</li>
</ul>

<p>
Changes which cause <code>dpkg-source</code> to print a warning but continue
anyway are:
</p>
<ul>
<li>
<p>
Removing files, directories or symlinks.  [<a href="#f125"
name="fr125">125</a>]
</p>
</li>
<li>
<p>
Changed text files which are missing the usual final newline (either in the
original or the modified source tree).
</p>
</li>
</ul>

<p>
Changes which are not represented, but which are not detected by
<code>dpkg-source</code>, are:
</p>
<ul>
<li>
<p>
Changing the permissions of files (other than <code>debian/rules</code>) and
directories.
</p>
</li>
</ul>

<p>
The <code>debian</code> directory and <code>debian/rules</code> are handled
specially by <code>dpkg-source</code> - before applying the changes it will
create the <code>debian</code> directory, and afterwards it will make
<code>debian/rules</code> world-executable.
</p>

<p><a name="ap-pkg-controlfields"></a></p>
<hr>

<p>
[ <a href="#ap-pkg-sourcepkg">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ D ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ap-pkg-conffiles">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Appendix D - Control files and their fields (from old Packaging Manual)</h1>

<hr>

<p>
Many of the tools in the <code>dpkg</code> suite manipulate data in a common
format, known as control files.  Binary and source packages have control data
as do the <code>.changes</code> files which control the installation of
uploaded files, and <code>dpkg</code>'s internal databases are in a similar
format.
</p>

<hr>

<h2 id="sD.1">D.1 Syntax of control files</h2>

<p>
See <a href="#s-controlsyntax">Syntax of control files, Section 5.1</a>.
</p>

<p>
It is important to note that there are several fields which are optional as far
as <code>dpkg</code> and the related tools are concerned, but which must appear
in every Debian package, or whose omission may cause problems.
</p>

<hr>

<h2 id="sD.2">D.2 List of fields</h2>

<p>
See <a href="#s-controlfieldslist">List of fields, Section 5.6</a>.
</p>

<p>
This section now contains only the fields that didn't belong to the Policy
manual.
</p>

<hr>

<h3 id="s-pkg-f-Filename">D.2.1 <samp>Filename</samp> and <samp>MSDOS-Filename</samp></h3>

<p>
These fields in <samp>Packages</samp> files give the filename(s) of (the parts
of) a package in the distribution directories, relative to the root of the
Debian hierarchy.  If the package has been split into several parts the parts
are all listed in order, separated by spaces.
</p>

<hr>

<h3 id="s-pkg-f-Size">D.2.2 <samp>Size</samp> and <samp>MD5sum</samp></h3>

<p>
These fields in <code>Packages</code> files give the size (in bytes, expressed
in decimal) and MD5 checksum of the file(s) which make(s) up a binary package
in the distribution.  If the package is split into several parts the values for
the parts are listed in order, separated by spaces.
</p>

<hr>

<h3 id="s-pkg-f-Status">D.2.3 <samp>Status</samp></h3>

<p>
This field in <code>dpkg</code>'s status file records whether the user wants a
package installed, removed or left alone, whether it is broken (requiring
re-installation) or not and what its current state on the system is.  Each of
these pieces of information is a single word.
</p>

<hr>

<h3 id="s-pkg-f-Config-Version">D.2.4 <samp>Config-Version</samp></h3>

<p>
If a package is not installed or not configured, this field in
<code>dpkg</code>'s status file records the last version of the package which
was successfully configured.
</p>

<hr>

<h3 id="s-pkg-f-Conffiles">D.2.5 <samp>Conffiles</samp></h3>

<p>
This field in <code>dpkg</code>'s status file contains information about the
automatically-managed configuration files held by a package.  This field should
<em>not</em> appear anywhere in a package!
</p>

<hr>

<h3 id="sD.2.6">D.2.6 Obsolete fields</h3>

<p>
These are still recognized by <code>dpkg</code> but should not appear anywhere
any more.
</p>
<dl>
<dt><samp>Revision</samp></dt>
<dt><samp>Package-Revision</samp></dt>
<dt><samp>Package_Revision</samp></dt>
<dd>
<p>
The Debian revision part of the package version was at one point in a separate
control field.  This field went through several names.
</p>
</dd>
<dt><samp>Recommended</samp></dt>
<dd>
<p>
Old name for <samp>Recommends</samp>.
</p>
</dd>
<dt><samp>Optional</samp></dt>
<dd>
<p>
Old name for <samp>Suggests</samp>.
</p>
</dd>
<dt><samp>Class</samp></dt>
<dd>
<p>
Old name for <samp>Priority</samp>.
</p>
</dd>
</dl>

<p><a name="ap-pkg-conffiles"></a></p>
<hr>

<p>
[ <a href="#ap-pkg-controlfields">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ E ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ap-pkg-alternatives">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Appendix E - Configuration file handling (from old Packaging Manual)</h1>

<hr>

<p>
<code>dpkg</code> can do a certain amount of automatic handling of package
configuration files.
</p>

<p>
Whether this mechanism is appropriate depends on a number of factors, but
basically there are two approaches to any particular configuration file.
</p>

<p>
The easy method is to ship a best-effort configuration in the package, and use
<code>dpkg</code>'s conffile mechanism to handle updates.  If the user is
unlikely to want to edit the file, but you need them to be able to without
losing their changes, and a new package with a changed version of the file is
only released infrequently, this is a good approach.
</p>

<p>
The hard method is to build the configuration file from scratch in the
<code>postinst</code> script, and to take the responsibility for fixing any
mistakes made in earlier versions of the package automatically.  This will be
appropriate if the file is likely to need to be different on each system.
</p>

<hr>

<h2 id="sE.1">E.1 Automatic handling of configuration files by <code>dpkg</code></h2>

<p>
A package may contain a control information file called <samp>conffiles</samp>.
This file should be a list of filenames of configuration files needing
automatic handling, separated by newlines.  The filenames should be absolute
pathnames, and the files referred to should actually exist in the package.
</p>

<p>
When a package is upgraded <code>dpkg</code> will process the configuration
files during the configuration stage, shortly before it runs the package's
<code>postinst</code> script,
</p>

<p>
For each file it checks to see whether the version of the file included in the
package is the same as the one that was included in the last version of the
package (the one that is being upgraded from); it also compares the version
currently installed on the system with the one shipped with the last version.
</p>

<p>
If neither the user nor the package maintainer has changed the file, it is left
alone.  If one or the other has changed their version, then the changed version
is preferred - i.e., if the user edits their file, but the package maintainer
doesn't ship a different version, the user's changes will stay, silently, but
if the maintainer ships a new version and the user hasn't edited it the new
version will be installed (with an informative message).  If both have changed
their version the user is prompted about the problem and must resolve the
differences themselves.
</p>

<p>
The comparisons are done by calculating the MD5 message digests of the files,
and storing the MD5 of the file as it was included in the most recent version
of the package.
</p>

<p>
When a package is installed for the first time <code>dpkg</code> will install
the file that comes with it, unless that would mean overwriting a file already
on the file system.
</p>

<p>
However, note that <code>dpkg</code> will <em>not</em> replace a conffile that
was removed by the user (or by a script).  This is necessary because with some
programs a missing file produces an effect hard or impossible to achieve in
another way, so that a missing file needs to be kept that way if the user did
it.
</p>

<p>
Note that a package should <em>not</em> modify a <code>dpkg</code>-handled
conffile in its maintainer scripts.  Doing this will lead to <code>dpkg</code>
giving the user confusing and possibly dangerous options for conffile update
when the package is upgraded.
</p>

<hr>

<h2 id="sE.2">E.2 Fully-featured maintainer script configuration handling</h2>

<p>
For files which contain site-specific information such as the hostname and
networking details and so forth, it is better to create the file in the
package's <code>postinst</code> script.
</p>

<p>
This will typically involve examining the state of the rest of the system to
determine values and other information, and may involve prompting the user for
some information which can't be obtained some other way.
</p>

<p>
When using this method there are a couple of important issues which should be
considered:
</p>

<p>
If you discover a bug in the program which generates the configuration file, or
if the format of the file changes from one version to the next, you will have
to arrange for the postinst script to do something sensible - usually this will
mean editing the installed configuration file to remove the problem or change
the syntax.  You will have to do this very carefully, since the user may have
changed the file, perhaps to fix the very problem that your script is trying to
deal with - you will have to detect these situations and deal with them
correctly.
</p>

<p>
If you do go down this route it's probably a good idea to make the program that
generates the configuration file(s) a separate program in
<code>/usr/sbin</code>, by convention called
<code><var>package</var>config</code> and then run that if appropriate from the
post-installation script.  The <samp><var>package</var>config</samp> program
should not unquestioningly overwrite an existing configuration - if its mode of
operation is geared towards setting up a package for the first time (rather
than any arbitrary reconfiguration later) you should have it check whether the
configuration already exists, and require a <samp>--force</samp> flag to
overwrite it.
</p>

<p><a name="ap-pkg-alternatives"></a></p>
<hr>

<p>
[ <a href="#ap-pkg-conffiles">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ F ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ap-pkg-diversions">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Appendix F - Alternative versions of an interface - <code>update-alternatives</code> (from old Packaging Manual)</h1>

<hr>

<p>
When several packages all provide different versions of the same program or
file it is useful to have the system select a default, but to allow the system
administrator to change it and have their decisions respected.
</p>

<p>
For example, there are several versions of the <code>vi</code> editor, and
there is no reason to prevent all of them from being installed at once, each
under their own name (<code>nvi</code>, <code>vim</code> or whatever).
Nevertheless it is desirable to have the name <samp>vi</samp> refer to
something, at least by default.
</p>

<p>
If all the packages involved cooperate, this can be done with
<code>update-alternatives</code>.
</p>

<p>
Each package provides its own version under its own name, and calls
<code>update-alternatives</code> in its postinst to register its version (and
again in its prerm to deregister it).
</p>

<p>
See the man page <code>update-alternatives(8)</code> for details.
</p>

<p>
If <code>update-alternatives</code> does not seem appropriate you may wish to
consider using diversions instead.
</p>

<p><a name="ap-pkg-diversions"></a></p>
<hr>

<p>
[ <a href="#ap-pkg-alternatives">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ G ]
[ <a href="#index">next</a> ]
</p>

<hr>

<h1>
Debian Policy Manual
<br>Appendix G - Diversions - overriding a package's version of a file (from old Packaging Manual)</h1>

<hr>

<p>
It is possible to have <code>dpkg</code> not overwrite a file when it
reinstalls the package it belongs to, and to have it put the file from the
package somewhere else instead.
</p>

<p>
This can be used locally to override a package's version of a file, or by one
package to override another's version (or provide a wrapper for it).
</p>

<p>
Before deciding to use a diversion, read <a
href="#ap-pkg-alternatives">Alternative versions of an interface -
<code>update-alternatives</code> (from old Packaging Manual), Appendix F</a> to
see if you really want a diversion rather than several alternative versions of
a program.
</p>

<p>
There is a diversion list, which is read by <code>dpkg</code>, and updated by a
special program <code>dpkg-divert</code>.  Please see
<code>dpkg-divert(8)</code> for full details of its operation.
</p>

<p>
When a package wishes to divert a file from another, it should call
<code>dpkg-divert</code> in its preinst to add the diversion and rename the
existing file.  For example, supposing that a <code>smailwrapper</code> package
wishes to install a wrapper around <code>/usr/sbin/smail</code>:
</p>

<pre>
        dpkg-divert --package smailwrapper --add --rename \
           --divert /usr/sbin/smail.real /usr/sbin/smail
</pre>

<p>
The <samp>--package smailwrapper</samp> ensures that
<code>smailwrapper</code>'s copy of <code>/usr/sbin/smail</code> can bypass the
diversion and get installed as the true version.  It's safe to add the
diversion unconditionally on upgrades since it will be left unchanged if it
already exists, but <code>dpkg-divert</code> will display a message.  To
suppress that message, make the command conditional on the version from which
the package is being upgraded:
</p>

<pre>
        if [ upgrade != &quot;$1&quot; ] || dpkg --compare-versions &quot;$2&quot; lt 1.0-2; then
           dpkg-divert --package smailwrapper --add --rename \
              --divert /usr/sbin/smail.real /usr/sbin/smail
        fi
</pre>

<p>
where <samp>1.0-2</samp> is the version at which the diversion was first added
to the package.  Running the command during abort-upgrade is pointless but
harmless.
</p>

<p>
The postrm has to do the reverse:
</p>

<pre>
       if [ remove = &quot;$1&quot; -o abort-install = &quot;$1&quot; -o disappear = &quot;$1&quot; ]; then
          dpkg-divert --package smailwrapper --remove --rename \
             --divert /usr/sbin/smail.real /usr/sbin/smail
       fi
</pre>

<p>
If the diversion was added at a particular version, the postrm should also
handle the failure case of upgrading from an older version (unless the older
version is so old that direct upgrades are no longer supported):
</p>

<pre>
       if [ abort-upgrade = &quot;$1&quot; ] &amp;&amp; dpkg --compare-versions &quot;$2&quot; lt 1.0-2; then
          dpkg-divert --package smailwrapper --remove --rename \
             --divert /usr/sbin/smail.real /usr/sbin/smail
       fi
</pre>

<p>
where <samp>1.0-2</samp> is the version at which the diversion was first added
to the package.  The postrm should not remove the diversion on upgrades both
because there's no reason to remove the diversion only to immediately re-add it
and since the postrm of the old package is run after unpacking so the removal
of the diversion will fail.
</p>

<p>
Do not attempt to divert a file which is vitally important for the system's
operation - when using <code>dpkg-divert</code> there is a time, after it has
been diverted but before <code>dpkg</code> has installed the new version, when
the file does not exist.
</p>

<p>
Do not attempt to divert a conffile, as <code>dpkg</code> does not handle it
well.
</p>

<hr>

<h1>
Debian Policy Manual
<br>Footnotes</h1>

<h2><a href="#fr1" name="f1">1</a></h2>

<p>
Informally, the criteria used for inclusion is that the material meet one of
the following requirements:
</p>
<dl>
<dt>Standard interfaces</dt>
<dd>
<p>
The material presented represents an interface to the packaging system that is
mandated for use, and is used by, a significant number of packages, and
therefore should not be changed without peer review.  Package maintainers can
then rely on this interface not changing, and the package management software
authors need to ensure compatibility with this interface definition.  (Control
file and changelog file formats are examples.)
</p>
</dd>
<dt>Chosen Convention</dt>
<dd>
<p>
If there are a number of technically viable choices that can be made, but one
needs to select one of these options for inter-operability.  The version number
format is one example.
</p>
</dd>
</dl>

<p>
Please note that these are not mutually exclusive; selected conventions often
become parts of standard interfaces.
</p>

<h2><a href="#fr2" name="f2">2</a></h2>

<p>
Compare RFC 2119.  Note, however, that these words are used in a different way
in this document.
</p>

<h2><a href="#fr3" name="f3">3</a></h2>

<p>
The Debian archive software uses the term &quot;component&quot; internally and
in the Release file format to refer to the division of an archive.  The Debian
Social Contract simply refers to &quot;areas.&quot; This document uses
terminology similar to the Social Contract.
</p>

<h2><a href="#fr4" name="f4">4</a></h2>

<p>
See <code><a href="http://www.debian.org/intro/free">What Does Free
Mean?</a></code> for more about what we mean by free software.
</p>

<h2><a href="#fr5" name="f5">5</a></h2>

<p>
It is possible that there are policy requirements which the package is unable
to meet, for example, if the source is unavailable.  These situations will need
to be handled on a case-by-case basis.
</p>

<h2><a href="#fr6" name="f6">6</a></h2>

<p>
This is an important criterion because we are trying to produce, amongst other
things, a free Unix.
</p>

<h2><a href="#fr7" name="f7">7</a></h2>

<p>
A sample implementation of such a whitelist written for the Mailman mailing
list management software is used for mailing lists hosted by alioth.debian.org.
</p>

<h2><a href="#fr8" name="f8">8</a></h2>

<p>
The detailed procedure for gracefully orphaning a package can be found in the
Debian Developer's Reference (see <a href="#s-related">Related documents,
Section 1.4</a>).
</p>

<h2><a href="#fr9" name="f9">9</a></h2>

<p>
The blurb that comes with a program in its announcements and/or
<code>README</code> files is rarely suitable for use in a description.  It is
usually aimed at people who are already in the community where the package is
used.
</p>

<h2><a href="#fr10" name="f10">10</a></h2>

<p>
Essential is needed in part to avoid unresolvable dependency loops on upgrade.
If packages add unnecessary dependencies on packages in this set, the chances
that there <strong>will</strong> be an unresolvable dependency loop caused by
forcing these Essential packages to be configured first before they need to be
is greatly increased.  It also increases the chances that frontends will be
unable to <strong>calculate</strong> an upgrade path, even if one exists.
</p>

<p>
Also, functionality is rarely ever removed from the Essential set, but
<em>packages</em> have been removed from the Essential set when the
functionality moved to a different package.  So depending on these packages
<em>just in case</em> they stop being essential does way more harm than good.
</p>

<h2><a href="#fr11" name="f11">11</a></h2>

<p>
<code>Debconf</code> or another tool that implements the Debian Configuration
Management Specification will also be installed, and any versioned dependencies
on it will be satisfied before preconfiguration begins.
</p>

<h2><a href="#fr12" name="f12">12</a></h2>

<p>
See the file <code>upgrading-checklist</code> for information about policy
which has changed between different versions of this document.
</p>

<h2><a href="#fr13" name="f13">13</a></h2>

<p>
Rationale:
</p>
<ul>
<li>
<p>
This allows maintaining the list separately from the policy documents (the list
does not need the kind of control that the policy documents do).
</p>
</li>
<li>
<p>
Having a separate package allows one to install the build-essential packages on
a machine, as well as allowing other packages such as tasks to require
installation of the build-essential packages using the depends relation.
</p>
</li>
<li>
<p>
The separate package allows bug reports against the list to be categorized
separately from the policy management process in the BTS.
</p>
</li>
</ul>

<h2><a href="#fr14" name="f14">14</a></h2>

<p>
The reason for this is that dependencies change, and you should list all those
packages, and <em>only</em> those packages that <em>you</em> need directly.
What others need is their business.  For example, if you only link against
<code>libimlib</code>, you will need to build-depend on
<code>libimlib2-dev</code> but not against any <samp>libjpeg*</samp> packages,
even though <samp>libimlib2-dev</samp> currently depends on them: installation
of <code>libimlib2-dev</code> will automatically ensure that all of its
run-time dependencies are satisfied.
</p>

<h2><a href="#fr15" name="f15">15</a></h2>

<p>
Mistakes in changelogs are usually best rectified by making a new changelog
entry rather than &quot;rewriting history&quot; by editing old changelog
entries.
</p>

<h2><a href="#fr16" name="f16">16</a></h2>

<p>
Although there is nothing stopping an author who is also the Debian maintainer
from using this changelog for all their changes, it will have to be renamed if
the Debian and upstream maintainers become different people.  In such a case,
however, it might be better to maintain the package as a non-native package.
</p>

<h2><a href="#fr17" name="f17">17</a></h2>

<p>
To be precise, the string should match the following Perl regular expression:
</p>

<pre>
     /closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*/i
</pre>

<p>
Then all of the bug numbers listed will be closed by the archive maintenance
software (<code>dak</code>) using the <var>version</var> of the changelog
entry.
</p>

<h2><a href="#fr18" name="f18">18</a></h2>

<p>
In the case of a sponsored upload, the uploader signs the files, but the
changelog maintainer name and address are those of the person who prepared this
release.  If the preparer of the release is not one of the usual maintainers of
the package (as listed in the <a
href="#s-f-Maintainer"><samp>Maintainer</samp></a> or <a
href="#s-f-Uploaders"><samp>Uploaders</samp></a> control fields of the
package), the first line of the changelog is conventionally used to explain why
a non-maintainer is uploading the package.  The Debian Developer's Reference
(see <a href="#s-related">Related documents, Section 1.4</a>) documents the
conventions used.
</p>

<h2><a href="#fr19" name="f19">19</a></h2>

<p>
This is the same as the format generated by <samp>date -R</samp>.
</p>

<h2><a href="#fr20" name="f20">20</a></h2>

<p>
The rationale is that there is some information conveyed by knowing the age of
the file, for example, you could recognize that some documentation is very old
by looking at the modification time, so it would be nice if the modification
time of the upstream source would be preserved.
</p>

<h2><a href="#fr21" name="f21">21</a></h2>

<p>
This is not currently detected when building source packages, but only when
extracting them.
</p>

<p>
Hard links may be permitted at some point in the future, but would require a
fair amount of work.
</p>

<h2><a href="#fr22" name="f22">22</a></h2>

<p>
Setgid directories are allowed.
</p>

<h2><a href="#fr23" name="f23">23</a></h2>

<p>
Another common way to do this is for <samp>build</samp> to depend on
<code>build-stamp</code> and to do nothing else, and for the
<code>build-stamp</code> target to do the building and to <samp>touch
build-stamp</samp> on completion.  This is especially useful if the build
routine creates a file or directory called <samp>build</samp>; in such a case,
<samp>build</samp> will need to be listed as a phony target (i.e., as a
dependency of the <samp>.PHONY</samp> target).  See the documentation of
<code>make</code> for more information on phony targets.
</p>

<h2><a href="#fr24" name="f24">24</a></h2>

<p>
This split allows binary-only builds to not install the dependencies required
for the <samp>build-indep</samp> target and skip any resource-intensive build
tasks that are only required when building architecture-independent binary
packages.
</p>

<h2><a href="#fr25" name="f25">25</a></h2>

<p>
The <code>fakeroot</code> package often allows one to build a package correctly
even without being root.
</p>

<h2><a href="#fr26" name="f26">26</a></h2>

<p>
Some packages support any delimiter, but whitespace is the easiest to parse
inside a makefile and avoids ambiguity with flag values that contain commas.
</p>

<h2><a href="#fr27" name="f27">27</a></h2>

<p>
Packages built with <samp>make</samp> can often implement this by passing the
<samp>-j</samp><var>n</var> option to <samp>make</samp>.
</p>

<h2><a href="#fr28" name="f28">28</a></h2>

<p>
<code>files.new</code> is used as a temporary file by
<code>dpkg-gencontrol</code> and <code>dpkg-distaddfile</code> - they write a
new version of <samp>files</samp> here before renaming it, to avoid leaving a
corrupted copy if an error occurs.
</p>

<h2><a href="#fr29" name="f29">29</a></h2>

<p>
For example, parts of the GNU build system work like this.
</p>

<h2><a href="#fr30" name="f30">30</a></h2>

<p>
Having multiple copies of the same code in Debian is inefficient, often creates
either static linking or shared library conflicts, and, most importantly,
increases the difficulty of handling security vulnerabilities in the duplicated
code.
</p>

<h2><a href="#fr31" name="f31">31</a></h2>

<hr>

<p>
<code>dpkg</code>'s internal databases are in a similar format.
</p>

<h2><a href="#fr32" name="f32">32</a></h2>

<p>
The paragraphs are also sometimes referred to as stanzas.
</p>

<h2><a href="#fr33" name="f33">33</a></h2>

<p>
This folding method is similar to RFC 5322, allowing control files that contain
only one paragraph and no multiline fields to be read by parsers written for
RFC 5322.
</p>

<h2><a href="#fr34" name="f34">34</a></h2>

<p>
It is customary to leave a space after the package name if a version number is
specified.
</p>

<h2><a href="#fr35" name="f35">35</a></h2>

<p>
In the past, people specified the full version number in the Standards-Version
field, for example &quot;2.3.0.0&quot;.  Since minor patch-level changes don't
introduce new policy, it was thought it would be better to relax policy and
only require the first 3 components to be specified, in this example
&quot;2.3.0&quot;.  All four components may still be used if someone wishes to
do so.
</p>

<h2><a href="#fr36" name="f36">36</a></h2>

<p>
Alphanumerics are <samp>A-Za-z0-9</samp> only.
</p>

<h2><a href="#fr37" name="f37">37</a></h2>

<p>
One common use of <samp>~</samp> is for upstream pre-releases.  For example,
<samp>1.0~beta1~svn1245</samp> sorts earlier than <samp>1.0~beta1</samp>, which
sorts earlier than <samp>1.0</samp>.
</p>

<h2><a href="#fr38" name="f38">38</a></h2>

<p>
The author of this manual has heard of a package whose versions went
<samp>1.1</samp>, <samp>1.2</samp>, <samp>1.3</samp>, <samp>1</samp>,
<samp>2.1</samp>, <samp>2.2</samp>, <samp>2</samp> and so forth.
</p>

<h2><a href="#fr39" name="f39">39</a></h2>

<p>
Completely empty lines will not be rendered as blank lines.  Instead, they will
cause the parser to think you're starting a whole new record in the control
file, and will therefore likely abort with an error.
</p>

<h2><a href="#fr40" name="f40">40</a></h2>

<p>
Example distribution names in the Debian archive used in <code>.changes</code>
files are:
</p>
<dl>
<dt><em>unstable</em></dt>
<dd>
<p>
This distribution value refers to the <em>developmental</em> part of the Debian
distribution tree.  Most new packages, new upstream versions of packages and
bug fixes go into the <em>unstable</em> directory tree.
</p>
</dd>
<dt><em>experimental</em></dt>
<dd>
<p>
The packages with this distribution value are deemed by their maintainers to be
high risk.  Oftentimes they represent early beta or developmental packages from
various sources that the maintainers want people to try, but are not ready to
be a part of the other parts of the Debian distribution tree.
</p>
</dd>
</dl>

<p>
Others are used for updating stable releases or for security uploads.  More
information is available in the Debian Developer's Reference, section &quot;The
Debian archive&quot;.
</p>

<h2><a href="#fr41" name="f41">41</a></h2>

<p>
The source formats currently supported by the Debian archive software are
<samp>1.0</samp>, <samp>3.0 (native)</samp>, and <samp>3.0 (quilt)</samp>.
</p>

<h2><a href="#fr42" name="f42">42</a></h2>

<p>
Other urgency values are supported with configuration changes in the archive
software but are not used in Debian.  The urgency affects how quickly a package
will be considered for inclusion into the <samp>testing</samp> distribution and
gives an indication of the importance of any fixes included in the upload.
<samp>Emergency</samp> and <samp>critical</samp> are treated as synonymous.
</p>

<h2><a href="#fr43" name="f43">43</a></h2>

<p>
A space after each comma is conventional.
</p>

<h2><a href="#fr44" name="f44">44</a></h2>

<p>
That is, the parts which are not the <samp>.dsc</samp>.
</p>

<h2><a href="#fr45" name="f45">45</a></h2>

<p>
This is so that if an error occurs, the user interrupts <code>dpkg</code> or
some other unforeseen circumstance happens you don't leave the user with a
badly-broken package when <code>dpkg</code> attempts to repeat the action.
</p>

<h2><a href="#fr46" name="f46">46</a></h2>

<p>
This can happen if the new version of the package no longer pre-depends on a
package that had been partially upgraded.
</p>

<h2><a href="#fr47" name="f47">47</a></h2>

<p>
For example, suppose packages foo and bar are &quot;Installed&quot; with foo
depending on bar.  If an upgrade of bar were started and then aborted, and then
an attempt to remove foo failed because its <code>prerm</code> script failed,
foo's <samp>postinst abort-remove</samp> would be called with bar only
&quot;Half-Installed&quot;.
</p>

<h2><a href="#fr48" name="f48">48</a></h2>

<p>
This is often done by checking whether the command or facility the
<code>postrm</code> intends to call is available before calling it.  For
example:
</p>

<pre>
     if [ &quot;$1&quot; = purge ] &amp;&amp; [ -e /usr/share/debconf/confmodule ]; then
             . /usr/share/debconf/confmodule
             db_purge
     fi
</pre>

<p>
in <code>postrm</code> purges the <code>debconf</code> configuration for the
package if <code>debconf</code> is installed.
</p>

<h2><a href="#fr49" name="f49">49</a></h2>

<p>
Part of the problem is due to what is arguably a bug in <code>dpkg</code>.
</p>

<h2><a href="#fr50" name="f50">50</a></h2>

<p>
Historical note: Truly ancient (pre-1997) versions of <code>dpkg</code> passed
<samp>&lt;unknown&gt;</samp> (including the angle brackets) in this case.  Even
older ones did not pass a second argument at all, under any circumstance.  Note
that upgrades using such an old dpkg version are unlikely to work for other
reasons, even if this old argument behavior is handled by your postinst script.
</p>

<h2><a href="#fr51" name="f51">51</a></h2>

<p>
This approach makes dependency resolution easier.  If two packages A and B are
being upgraded, the installed package A depends on exactly the installed
package B, and the new package A depends on exactly the new package B (a common
situation when upgrading shared libraries and their corresponding development
packages), satisfying the dependencies at every stage of the upgrade would be
impossible.  This relaxed restriction means that both new packages can be
unpacked together and then configured in their dependency order.
</p>

<h2><a href="#fr52" name="f52">52</a></h2>

<p>
It is possible that a future release of <code>dpkg</code> may add the ability
to specify a version number for each virtual package it provides.  This feature
is not yet present, however, and is expected to be used only infrequently.
</p>

<h2><a href="#fr53" name="f53">53</a></h2>

<p>
To see why <samp>Breaks</samp> is normally needed in addition to
<samp>Replaces</samp>, consider the case of a file in the package
<code>foo</code> being taken over by the package <code>foo-data</code>.
<samp>Replaces</samp> will allow <code>foo-data</code> to be installed and take
over that file.  However, without <samp>Breaks</samp>, nothing requires
<code>foo</code> to be upgraded to a newer version that knows it does not
include that file and instead depends on <code>foo-data</code>.  Nothing would
prevent the new <code>foo-data</code> package from being installed and then
removed, removing the file that it took over from <code>foo</code>.  After that
operation, the package manager would think the system was in a consistent
state, but the <code>foo</code> package would be missing one of its files.
</p>

<h2><a href="#fr54" name="f54">54</a></h2>

<p>
Replaces is a one way relationship.  You have to install the replacing package
after the replaced package.
</p>

<h2><a href="#fr55" name="f55">55</a></h2>

<p>
There is no Build-Depends-Arch; this role is essentially met with
Build-Depends.  Anyone building the <samp>build-indep</samp> and
<samp>binary-indep</samp> targets is assumed to be building the whole package,
and therefore installation of all build dependencies is required.
</p>

<p>
The autobuilders use <samp>dpkg-buildpackage -B</samp>, which calls
<samp>build</samp>, not <samp>build-arch</samp> since it does not yet know how
to check for its existence, and <samp>binary-arch</samp>.  The purpose of the
original split between <samp>Build-Depends</samp> and
<samp>Build-Depends-Indep</samp> was so that the autobuilders wouldn't need to
install extra packages needed only for the binary-indep targets.  But without a
build-arch/build-indep split, this didn't work, since most of the work is done
in the build target, not in the binary target.
</p>

<h2><a href="#fr56" name="f56">56</a></h2>

<p>
<samp>Build-Depends</samp> in the source package is not adequate since it
(rightfully) does not document the exact version used in the build.
</p>

<h2><a href="#fr57" name="f57">57</a></h2>

<p>
The archive software might reject packages that refer to non-existent sources.
</p>

<h2><a href="#fr58" name="f58">58</a></h2>

<p>
This is a convention of shared library versioning, but not a requirement.  Some
libraries use the <samp>SONAME</samp> as the full library file name instead and
therefore do not need a symlink.  Most, however, encode additional information
about backwards-compatible revisions as a minor version number in the file
name.  The <samp>SONAME</samp> itself only changes when binaries linked with
the earlier version of the shared library may no longer work, but the filename
may change with each release of the library.  See <a
href="#s-sharedlibs-runtime">Run-time shared libraries, Section 8.1</a> for
more information.
</p>

<h2><a href="#fr59" name="f59">59</a></h2>

<p>
The package management system requires the library to be placed before the
symbolic link pointing to it in the <code>.deb</code> file.  This is so that
when <code>dpkg</code> comes to install the symlink (overwriting the previous
symlink pointing at an older version of the library), the new shared library is
already in place.  In the past, this was achieved by creating the library in
the temporary packaging directory before creating the symlink.  Unfortunately,
this was not always effective, since the building of the tar file in the
<code>.deb</code> depended on the behavior of the underlying file system.  Some
file systems (such as reiserfs) reorder the files so that the order of creation
is forgotten.  Since version 1.7.0, <code>dpkg</code> reorders the files itself
as necessary when building a package.  Thus it is no longer important to
concern oneself with the order of file creation.
</p>

<h2><a href="#fr60" name="f60">60</a></h2>

<p>
These are currently <code>/usr/local/lib</code> plus directories under
<code>/lib</code> and <code>/usr/lib</code> matching the multiarch triplet for
the system architecture.
</p>

<h2><a href="#fr61" name="f61">61</a></h2>

<p>
During install or upgrade, the preinst is called before the new files are
unpacked, so calling &quot;ldconfig&quot; is pointless.  The preinst of an
existing package can also be called if an upgrade fails.  However, this happens
during the critical time when a shared libs may exist on-disk under a temporary
name.  Thus, it is dangerous and forbidden by current policy to call
&quot;ldconfig&quot; at this time.
</p>

<p>
When a package is installed or upgraded, &quot;postinst configure&quot; runs
after the new files are safely on-disk.  Since it is perfectly safe to invoke
ldconfig unconditionally in a postinst, it is OK for a package to simply put
ldconfig in its postinst without checking the argument.  The postinst can also
be called to recover from a failed upgrade.  This happens before any new files
are unpacked, so there is no reason to call &quot;ldconfig&quot; at this point.
</p>

<p>
For a package that is being removed, prerm is called with all the files intact,
so calling ldconfig is useless.  The other calls to &quot;prerm&quot; happen in
the case of upgrade at a time when all the files of the old package are
on-disk, so again calling &quot;ldconfig&quot; is pointless.
</p>

<p>
postrm, on the other hand, is called with the &quot;remove&quot; argument just
after the files are removed, so this is the proper time to call
&quot;ldconfig&quot; to notify the system of the fact that the shared libraries
from the package are removed.  The postrm can be called at several other times.
At the time of &quot;postrm purge&quot;, &quot;postrm abort-install&quot;, or
&quot;postrm abort-upgrade&quot;, calling &quot;ldconfig&quot; is useless
because the shared lib files are not on-disk.  However, when &quot;postrm&quot;
is invoked with arguments &quot;upgrade&quot;, &quot;failed-upgrade&quot;, or
&quot;disappear&quot;, a shared lib may exist on-disk under a temporary
filename.
</p>

<h2><a href="#fr62" name="f62">62</a></h2>

<p>
For example, a <code><var>package-name</var>-config</code> script or
<code>pkg-config</code> configuration files.
</p>

<h2><a href="#fr63" name="f63">63</a></h2>

<p>
This wording allows the development files to be split into several packages,
such as a separate architecture-independent
<code><var>libraryname</var>-headers</code>, provided that the development
package depends on all the required additional packages.
</p>

<h2><a href="#fr64" name="f64">64</a></h2>

<p>
Previously, <samp>${Source-Version}</samp> was used, but its name was confusing
and it has been deprecated since dpkg 1.13.19.
</p>

<h2><a href="#fr65" name="f65">65</a></h2>

<p>
A <code>shlibs</code> file represents an SONAME as a library name and version
number, such as <samp>libfoo VERSION</samp>, instead of recording the actual
SONAME.  If the SONAME doesn't match one of the two expected formats
(<samp>libfoo-VERSION.so</samp> or <samp>libfoo.so.VERSION</samp>), it cannot
be represented.
</p>

<h2><a href="#fr66" name="f66">66</a></h2>

<p>
<code>dpkg-shlibdeps</code> will use a program like <code>objdump</code> or
<code>readelf</code> to find the libraries and the symbols in those libraries
directly needed by the binaries or shared libraries in the package.
</p>

<h2><a href="#fr67" name="f67">67</a></h2>

<p>
The easiest way to call <code>dpkg-shlibdeps</code> correctly is to use a
package helper framework such as <code>debhelper</code>.  If you are using
<code>debhelper</code>, the <code>dh_shlibdeps</code> program will do this work
for you.  It will also correctly handle multi-binary packages.
</p>

<h2><a href="#fr68" name="f68">68</a></h2>

<p>
<code>dh_shlibdeps</code> from the <samp>debhelper</samp> suite will
automatically add this option if it knows it is processing a udeb.
</p>

<h2><a href="#fr69" name="f69">69</a></h2>

<p>
Again, <code>dh_shlibdeps</code> and <code>dh_gencontrol</code> will handle
everything except the addition of the variable to the control file for you if
you're using <code>debhelper</code>, including generating separate
<code>substvars</code> files for each binary package and calling
<code>dpkg-gencontrol</code> with the appropriate flags.
</p>

<h2><a href="#fr70" name="f70">70</a></h2>

<p>
A good example of where this helps is the following.  We could update
<samp>libimlib</samp> with a new version that supports a new revision of a
graphics format called dgf (but retaining the same major version number) and
depends on a new library package <code>libdgf4</code> instead of the older
<code>libdgf3</code>.  If we used <code>ldd</code> to add dependencies for
every library directly or indirectly linked with a binary, every package that
uses <samp>libimlib</samp> would need to be recompiled so it would also depend
on <code>libdgf4</code> in order to retire the older <code>libdgf3</code>
package.  Since dependencies are only added based on ELF <samp>NEEDED</samp>
attribute, packages using <samp>libimlib</samp> can rely on
<samp>libimlib</samp> itself having the dependency on an appropriate version of
<samp>libdgf</samp> and do not need rebuilding.
</p>

<h2><a href="#fr71" name="f71">71</a></h2>

<p>
An example of an &quot;unreasonable&quot; program is one that uses library
interfaces that are documented as internal and unsupported.  If the only
programs or libraries affected by a change are &quot;unreasonable&quot; ones,
other techniques, such as declaring <samp>Breaks</samp> relationships with
affected packages or treating their usage of the library as bugs in those
packages, may be appropriate instead of changing the SONAME.  However, the
default approach is to change the SONAME for any change to the ABI that could
break a program.
</p>

<h2><a href="#fr72" name="f72">72</a></h2>

<p>
An example may clarify.  Suppose the source package <samp>foo</samp> generates
two binary packages, <samp>libfoo2</samp> and <samp>foo-runtime</samp>.  When
building the binary packages, the contents of the packages are staged in the
directories <code>debian/libfoo2</code> and <code>debian/foo-runtime</code>
respectively.  (<code>debian/tmp</code> could be used instead of one of these.)
Since <samp>libfoo2</samp> provides the <samp>libfoo</samp> shared library, it
will contain a <samp>symbols</samp> file, which will be installed in
<code>debian/libfoo2/DEBIAN/symbols</code>, eventually to be included as a
control file in that package.  When <code>dpkg-shlibdeps</code> is run on the
executable <code>debian/foo-runtime/usr/bin/foo-prog</code>, it will examine
the <code>debian/libfoo2/DEBIAN/symbols</code> file to determine whether
<samp>foo-prog</samp>'s library dependencies are satisfied by any of the
libraries provided by <samp>libfoo2</samp>.  Since those binaries were linked
against the just-built shared library as part of the build process, the
<code>symbols</code> file for the newly-built <samp>libfoo2</samp> must take
precedence over a <code>symbols</code> file for any other <samp>libfoo2</samp>
package already installed on the system.
</p>

<h2><a href="#fr73" name="f73">73</a></h2>

<p>
This can be determined by using the command
</p>
<pre>
     		  readelf -d /usr/lib/libz.so.1.2.3.4 | grep SONAME
</pre>

<h2><a href="#fr74" name="f74">74</a></h2>

<p>
An example of where this may be needed is with a library that implements the
libGL interface.  All GL implementations provide the same set of base
interfaces, and then may provide some additional interfaces only used by
programs that require that specific GL implementation.  So, for example,
libgl1-mesa-glx may use the following <code>symbols</code> file:
</p>

<pre>
     		  libGL.so.1 libgl1
     		  | libgl1-mesa-glx #MINVER#
     		  publicGlSymbol@Base 6.3-1
     		  [...]
     		  implementationSpecificSymbol@Base 6.5.2-7 1
     		  [...]
</pre>

<p>
Binaries or shared libraries using only <samp>publicGlSymbol</samp> would
depend only on <samp>libgl1</samp> (which may be provided by multiple
packages), but ones using <samp>implementationSpecificSymbol</samp> would get a
dependency on <samp>libgl1-mesa-glx (&gt;= 6.5.2-7)</samp>
</p>

<h2><a href="#fr75" name="f75">75</a></h2>

<p>
This field should normally not be necessary, since if the behavior of any
symbol has changed, the corresponding symbol <var>minimal-version</var> should
have been increased.  But including it makes the <samp>symbols</samp> system
more robust by tightening the dependency in cases where the package using the
shared library specifically requires at least a particular version of the
shared library development package for some reason.
</p>

<h2><a href="#fr76" name="f76">76</a></h2>

<p>
If you are using <samp>debhelper</samp>, <code>dh_makeshlibs</code> will take
care of calling either <code>dpkg-gensymbols</code> or generating a
<code>shlibs</code> file as appropriate.
</p>

<h2><a href="#fr77" name="f77">77</a></h2>

<p>
This is what <code>dh_makeshlibs</code> in the <code>debhelper</code> suite
does.  If your package also has a udeb that provides a shared library,
<code>dh_makeshlibs</code> can automatically generate the <samp>udeb:</samp>
lines if you specify the name of the udeb with the <samp>--add-udeb</samp>
option.
</p>

<h2><a href="#fr78" name="f78">78</a></h2>

<p>
This is necessary in order to reserve the directories for use in
cross-installation of library packages from other architectures, as part of
<samp>multiarch</samp>.
</p>

<h2><a href="#fr79" name="f79">79</a></h2>

<p>
This is necessary for architecture-dependant headers file to coexist in a
<samp>multiarch</samp> setup.
</p>

<h2><a href="#fr80" name="f80">80</a></h2>

<p>
This directory is used as mount point to mount virtual filesystems to get
access to kernel information.
</p>

<h2><a href="#fr81" name="f81">81</a></h2>

<p>
These directories are used to store translators and as a set of standard names
for mount points, respectively.
</p>

<h2><a href="#fr82" name="f82">82</a></h2>

<p>
<samp>/lib/lsb/init-functions</samp>, which assists in writing LSB-compliant
init scripts, may fail if <samp>set -e</samp> is in effect and echoing status
messages to the console fails, for example.
</p>

<h2><a href="#fr83" name="f83">83</a></h2>

<p>
Creating, modifying or removing a file in <code>/usr/lib/mime/packages/</code>
using maintainer scripts will not activate the trigger.  In that case, it can
be done by calling <samp>dpkg-trigger --no-await /usr/lib/mime/packages</samp>
from the maintainer script after creating, modifying, or removing the file.
</p>

<h2><a href="#fr84" name="f84">84</a></h2>

<p>
If you are using GCC, <samp>-fPIC</samp> produces code with relocatable
position independent code, which is required for most architectures to create a
shared library, with i386 and perhaps some others where non position
independent code is permitted in a shared library.
</p>

<p>
Position independent code may have a performance penalty, especially on
<samp>i386</samp>.  However, in most cases the speed penalty must be measured
against the memory wasted on the few architectures where non position
independent code is even possible.
</p>

<h2><a href="#fr85" name="f85">85</a></h2>

<p>
Some of the reasons why this might be required is if the library contains hand
crafted assembly code that is not relocatable, the speed penalty is excessive
for compute intensive libs, and similar reasons.
</p>

<h2><a href="#fr86" name="f86">86</a></h2>

<p>
Some of the reasons for linking static libraries with the <samp>-fPIC</samp>
flag are if, for example, one needs a Perl API for a library that is under
rapid development, and has an unstable API, so shared libraries are pointless
at this phase of the library's development.  In that case, since Perl needs a
library with relocatable code, it may make sense to create a static library
with relocatable code.  Another reason cited is if you are distilling various
libraries into a common shared library, like <samp>mklibs</samp> does in the
Debian installer project.
</p>

<h2><a href="#fr87" name="f87">87</a></h2>

<p>
You might also want to use the options <samp>--remove-section=.comment</samp>
and <samp>--remove-section=.note</samp> on both shared libraries and
executables, and <samp>--strip-debug</samp> on static libraries.
</p>

<h2><a href="#fr88" name="f88">88</a></h2>

<p>
A common example are the so-called &quot;plug-ins&quot;, internal shared
objects that are dynamically loaded by programs using <code>dlopen(3)</code>.
</p>

<h2><a href="#fr89" name="f89">89</a></h2>

<p>
These files store, among other things, all libraries on which that shared
library depends.  Unfortunately, if the <code>.la</code> file is present and
contains that dependency information, using <code>libtool</code> when linking
against that library will cause the resulting program or library to be linked
against those dependencies as well, even if this is unnecessary.  This can
create unneeded dependencies on shared library packages that would otherwise be
hidden behind the library ABI, and can make library transitions to new SONAMEs
unnecessarily complicated and difficult to manage.
</p>

<h2><a href="#fr90" name="f90">90</a></h2>

<p>
Single UNIX Specification, version 3, which is also IEEE 1003.1-2004 (POSIX),
and is available on the World Wide Web from <code><a
href="http://www.unix.org/version3/online.html">The Open Group</a></code> after
free registration.
</p>

<h2><a href="#fr91" name="f91">91</a></h2>

<p>
These features are in widespread use in the Linux community and are implemented
in all of bash, dash, and ksh, the most common shells users may wish to use as
<code>/bin/sh</code>.
</p>

<h2><a href="#fr92" name="f92">92</a></h2>

<p>
This is necessary to allow top-level directories to be symlinks.  If linking
<code>/var/run</code> to <code>/run</code> were done with the relative symbolic
link <code>../run</code>, but <code>/var</code> were a symbolic link to
<code>/srv/disk1</code>, the symbolic link would point to <code>/srv/run</code>
rather than the intended target.
</p>

<h2><a href="#fr93" name="f93">93</a></h2>

<p>
This notification could be done via a (low-priority) debconf message, or an
echo (printf) statement.
</p>

<h2><a href="#fr94" name="f94">94</a></h2>

<p>
It's better to use <code>mkfifo</code> rather than <code>mknod</code> to create
named pipes so that automated checks for packages incorrectly creating device
files with <code>mknod</code> won't have false positives.
</p>

<h2><a href="#fr95" name="f95">95</a></h2>

<p>
The <code>dpkg-maintscript-helper</code> tool, available from the
<code>dpkg</code> package, can help for this task.
</p>

<h2><a href="#fr96" name="f96">96</a></h2>

<p>
Rationale: There are two problems with hard links.  The first is that some
editors break the link while editing one of the files, so that the two files
may unwittingly become unlinked and different.  The second is that
<code>dpkg</code> might break the hard link while upgrading
<samp>conffile</samp>s.
</p>

<h2><a href="#fr97" name="f97">97</a></h2>

<p>
The traditional approach to log files has been to set up <em>ad hoc</em> log
rotation schemes using simple shell scripts and cron.  While this approach is
highly customizable, it requires quite a lot of sysadmin work.  Even though the
original Debian system helped a little by automatically installing a system
which can be used as a template, this was deemed not enough.
</p>

<p>
The use of <code>logrotate</code>, a program developed by Red Hat, is better,
as it centralizes log management.  It has both a configuration file
(<code>/etc/logrotate.conf</code>) and a directory where packages can drop
their individual log rotation configurations (<code>/etc/logrotate.d</code>).
</p>

<h2><a href="#fr98" name="f98">98</a></h2>

<p>
When a package is upgraded, and the owner or permissions of a file included in
the package has changed, dpkg arranges for the ownership and permissions to be
correctly set upon installation.  However, this does not extend to directories;
the permissions and ownership of directories already on the system does not
change on install or upgrade of packages.  This makes sense, since otherwise
common directories like <samp>/usr</samp> would always be in flux.  To
correctly change permissions of a directory the package owns, explicit action
is required, usually in the <samp>postinst</samp> script.  Care must be taken
to handle downgrades as well, in that case.
</p>

<h2><a href="#fr99" name="f99">99</a></h2>

<p>
Ordinary files installed by <code>dpkg</code> (as opposed to
<samp>conffile</samp>s and other similar objects) normally have their
permissions reset to the distributed permissions when the package is
reinstalled.  However, the use of <code>dpkg-statoverride</code> overrides this
default behavior.
</p>

<h2><a href="#fr100" name="f100">100</a></h2>

<p>
Internally, the package system normalizes the GNU triplets and the Debian
arches into Debian arch triplets (which are kind of inverted GNU triplets),
with the first component of the triplet representing the libc and ABI in use,
and then does matching against those triplets.  However, such triplets are an
internal implementation detail that should not be used by packages directly.
The libc and ABI portion is handled internally by the package system based on
the <var>os</var> and <var>cpu</var>.
</p>

<h2><a href="#fr101" name="f101">101</a></h2>

<p>
The Debian base system already provides an editor and a pager program.
</p>

<h2><a href="#fr102" name="f102">102</a></h2>

<p>
If it is not possible to establish both locks, the system shouldn't wait for
the second lock to be established, but remove the first lock, wait a (random)
time, and start over locking again.
</p>

<h2><a href="#fr103" name="f103">103</a></h2>

<p>
You will need to depend on <samp>liblockfile1 (&gt;&gt;1.01)</samp> to use
these functions.
</p>

<h2><a href="#fr104" name="f104">104</a></h2>

<p>
There are two traditional permission schemes for mail spools: mode 600 with all
mail delivery done by processes running as the destination user, or mode 660
and owned by group mail with mail delivery done by a process running as a
system user in group mail.  Historically, Debian required mode 660 mail spools
to enable the latter model, but that model has become increasingly uncommon and
the principle of least privilege indicates that mail systems that use the first
model should use permissions of 600.  If delivery to programs is permitted,
it's easier to keep the mail system secure if the delivery agent runs as the
destination user.  Debian Policy therefore permits either scheme.
</p>

<h2><a href="#fr105" name="f105">105</a></h2>

<p>
This implements current practice, and provides an actual policy for usage of
the <samp>xserver</samp> virtual package which appears in the virtual packages
list.  In a nutshell, X servers that interface directly with the display and
input hardware or via another subsystem (e.g., GGI) should provide
<samp>xserver</samp>.  Things like <samp>Xvfb</samp>, <samp>Xnest</samp>, and
<samp>Xprt</samp> should not.
</p>

<h2><a href="#fr106" name="f106">106</a></h2>

<p>
&quot;New terminal window&quot; does not necessarily mean a new top-level X
window directly parented by the window manager; it could, if the terminal
emulator application were so coded, be a new &quot;view&quot; in a
multiple-document interface (MDI).
</p>

<h2><a href="#fr107" name="f107">107</a></h2>

<p>
For the purposes of Debian Policy, a &quot;font for the X Window System&quot;
is one which is accessed via X protocol requests.  Fonts for the Linux console,
for PostScript renderer, or any other purpose, do not fit this definition.  Any
tool which makes such fonts available to the X Window System, however, must
abide by this font policy.
</p>

<h2><a href="#fr108" name="f108">108</a></h2>

<p>
This is because the X server may retrieve fonts from the local file system or
over the network from an X font server; the Debian package system is empowered
to deal only with the local file system.
</p>

<h2><a href="#fr109" name="f109">109</a></h2>

<p>
Note that this mechanism is not the same as using app-defaults; app-defaults
are tied to the client binary on the local file system, whereas X resources are
stored in the X server and affect all connecting clients.
</p>

<h2><a href="#fr110" name="f110">110</a></h2>

<p>
It is not very hard to write a man page.  See the <code><a
href="http://www.schweikhardt.net/man_page_howto.html">Man-Page-HOWTO</a></code>,
<code>man(7)</code>, the examples created by <code>dh_make</code>, the helper
program <code>help2man</code>, or the directory
<code>/usr/share/doc/man-db/examples</code>.
</p>

<h2><a href="#fr111" name="f111">111</a></h2>

<p>
Supporting this in <code>man</code> often requires unreasonable processing time
to find a manual page or to report that none exists, and moves knowledge into
man's database that would be better left in the file system.  This support is
therefore deprecated and will cease to be present in the future.
</p>

<h2><a href="#fr112" name="f112">112</a></h2>

<p>
<code>man</code> will automatically detect whether UTF-8 is in use.  In future,
all manual pages will be required to use UTF-8.
</p>

<h2><a href="#fr113" name="f113">113</a></h2>

<p>
At the time of writing, Chinese and Portuguese are the main languages with such
differences, so <code>pt_BR</code>, <code>zh_CN</code>, and <code>zh_TW</code>
are all allowed.
</p>

<h2><a href="#fr114" name="f114">114</a></h2>

<p>
Normally, info documents are generated from Texinfo source.  To include this
information in the generated info document, if it is absent, add commands like:
</p>

<pre>
     @dircategory Individual utilities
     @direntry
     * example: (example).               An example info directory entry.
     @end direntry
</pre>

<p>
to the Texinfo source of the document and ensure that the info documents are
rebuilt from source during the package build.
</p>

<h2><a href="#fr115" name="f115">115</a></h2>

<p>
The system administrator should be able to delete files in
<code>/usr/share/doc/</code> without causing any programs to break.
</p>

<h2><a href="#fr116" name="f116">116</a></h2>

<p>
Please note that this does not override the section on changelog files below,
so the file <code>/usr/share/doc/<var>package</var>/changelog.Debian.gz</code>
must refer to the changelog for the current version of <var>package</var> in
question.  In practice, this means that the sources of the target and the
destination of the symlink must be the same (same source package and version).
</p>

<h2><a href="#fr117" name="f117">117</a></h2>

<p>
Rationale: The important thing here is that HTML documentation should be
available from <em>some</em> binary package.
</p>

<h2><a href="#fr118" name="f118">118</a></h2>

<p>
In particular, <code>/usr/share/common-licenses/Apache-2.0</code>,
<code>/usr/share/common-licenses/Artistic</code>,
<code>/usr/share/common-licenses/GPL-1</code>,
<code>/usr/share/common-licenses/GPL-2</code>,
<code>/usr/share/common-licenses/GPL-3</code>,
<code>/usr/share/common-licenses/LGPL-2</code>,
<code>/usr/share/common-licenses/LGPL-2.1</code>,
<code>/usr/share/common-licenses/LGPL-3</code>,
<code>/usr/share/common-licenses/GFDL-1.2</code>, and
<code>/usr/share/common-licenses/GFDL-1.3</code> respectively.  The University
of California BSD license is also included in <code>base-files</code> as
<code>/usr/share/common-licenses/BSD</code>, but given the brevity of this
license, its specificity to code whose copyright is held by the Regents of the
University of California, and the frequency of minor wording changes, its text
should be included in the copyright file rather than referencing this file.
</p>

<h2><a href="#fr119" name="f119">119</a></h2>

<p>
Rationale: People should not have to look in places for upstream changelogs
merely because they are given different names or are distributed in HTML
format.
</p>

<h2><a href="#fr120" name="f120">120</a></h2>

<p>
<code>dpkg</code> is targeted primarily at Debian, but may work on or be ported
to other systems.
</p>

<h2><a href="#fr121" name="f121">121</a></h2>

<p>
This is so that the control file which is produced has the right permissions
</p>

<h2><a href="#fr122" name="f122">122</a></h2>

<p>
This is not currently detected when building source packages, but only when
extracting them.
</p>

<h2><a href="#fr123" name="f123">123</a></h2>

<p>
Hard links may be permitted at some point in the future, but would require a
fair amount of work.
</p>

<h2><a href="#fr124" name="f124">124</a></h2>

<p>
Setgid directories are allowed.
</p>

<h2><a href="#fr125" name="f125">125</a></h2>

<p>
Renaming a file is not treated specially - it is seen as the removal of the old
file (which generates a warning, but is otherwise ignored), and the creation of
the new one.
</p>

<hr>

<p>
[ <a href="#ap-pkg-diversions">previous</a> ]
[ <a href="#contents">Contents</a> ]
[ <a href="#ch-scope">1</a> ]
[ <a href="#ch-archive">2</a> ]
[ <a href="#ch-binary">3</a> ]
[ <a href="#ch-source">4</a> ]
[ <a href="#ch-controlfields">5</a> ]
[ <a href="#ch-maintainerscripts">6</a> ]
[ <a href="#ch-relationships">7</a> ]
[ <a href="#ch-sharedlibs">8</a> ]
[ <a href="#ch-opersys">9</a> ]
[ <a href="#ch-files">10</a> ]
[ <a href="#ch-customized-programs">11</a> ]
[ <a href="#ch-docs">12</a> ]
[ <a href="#ap-pkg-scope">A</a> ]
[ <a href="#ap-pkg-binarypkg">B</a> ]
[ <a href="#ap-pkg-sourcepkg">C</a> ]
[ <a href="#ap-pkg-controlfields">D</a> ]
[ <a href="#ap-pkg-conffiles">E</a> ]
[ <a href="#ap-pkg-alternatives">F</a> ]
[ <a href="#ap-pkg-diversions">G</a> ]
[ <a href="#ch-scope">next</a> ]
</p>

<hr>

<p>
Debian Policy Manual
</p>

<address>
version 3.9.8.0, 2016-03-30<br>
<br>
<a href="#s-authors">The Debian Policy Mailing List</a><br>
<br>
</address>
<hr>

</body>

</html>