/usr/sbin/faxsetup is in hylafax-server 3:6.0.6-5.
This file is owned by root:root, with mode 0o755.
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 | #! /bin/bash
# $Id$
#
# Warning, this file was automatically created by the HylaFAX configure script
#
# HylaFAX Facsimile Software
#
# Copyright (c) 1990-1996 Sam Leffler
# Copyright (c) 1991-1996 Silicon Graphics, Inc.
# HylaFAX is a trademark of Silicon Graphics
#
# Permission to use, copy, modify, distribute, and sell this software and
# its documentation for any purpose is hereby granted without fee, provided
# that (i) the above copyright notices and this permission notice appear in
# all copies of the software and related documentation, and (ii) the names of
# Sam Leffler and Silicon Graphics may not be used in any advertising or
# publicity relating to the software without the specific, prior written
# permission of Sam Leffler and Silicon Graphics.
#
# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
#
# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
# OF THIS SOFTWARE.
#
#
# VERSION: 6.0.6
# DATE: Sun Mar 10 23:28:47 UTC 2013
# TARGET: x86_64-unknown-linux-gnu
#
#
# faxsetup [options]
#
# This script interactively prepares and verifies
# a HylaFAX client and/or server machine for use.
#
PATH=/bin:/usr/bin:/etc
test -d /usr/ucb && PATH=$PATH:/usr/ucb # Sun and others
test -d /usr/bsd && PATH=$PATH:/usr/bsd # Silicon Graphics
test -d /usr/5bin && PATH=/usr/5bin:$PATH:/usr/etc # Sun and others
test -d /usr/sbin && PATH=/usr/sbin:$PATH # 4.4BSD-derived
test -d /usr/local/bin && PATH=$PATH:/usr/local/bin # for GNU tools
AWK=/usr/bin/awk # awk for use below
CAT=/bin/cat # cat command for use below
CHGRP=/bin/chgrp # change file group for use below
CHMOD=/bin/chmod # change file mode for use below
CHOWN=/bin/chown # change file owner for use below
CP=/bin/cp # cp command for use below
ECHO=/bin/echo # echo command for use below
ENCODING= # encoding style for uuencode/mimencode
FUSER=fuser # fuser command to dump in setup.cache
GREP=/bin/grep # grep command for use below
LN=/bin/ln # ln command for use below
LN_S=-s # ln option for creating a symbolic link
MKFIFO=/usr/bin/mkfifo # FIFO creation program for use below
MV=/bin/mv # move file for use below
PCL6CMD=pcl6 # pcl6 (GhostPCL) program
RMCMD=/bin/rm # remove file for use below
SCRIPT_SH=/bin/bash # shell for use below
SED=/bin/sed # sed for use below
TIFF2PDF=/usr/bin/tiff2pdf # tiff-to-pdf conversion tool
TTYCMD=/usr/bin/tty # tty for error output
BASE64ENCODE="" # base64encode command to dump in setup.cache
MIMENCODE="" # mimeencode command to dump in setup.cache for old notifys
QPENCODE="" # qpencode command to dump in setup.cache
UUENCODE="" # uuencode command to dump in setup.cache
FAX=uucp # identity of the fax user
SERVICES=/etc/services # location of services database
INETDCONF=/etc/inetd.conf # default location of inetd configuration file
ALIASES=/etc/aliases # default location of mail aliases database file
PASSWD=/etc/passwd # where to go for password entries
PROTOUID=uucp # user who's uid we use for FAX user
defPROTOUID=3 # use this uid if PROTOUID doesn't exist
GROUP=/etc/group # where to go for group entries
PROTOGID=uucp # group who's gid we use for FAX user
defPROTOGID=10 # use this gid if PROTOGID doesn't exist
VERSION="6.0.6" # configured version
DATE="Sun Mar 10 23:28:47 UTC 2013" # data software was configured
TARGET="x86_64-unknown-linux-gnu" # configured target
PATH_AFM=/usr/share/fonts/type1/gsfonts # directory for Adobe Font Metric files
PATH_FONTMAP=/usr/share/gs-esp/8.15/lib:/usr/share/gs-esp/7.07/lib:/usr/share/gs/6.53 # directory for FontMap files
DIR_BIN=/usr/bin # directory for client applications
DIR_LIBDATA=/etc/hylafax # directory for client data files
DIR_LIBEXEC=/usr/sbin # directory where servers are located
DIR_LOCKS=/var/lock # UUCP locking directory
DIR_MAN=/usr/share/man # directory for manual pages
DIR_SBIN=/usr/sbin # directory for server applications
DIR_SPOOL=/var/spool/hylafax # top of fax spooling tree
TIFFBIN=/usr/bin # TIFF tools
LOCKS=ascii # UUCP lock type
PATH_GETTY=/etc/hylafax/getty-link # pathname for getty program
PATH_SENDMAIL=/usr/lib/sendmail # pathname for sendmail
PATH_VGETTY=/etc/hylafax/vgetty-link # pathname for voice getty program
PATH_EGETTY=/etc/hylafax/egetty-link # pathname for external getty program
PS=gs # default PostScript RIP package
PATH_GSRIP=/usr/bin/gs # pathname of Ghostscript RIP
PATH_DPSRIP=/usr/local/sbin/ps2fax.exe # pathname of old IRIX DPS RIP
PATH_IMPRIP=/usr/bin/psrip # pathname of IRIX Impressario RIP
POSIXLY_CORRECT=1; export POSIXLY_CORRECT # disable GNU extensions
#
# Location of sysv init script
#
DIR_SYSVINIT=/etc/init.d
FAXQ_SERVER=yes
HFAXD_SERVER=yes
HFAXD_SNPP_SERVER=no
#
# These are the configuration parameters written to the
# setup.cache file and read in by all the HylaFAX scripts.
#
# We use the same names used by configure for consistency
# (but some confusion within this script).
#
VARS="SCRIPT_SH
FONTPATH PATH_AFM
AWK
BASE64ENCODE
BIN DIR_BIN
CAT
CHGRP
CHMOD
CHOWN
CP
DPSRIP PATH_DPSRIP
ECHO
ENCODING
FAXQ_SERVER
FUSER
GREP
GSRIP PATH_GSRIP
HFAXD_SERVER
HFAXD_SNPP_SERVER
IMPRIP PATH_IMPRIP
LIBDATA DIR_LIBDATA
LIBEXEC DIR_LIBEXEC
LN
MANDIR DIR_MAN
MIMENCODE
MKFIFO
MV
PATH
PATHGETTY PATH_GETTY
PATHVGETTY PATH_VGETTY
PATHEGETTY PATH_EGETTY
PCL6CMD
PSPACKAGE PS
QPENCODE
RM RMCMD
SBIN DIR_SBIN
SED
SENDMAIL PATH_SENDMAIL
SPOOL DIR_SPOOL
SYSVINIT
TIFF2PDF
TIFFBIN
TARGET
TTYCMD
UUENCODE
UUCP_LOCKDIR DIR_LOCKS
UUCP_LOCKTYPE LOCKS"
[ ! -d /var/spool/hylafax/etc ] && mkdir /var/spool/hylafax/etc
[ -d /var/spool/hylafax/etc ] && cp -a /etc/hylafax/* /var/spool/hylafax/etc/
dumpvals()
{
echo "$VARS" |
while read a b; do eval c=\$${b:-$a}; echo "$a='$c'"; done
}
#
# Find the full pathname of an executable;
# supply a default if nothing is found.
#
findAppDef()
{
app=$1; path=$2; def=$3
case $app in
/*) test -x $app && { echo $app; return; };;
esac
IFS=:
for i in $path; do
test -x $i/$app && { echo $i/$app; return; }
done
echo $def
}
#
# Error diagnostics that should go to the terminal are
# done with this interface or cat.
#
bitch()
{
echo "$@" 1>&2
}
#
# This is the preferred interface for
# configure to terminate abnormally.
#
boom()
{
$RM $JUNK
# boom can be called before TMPDIR is set
if test x$TMPDIR != x; then
$RM -r $TMPDIR
fi
exit 1
}
usage()
{
cat<<EOF
Usage: faxsetup [options] [host]
Options: [defaults in brackets after descriptions]
-client setup client support
-server setup server support
-with-PARAM[=ARG] set configuration PARAM [ARG=yes]
-help print this message
-quiet do not print 'Using ...' messages
-verbose opposite of -quiet
EOF
}
QUIET=no
isServer=no
isClient=no
onClient()
{
test $isClient = yes
}
onServer()
{
test $isServer = yes
}
#
# Crack command line arguments. We purposely
# use syntax and options that are compatible
# with GNU autoconf.
#
WITHARGS=no
ac_prev=
for ac_option
do
if [ -n "$ac_prev" ]; then # assign the argument to previous option
eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
case "$ac_option" in # collect optional argument
-*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'`;;
*) ac_optarg=;;
esac
case "$ac_option" in
-with-*|--with-*)
ac_with=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
# Reject names that are not valid shell variable names.
if [ -n "`echo $ac_with| sed 's/[-_a-zA-Z0-9]//g'`" ]; then
bitch "configure: $ac_with: invalid parameter name."
boom
fi
ac_with=`echo $ac_with| sed 's/-/_/g'`
case "$ac_option" in
*=*) ;;
*) ac_optarg=yes;;
esac
eval "${ac_with}='$ac_optarg'"
WITHARGS=yes
;;
-client) isClient=yes;;
-server) isServer=yes;;
-quiet) QUIET=yes;;
-verbose) QUIET=no;;
-help) usage; exit 0;;
-*)
bitch "faxsetup: $ac_option: invalid option; use -help for usage."
boom
;;
esac
done
if [ -n "$ac_prev" ]; then
bitch "faxsetup: missing argument to --`echo $ac_prev | sed 's/_/-/g'`"
boom
fi
# if nothing specified on command line, default client+server
if [ $isClient = no ] && [ $isServer = no ]; then
#
# on debian the client configuration file is already bundled with the package
#
isClient=no
isServer=yes
fi
#
# Descriptor usage:
# 1: ???
# 2: messages that should be seen even if we're in the background.
# 3: [stdout from test runs]
# 4: verbose-style messages (Using ...)
# 5: setup.cache file
#
if [ $QUIET = yes ]; then
exec 4>/dev/null # chuck messages
else
exec 4>&1 # messages go to stdout
fi
Note()
{
echo "$@" 1>&4
}
capture()
{
(eval "set -x; $*") > /dev/null 2>&1
return
}
Note ""
Note "Setup program for HylaFAX (tm) $VERSION."
Note ""
Note "Created for $TARGET on $DATE."
Note ""
CPU=`expr $TARGET : '\([^\-]*\)'` || CPU=unknown
VENDOR=`expr $TARGET : '[^\-]*-\([^\-]*\)'` || VENDOR=unknown
OS=`expr $TARGET : '[^\-]*-[^\-]*-\([a-zA-Z]*\).*'` || OS=unknown
RELEASE=`(uname -r) 2>/dev/null` || RELEASE=unknown
#
# Read in any site, target, vendor, os, or os-release
# specific setup work. Note that we read stuff here
# so that configuration parameters can be altered. We
# use some pre-defined function names below to provide
# hooks for other actions.
#
#
# Hooks for additional client+server checks
#
otherBasicServerChecks()
{
true
}
otherBasicClientChecks()
{
true
}
#
# Hook for adding stuff to setup.modem
#
dumpOtherModemFuncs()
{
true
}
#
# Figure out which brand of echo we have and define prompt
# and printf shell functions accordingly. Note that we
# assume that if the System V-style echo is not present,
# then the BSD printf program is available. These functions
# are defined here so that they can be tailored on a per-site,
# etc. basis.
#
if [ `echo foo\\\c`@ = "foo@" ]; then
# System V-style echo supports \r
# and \c which is all that we need
prompt()
{
echo "$* \\c"
}
printf()
{
echo "$*\\c"
}
dumpPromptFuncs()
{
cat<<-'EOF'
prompt()
{
echo "$* \\c"
}
printf()
{
echo "$*\\c"
}
EOF
}
elif [ "`echo -n foo`@" = "foo@" ]; then
# BSD-style echo; use echo -n to get
# a line without the trailing newline
prompt()
{
echo -n "$* "
}
dumpPromptFuncs()
{
cat<<-'EOF'
prompt()
{
echo -n "$* "
}
EOF
}
else
# something else; do without
prompt()
{
echo "$*"
}
dumpPromptFuncs()
{
cat<<-'EOF'
prompt()
{
echo "$*"
}
EOF
}
fi
if onServer; then
#
# Setup the password file manipulation functions according
# to whether we have System-V style support through the
# passmgmt program, or BSD style support through the chpass
# program, or for SCO boxes through pwconv, or SVR4 style support
# through useradd. If none are found, we setup functions that
# will cause us to abort if we need to munge the password file.
#
# NB: some systems override these function definitions through
# per-os faxsetup files
#
if [ -f /bin/passmgmt ] || [ -f /usr/sbin/passmgmt ]; then
addPasswd()
{
passmgmt -o -a -c 'Facsimile Agent' -h $4 -u $2 -g $3 $1
}
deletePasswd()
{
passmgmt -d $1
}
modifyPasswd()
{
passmgmt -m -h $4 -u $2 -o -g $3 $1
}
lockPasswd()
{
passwd -l $1
}
elif [ -f /usr/bin/chpass ]; then
addPasswd()
{
chpass -a "$1:*:$2:$3::0:0:Facsimile Agent:$4:"
}
modifyPasswd()
{
chpass -a "$1:*:$2:$3::0:0:Facsimile Agent:$4:"
}
lockPasswd()
{
return 0 # entries are always locked
}
elif [ -f /etc/pwconv ]; then # could be a SCO box
addPasswd()
{
echo "${1}:NOLOGIN:${2}:${3}:Facsimile Agent:${4}:/bin/false" >> ${PASSWD}
/etc/pwconv
}
lockPasswd()
{
return 0 # entries are always locked
}
modifyPasswd()
{
OLD_HOME=`grep "^${1}:" ${PASSWD} | awk -F: '{print $6}'`
ed - $PASSWD <<_EOF
g~^$1:~s~${OLD_HOME}~$4~
w
q
_EOF
}
elif [ -f /usr/sbin/useradd ] || [ -f /etc/useradd ]; then
addPasswd()
{
useradd -c 'Facsimile Agent' -d $4 -u $2 -o -g $3 $1
}
deletePasswd()
{
userdel $1
}
modifyPasswd()
{
usermod -m -d $4 -u $2 -o -g $3 $1
}
lockPasswd()
{
passwd -l $1
}
else
addPasswd()
{
cat >&2 <<EOF
FATAL ERROR: I don't know how to add a passwd entry!
You will have to create the password entry manually using the following info:
Login Name: $1
Password: *
Uid: $2
Gid: $3
Full Name: Facsimile Agent
Home Dir: $4
EOF
boom
}
modifyPasswd()
{
cat >&2 <<EOF
FATAL ERROR: I don't know how to modify a passwd entry!
You will have to update the password entry manually using the following info:
Login Name: $1
Password: *
Uid: $2
Gid: $3
Full Name: Facsimile Agent
Home Dir: $4
EOF
boom
}
fi
#
# Functions required by faxaddmodem.
#
case $TARGET in
*-sunos*|*-linux*|*-ultrix*|*-hpux*|*-freebsd*|*-netbsd*|*-sysv5SCO_SV6*)
dumpTTYFuncs()
{
cat<<'EOF'
ttyPort()
{
expr $1 : 'tty\(.*\)'
}
ttyLocks()
{
echo $UUCP_LOCKDIR/LCK..`expr /$1 : '.*/\(.*\)'`
}
ttyAliases()
{
if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
echo $1
}
ttyDev()
{
if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
echo $1
}
checkPort()
{
return
}
EOF
}
;;
*-svr4*|*-sysv4*|*-sysv5*|*-solaris*)
dumpTTYFuncs()
{
cat<<'EOF'
ttyPort()
{
port=`expr $1 : 'term\/\(.*\)' \| $1` # Usual
port=`expr $port : 'cua\/\(.*\)' \| $port` # Solaris
port=`expr $port : 'tty\(.*\)' \| $port` # Old-style
echo $port
}
ttyLocks()
{
devs=$1
locks="$UUCP_LOCKDIR/`$SVR4UULCKN /dev/$devs`" || {
echo "Sorry, I cannot determine the UUCP lock file name for $devs"
exit 1
}
echo $locks
}
ttyAliases()
{
if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
echo $1
}
ttyDev()
{
if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
echo $1
}
checkPort()
{
return
}
EOF
}
;;
*)
dumpTTYFuncs()
{
Note ""
Note "Beware, I am guessing the tty naming conventions for your system."
cat<<'EOF'
ttyPort()
{
expr $1 : 'tty\(.*\)'
}
ttyLocks()
{
echo $UUCP_LOCKDIR/LCK..`expr /$1 : '.*/\(.*\)'`
}
ttyAliases()
{
if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
echo $1
}
ttyDev()
{
if [ -z "`echo $1 | grep "^/"`" ]; then printf "/dev/"; fi
echo $1
}
checkPort()
{
return
}
EOF
}
;;
esac
case $TARGET in
*-*bsd*)
dumpSTTYFuncs()
{
cat<<EOF
ttyStty()
{
echo $STTYCMD -f \$tdev
}
ttySpeeds()
{
speeds=
if [ -z "\$SPEED" ]; then
for s in 38400 19200 9600 4800 2400 1200; do
$STTYCMD -f \$tdev \$s </dev/null >/dev/null 2>&1 && speeds="\$speeds \$s"
done
fi
echo \$speeds
}
EOF
}
;;
*)
dumpSTTYFuncs()
{
cat<<EOF
ttyStty()
{
echo $STTYCMD
}
ttySpeeds()
{
speeds=
if [ -z "\$SPEED" ]; then
for s in 38400 19200 9600 4800 2400 1200; do
onDev $STTYCMD \$s </dev/null >/dev/null 2>&1 && speeds="\$speeds \$s"
done
fi
echo \$speeds
}
EOF
}
;;
esac
machdepPasswdWork()
{
true
}
#
# Default values for new scheduler config files
#
defaultLogFacility=daemon
defaultCountryCode=1
defaultAreaCode=
defaultLongDistancePrefix=1
defaultInternationalPrefix=011
defaultDialStringRules=\"etc/dialrules\"
defaultServerTracing=1
defaultContCoverPage=
defaultContCoverCmd=\"bin/mkcover\"
defaultMaxConcurrentCalls=1
defaultMaxDials=12
defaultMaxSendPages=0xffffffff
defaultMaxTries=3
defaultModemGroup=
defaultPostScriptTimeout=180
defaultPS2FaxCmd=\"bin/ps2fax\"
defaultSendFaxCmd=\"bin/faxsend\"
defaultSendPageCmd=\"bin/pagesend\"
defaultSendUUCPCmd=\"bin/uucpsend\"
defaultSessionTracing=0xffffffff
defaultTimeOfDay=\"Any\"
defaultUse2D=Yes
defaultNotifyCmd=\"bin/notify\"
defaultUUCPLockDir=\"$DIR_LOCKS\"
defaultUUCPLockTimeout=30
defaultUUCPLockType=\"$LOCKS\"
fi
CONFIG_FILES=
if [ -f $DIR_SBIN/faxsetup.local ]; then
. $DIR_SBIN/faxsetup.local
CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.local"
elif [ -f $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}${RELEASE} ]; then
. $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}${RELEASE}
CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}${RELEASE}"
elif [ -f $DIR_SBIN/faxsetup.${VENDOR}-${OS}${RELEASE} ]; then
. $DIR_SBIN/faxsetup.${VENDOR}-${OS}${RELEASE}
CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${VENDOR}-${OS}${RELEASE}"
elif [ -f $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS} ]; then
. $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}
CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${CPU}-${VENDOR}-${OS}"
elif [ -f $DIR_SBIN/faxsetup.${VENDOR}-${OS} ]; then
. $DIR_SBIN/faxsetup.${VENDOR}-${OS}
CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${VENDOR}-${OS}"
elif [ -f $DIR_SBIN/faxsetup.${CPU}-${VENDOR} ]; then
. $DIR_SBIN/faxsetup.${CPU}-${VENDOR}
CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${CPU}-${VENDOR}"
elif [ -f $DIR_SBIN/faxsetup.${VENDOR} ]; then
. $DIR_SBIN/faxsetup.${VENDOR}
CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${VENDOR}"
elif [ -f $DIR_SBIN/faxsetup.${OS} ]; then
. $DIR_SBIN/faxsetup.${OS}
CONFIG_FILES="$CONFIG_FILES $DIR_SBIN/faxsetup.${OS}"
fi
#
# Flush cached values if something was specified on the
# command line
#
if onServer; then
REASON=
if [ $WITHARGS = yes ]; then
REASON="of command line parameters"
elif [ "$CONFIG_FILES" ]; then
REASON=`find $CONFIG_FILES -newer $DIR_SPOOL/etc/setup.cache -print 2>/dev/null`
test "$REASON" && REASON="$REASON has been updated"
fi
if [ "$REASON" ] && [ -f $DIR_SPOOL/etc/setup.cache ]; then
Note "Flushing cached parameters because $REASON."
Note ""
rm -f $DIR_SPOOL/etc/setup.cache
fi
if [ -f $DIR_SPOOL/etc/setup.cache ]; then
Note "Reading cached parameters from $DIR_SPOOL/etc/setup.cache."
Note ""
. $DIR_SPOOL/etc/setup.cache
fi
fi
#
# Double-check these settings...
#
if [ ! -x "$TIFF2PDF" ] || [ "$TIFF2PDF" = "bin/tiff2pdf" ]; then
TIFF2PDF=`findAppDef tiff2pdf $PATH bin/tiff2pdf`
if [ "$TIFF2PDF" != "bin/tiff2pdf" ]; then
test -x "$TIFF2PDF" && Note "Found converter: $TIFF2PDF"
fi
fi
test -x "$PCL6CMD" || {
PCL6CMD=`findAppDef pcl6 $PATH pcl6`
test -x "$PCL6CMD" && Note "Found PCL converter: $PCL6CMD"
}
test -x "$UUENCODE" || {
UUENCODE=`findAppDef uuencode $PATH uuencode`
test -x "$UUENCODE" && Note "Found uuencode encoder: $UUENCODE"
}
# $BASE64ENCODE may contain parameters
cmd=`echo "$BASE64ENCODE" | $SED -e "s/^ *//" -e "s/ .*$//"`
test -x "$cmd" || BASE64ENCODE=`findAppDef mimencode $PATH mimencode`
test -x "$BASE64ENCODE" || BASE64ENCODE=`findAppDef base64-encode $PATH base64-encode`
test -x "$BASE64ENCODE" || BASE64ENCODE=`findAppDef base64 $PATH base64`
test -x "$BASE64ENCODE" || {
if [ -x "$UUENCODE" ]; then
if capture "$UUENCODE -m $PASSWD foo"; then
BASE64ENCODE="$UUENCODE -m ==== | $GREP -v ===="
fi
fi
}
test -n "$BASE64ENCODE" && Note "Found base64 encoder: $BASE64ENCODE"
# $QPENCODE may contain parameters
cmd=`echo $QPENCODE | $SED -e "s/^ *//" -e "s/ .*$//"`
test -x "$cmd" || {
cmd=`findAppDef mimencode $PATH mimencode`
QPENCODE="$cmd -q"
test -x $cmd || {
QPENCODE=`findAppDef qp-encode $PATH qp-encode`
}
}
test -n "$QPENCODE" && Note "Found Quoted-Printable encoder: $QPENCODE"
if [ -n "$BASE64ENCODE" ]; then
if [ "$ENCODING" != "base64" ]; then
ENCODING=base64
Note "Looks like $BASE64ENCODE supports base64 encoding."
fi
elif [ -x "$UUENCODE" ]; then
if [ "$ENCODING" != "x-uuencode" ]; then
ENCODING=x-uuencode
Note "Looks like $UUENCODE does not support base64 encoding."
fi
fi
# $MIMENCODE may contain parameters
cmd=`echo "$MIMENCODE" | $SED -e "s/^ *//" -e "s/ .*$//"`
test -x "$cmd" || {
MIMENCODE=`findAppDef mimencode $PATH mimencode`
}
test -n "$MIMENCODE" && Note "Found mimencode for compatibilty: $MIMENCODE"
RM="$RMCMD -f" # remove file for use below
#
# Deduce the effective user id:
# 1. POSIX-style, the id program
# 2. the old whoami program
# 3. last gasp, check if we have write permission on /dev
#
euid=`id|$SED -e 's/.*uid=[0-9]*(\([^)]*\)).*/\1/'`
test -z "$euid" && euid=`(whoami) 2>/dev/null`
test -z "$euid" && test -w /dev && euid=root
if [ "$euid" != "root" ]; then
bitch "Sorry, but you must run this script as the super-user!"
boom
fi
onClient && Note "Checking system for proper client configuration."
onServer && Note "Checking system for proper server configuration."
#
# Verify configuration parameters are correct.
#
dirMisConfigured()
{
cat >&2 <<EOF
FATAL ERROR: $1 does not exist or is not a directory!
The directory $1 does not exist or this file is not a directory. If
the HylaFAX software is not yet installed you must do so before running
this script. If the software is installed but is configured for use in
a different location than this script expects then the software will not
function correctly.
EOF
boom
}
#
# Check basic spooling area setup.
#
if onServer; then
test -d $DIR_SPOOL || {
cat >&2 <<-EOF
FATAL ERROR: $DIR_SPOOL does not exist or is not a directory!
The HylaFAX spooling area $DIR_SPOOL does not exist or this file is
not a directory. If the HylaFAX software is not yet installed you
must do so before running this script. If the software is installed
but is configured for use in a different location than this script
expects then you may override the default pathname by running this
script with a -with-DIR_SPOOL option; e.g.
faxsetup -with-DIR_SPOOL=/var/spool/someplace_unexpected
EOF
boom
}
cd $DIR_SPOOL
DIRS="archive bin client config dev docq doneq etc info log\
pollq recvq sendq status tmp"
for i in $DIRS; do
test -d $i || dirMisConfigured $DIR_SPOOL/$i
done
#
# XXX should check permission and ownership of sensitive dirs
#
# Setup TMPDIR before anything can trap and rm it
TMPDIR=`(mktemp -d /tmp/.faxsetup.XXXXXX) 2>/dev/null`
if test x$TMPDIR = x; then
TMPDIR=/tmp/.faxsetup$$
fi
$RM -rf $TMPDIR
(umask 077 ; mkdir $TMPDIR) || exit 1
JUNK="etc/setup.tmp"
trap "$RM \$JUNK; $RM -r \$TMPDIR; exit 1" 1 2 15
exec 5>etc/setup.tmp
echo '# Warning, this file was automatically generated by faxsetup' >&5
echo '# on' `date` "for ${USER:-$euid}" >&5
fi
#
# Basic client installation.
#
if onClient; then
test -d $DIR_BIN || dirMisConfigured $DIR_BIN
for file in sendfax sendpage faxstat faxalter faxcover faxmail faxrm; do
test -x $DIR_BIN/$file || {
cat >&2 <<EOF
FATAL ERROR: $DIR_BIN/$file is not an executable program!
The file $DIR_BIN/$file does not exist or this file is not
an executable program. If the HylaFAX software is not yet installed you
must do so before running this script. If the software is installed but
is configured for use in a different location than this script expects
then the software will not function correctly.
EOF
boom
}
done
test -d $DIR_LIBDATA || dirMisConfigured $DIR_LIBDATA
for file in pagesizes faxcover.ps typerules; do
test -f $DIR_LIBDATA/$file || {
cat >&2 <<EOF
FATAL ERROR: $DIR_LIBDATA/$file does not exist!
The file $DIR_LIBDATA/$file does not exist. If the HylaFAX
software is not yet installed you must do so before running this script.
If the software is installed but is configured for use in a different
location than this script expects then the software will not function
correctly.
EOF
boom
}
done
test -d $DIR_LIBEXEC || dirMisConfigured $DIR_LIBEXEC
for file in textfmt; do
test -f $DIR_LIBEXEC/$file || {
cat >&2 <<EOF
FATAL ERROR: $DIR_LIBEXEC/$file does not exist!
The file $DIR_LIBEXEC/$file does not exist. If the HylaFAX
software is not yet installed you must do so before running this script.
If the software is installed but is configured for use in a different
location than this script expects then the software will not function
correctly.
EOF
boom
}
done
otherBasicClientChecks
fi
#
# Server setup other than the spooling area.
#
if onServer; then
test -d $DIR_LIBEXEC || dirMisConfigured $DIR_LIBEXEC
test -d $DIR_SBIN || dirMisConfigured $DIR_SBIN
test -d $DIR_LOCKS || {
cat >&2 <<EOF
FATAL ERROR: $DIR_LOCKS does not exist or is not a directory!
The UUCP lockfile directory is not where it is expected or this file
is not a directory. It is possible to configure the HylaFAX software
to use a directory other than the configured one by setting up the
UUCPLockDir configuration parameter in each configuration file in the
$DIR_SPOOL/etc directory, but this is potentially error-prone.
Your best bet is to either create a symbolic link for the expected
pathname or reconfigure HylaFAX with the correct pathname and build
a new distribution.
EOF
boom
}
test -d $TIFFBIN || {
cat >&2 <<EOF
FATAL ERROR: $TIFFBIN does not exist or is not a directory!
The directory of tools from the TIFF software distribution is not
where it is expected or this file is not a directory. If you do not
have the TIFF distribution installed on this machine then you must
install it; the homepage for LibTIFF is http://www.remotesensing.org/libtiff/.
Otherwise, if the software is installed in a directory other than
where it is expected you can configure the HylaFAX software to use
an alternate directory by supplying a -with-TIFFBIN option when running
this script; e.g. faxsetup -with-TIFFBIN=someplace_nonstandard.
EOF
boom
}
for file in tiffcp tiff2ps fax2ps tiffinfo; do
test -x $TIFFBIN/$file || {
cat >&2 <<EOF
FATAL ERROR: $TIFFBIN/$file does not exist or is not an executable program!
The program $TIFFBIN/$file is not where it is expected or the file
is not executable. This program is part of the TIFF software
distribution that is required for use with HylaFAX. If you do not
have the TIFF distribution installed on this machine then you must
install it; the homepage for LibTIFF is http://www.remotesensing.org/libtiff/.
Otherwise, if the software is installed in a directory other than
where it is expected you can configure the HylaFAX software to use
an alternate directory by supplying a -with-TIFFBIN option when running
this script; e.g. faxsetup -with-TIFFBIN=someplace_nonstandard.
EOF
boom
}
done
otherBasicServerChecks
fi
#
# Quick check to see if the manual pages are installed;
# perhaps not even worth the effort.
#
test -d $DIR_MAN || {
cat >&4 <<EOF
Warning: $DIR_MAN does not exist or is not a directory!
The directory for manual pages does not exist or is not a directory.
If this directory does not exist because the manual pages have not been
installed then you can ignore this message. Otherwise you may want to
check out what happened to the manual pages.
EOF
}
#
# Utility program parameters.
#
appMisConfigured()
{
cat >&2 <<EOF
FATAL ERROR: $1 does not exist or is not an executable program!
The file:
$1
does not exist or this file is not an executable program. The HylaFAX
software expects this program to exist and be in this location. If the
program resides in a different location then you must either reconfigure
and rebuild HylaFAX or override the default pathnames in the distributed
software through one of the HylaFAX configuration files (consult the
HylaFAX documentation).
EOF
boom
}
warnAppMisConfigured()
{
cat >&2 <<EOF
Warning: $1 does not exist or is not an executable program!
The file:
$1
does not exist or this file is not an executable program. The
HylaFAX software optionally uses this program and the fact that
it does not exist on the system is not a fatal error. If the
program resides in a different location and you do not want to
install a symbolic link for $1 that points to your program
then you must reconfigure and rebuild HylaFAX from source code.
EOF
}
if onServer; then
test -x $PATH_GETTY || warnAppMisConfigured $PATH_GETTY
test -x $PATH_VGETTY || warnAppMisConfigured $PATH_VGETTY
test -x $PATH_EGETTY || warnAppMisConfigured $PATH_EGETTY
for i in $CAT $CHGRP $CHMOD $CHOWN $CP $ECHO $GREP $LN $MKFIFO $MV \
$RMCMD $SED $SENDMAIL; do
test -x $i || appMisConfigured $i
done
#
# Test/verify we know how to create FIFO special files.
#
case $MKFIFO in
*mknod)
mkfifo()
{
$MKFIFO $1 p
}
;;
*)
mkfifo()
{
$MKFIFO $1
}
;;
esac
$RM conffifo; JUNK="$JUNK conffifo"
if (mkfifo conffifo && test -p conffifo) >/dev/null 2>&1; then
true
elif test -r conffifo; then # NB: not everyone has test -p
true
else
cat >&2 <<EOF
FATAL ERROR: Don't know how to create FIFO special files!
We were unable to create a FIFO special file using the command:
$MKFIFO conffifo
HylaFAX requires support for FIFO special files and will not function
without this support. If your system does not have support for FIFO
files then reconfigure it to include support (on some systems this
support is optional and requires recompilation or rebuilding of the
kernel). If your system does have support for FIFO files but they are
not created using the expected program then you will need to reconfigure
and rebuild HylaFAX from the source distribution or emulate the needed
functionality (possibly by providing a shell script).
EOF
boom
fi
fi
#
# AWK support.
#
if onServer; then
test -x $AWK || appMisConfigured $AWK
# awk must support functions and -v
CheckAwk()
{
($1 -v BAR=bar '
function foo(x) {
print "GOT" x
}
BEGIN { foo(BAR) }
' </dev/null | grep GOTbar) >/dev/null 2>&1
return
}
CheckAwk $AWK || {
cat >&2 <<EOF
FATAL ERROR: $AWK does not support needed functionality!
The following test does not work correctly with the configured awk program.
----------------------------------------------------------
$AWK -v BAR=bar '
function foo(x) {
print "GOT" x
}
BEGIN { foo(BAR) }
' </dev/null | grep GOTbar
----------------------------------------------------------
The HylaFAX software requires an awk program that supports functions and
the -v option for passing parameters from the command line. The deficiency
of $AWK on your system will cause problems in various parts of the HylaFAX
software.
If you are running an old version of $AWK then get a more up to date
version. Otherwise you can reconfigure HylaFAX from the source distribution
to force a different awk program to be used or you can, as a last resort,
try altering the shell scripts that are part of HylaFAX that use $AWK.
EOF
boom
}
fi
#
# Runtime Fontpath/Fontmap detection
#
if onClient; then
getGSFonts()
{
$PATH_GSRIP -h 2>/dev/null | $AWK -F '[ ]' '
BEGIN { start = 0; }
/Search path:/ { start = 1 }
{
if (start == 1) {
if ($1 == "") {
gsub(" ","")
gsub("^[.]","")
gsub("^:","")
printf "%s", $0
} else if ($1 != "Search") start = 0
}
}
'
}
genFontmap()
{
FONTMAP_FILE=$1
Note ""
Note "Generating Fontmap $FONTMAP_FILE."
Note ""
echo "% HylaFAX FontMap file generated by faxsetup on `date 2>/dev/null`" > $FONTMAP_FILE
for d in `echo $2 | $SED 's/:/ /g'`; do
if [ -d "$d" ]; then
cd $d
for f in `ls | grep '\.afm'`; do
$AWK -F '[ ]' '/FontName/ {print "/"$2"\t("FILENAME")\t;"; exit}; // {}' $f >> $FONTMAP_FILE
done
fi
done
}
validateFont()
{
FONTNAME=$1
FONTMAP_PATH=$2
FONT_PATH=$3
# Note ""
# Note "Searching for a font named $FONTNAME."
# Note ""
ALIAS=$FONTNAME
while [ "$ALIAS" != "$LAST_ALIAS" ]; do
LAST_ALIAS=$ALIAS
for d in `echo $FONTMAP_PATH | $SED 's/:/ /g'`; do
if [ -d "$d" ]; then
cd $d
for f in Fontmap Fontmap.GS Fontmap.HylaFAX; do
if [ -f $f ]; then
OUTPUT=`$SED -n -e 's/^\/'$ALIAS'[ ]*\((\([^)]*\))\|\/\([^ ;]*\)\).*/\2\3/p' $f`
if [ -n "$OUTPUT" ]; then
# Allow later files to overwrite previous definitions
ALIAS=$OUTPUT
fi
fi
done
fi
done
done
FONTFILE=`echo $ALIAS | sed -e 's/\.[^./]*$//'`
for d in `echo $FONT_PATH | $SED 's/:/ /g'`; do
if [ -f "$d/$FONTFILE.afm" ] || [ -f "$d/$FONTFILE" ]; then
echo $FONTNAME
return
fi
done
}
getDefaultFont()
{
FONTNAME=$1
FONTMAP_PATH=$2
FONT_PATH=$3
FONTNAME=`validateFont $FONTNAME $FONTMAP_PATH $FONT_PATH`
if [ -n "$FONTNAME" ]; then
echo $FONTNAME
return
fi
# Requested font not found, searching for Courier
FONTNAME=`validateFont Courier $FONTMAP_PATH $FONT_PATH`
if [ -n "$FONTNAME" ]; then
echo $FONTNAME
return
fi
Note ""
Note "Searching for a default font."
Note ""
# Courier font not found, searching for any font, with a
# preference for fixed, non-italic, non-bold font.
MAX=-1
for d in `echo $FONT_PATH | $SED 's/:/ /g'`; do
if [ -d "$d" ]; then
cd $d
for f in `ls | grep '\.afm'`; do
VAL=`$AWK -F '[ ]' '
/^IsFixedPitch / {count++; if (tolower($2) == "true") val += 100}
/^ItalicAngle / {count++; if ($2 == 0) val += 10}
/^Weight / {count++; if (tolower($2) == "regular") val += 5;
if (tolower($2) == "normal") val += 4;
if (tolower($2) == "roman") val += 3;
if (tolower($2) == "medium") val += 2;
if (tolower($2) == "book") val += 1}
// {if (count >= 3) exit}
BEGIN {val = count = 0}
END {print val}
' $f`
if [ $VAL -gt $MAX ]; then
MAX=$VAL
FONTNAME=`echo $f | sed -e 's/\.[^./]*$//'`
fi
done
fi
done
echo $FONTNAME
return
}
if [ -f $DIR_LIBDATA/hyla.conf ]; then
CONFIGURED_PATH_AFM=`$SED -n -e 's/^FontPath:[ ]*\(.*\)/\1/p' $DIR_LIBDATA/hyla.conf`
CONFIGURED_PATH_FONTMAP=`$SED -n -e 's/^FontMap:[ ]*\(.*\)/\1/p' $DIR_LIBDATA/hyla.conf`
CONFIGURED_TEXTFONT=`$SED -n -e 's/^TextFont:[ ]*\(.*\)/\1/p' $DIR_LIBDATA/hyla.conf`
fi
if [ -n "$CONFIGURED_TEXTFONT" ]; then
FONTNAME=$CONFIGURED_TEXTFONT
else
FONTNAME=Courier
fi
if [ -n "$CONFIGURED_PATH_FONTMAP" ]; then
FONTMAP_PATH=$CONFIGURED_PATH_FONTMAP
else
FONTMAP_PATH=$PATH_AFM
fi
if [ -n "$CONFIGURED_PATH_AFM" ]; then
FONT_PATH=$CONFIGURED_PATH_AFM
else
FONT_PATH=$PATH_AFM
fi
FOUND_FONTNAME=`getDefaultFont $FONTNAME $FONTMAP_PATH $FONT_PATH`
if [ "$FOUND_FONTNAME" != "$FONTNAME" ]; then
genFontmap $DIR_LIBDATA/Fontmap.HylaFAX $FONT_PATH
FOUND_FONTNAME=`getDefaultFont $FONTNAME $FONTMAP_PATH:$DIR_LIBDATA $FONT_PATH`
if [ "$FOUND_FONTNAME" = "$FONTNAME" ]; then
# Font was found using our local Fontmap file
FONTMAP_PATH=$FONTMAP_PATH:$DIR_LIBDATA
else
RUNTIME_PATH_AFM=`getGSFonts`
if [ -n "$RUNTIME_PATH_AFM" ] && \
( [ "$RUNTIME_PATH_AFM" != "$FONTMAP_PATH" ] || \
[ "$RUNTIME_PATH_AFM" != "$FONT_PATH" ] ); then
FONTMAP_PATH=$RUNTIME_PATH_AFM
FONT_PATH=$RUNTIME_PATH_AFM
FOUND_FONTNAME=`getDefaultFont $FONTNAME $FONTMAP_PATH $FONT_PATH`
if [ "$FOUND_FONTNAME" != "$FONTNAME" ]; then
FOUND_FONTNAME=`getDefaultFont $FONTNAME $FONTMAP_PATH:$DIR_LIBDATA $FONT_PATH`
if [ -n "$FOUND_FONTNAME" ]; then
# Font was found using our local Fontmap file
FONTMAP_PATH=$FONTMAP_PATH:$DIR_LIBDATA
fi
fi
fi
fi
fi
if [ -n "$FOUND_FONTNAME" ] && [ "$FOUND_FONTNAME" != "$FONTNAME" ]; then
# Requested font not found
# Setting default font to the best one found
FONTNAME=$FOUND_FONTNAME
fi
if [ -n "$FONTNAME" ]; then
Note ""
Note "Found $FONTNAME to use as default font."
Note ""
else
Note ""
Note "Found no font to use as default font. You will most probably"
Note "have to specify a font on textfmt command line."
Note ""
fi
if [ -n "$FONTMAP_PATH" ] && \
( [ "$CONFIGURED_PATH_FONTMAP" != "$FONTMAP_PATH" ] || \
[ "$CONFIGURED_PATH_AFM" != "$FONT_PATH" ] || \
[ "$CONFIGURED_TEXTFONT" != "$FONTNAME" ] ); then
if [ -f $DIR_LIBDATA/hyla.conf ]; then
$AWK '!/^FontMap|^FontPath|^TextFont|\/FontPath added by|^# Font configuration added by/ { print }' \
$DIR_LIBDATA/hyla.conf > $DIR_LIBDATA/hyla.conf.tmp
fi
if [ -n "$FONTMAP_PATH" ] && \
( [ "$PATH_FONTMAP" != "$FONTMAP_PATH" ] || \
[ "$PATH_AFM" != "$FONT_PATH" ] || \
[ "Courier" != "$FONTNAME" ] ); then
Note ""
Note "Setting font configuration in $DIR_LIBDATA/hyla.conf."
Note ""
echo "# Font configuration added by faxsetup (`date 2>/dev/null`)" \
>> $DIR_LIBDATA/hyla.conf.tmp
fi
if [ -n "$FONTMAP_PATH" ] && [ "$PATH_FONTMAP" != "$FONTMAP_PATH" ]; then
echo "FontMap: $FONTMAP_PATH" >> $DIR_LIBDATA/hyla.conf.tmp
PATH_FONTMAP=$FONTMAP_PATH
fi
if [ -n "$FONT_PATH" ] && [ "$PATH_AFM" != "$FONT_PATH" ]; then
echo "FontPath: $FONT_PATH" >> $DIR_LIBDATA/hyla.conf.tmp
PATH_AFM=$FONT_PATH
fi
if [ -n "$FONTNAME" ] && [ "Courier" != "$FONTNAME" ]; then
echo "TextFont: $FONTNAME" >> $DIR_LIBDATA/hyla.conf.tmp
fi
$MV $DIR_LIBDATA/hyla.conf.tmp $DIR_LIBDATA/hyla.conf
fi
#
# Installation of Adobe Font Metric files
#
if [ -z "$FONT_PATH" ];then
cat >&4 <<EOF
Warning: Font metric information files were not found!
The font metric information file for the Courier font was not found in
the $PATH_AFM path. This means that client HylaFAX applications
that use this information to format ASCII text for submission as fax will
use incorrect information and generate potentially illegible facsimile.
If font metric information is present on your system in a directory other
than $PATH_AFM then you can setup a symbolic link to the appropriate
directory or you can specify the appropriate pathname in the configuration
file $DIR_LIBDATA/hyla.conf with a line of the form:
FontPath: someplace_unexpected
If you do not have the font metric information files loaded on your system
system you can obtain them by public FTP from the place where you obtained
the HylaFAX software or from the master FTP site at ftp.hylafax.org.
EOF
fi
fi
#
# PostScript RIP support.
#
if onServer; then
cd $DIR_SPOOL
#
# Force bin/ps2fax and bin/pdf2fax to point to the appropriate scripts.
#
Note ""
Note "Make $DIR_SPOOL/bin/ps2fax a link to $DIR_SPOOL/bin/ps2fax.$PS."
Note ""
$RM bin/ps2fax
$RM bin/pdf2fax
if [ -n "$LN_S" ]; then
$LN $LN_S ps2fax.$PS bin/ps2fax;
if [ $PS = gs ]; then
Note ""
Note "Make $DIR_SPOOL/bin/pdf2fax a link to $DIR_SPOOL/bin/pdf2fax.$PS."
Note ""
$LN $LN_S pdf2fax.$PS bin/pdf2fax;
else
Note ""
Note "Server-side PDF conversion is not supported on this system."
Note ""
fi
else
$LN bin/ps2fax.$PS bin/ps2fax;
if [ $PS = gs ]; then
Note ""
Note "Make $DIR_SPOOL/bin/pdf2fax a link to $DIR_SPOOL/bin/pdf2fax.$PS."
Note ""
$LN bin/pdf2fax.$PS bin/pdf2fax;
else
Note ""
Note "Server-side PDF conversion is not supported on this system."
Note ""
fi
fi
fi
#
# Find the full pathname of a file
# using the specified test operation.
#
findThing()
{
t="$1"; app=$2; path=$3;
case $app in
/*) eval $t $app && { echo $app; return; };;
esac
IFS=:
for i in $path; do
eval $t $i/$app && { echo $i/$app; return; }
done
}
#
# Find the full pathname of an executable.
#
findApp()
{
findThing "test -x" $1 $2
}
#
# Deal with known alternate locations for system files.
#
PickFile()
{
for i do
test -f $i && { echo $i; return; }
done
echo $1
}
INETDCONF=`PickFile $INETDCONF /etc/inetd.conf /etc/inet/inetd.conf`
ALIASES=`PickFile $ALIASES /etc/aliases /etc/ucbmail/aliases /etc/mail/aliases /usr/mmdf/table/alias.user /usr/mmdf/table/alias.n /etc/postfix/aliases`
SERVICES=`PickFile $SERVICES /etc/inet/services`
test -f /etc/master.passwd && PASSWD=/etc/master.passwd
#
# Figure out which brand of echo we have and define
# prompt and printf shell functions accordingly.
# Note that we assume that if the System V-style
# echo is not present, then the BSD printf program
# is available.
#
t=`(printf hello) 2>/dev/null`
if [ "$t" != hello ]; then
cat >&2 <<EOF
FATAL ERROR: No printf command or emulation!
HylaFAX requires a shell-level program that understands C-style strings
(e.g. "\r") and has a mechanism for printing a string without a trailing
newline character. The System V echo command and the BSD/POSIX-style
printf command are known to support these functions; however your system
does not appear to have either of these programs. If you have a program
hidden somewhere on your system be sure to include it in the search path
used by faxsetup:
$PATH
and then rerun faxsetup. Otherwise a printf command is included in the
GNU shell utilities package that can be retrieved by public FTP.
EOF
boom
fi
if onServer; then
dumpPromptFuncs >&5
fi
#
# Prompt the user for a string that can not be null.
#
promptForNonNullStringParameter()
{
x=""
while [ -z "$x" ]; do
prompt "$2 [$1]?"; read x
if [ "$x" ]; then
# strip leading and trailing white space
x=`echo "$x" | $SED -e 's/^[ ]*//' -e 's/[ ]*$//'`
else
x="$1"
fi
done
param="$x"
}
#
# Prompt the user for a string that can be null.
#
promptForStringParameter()
{
prompt "$2 [$1]?"; read x
if [ "$x" ]; then
# strip leading and trailing white space
x=`echo "$x" | $SED -e 's/^[ ]*//' -e 's/[ ]*$//'`
else
x="$1"
fi
param="$x"
}
#
# Prompt the user for a numeric value.
#
promptForNumericParameter()
{
x=""
while [ -z "$x" ]; do
prompt "$2 [$1]?"; read x
if [ "$x" ]; then
# strip leading and trailing white space
x=`echo "$x" | $SED -e 's/^[ ]*//' -e 's/[ ]*$//'`
match=`expr "$x" : "\([0-9]*\)"`
if [ "$match" != "$x" ]; then
echo ""
echo "This must be entirely numeric; please correct it."
echo ""
x="";
fi
else
x="$1"
fi
done
param="$x"
}
#
# Prompt the user for a C-style numeric value.
#
promptForCStyleNumericParameter()
{
x=""
while [ -z "$x" ]; do
prompt "$2 [$1]?"; read x
if [ "$x" ]; then
# strip leading and trailing white space and C-style 0x prefix
x=`echo "$x" | $SED -e 's/^[ ]*//' -e 's/[ ]*$//'`
match=`expr "$x" : "\([0-9]*\)" \| "$x" : "\(0x[0-9a-fA-F]*\)"`
if [ "$match" != "$x" ]; then
echo ""
echo "This must be entirely numeric; please correct it."
echo ""
x="";
fi
else
x="$1"
fi
done
param="$x"
}
#
# Prompt the user for a boolean value.
#
promptForBooleanParameter()
{
x=""
while [ -z "$x" ]; do
prompt "$2 [$1]?"; read x
if [ "$x" ]; then
# strip leading and trailing white space
x=`echo "$x" | $SED -e 's/^[ ]*//' -e 's/[ ]*$//'`
case "$x" in
n|no|off) x=no;;
y|yes|on) x=yes;;
*)
cat <<EOF
"$x" is not a valid boolean parameter setting;
use one of: "yes", "on", "no", or "off".
EOF
x="";;
esac
else
x="$1"
fi
done
param="$x"
}
#
# Compile a table of configuration parameters prompts into
# a shell program that can be ``eval'd'' to prompt the user
# for changes to the current parameter settings.
#
compilePrompts()
{
$AWK -F'[ ]+' '
function p(t)
{
printf "promptFor%sParameter \"$%s\" \"%s\";%s=\"$param\"\n", t, $2, $3, $2
}
$1 == "#" { p("Numeric"); next }
$1 == "C#" { p("CStyleNumeric"); next }
$1 == "S" { p("String"); next }
$1 == "NNS" { p("NonNullString"); next }
$1 == "B" { p("Boolean"); next }
{ printf "promptFor%s\n", $1 }
'
}
faxUID=`grep "^$PROTOUID:" $PASSWD | cut -d: -f3`
if [ -z "$faxUID" ]; then faxUID=$defPROTOUID; fi
faxGID=`grep "^$PROTOGID:" $GROUP | cut -d: -f3`
if [ -z "$faxGID" ]; then faxGID=$defPROTOGID; fi
#
# Add a fax user to the password file and lock the
# entry so that noone can login as the user.
#
addFaxUser()
{
emsg1=`addPasswd $FAX $faxUID $faxGID $DIR_SPOOL 2>&1`
case $? in
0) emsg2=`lockPasswd $FAX 2>&1`
case $? in
0) echo "Added user \"$FAX\" to $PASSWD.";;
*) emsg3=`deletePasswd $FAX 2>&1`
case $? in
0|9) cat <<-EOF
Failed to add user "$FAX" to $PASSWD because the
attempt to lock the password failed with:
"$emsg2"
Please fix this problem and rerun this script."
EOF
;;
*) cat <<-EOF
You will have to manually edit $PASSWD because
after successfully adding the new user "$FAX", the
attempt to lock its password failed with:
"$emsg2"
and the attempt to delete the insecure passwd entry failed with:
"$emsg3"
To close this security hole, you should add a password
to the "$FAX" entry in the file $PASSWD, or lock this
entry with an invalid password.
EOF
;;
esac
boom;;
esac;;
9) # fax was already in $PASSWD, but not found with grep
;;
*) cat <<-EOF
There was a problem adding user "$FAX" to $PASSWD;
the command failed with:
"$emsg1"
HylaFAX will not work until you have corrected this problem.
EOF
boom;;
esac
}
isOK()
{
x="$1"
test -z "$x" || test "$x" = y || test "$x" = yes
}
if onServer; then
x=`grep "^$FAX:" $PASSWD | cut -d: -f3`
if [ "$PASSWD" = "/etc/master.passwd" ]; then
PARAMLOC=9;
else
PARAMLOC=6;
fi
if [ -z "$x" ]; then
echo ""
echo ""
echo "You do not appear to have a \"$FAX\" user in the password file."
prompt "HylaFAX needs this to work properly, add it [yes]?"
read x
isOK $x && addFaxUser
fi
machdepPasswdWork
#
# Verify existence, permission and ownership of sensitive files.
# XXX there are other files too
#
HOSTS=$DIR_SPOOL/etc/hosts.hfaxd
test -f $HOSTS || {
cat<<EOF
Warning: $1 does not exist!
The file $1 does not exist or is not a regular file.
This file specifies which clients are permitted to use the HylaFAX
server. The file will be initialized so that local clients are
provided service. Consult the HTML documentation and the manual
page hosts.hfaxd(5) for more information on setting up this file.
EOF
$RM $HOSTS
echo "localhost" >$HOSTS
echo "127.0.0.1" >>$HOSTS
}
#
# Too complicated to check contents:
# simply force correct protection and ownership
#
$CHOWN $faxUID $HOSTS; $CHGRP $faxGID $HOSTS
$CHMOD 600 $HOSTS
fi
#
# Check for services entries for hylafax and snpp.
#
hasYP=`(ypcat services) 2>/dev/null | $SED -n '$p'` 2>/dev/null
x=`$GREP '^hylafax[ ]' $SERVICES 2>/dev/null` 2>/dev/null
if [ -z "$x" ]; then
if [ "$hasYP" ]; then
x=`ypcat services 2>/dev/null | $GREP '^hylafax[ ]'` 2>/dev/null
fi
if [ -z "$x" ]; then
ENTRY="hylafax 4559/tcp # HylaFAX client-server protocol"
cat<<-EOF
Warning: No hylafax service entry found!
No entry was found for the hylafax service in the YP/NIS database
or in the $SERVICES file. The software should work properly
without one (except if you want to start hfaxd from inetd), but you
will see warning messages whenever you run a HylaFAX client
application. If you want to manually add an entry the following
information should be used:
$ENTRY
EOF
prompt "Should a hylafax entry be added to $SERVICES [yes]?"
read x
isOK $x && echo "$ENTRY" >>$SERVICES
fi
fi
x=`$GREP '^snpp[ ]' $SERVICES 2>/dev/null` 2>/dev/null
if [ -z "$x" ]; then
if [ "$hasYP" ]; then
x=`ypcat services 2>/dev/null | $GREP '^snpp[ ]'` 2>/dev/null
fi
if [ -z "$x" ]; then
ENTRY="snpp 444/tcp # Simple Network Paging Protocol"
cat<<-EOF
Warning: No snpp service entry found!
No entry was found for the Simple Network Paging Protocol (SNPP)
service in the YP/NIS database or in the $SERVICES file.
The software should work properly without one (except if you want
to start hfaxd from inetd), but you will see warning messages whenever
you run the HylaFAX sendpage program. If you want to manually add
an entry the following information should be used:
$ENTRY
EOF
prompt "Should an snpp entry be added to $SERVICES [yes]?"
read x
isOK $x && echo "$ENTRY" >>$SERVICES
fi
fi
#
# Check that for servers being started at system boot.
#
if onServer; then
signalINETD=no
if [ -f ${DIR_SYSVINIT}/hylafax ]; then
# started by init at boot time
if [ $FAXQ_SERVER = no ]; then
cat <<EOF
Warning faxq will NOT be automatically started on reboot!
EOF
true
fi
fi
if [ -f $INETDCONF ] && [ $HFAXD_SERVER = no ]; then
E="hylafax stream tcp nowait root $DIR_LIBEXEC/hfaxd hfaxd -I"
editInetdConf()
{
ed - $INETDCONF<<EOF
/^hylafax[ ]*stream[ ]*tcp/d
a
$E
.
w
q
EOF
if [ $? != 0 ]; then
cat<<EOF
FATAL ERROR: Unable to correct HylaFAX entry in $INETDCONF!
We were unable to edit the $INETDCONF file to correct the entry
for starting up the HylaFAX client-server protocol process. You
must manually correct this entry so that it reads:
$E
and then rerun faxsetup.
EOF
boom
fi
}
eval `$GREP '^hylafax[ ]*stream[ ]*tcp' $INETDCONF | \
$AWK -F'[ ]+' '{ print "F=" $6 "; U=" $5 }' 2>/dev/null`
if [ -z "$F" ] && [ -z "$U" ]; then
cat<<EOF
There is no entry for the hylafax service in $INETDCONF.
The HylaFAX client-server protocol process can be setup to run
standalone or started by the inetd program. A standalone setup
is preferred for performance reasons, especially if hfaxd is to
support multiple protocols (e.g. SNPP); however it may require
manual setup if your operating system does not have a System-V
style init program.
EOF
prompt "Should an entry be added to $INETDCONF [no]?"; read x
if [ "$x" = y ] || [ "$x" = yes ]; then
echo "$E" >>$INETDCONF;
signalINETD=yes
fi
else
if [ "$F" != $DIR_LIBEXEC/hfaxd ]; then
cat<<EOF
Warning: $INETDCONF is setup wrong!
The $INETDCONF file is setup to start $F
instead of $DIR_LIBEXEC/hfaxd. You will need to correct
this before client requests to submit jobs will be properly serviced.
EOF
prompt "Should the entry in $INETDCONF be corrected [yes]?"; read x
isOK "$x" && editInetdConf
fi
if [ "$U" != $FAX ]; then
cat<<EOF
Warning: $INETDCONF is setup wrong!
Warning, the HylaFAX entry is setup so that $F is run by the
$U user instead of the $FAX user. This must be corrected
before client requests to submit jobs will be properly serviced.
EOF
prompt "Should the entry in $INETDCONF be corrected [yes]?"; read x
isOK "$x" && editInetdConf
fi
fi
elif [ ! -f $INETDCONF ] && [ $HFAXD_SERVER = no ]; then
cat<<EOF
Warning: Don't know how to startup HylaFAX servers!
No $INETDCONF file was found and the System V boot script
that starts up the HylaFAX server processes was also not present.
You will need to manually arrange for the various HylaFAX servers
to be started up on your system when it is booted multi-user.
Specifically you will need to start the faxq and hfaxd programs and
any faxgetty processes that are to service inbound calls on modems.
EOF
fi
fi
FAXMASTER=faxmaster
#
# Generate or update default values for status/any.info
#
if onServer; then
if [ -r $DIR_SPOOL/status/any.info ]; then
INFO=`cat $DIR_SPOOL/status/any.info | \
$GREP -v "HylaFAX version" | $GREP -v "FaxMaster"`
else INFO=""
fi
if [ -d $DIR_SPOOL/status ]; then
echo "Update $DIR_SPOOL/status/any.info."
echo "HylaFAX version $VERSION built $DATE for $TARGET" \
> $DIR_SPOOL/status/any.info
echo $FAXMASTER >> $DIR_SPOOL/status/any.info
echo $INFO >> $DIR_SPOOL/status/any.info
fi
fi
#
# Emit shell functions required by faxaddmodem.
#
if onServer; then
printConfig()
{
cat<<EOF
HylaFAX configuration parameters are:
[1] Init script starts faxq: $FAXQ_SERVER
[2] Init script starts hfaxd $HFAXD_SERVER
[3] Start paging protocol: $HFAXD_SNPP_SERVER
EOF
}
promptForParameter()
{
case $1 in
1) promptForBooleanParameter "$FAXQ_SERVER" \
"Init script starts faxq"; FAXQ_SERVER="$param"
;;
2) promptForBooleanParameter "$HFAXD_SERVER" \
"Init script starts hfaxd"; HFAXD_SERVER="$param"
;;
3) promptForBooleanParameter "$HFAXD_SNPP_SERVER" \
"Start paging protocol"; HFAXD_SNPP_SERVER="$param"
;;
esac
}
ok=skip
while [ "$ok" != y ] && [ "$ok" != yes ]; do
if [ "$ok" != skip ]; then
for i in 1 2 3 4 ; do
promptForParameter $i;
done
fi
printConfig
prompt "Are these ok [yes]?"; read ok
test -z "$ok" && ok=yes
case "$ok" in
[1-4]) promptForParameter $ok;;
[yY]*|[nN]*) continue;;
?*)
echo ""
echo "\"y\", \"yes\", or <RETURN> accepts the displayed parameters."
echo "A number lets you change the numbered parameter."
echo ""
;;
esac
ok=skip
done
STTYCMD=`findApp stty $PATH`
(dumpTTYFuncs; dumpSTTYFuncs; dumpOtherModemFuncs)>&5
$RM etc/setup.modem
$MV etc/setup.tmp etc/setup.modem
$CHMOD 444 etc/setup.modem
$RM etc/setup.cache
(echo '# Warning, this file was automatically generated by faxsetup'
echo '# on' `date` "for ${USER:-$euid}"
dumpvals |sort)> etc/setup.cache
$CHMOD 444 etc/setup.cache
Note ""
Note "Modem support functions written to $DIR_SPOOL/etc/setup.modem."
Note "Configuration parameters written to $DIR_SPOOL/etc/setup.cache."
fi
#
# Configuration parameters specific to scheduler operation.
# Required parameters are *always* emitted in the created
# configuration file; optional parameters are emitted
# only if the configured value differs from the default
# value known to be used by the server.
#
# NB: the order of some parameters is important; e.g.
# DialStringRules must be after AreaCode and CountryCode.
#
RequiredSchedulerParameters="
LogFacility
CountryCode
AreaCode
LongDistancePrefix
InternationalPrefix
DialStringRules
ServerTracing
"
OptionalSchedulerParameters="
ContCoverPage
ContCoverCmd
MaxConcurrentCalls
MaxDials
MaxSendPages
MaxTries
ModemGroup
PostScriptTimeout
PS2FaxCmd
SendFaxCmd
SendPageCmd
SendUUCPCmd
SessionTracing
TimeOfDay
Use2D
"
#
# NB: these defaults are set above
#
OptionalParameters="
$OptionalSchedulerParameters
JobReqOther
NotifyCmd
UUCPLockDir
UUCPLockTimeout
UUCPLockType
"
SchedulerParameters="
$RequiredSchedulerParameters
$OptionalParameters
"
#
# Echo the configuration lines for those scheduler parameters
# whose value is different from the default value. Note
# that we handle the case where there is embedded whitespace
# by enclosing the parameter value in quotes.
#
echoSchedulerParameters()
{
(for i in $RequiredSchedulerParameters; do
eval echo \"$i:\$$i:\"
done
for i in $OptionalSchedulerParameters; do
eval echo \"$i:\$$i:\$default$i\"
done) | $AWK -F: '
function p(tag, value)
{
tabs = substr("\t\t\t", 1, 3-int((length(tag)+1)/8));
if (match(value, "^[^\"].*[ ]") == 0)
printf "%s:%s%s\n", tag, tabs, value
else
printf "%s:%s\"%s\"\n", tag, tabs, value
}
$2 != $3{ p($1, $2) }'
}
#
# Print the current server configuration parameters.
#
printSchedulerConfig()
{
(for i in $SchedulerParameters; do
eval echo \"$i:\$$i:\$default$i\"
done) | $AWK -F: '
function p(tag, value)
{
tabs = substr("\t\t\t", 1, 3-int((length(tag)+1)/8));
printf "%s:%s%s\n", tag, tabs, value
}
BEGIN { printf "\nThe non-default scheduler parameters are:\n\n" }
$2 != $3{ p($1, $2) }
END { printf "\n" }'
}
checkForLocalFile()
{
f="`echo $1 | $SED 's/\"//g'`"
if [ ! -f $DIR_SPOOL/$f ]; then
cat<<EOF
Warning, the $2 file,
$DIR_SPOOL/$f
does not exist, or is not a plain file. This file must
reside in the $DIR_SPOOL directory tree.
EOF
ok=no;
fi
}
isNotOK()
{
x="$1"
test "$x" != y && test "$x" != yes
}
CONFIG=$DIR_SPOOL/etc/config # faxq config file
if onServer; then
if [ ! -f $CONFIG ]; then
for i in $SchedulerParameters; do
eval $i=\$default$i
done
echo ""
echo "No scheduler config file exists, creating one from scratch."
ok=prompt # prompt for parameters
PROMPTS=$TMPDIR/faxpr$$
JUNK="$JUNK $PROMPTS"
$RM -rf $PROMPTS
while true; do
if [ "$ok" != skip ]; then
test -f $PROMPTS || (
${NOCLOBBER_ON}
> $PROMPTS || boom
${NOCLOBBER_OFF}
compilePrompts>$PROMPTS<<EOF
# CountryCode Country code
# AreaCode Area code
# LongDistancePrefix Long distance dialing prefix
# InternationalPrefix International dialing prefix
NNS DialStringRules Dial string rules file (relative to $DIR_SPOOL)
C# ServerTracing Tracing during normal server operation
C# SessionTracing \
Default tracing during send and receive sessions
S ContCoverPage Continuation cover page (relative to $DIR_SPOOL)
C# PostScriptTimeout \
Timeout when converting PostScript documents (secs)
C# MaxConcurrentCalls \
Maximum number of concurrent jobs to a destination
S ModemGroup Define a group of modems
S TimeOfDay Time of day restrictions for outbound jobs
C# UUCPLockTimeout \
Timeout before purging a stale UUCP lock file (secs)
C# MaxSendPages Max number of pages to permit in an outbound job
S LogFacility Syslog facility name for ServerTracing messages
EOF
)
. $PROMPTS
fi
checkForLocalFile $DialStringRules "dial string rules"
printSchedulerConfig; prompt "Are these ok [yes]?"; read ok
isOK "$ok" && break
done
#
# All done with the prompting; edit up a config file!
#
echo ""
echo "Creating new configuration file $CONFIG..."
echoSchedulerParameters >$CONFIG 2>/dev/null
test -s $CONFIG || {
JUNK="$JUNK $CONFIG" # clobber on exit
cat<<EOF
FATAL ERROR: Problem writing $CONFIG!
Sorry, something went wrong writing the new scheduler configuration
file. Check to make sure there is sufficient disk space and rerun
this script.
EOF
boom
}
$CHOWN $faxUID $CONFIG; $CHGRP $faxGID $CONFIG
$CHMOD 644 $CONFIG
fi
fi
#
# Startup/restart server processes.
#
if onServer; then
echo ""
echo "Restarting HylaFAX server processes."
findproc()
{
# NB: ps ax should give an error on System V, so we try it first!
pid="`ps ax 2>/dev/null | $AWK \"\
/[\/ (]$1[ )]/ {print \\$1;}
/[\/ ]$1\$/ {print \\$1;}\"`"
test "$pid" ||
pid="`ps -e 2>/dev/null | $AWK \"/ $1[ ]*\$/ {print \\$1;}\"`"
echo "$pid"
}
HFAXD="`findproc hfaxd`"
# if [ "$HFAXD" ]; then
# fi
FAXD="`findproc faxd`"
if [ "$FAXD" ]; then
echo ""
echo "You seem to be running FlexFAX (there are faxd processes)."
prompt "Is it ok to terminate these processes ($FAXD) [yes]?"; read x
if isOK "$x"; then
if kill $FAXD; then
echo "Sent a SIGTERM to processes $FAXD."
else
echo "Unable to send a SIGTERM to processes $FAXD."
fi
while true; do
for delay in 1 1 2 2 5 5; do
FAXD="`findproc faxd`"
test "$FAXD" || break
sleep $delay
done
test -z "$FAXD" && break
cat<<EOF
Warning: faxd is still running!
Something is hung. The command
kill $FAXD
did not terminate the faxd processes as expected.
EOF
prompt "Should we continue to wait [no]?"; read x
isNotOK "$x" && break
done
fi
fi
FAXQ="`findproc faxq`"
if [ "$FAXQ" ]; then
cat<<EOF
You have a HylaFAX scheduler process running. faxq will be
restarted shortly, as soon as some other work has been completed.
EOF
prompt "Can I terminate this faxq process ($FAXQ) [yes]?";
read x
if isOK "$x" ]; then
$DIR_SBIN/faxquit >/dev/null 2>&1
while true; do
for delay in 1 1 2 2 5 5; do
FAXQ="`findproc faxq`"
test "$FAXQ" || break
sleep $delay
done
test -z "$FAXQ" && break
pids=
for p in faxsend pagesend; do
pids="${pids}`findproc $p`"
done
if [ "$pids" ]; then
cat<<EOF
Warning: faxq is busy with outbound jobs!
faxq did not terminate in response to the faxquit command because
there are subprocesses actively processing outbound jobs.
EOF
prompt "Should we continue to wait [yes]?"; read x
isOK "$x" || break
else
cat<<EOF
Warning: faxq is still running for some reason!
Something is hung, faxq did not terminate in response to the faxquit
command. There do not appear to be any faxsend or pagesend subprocesses
actively handling outbound jobs so the reason for it running is unknown.
EOF
prompt "Should we continue to wait [no]?"; read x
isNotOK "$x" && break
fi
done
fi
fi
if [ "$FAXQ" ] || [ "$FAXD" ]; then
cat<<EOF
FATAL ERROR: Old server processes still running!
One or more old server processes are still running. It is not wise
to start new server processes while old processes are running because
their actions might conflict. You need to terminate the existing
processes and rerun this script or manually startup the new HylaFAX
server processes.
EOF
boom
fi
if [ "$signalINETD" = yes ]; then
INETD="`findproc inetd`"
if [ "$INETD" ]; then
if kill -HUP $INETD 2>/dev/null; then
echo "Sent inetd a SIGHUP so that it re-reads the configuration file."
else
echo "Unable to send inetd a SIGHUP, you may need to do it yourself."
fi
else
echo "Strange, you do not seem to have an inetd process running."
fi
fi
if [ -e /etc/hylafax/setup.cache ]
then
prompt "Should I restart the HylaFAX server processes [yes]?"; read x
if isOK "$x"; then
echo ""
if [ -x ${DIR_SYSVINIT}/hylafax ]; then
echo ${DIR_SYSVINIT}/hylafax start
${DIR_SYSVINIT}/hylafax start
else
echo $DIR_SBIN/faxq; $DIR_SBIN/faxq
fi
fi
fi
DEVS="`cd $DIR_SPOOL/etc; echo config.*`"
if [ "$DEBCONF_FRONTEND" != "non-interactive" -a "$DEBCONF_FRONTEND" != noninteractive ] && [ -z "$DEVS" -o "$DEVS" = 'config.*' ]; then
cat<<EOF
You do not appear to have any modems configured for use. Modems are
configured for use with HylaFAX with the faxaddmodem(8) command.
EOF
prompt "Do you want to run faxaddmodem to configure a modem [yes]?"; read x
while isOK "$x"; do
$DIR_SBIN/faxaddmodem
prompt "Do you want to run faxaddmodem to configure another modem [yes]?"; read x
done
DEVS="`cd $DIR_SPOOL/etc; echo config.*`"
fi
if [ -n "$DEVS" ] && [ "$DEVS" != 'config.*' ]; then
FAXGETTY="`findproc faxgetty`"
if [ "$FAXGETTY" ]; then
cat<<EOF
Looks like you have some faxgetty processes running (PIDs are):
$FAXGETTY
It is usually a good idea to restart these processes after running
faxsetup; especially if have just installed new software. If these
processes are being started by init(8) then sending each of them a
QUIT message with the faxquit command should cause them to be restarted.
EOF
prompt "Is it ok to send a QUIT command to each process [yes]?"
read x
if isOK "$x"; then
for x in $DEVS; do
devid="`expr $x : 'config.\(.*\)'`"
if [ -w $DIR_SPOOL/FIFO.$devid ]; then
echo $DIR_SBIN/faxquit $devid
$DIR_SBIN/faxquit $devid >/dev/null 2>&1
fi
done
fi
else
if [ -f /etc/inittab ]; then
FAXGETTY="`$GREP '[^#].*:respawn:faxgetty.*' /etc/inittab`"
elif [ -f /etc/ttys ]; then
FAXGETTY="`$GREP '[^#].*faxgetty.*' /etc/ttys`"
fi
if [ "$FAXGETTY" ]; then
cat<<EOF
You appear to have faxgetty setup to run on some tty lines but no faxgetty
processes were found running. This might happen if you manually edited the
tty configuration file but did not notify init to re-read the file.
EOF
prompt "Send init a SIGHUP so that it re-reads its configuration file [yes]?"
read x
if isOK "$x"; then
init="`findproc init`"
if [ "$init" ]; then
if kill -HUP $init; then
echo "Sent init a SIGHUP; the faxgetty processes should be started."
else
echo "Unable to send init a SIGHUP; you may need to do this yourself."
fi
else
echo "Strange, you do not seem to have an init process running!"
fi
fi
else
cat<<EOF
You do not appear to be using faxgetty to notify the HylaFAX scheduler
about new modems and/or their status. This means that you must use the
faxmodem program to inform the new faxq process about the modems you
want to have scheduled by HylaFAX. Beware that if you have modems that
require non-default capabilities specified to faxmodem then you should
read faxmodem(8) manual page and do this work yourself (since this
script is not intelligent enough to automatically figure out the modem
capabilities and supply the appropriate arguments).
EOF
prompt "Should I run faxmodem for each configured modem [yes]?"
read x
if isOK "$x"; then
for x in $DEVS; do
devid="`expr $x : 'config.\(.*\)'`"
if [ -w $DIR_SPOOL/FIFO.$devid ]; then
echo $DIR_SBIN/faxmodem $devid
$DIR_SBIN/faxmodem $devid >/dev/null 2>&1
fi
done
fi
fi
fi
fi
fi
Note ""
Note "Done verifying system setup."
if onServer; then
$RM $JUNK
$RM -r $TMPDIR
fi
exec /usr/lib/hylafax/bin/copy_configuration_from_spool
|