3builddistro 182 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838
  1. #!/bin/sh
  2. #(c) Copyright Barry Kauler 2009.
  3. #2createpackages has already built the generic packages in packages-$DISTRO_FILE_PREFIX/.
  4. #these packages have generic names as specified in the second field of PKGS_SPECS_TABLE,
  5. #which is a variable in ./DISTRO_PKGS_SPECS. The format of entries in table:
  6. # yes|abiword|abiword,abiword-common|exe,dev,doc,nls
  7. # ...if first field is 'yes' then it will be built into distro.
  8. #100628 my 2.6.34 pet has modules.builtin and modules.order, don't delete.
  9. #100629 if nouveau xorg driver exists, move nv driver to 'drivers-alternate'.
  10. #100801,100806 file inline_get_pet, inline_get_compat have common code.
  11. #100831 hack.
  12. #100903 extract all kernel-specific files to zdrv, to support mix-n-match.
  13. #100911 handle Packages-puppy-lucid-official.
  14. #100911 simple filenames vmlinuz, initrd.gz, puppy.sfs, zdrv.sfs, devx.sfs.
  15. #100912 choose between old and new puppy filenames.
  16. #100916 don't bother record devx sfs name. second help screen at bootup.
  17. #101007 the latest busybox depmod generates relative paths in modules.dep, breaks modprobe in initrd.
  18. #101012 have restored 'depmod-FULL' name to 'depmod'.
  19. #101013 read variable PKG_PREFER_OLDER in file PKGS_MANAGEMENT to choose between 2 pkgs.
  20. #101023 small bugfix. 101024 bugfix. 101025 bugfix.
  21. #101026 display "wary <version>" on boot splash screen.
  22. #101027 Iguleder reported DISTRO_SPECS did not have a carriage-return on last line.
  23. #101028 added ko* as have some named .koHIDE.
  24. #101126 Quirky is now built from wary5 pet packages.
  25. #101217 get latest BaCon in devx.
  26. #101222 some big modems named *HIDE, not *.ko.
  27. #110213 fix if /usr/share/X11/locale/locale.alias missing .utf8 entries.
  28. #110215 extra logic for BaCon compiler in devx.
  29. #110329 move some python files to the 'devx'.
  30. #110412 move all .bac, .pot and .pupdev files to 'devx'.
  31. #110413 variable DISTRO_XORG_AUTO in /etc/DISTRO_SPECS, set in Woof '3builddistro'.
  32. #110417 this will make Thunar use ROX-Filer's icons for files
  33. #110421 vercmp utility.
  34. #110422 DISTRO_VERSION variable now has dotted format. note, also now using full dotted version# in puppy filenames.
  35. #110426 help file on CD for Windows users.
  36. #110429 fix ownership of /root/spot just in case.
  37. #110429 may need a fix, think want glibc scsi headers in usr/include/scsi.
  38. #110512 fix for kernel pet name linux_kernel-2.6.32-40-w5.pet
  39. #110516 attempt fix dependcheck() hanging.
  40. #110517 debian squeeze hack, copy pango-querymodules from devx.
  41. #110517 squeeze debian, boot splash message "squeezed <version>".
  42. #110517 turn on kms for intel,radeon,nouveau if recent versions.
  43. #110518 radical culling of modules, add fbcon.ko.
  44. #110523 override files from rootfs-skeleton/root/Choices/MIME-types, if rox pkg has older files.
  45. #110608 copy Packages-puppy-common-official, not -woof-.
  46. #110612 copy rpm2ppm and mageia2ppm needed by 0setup in built puppy.
  47. #110620 do same as 110523, for mime icons.
  48. #110621 fix for turning on kms.
  49. #110622 hack for mageia 1 (otherwise can't find pango.modules)...
  50. #110622 mageia1 requires pixbuf cache file to be at /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache.
  51. #110701 possible lib clash between e2fsprogs and util-linux (i might use old util-linux pet).
  52. #110702 mageia1 python pkg puts /etc/profile.d/30python.csh in devx.
  53. #110712 modinfo won't work if modules.* files missing.
  54. #110712 reduce hid-* drivers moved to initrd, so when usbhid configured builtin, none be moved to initrd.
  55. #110713 support xz compression for squashfs 4.2 and kernel 2.6.39+.
  56. #110721 Drake Puppy: display "drake <version>" on boot splash screen.
  57. #110726 Drake Puppy: config files put in usr/bin/multiarch-i386-linux, move to usr/bin.
  58. #110727 running drake pup 0.3 with k2.6.39-3 new laptop, mysterious loss of dirs/files. try sync.
  59. #110727 no longer using $PKG_PREFER_OLDER to select kernel-version-sensitive pkg alternatives.
  60. #110803 workaround for 'pngoverlay' needs X runnning, also avoid cpu overhead at first startup.
  61. #110806 if yad installed, no zenity, make sure zenity is symlink to yad.
  62. #110816 add Packages-puppy-slacko-official.
  63. #110821 copy support/findpkgs into build.
  64. #110822 removed fossil_fixup_func. improved choice of KMS on/off.
  65. #110822 customizations script provided by 01micko for Slacko.
  66. #110823 move asking for kernel pet from 3builddistro to 1download.
  67. #110823 revert 110821 (also have removed rootfs-skeleton/usr/local/petget/findwoofinstalledpkgs.sh)
  68. #110823 fix creating file woof-installed-packages.
  69. #110824 add common repo default in PPM, set defaults for slacko.
  70. #110826 no longer calling icon_switcher_cli from rc.update, modify 110803.
  71. #110826 get the kernel version out of inside the PET pkg.
  72. #110831 support png background image.
  73. #110901 i have experimented with building a wary "5.2pre" without libxcb.
  74. #110901 temp hack, if only have gtkdialog4 pkg.
  75. #110903 pixbuf loader cache fix.
  76. #110904 revert 110901 libxcb hack.
  77. #110906 fix syntax error.
  78. #110907 rcrsn51: network printing, need pdftops symlink.
  79. #110910 make sure gtkdialog links to latest.
  80. #110911 'drivers-alternate' moved from /usr/lib/xorg/modules/ to /usr/lib/x/.
  81. #110912 modify jwm to use menu icon 'start-button.png' if present.
  82. #110917 support file prefix 'racy'.
  83. #110918 kernel-skeleton now has a pinstall.sh script.
  84. #110918 radeon, default kms off. testers found can't shutdown with it on.
  85. #110923 avoid conflict between busybox applets and full utilities.
  86. #110928 boot splash image for Racy. 111003 racy logo.
  87. #111004 for 110923, need to check in devx also.
  88. #111006 generic logo mechanism for all pups. replaces 091206 100516 111003
  89. #111010 set desktop font.
  90. #111014 support 3.x kernel.
  91. #111026 davids45: /tmp needs 777 permissions. i do have this in rootfs-skeleton, but lost in sandbox3/rootfs-complete
  92. #111027 revert 110907. was symlinking to pdftops from poppler pkg, but must have actual pdftops from cups pkg.
  93. #111114 support older gtk (2.20.1) for pixbuf loaders in new location.
  94. #111121 noryb009: improve arch linux support, patched: 0setup, 1download, 2createpackages, 3builddistro, DISTRO_COMPAT_REPOS-arch, support/arch/runDotInstalls
  95. #111123 support cross-build.
  96. #111127 no need to copy 'printcols', 'vercmp' to target build, now done in 'merge2out' script.
  97. #111203 remove offer to download and compile bacon (no good for cross-builds).
  98. #111204 remove zdump from list.
  99. #120215 language translations for init script.
  100. #120216 set default LANG and KMAP. 120217 recommend UTF-8.
  101. #120217 translate early-boot splash screens... (expect building with langpack)
  102. #120224 move rootfs-complete/usr/share/doc/nls to 'devx'.
  103. #120225 DISTRO_PUPPYDATE -> DISTRO_SPECS. this is read by /usr/share/doc/convert-raw-docs. (note: this script no longer exists)
  104. #120305 copy Packages-puppy-noarch-official to build.
  105. #120312 removed Packages-puppy-common-official from ppm default selection.
  106. #120315 Ubuntu Precise Pangolin has done a big move of files from /lib to /lib/i386-linux-gnu and /usr/lib to /usr/lib/i386-linuxgnu
  107. #120331 bugfix generating README.HTM on cd.
  108. #120401 improve choosing locale.
  109. #120502 more support for arm build.
  110. #120506 support creation of SD-card image (for arm build).
  111. #120506b check that sd card big enough.
  112. #120510 offer to resize 2nd partition of SD card to fill card.
  113. #120521 for SD-image build, copy-only console fonts and keyboard layouts to initrd, copy-only kernel modules to initrd.
  114. #120522 precise puppy, seamonkey was crashing. needed /usr/share/glib-2.0/schemas/apps.gecko-mediaplayer.preferences, also must be compiled.
  115. #120523 precise puppy, may also need to run gio-querymodules. (refer also installpkg.sh, rc.update)
  116. #120526 try radeon kms default on. 120605 turn off again.
  117. #120605 shinobar: generate gtk.immodules. ref: http://murga-linux.com/puppy/viewtopic.php?t=76961&start=195
  118. #120613 kernel image can have different names. rename to vmlinuz, however change back later if build sd card.
  119. #120616 check dri drivers exist before offer kernel modesetting.
  120. #120618 raspi debian squeeze, links as main browser, helpsurfer html viewer, gtkmoz missing. 120620 modify.
  121. #120628 certain utilities are not appropriate when booting on an arm board.
  122. #120703 sd card: allow 2nd partition to be ext2, ext3 or ext4.
  123. #120704 ask if want to load swap partition/file at bootup.
  124. #120704 sd card image, ext2 f.s., offer to bump to ext4 (without journal).
  125. #120705 refine upgrade ext2 to ext4. 120706 disktype misreports ext4 without journal as ext2.
  126. #120707 change relatime to noatime. see also rc.sysinit.
  127. #120708 added BOOT_QUICKSETUP='quickarm'. quickarm is symlink to /usr/sbin/quicksetup. leave out X config frame for arm boards.
  128. #120709 fix for pci.ids and usb.ids in "wrong" place. new BOOT_UDEVDCHILDREN.
  129. #120714 revert 120708. instead, BOOT_BOARD (= raspi, mele, odroidx, etc.) read by quicksetup.
  130. #120720 raspbian wheezy has files in /lib/arm-linux-gnueabihf and /usr/lib/arm-linux-gnueabihf
  131. #120721 support ubuntu and debian arm multiarch.
  132. #120723 BOOT_DISABLEXORGWIZARD variable.
  133. #120724 'alsaconf' does not work on arm boards, BOOT_DISABLEALSACONF variable. refer /usr/sbin/alsawizard.
  134. #120830 my hunspell-en-us pet has pinstall.sh that creates symlinks of en_US.aff and en_US.dic from seamonkey and firefox. however, need to do this thoroughly.
  135. #120831 simplify repo-list radiobuttons for ppm.
  136. #120903 default radeon kms on again.
  137. #120909 multiarch support for /usr/bin. (see also 2createpackages).
  138. #120922 was getting "nv" listing twice (precise puppy) for xorg drivers-alternate.
  139. #120925 ignore debian/ubuntu multiarch circular symlink (these are create by 2createpackages), when creating builtin_files lists.
  140. #121010 fix for 120925.
  141. #121022 fix for python not in devx, in main f.s.
  142. #121028 copy devx-only-installed-packages to build. (refer findwoofinstalledpkgs)
  143. #121102 file DISTRO_SPECS has new variable DISTRO_DB_SUBNAME. ex: for 14.0-based slacko, DISTRO_DB_SUBNAME=slacko14
  144. #121105 fix enabled-repo list for ppm.
  145. #121111 debdb2pupdb, new fast deb to pup db converter, called by 0setup.
  146. #121123 changed default locale from en_US to en_US.UTF-8.
  147. #121123 some chroot operations may leave something inside sandbox3/rootfs-complete/tmp, delete.
  148. #121123 new variable DISTRO_ARCHDIR in /etc/DISTRO_SPECS
  149. #121203 /usr/sbin/welcome1stboot needs this lib: /usr/lib/libgtk-x11-2.0.so (symlink was only in devx).
  150. #121210 fix, ARCHDIR was not getting set.
  151. #121212 puninstall.sh was not getting removed from root of sandbox3/rootfs-complete.
  152. #121227 initrd: if kernel has f.s. drivers as modules (quirky6), added ext2.ko ext3.ko ext4.ko fat.ko msdos.ko vfat.ko ntfs.ko reiserfs.ko udf.ko, and deps: jbd.ko mbcache.ko jbd2.ko
  153. #130111 proper handling of multiarch for mageia (refer 2createpackages).
  154. #130112 multiarch symlinks now optional.
  155. #130114 revert 130112.
  156. #130129 offer to change X dpi from 78 to 96.
  157. #130129 busybox: deb 'bsdmainutils' has broken 'cal' and 'hd' symlinks. 130130 tweak.
  158. #130203 fix /tmp permissions.
  159. #130204 01micko: fix for spaces in names.
  160. #130226 hack for missing /usr/bin/X.
  161. #130306 fix arch linux build. 130307 fix arch post-install script execution.
  162. #130314 want to run arch post-install script from ppm also.
  163. #130316 disable execution of arch install scripts.
  164. #130316 now have rootfs-complete/usr/local/petget/invaliddepslist.
  165. #130320 util-linux libblkid and libuuid have preference over e2fsprogs.
  166. #130321 fix call to slacko customisation script.
  167. #130326 X dpi now 96. 130327 offer choice of next-larger.
  168. #130329 append extra line, needed for Qt4 theme matching. (see also /etc/profile.d/pup_gtk and /root/.config/Trolltech.conf).
  169. #130330 Xorg: move modesetting_drv.so to drivers-alternate directory.
  170. #130330 want 'universe' radiobutton before 'main'.
  171. #130401 01micko: support gtk3 themes (see also 130329).
  172. #130404 01micko: link to actual gtk3 theme.
  173. #130418 support kmod. but, still use old depmod from module-init-tools in initrd (as unable to compile kmod statically).
  174. #130430 coreutils 8.20 cp outputs different error message.
  175. #130430 fix depmod symlink.
  176. #130430 gpu/drm/sis.ko needs video/sis/sisfb.ko, must keep. WARNING: sisfb is blacklisted -- as mucks up my pc that has sis video and only vesa works.
  177. #130510 support multiarch for debian wheezy.
  178. #130512 scsijon: dpi size setting not working.
  179. #130515 ask disable 'pupdesk.flg' mechanism, see also init script in initrd.
  180. #130530 write puppy files to SD image file, not to card.
  181. #130601 new script support/setup-spot, optional run internet apps as user 'spot'.
  182. #130604 tweak 130601.
  183. #130612 support devtmpfs. see also 'init' script in initrd.
  184. #130613 kmod depmod wants modules.builtin, modules.order.
  185. #130618 modify 130612.
  186. #130618 restore the "layer:" lines in /etc/xdg/templates/_root_.jwmrc.
  187. #130710 01micko: DEVTMPFSFLG bug fix.
  188. #130720 add QtWeb option to run as spot. 130721 fixes.
  189. #130723 add opera option to run as spot.
  190. #130725 if alternate-browser, set defaulthtmlviewer to it. 130726 fix.
  191. #130821 add firefox option to run as spot.
  192. #v431 accepts passed params, from woof_gui_tabs:
  193. #$1=$CHOICE_KERNELPKG $2=$CHOICE_SCSI $3=$CHOICE_BIGMODEM $4=$CHK_FB_STATE $5=$CHK_EXOTIC_STATE $6=$CHK_RADICAL_STATE
  194. #100912 add $7=CHK_SIMPLE_FILENAMES
  195. export LANG=C #faster.
  196. #w482 use xorriso if it is installed (see also functions4puppy)...
  197. CDRECORD='cdrecord'
  198. MKISOFS='mkisofs'
  199. if [ "`which xorriso`" != "" ];then
  200. CDRECORD='xorrecord'
  201. MKISOFS='xorrisofs' #growisofs reads this variable.
  202. fi
  203. export CDRECORD MKISOFS
  204. . ./DISTRO_SPECS #this has DISTRO_VERSION.
  205. if [ ! "$DISTRO_DB_SUBNAME" ];then #121102
  206. DISTRO_DB_SUBNAME="$DISTRO_COMPAT_VERSION" #fallback if DISTRO_DB_SUBNAME not defined in file DISTRO_SPECS.
  207. echo '#subname for online PETs dir. Ex: "slacko14", dir "pet_packages-slacko14", db file "Packages-puppy-slacko14-official":
  208. #note: prior to existence of this variable, online subname was set to $DISTRO_COMPAT_VERSION or via some hack code.
  209. ' >> ./DISTRO_SPECS
  210. echo "DISTRO_DB_SUBNAME='${DISTRO_DB_SUBNAME}'" >> ./DISTRO_SPECS
  211. fi
  212. if [ -f ./DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then
  213. . ./DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION}
  214. else
  215. . ./DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT} #130306
  216. fi
  217. if [ -f ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then #w478
  218. . ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} #has FALLBACKS_COMPAT_VERSIONS
  219. else
  220. . ./DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT} #has FALLBACKS_COMPAT_VERSIONS
  221. fi
  222. . ./PKGS_MANAGEMENT #101013 want variable PKG_PREFER_OLDER.
  223. . ./DISTRO_PET_REPOS #120506 want variable PACKAGELISTS_PET_ORDER
  224. if [ -f WOOFMERGEVARS ];then #111123
  225. . ./WOOFMERGEVARS #has variables WOOF_HOSTARCH, WOOF_TARGETARCH, WOOF_COMPATDISTRO, WOOF_COMPATVERSION
  226. else
  227. echo 'File WOOFMERGEVARS does not exist. This is created by script
  228. merge2out. Your setup is wrong, quiting.'
  229. exit
  230. fi
  231. #100911 simple filenames, want idstring...
  232. #IDDATE="`date +%y%m%d%H%M%S`" #12 bytes, ex: 100911153319
  233. #IDPREFIX="`echo -n "$DISTRO_FILE_PREFIX" | cut -b 1`"
  234. #vDISTRO_VERSION="`echo -n "$DISTRO_VERSION" | cut -b 1-3`" #in case it ever gets bigger than 3 chars.
  235. #IDSTRING="${IDPREFIX}${vDISTRO_VERSION}${IDDATE}"
  236. #110422 increase size of idstring to 32 bytes...
  237. IDDATE="`date +%y%m%d%H%M%S`" #12 bytes, ex: 100911153319
  238. IDPREFIX="`echo -n "$DISTRO_FILE_PREFIX" | cut -b 1`"
  239. IDSTRING="${IDPREFIX}${IDDATE}ZZZZ${DISTRO_VERSION}"
  240. #...ZZZZ reserved space for future use.
  241. LEN1=`echo -n "$IDSTRING" | wc -c`
  242. LEN2=`expr 32 - $LEN1`
  243. EXTX=''
  244. while [ $LEN2 -gt 0 ];do
  245. LEN2=`expr $LEN2 - 1`
  246. EXTX="${EXTX}X"
  247. done
  248. IDSTRING="${IDSTRING}${EXTX}" #32 bytes ex: w110423092024ZZZZ5.1.2XXXXXXXXXX
  249. #the files that have compatible-distro pkg docs (these were downloaded by 0setup)...
  250. PKGLISTS_COMPAT="`echo "$PKG_DOCS_DISTRO_COMPAT" | tr ' ' '\n' | cut -f 3 -d '|' | tr '\n' ' ' | sed -e 's% $%%'`" #see file DISTRO_PKGS_SPECS-ubuntu
  251. #...format ex: 'Packages-ubuntu-intrepid-main Packages-ubuntu-intrepid-universe'
  252. WKGDIR="`pwd`"
  253. #120506 params passed from woof_gui_tabs. moved up...
  254. KERNELPKG=""
  255. [ $1 ] && KERNELPKG="$1"
  256. CHOICE_SCSI=""
  257. [ $2 ] && CHOICE_SCSI="$2" #Erase_SCSI, Keep_SCSI, Boot_SCSI
  258. CHOICE_BIGMODEM=""
  259. [ $3 ] && CHOICE_BIGMODEM="$3" #Erase_big_modems Keep_big_modems Zdrv_big_modems
  260. CHK_FB_STATE=""
  261. [ $4 ] && CHK_FB_STATE="$4"
  262. CHK_EXOTIC_STATE=""
  263. [ $5 ] && CHK_EXOTIC_STATE="$5"
  264. CHK_RADICAL_STATE=""
  265. [ $6 ] && CHK_RADICAL_STATE="$6"
  266. #120506
  267. echo
  268. echo "Do you want to create a live-CD .iso file, which is the normal choice for a
  269. PC-compatible target, or is your target an SD-card for an ARM-based board?
  270. In the latter case, you would already have downloaded an SD-card skeleton image
  271. file into folder 'sd-skeleton-images' (done by script '1download') -- if there
  272. is no image file in that folder, you cannot choose the SD-card option.
  273. The latter choice will also require an SD card to write to, and you must have
  274. it available now."
  275. echo "WARNING: for the SD-card option, you must have enough free space in the
  276. current directory ${WKGDIR}/sandbox3
  277. to expand the SD image file, typically 4GB."
  278. echo "Press ENTER only for normal .iso creation, or "
  279. echo -n "any other printable character for SD-card: "
  280. read SDFLAG
  281. #120714 ask what type of arm board...
  282. if [ "$SDFLAG" != "" ];then
  283. echo "...ok, chose sd-card image."
  284. echo
  285. echo "Type number of board that you are building for:
  286. 1 Raspberry Pi
  287. 2 Mele A1000 or A2000 (or other A10 board)
  288. 3 ODROID-X (or other Exynos 4412 board)"
  289. read boardnum
  290. case $boardnum in
  291. 1) BOOT_BOARD='raspi' ;;
  292. 2) BOOT_BOARD='mele' ;;
  293. *) BOOT_BOARD='odroidx' ;;
  294. esac
  295. echo "...you chose $BOOT_BOARD"
  296. fi
  297. if [ "$SDFLAG" != "" ];then
  298. #override module choices, as kernel is built customized to particular hardware...
  299. CHOICE_BIGMODEM="Keep_big_modems"
  300. CHOICE_SCSI="Keep_SCSI"
  301. CHK_FB_STATE="false"
  302. CHK_EXOTIC_STATE="false"
  303. CHK_RADICAL_STATE="false"
  304. CHK_YES_ZDRV="false"
  305. fi
  306. #w003 remove comments from PKGS_SPECS_TABLE
  307. PKGS_SPECS_TABLE="`echo "$PKGS_SPECS_TABLE" | grep -v '^#'`"
  308. mkdir -p sandbox3
  309. export DISTRO_NAME
  310. export DISTRO_VERSION
  311. if [ "`echo -n "$DISTRO_VERSION" | grep '\.'`" = "" ];then #110422
  312. DIGIT1="`echo "$DISTRO_VERSION" | cut -b 1`"
  313. DIGIT2="`echo "$DISTRO_VERSION" | cut -b 2`"
  314. DIGIT3="`echo "$DISTRO_VERSION" | cut -b 3`"
  315. RIGHTVER="${DIGIT1}.${DIGIT2}.${DIGIT3}"
  316. [ "$DIGIT3" = "0" ] && RIGHTVER="${DIGIT1}.${DIGIT2}"
  317. else
  318. RIGHTVER="$DISTRO_VERSION"
  319. fi
  320. #the kernel is supposed to be a .pet package, already downloaded into packages-pet...
  321. echo
  322. if [ "$KERNELPKG" = "" ];then
  323. #110823
  324. KERNELPKG="$DISTRO_KERNEL_PET"
  325. echo "The kernel pkg that you are using is: $KERNELPKG"
  326. echo "This is specified in variable DISTRO_KERNEL_PET in file DISTRO_SPECS,"
  327. echo "which is set in the first GUI tab of script woof_gui, or in script 1download,"
  328. echo "or you can directly edit DISTRO_SPECS -- but please do so early-on, before"
  329. echo "running script 1download, as Woof needs to know the kernel version to"
  330. echo "properly resolve some dependencies, possible packages that are dependent"
  331. echo "on a certain kernel version."
  332. echo "Note, the linux_kernel PET needs to be in directory packages-pet."
  333. echo -n "Press ENTER to continue: "
  334. read keepgoing
  335. fi
  336. #110826...
  337. #KERNELVER="`echo "$KERNELPKG" | cut -f 2 -d '-'`"
  338. ##um, if it is named 'linux-2.6.29-rc7-*.pet' then get 2 fields...
  339. #[ "`echo -n "$KERNELPKG" | grep '\-rc[0-9]\-'`" != "" ] && KERNELVER="`echo "$KERNELPKG" | cut -f 2,3 -d '-'`"
  340. ##100204 may be like this 2.6.33-rc6-git2...
  341. #[ "`echo -n "$KERNELPKG" | grep '\-git[0-9]\-'`" != "" ] && KERNELVER="`echo "$KERNELPKG" | rev | grep -o '[0-9]tig\-.*' | rev | cut -f 2- -d '-'`"
  342. ##100209 special case...
  343. #[ "`echo -n "$KERNELPKG" | grep '\-vortex86'`" != "" ] && KERNELVER="`echo "$KERNELPKG" | cut -f 2,3 -d '-'`"
  344. ##110512 special case... format linux-2.6.32-40-w5
  345. #dotnum="`echo -n "$KERNELVER" | sed -e 's%[^\.]%%g' | wc -c`"
  346. #if [ "$dotnum" = "2" ];then
  347. # SUB_SUB_KERNELVER=`echo -n "$KERNELPKG" | cut -f 3 -d '-'`
  348. #else
  349. # SUB_SUB_KERNELVER=`echo -n "$KERNELVER" | cut -f 1 -d '-' | cut -f 4 -d '.'`
  350. #fi
  351. #SUB_KERNELVER=`echo -n "$KERNELVER" | cut -f 1 -d '-' | cut -f 3 -d '.'`
  352. #110826 #131124 xz
  353. KERNELVER="`tar --list -f packages-pet/${KERNELPKG} 2>/dev/null | grep -o '/lib/modules/[23]\..*' | head -n 1 | cut -f 4 -d '/'`" #120502 hide error msg.
  354. dotnum="`echo -n "$KERNELVER" | sed -e 's%[^\.]%%g' | wc -c`"
  355. if [ "$dotnum" = "2" ];then
  356. #SUB_SUB_KERNELVER=`echo -n "$KERNELPKG" | cut -f 3 -d '-'`
  357. SUB_SUB_KERNELVER=0 #cos we don't really know what it is.
  358. else
  359. SUB_SUB_KERNELVER=`echo -n "$KERNELVER" | cut -f 1 -d '-' | cut -f 4 -d '.'`
  360. fi
  361. SUB_KERNELVER=`echo -n "$KERNELVER" | cut -f 1 -d '-' | cut -f 3 -d '.'`
  362. MAJ_KERNELVER=`echo -n "$KERNELVER" | cut -f 1 -d '-' | cut -f 1 -d '.'` #111014 2 or 3.
  363. echo
  364. echo "You have chosen $KERNELPKG, which is version $KERNELVER."
  365. #echo -n "Press ENTER to continue: "
  366. #read continue1
  367. #if >= 2.6.29 kernel, use mksquashfs v4.0...
  368. if [ "$MAJ_KERNELVER" = "2" ];then
  369. MKSQUASHFS='mksquashfs3.3'
  370. [ $SUB_KERNELVER -ge 29 ] && MKSQUASHFS='mksquashfs4.0'
  371. [ $SUB_KERNELVER -ge 39 ] && MKSQUASHFS='mksquashfs4.2' #110713
  372. #[ $SUB_KERNELVER -eq 18 ] && MKSQUASHFS='mksquashfs3.1' #w478
  373. #[ $SUB_KERNELVER -eq 18 ] && MKSQUASHFS='mksquashfs3.2' #w478 old 2.6.18.1 kernel
  374. [ $SUB_KERNELVER -eq 18 ] && MKSQUASHFS='mksquashfs3.3' #w479 2.6.18.8 kernel
  375. [ $SUB_KERNELVER -eq 18 ] && [ $SUB_SUB_KERNELVER -eq 1 ] && MKSQUASHFS='mksquashfs3.2' #w479
  376. [ $SUB_KERNELVER -eq 27 ] && [ $SUB_SUB_KERNELVER -gt 46 ] && MKSQUASHFS='mksquashfs4.0' #100607
  377. else #111014
  378. MKSQUASHFS='mksquashfs4.2'
  379. fi
  380. SQUASHFSMAJOR="`echo -n "$MKSQUASHFS" | cut -f 1 -d '.' | rev | cut -c 1`" #3 or 4.
  381. if [ "$MKSQUASHFS" = "mksquashfs4.2" ];then #110713
  382. echo
  383. echo ".sfs files are normally compressed with gzip."
  384. echo "However, this kernel supports xz, which is higher compression."
  385. echo -n "Press ENTER only for gzip, any other char for xz: "
  386. read XZCHOICE
  387. if [ "$XZCHOICE" ];then
  388. echo "...xz chosen"
  389. COMPCHOICE='-comp xz -Xbcj x86 -b 512K'
  390. else
  391. echo "...gzip chosen"
  392. COMPCHOICE=''
  393. fi
  394. fi
  395. #110823
  396. echo
  397. ./findwoofinstalledpkgs #creates woof-installed-packages, which later gets copied into sandbox3/rootfs-complete/root/.packages/
  398. #121028 ...now also creates devx-only-installed-packages.
  399. #100912 choose simple or traditional filenames...
  400. #traditional names...
  401. PREFIX1CHAR="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1`"
  402. KERNEL3CHARS="`echo -n "$KERNELVER" | tr -d '.' | tr -d '\-' | tr -d '[a-z]' | rev | cut -c 1,2,3 | rev`"
  403. #tradZDRVSFS="z${PREFIX1CHAR}${DISTRO_VERSION}${KERNEL3CHARS}.sfs" #ex: zw071629.sfs
  404. #tradDEVXSFS="${DISTRO_FILE_PREFIX}_devx_${DISTRO_VERSION}.sfs" #ex: wary_devx_071.sfs
  405. ##tradPUPPYSFS="${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}.sfs" #ex: wary-071.sfs
  406. ##tradZDRVSFS="zdrv_${DISTRO_VERSION}.sfs"
  407. ##tradDEVXSFS="devx_${DISTRO_VERSION}.sfs"
  408. #tradPUPPYSFS="${DISTRO_FILE_PREFIX}_${DISTRO_VERSION}.sfs"
  409. #110422 new traditional names...
  410. tradPUPPYSFS="puppy_${DISTRO_FILE_PREFIX}_${DISTRO_VERSION}.sfs"
  411. tradZDRVSFS="zdrv_${DISTRO_FILE_PREFIX}_${DISTRO_VERSION}.sfs"
  412. tradDEVXSFS="devx_${DISTRO_FILE_PREFIX}_${DISTRO_VERSION}.sfs"
  413. if [ $7 ];then #passed in from woof_gui
  414. CHK_SIMPLE_FILENAMES="$7"
  415. else
  416. echo
  417. echo "Woof can build to use traditional or simplified filenames."
  418. echo "The simplified filenames do not have any distro or version information in their"
  419. echo "names: vmlinuz, initrd.gz, puppy.sfs, zdrv.sfs"
  420. echo "The traditional names look like this:"
  421. echo "vmlinuz, initrd.gz, ${tradPUPPYSFS}, ${tradZDRVSFS}"
  422. echo "Note that there are many apps that use the traditional names, such as CD"
  423. echo "remaster applications, though the official Woof scripts should be all working"
  424. echo "with both naming schemes. To complicate matters, there is some variation in"
  425. echo "the traditional names with different versions of Puppy, so best to use scripts"
  426. echo "that have been updated to work will the names stored in file DISTRO_SPECS: so"
  427. echo "note that the chosen names are available in a running Puppy in /etc/DISTRO_SPECS"
  428. echo "as these variables: DISTRO_PUPPYSFS, DISTRO_ZDRVSFS"
  429. echo -n "Press ENTER only for simplified names (any char otherwise): "
  430. read read_simple
  431. CHK_SIMPLE_FILENAMES='true' #simple.
  432. [ "$read_simple" ] && CHK_SIMPLE_FILENAMES='false'
  433. fi
  434. if [ "$CHK_SIMPLE_FILENAMES" = "true" ];then
  435. echo '...simple chosen'
  436. PUPPYSFS='puppy.sfs'
  437. ZDRVSFS='zdrv.sfs'
  438. DEVXSFS='devx.sfs'
  439. else
  440. echo '...traditional chosen'
  441. PUPPYSFS="$tradPUPPYSFS"
  442. ZDRVSFS="$tradZDRVSFS"
  443. DEVXSFS="$tradDEVXSFS"
  444. fi
  445. #now build rootfs-complete, the main filesystem...
  446. echo
  447. echo "Now building sandbox3/rootfs-complete, with the complete filesystem..."
  448. echo '#!/bin/sh' > sandbox3/pinstall.sh
  449. rm -rf sandbox3/rootfs-complete
  450. sync
  451. mkdir sandbox3/rootfs-complete
  452. mkdir sandbox3/rootfs-complete/etc
  453. #no, confusing, assign to history...
  454. #echo -n "$DISTRO_VERSION" > sandbox3/rootfs-complete/etc/puppyversion #for backwards compat. old scripts.
  455. cp DISTRO_SPECS sandbox3/rootfs-complete/etc/
  456. #copy the skeleton...
  457. cp -a rootfs-skeleton/* sandbox3/rootfs-complete/
  458. cat sandbox3/rootfs-complete/pinstall.sh >> sandbox3/pinstall.sh
  459. for d in $(ls rootfs-packages)
  460. do
  461. cp -a rootfs-packages/$d/* sandbox3/rootfs-complete/
  462. cat sandbox3/rootfs-complete/pinstall.sh >> sandbox3/pinstall.sh
  463. done
  464. rm -f sandbox3/rootfs-complete/pinstall.sh
  465. rm -f /tmp/3builddistro_removed_alt 2>/dev/null #101013
  466. #120315 Ubuntu Precise Pangolin has done a big move of files from /lib to /lib/i386-linux-gnu and /usr/lib to /usr/lib/i386-linuxgnu
  467. #well, i want to move them back. symlinks will do it (cp below does not destroy them)...
  468. #120316 note, see also 2createpackages.
  469. #if [ ! -e packages-${DISTRO_FILE_PREFIX}/glibc/lib/libc.so.6 ];then
  470. # #ARCHDIR="`find packages-${DISTRO_FILE_PREFIX}/glibc/lib -mindepth 2 -maxdepth 2 -name 'libc.so.6' | head -n 1 | rev | cut -f 2 -d '/' | rev`"
  471. # ARCHDIR=''
  472. # case $WOOF_TARGETARCH in #see file WOOFMERGEVARS
  473. # x86) ARCHDIR='i386-linux-gnu' ;;
  474. # x86_64) ARCHDIR='x86_64-linux-gnu' ;;
  475. # arm) #120720 120721
  476. # case $WOOF_COMPATDISTRO in #see file WOOFMERGEVARS
  477. # raspbian) ARCHDIR='arm-linux-gnueabihf' ;;
  478. # debian)
  479. # case $WOOF_COMPATVERSION in
  480. # squeeze) true ;; #old release
  481. # *) ARCHDIR='arm-linux-gnueabihf' ;;
  482. # esac
  483. # ;;
  484. # ubuntu)
  485. # case $WOOF_COMPATVERSION in
  486. # jaunty|karmic|lucid) true ;; #old releases.
  487. # *) ARCHDIR='arm-linux-gnueabihf' ;;
  488. # esac
  489. # ;;
  490. # esac
  491. # ;;
  492. # esac
  493. # if [ "$ARCHDIR" ];then #ex: i386-linux-gnu
  494. # ln -snf ./ sandbox3/rootfs-complete/lib/${ARCHDIR}
  495. # ln -snf ./ sandbox3/rootfs-complete/usr/lib/${ARCHDIR}
  496. # ln -snf ./ sandbox3/rootfs-complete/usr/bin/${ARCHDIR} #120909
  497. # fi
  498. #fi
  499. #121210 fix, ARCHDIR was not getting set...
  500. ARCHDIR=''
  501. if [ "$WOOF_COMPATDISTRO" = "ubuntu" ];then
  502. case $WOOF_COMPATVERSION in
  503. jaunty|karmic|lucid) #old releases.
  504. true
  505. ;;
  506. *)
  507. case $WOOF_TARGETARCH in
  508. x86) ARCHDIR='i386-linux-gnu' ;;
  509. x86_64) ARCHDIR='x86_64-linux-gnu' ;;
  510. esac
  511. ;;
  512. esac
  513. fi
  514. if [ "$WOOF_COMPATDISTRO" = "debian" ];then #130510
  515. case $WOOF_COMPATVERSION in
  516. squeeze|lenny|etch|sarge|woody) #old releases.
  517. true
  518. ;;
  519. *) #wheezy and later...
  520. case $WOOF_TARGETARCH in
  521. x86) ARCHDIR='i386-linux-gnu' ;;
  522. x86_64) ARCHDIR='x86_64-linux-gnu' ;;
  523. esac
  524. ;;
  525. esac
  526. fi
  527. if [ "$WOOF_COMPATDISTRO" = "mageia" ];then #130111
  528. case $WOOF_TARGETARCH in
  529. x86) ARCHDIR='multiarch-i386-linux' ;;
  530. *) ARCHDIR=''; echo 'dunno'; exit ;;
  531. esac
  532. fi
  533. case $WOOF_TARGETARCH in
  534. arm)
  535. case $WOOF_COMPATDISTRO in #see file WOOFMERGEVARS
  536. raspbian) ARCHDIR='arm-linux-gnueabihf' ;; #different from debian/ubuntu, compiled for armv6 hf.
  537. debian)
  538. case $WOOF_COMPATVERSION in
  539. squeeze) true ;; #old release
  540. *) ARCHDIR='arm-linux-gnueabihf' ;;
  541. esac
  542. ;;
  543. ubuntu)
  544. case $WOOF_COMPATVERSION in
  545. jaunty|karmic|lucid) true ;; #old releases.
  546. *) ARCHDIR='arm-linux-gnueabihf' ;;
  547. esac
  548. ;;
  549. esac
  550. ;;
  551. esac
  552. #130114 revert 130112...
  553. if [ "$ARCHDIR" ];then #ex: i386-linux-gnu
  554. # #130112 multiarch symlinks now optional...
  555. # if [ "$DISTRO_ARCHDIR_SYMLINKS" = "" ];then #this now created in 2createpackages.
  556. # echo
  557. # echo "Woof-built puppies up until Dec 2012 have multiarch dirs as symlinks,
  558. #for example /usr/lib/i386-linux-gnu is a symlink to /usr/lib in Debian/Ubuntu
  559. #based pups. However, in future builds will by default retain the multiarch
  560. #sub-directories."
  561. # echo -n "ENTER only to retain multiarch dirs: "
  562. # read flagmultiarchdirs
  563. # else
  564. # flagmultiarchdirs=""
  565. # [ "$DISTRO_ARCHDIR_SYMLINKS" = "yes" ] && flagmultiarchdirs="yes"
  566. # fi
  567. # if [ "$flagmultiarchdirs" != "" ];then
  568. # echo "...Creating multiarch symlinks"
  569. # ln -snf ./ sandbox3/rootfs-complete/lib/${ARCHDIR}
  570. # ln -snf ./ sandbox3/rootfs-complete/usr/lib/${ARCHDIR}
  571. # ln -snf ./ sandbox3/rootfs-complete/usr/bin/${ARCHDIR} #120909
  572. # xDISTRO_ARCHDIR_SYMLINKS='yes'
  573. # else
  574. # echo
  575. # echo "...Multiarch directories retained"
  576. # mkdir -p sandbox3/rootfs-complete/lib/${ARCHDIR}
  577. # echo "/lib/${ARCHDIR}" >> sandbox3/rootfs-complete/etc/ld.so.conf
  578. # #do we really need to populate LD_LIBRARY_PATH if already in ld.so.conf?
  579. # libPTN="s%^LD_LIBRARY_PATH=\"%LD_LIBRARY_PATH=\"/lib/${ARCHDIR}:%"
  580. # sed -i -e "$libPTN" sandbox3/rootfs-complete/etc/profile
  581. # mkdir -p sandbox3/rootfs-complete/usr/lib/${ARCHDIR}
  582. # echo "/usr/lib/${ARCHDIR}" >> sandbox3/rootfs-complete/etc/ld.so.conf
  583. # libPTN="s%^LD_LIBRARY_PATH=\"%LD_LIBRARY_PATH=\"/usr/lib/${ARCHDIR}:%"
  584. # sed -i -e "$libPTN" sandbox3/rootfs-complete/etc/profile
  585. # mkdir -p sandbox3/rootfs-complete/usr/bin/${ARCHDIR}
  586. # binPTN="s%^PATH=\"%PATH=\"/usr/bin/${ARCHDIR}:%"
  587. # sed -i -e "$binPTN" sandbox3/rootfs-complete/etc/profile
  588. # xDISTRO_ARCHDIR_SYMLINKS='no'
  589. # fi
  590. ln -snf ./ sandbox3/rootfs-complete/lib/${ARCHDIR}
  591. ln -snf ./ sandbox3/rootfs-complete/usr/lib/${ARCHDIR}
  592. ln -snf ./ sandbox3/rootfs-complete/usr/bin/${ARCHDIR} #120909
  593. fi
  594. PKGLIST="`echo "$PKGS_SPECS_TABLE" | grep '^yes' | cut -f 2 -d '|' | tr '\n' ' '`"
  595. for ONEPKG in $PKGLIST
  596. do
  597. if [ ! -d packages-${DISTRO_FILE_PREFIX}/${ONEPKG} ];then
  598. if [ ! -d packages-${DISTRO_FILE_PREFIX}/${ONEPKG}_DEV ];then #pkg may go entirely into devx.
  599. if [ ! -d packages-${DISTRO_FILE_PREFIX}/${ONEPKG}_DOC ];then #pkg may go entirely into docs.
  600. echo "WARNING, PKG DOES NOT EXIST: packages-${DISTRO_FILE_PREFIX}/${ONEPKG}"
  601. continue
  602. fi
  603. fi
  604. fi
  605. #110923 avoid conflict between busybox applets and full utilities...
  606. [ "$ONEPKG" == "busybox" ] && continue #see below.
  607. #cp -a --remove-destination packages-${DISTRO_FILE_PREFIX}/${ONEPKG}/* sandbox3/rootfs-complete/ 2> /dev/null
  608. #w003 problem. pet pkg seamonkey_addon_adblock has files in /usr/lib/seamonkey but in rootfs-complete
  609. #usr/lib/seamonkey is a symlink to seamonkey-1.1.14 and copy fails. this will follow path with a
  610. #symlink (hopefully doesn't break something else)...
  611. #looks okay. the --remove-destination ensures that if target file already exists as a symlink
  612. #it will be deleted first and won't be followed. shit no, it changed /usr/lib/seamonkey into a dir...
  613. #cp -r --preserve=mode,ownership,timestamps,links --dereference --remove-destination packages-${DISTRO_FILE_PREFIX}/${ONEPKG}/* sandbox3/rootfs-complete/ 2> /dev/null
  614. #/usr/sbin/petget solves this a different way, let's try that...
  615. #130430 new problem with coreutils 8.20... ex building raring pup...
  616. #ex: cp -a --remove-destination packages-raring/synclient/* sandbox3/rootfs-complete/
  617. #coreutils 5.2.1 stderr: cannot overwrite non-directory `sandbox3/rootfs-complete/usr/X11' with directory `packages-raring/synclient/usr/X11'
  618. #coreutils 8.20 (in Raring) stderr: cp: cannot overwrite non-directory ‘sandbox3/rootfs-complete/usr/X11’ with directory ‘packages-raring/synclient/usr/X11’
  619. #...!!!! ok, attempt to fix...
  620. cp -a --remove-destination packages-${DISTRO_FILE_PREFIX}/${ONEPKG}/* sandbox3/rootfs-complete/ 2> /tmp/3builddistro-cp-errlog
  621. sync #110727 running drake pup 0.3 with k2.6.39-3 new laptop, mysterious loss of dirs/files. try sync.
  622. if [ -s /tmp/3builddistro-cp-errlog ];then #130430 next line fixes those quote chars...
  623. cat /tmp/3builddistro-cp-errlog | grep 'cannot overwrite non-directory' | tr '[`‘’]' "'" | cut -f 2 -d "'" |
  624. while read ONEDIRSYMLINK
  625. do
  626. xONEDIRSYMLINK="`echo -n "$ONEDIRSYMLINK" | sed -e 's%sandbox3/rootfs-complete%%'`"
  627. #adding that extra trailing / does the trick...
  628. cp -a --remove-destination packages-${DISTRO_FILE_PREFIX}/${ONEPKG}${xONEDIRSYMLINK}/* sandbox3/rootfs-complete${xONEDIRSYMLINK}/
  629. done
  630. fi
  631. #...now seems ok. note, there are two places in woof v003 where this problem occurs: /usr/lib/seamonkey
  632. # and /usr/share/cups/model.
  633. if [ -f sandbox3/rootfs-complete/pinstall.sh ];then
  634. #note, do not filter #! /bin/sh (with a space)...
  635. grep -E -v '^\#\!\/bin\/sh' sandbox3/rootfs-complete/pinstall.sh >> sandbox3/pinstall.sh
  636. rm -f sandbox3/rootfs-complete/pinstall.sh
  637. fi
  638. #get rid of a .specs file...
  639. rm -f sandbox3/rootfs-complete/*.specs
  640. #window and menu icons can also be in the top-level directory of the package...
  641. mv sandbox3/rootfs-complete/*24.xpm sandbox3/rootfs-complete/usr/local/lib/X11/pixmaps/ 2>/dev/null
  642. mv sandbox3/rootfs-complete/*32.xpm sandbox3/rootfs-complete/usr/local/lib/X11/pixmaps/ 2>/dev/null
  643. mv sandbox3/rootfs-complete/*32.png sandbox3/rootfs-complete/usr/local/lib/X11/pixmaps/ 2>/dev/null
  644. mv sandbox3/rootfs-complete/*48.xpm sandbox3/rootfs-complete/usr/local/lib/X11/pixmaps/ 2>/dev/null
  645. mv sandbox3/rootfs-complete/*48.png sandbox3/rootfs-complete/usr/local/lib/X11/pixmaps/ 2>/dev/null
  646. mv sandbox3/rootfs-complete/*.xpm sandbox3/rootfs-complete/usr/local/lib/X11/mini-icons/ 2>/dev/null
  647. mv sandbox3/rootfs-complete/*.png sandbox3/rootfs-complete/usr/local/lib/X11/mini-icons/ 2>/dev/null
  648. done
  649. #110923 fix busybox applets...
  650. DEVXUTILS=' config ar ar86 as as86 audiofile-config autoconf autoheader autom4te automake autopoint autoreconf autoscan autoupdate bacon bacongui bcc bison c2ph catchsegv cc ccmake chem cmake combinediff config_data corelist cpack cpan cpan2dist cpanp cpanp-run-perl cpp ctest cups-config curl-config cvs cvsbug db_archive db_checkpoint db_deadlock db_dump db_hotbackup db_load db_printlog db_recover db_stat db_upgrade db_verify dehtmldiff diet dnsd dprofpp dvdnav-config dvdread-config editdiff elftrunc enc2xs envsubst eqn eqn2graph espdiff filterdiff find2perl fixcvsdiff flex flipdiff freetype-config gccbug gcov gdb gdbserver gdbtui gdiffmk gencat getconf getent gettext gettext.sh gettextize gfortran git git-cvsserver git-receive-pack git-shell git-upload-archive git-upload-pack gitk glade-3 gmake gnome-menu-spec-test gperf gphoto2-config gphoto2-port-config gprof grap2graph grepdiff grn grodvi groff groffer grog grolbp grolj4 grops grotty h2ph h2xs hpftodit iconv idle ifnames indxbib info infokey install-info instmodsh interdiff intltool-extract intltool-merge intltool-prepare intltool-update intltoolize ld ld86 ldd lddlibc4 lex lib-i386 libart2-config libnetcfg libpng-config libpng12-config libtool libtoolize libusb-config lkbib locale localedef lookbib lsdiff m4 make makeinfo man man1 man2dvi man2html mmroff msgattrib msgcat msgcmp msgcomm msgconv msgen msgexec msgfilter msgfmt msggrep msginit msgmerge msgunfmt msguniq mtrace nasm ndisasm neon-config neqn netpbm-config ngettext nm nm86 nroff objcopy objdump objdump86 onsgmls osgmlnorm ospam ospcat ospent osx patch pcap-config pcprofiledump pcre-config pdfroff pdftexi2dvi perl perlbug perldoc perlivp perlthanks pfbtops pic pic2graph piconv pkg-config pl2pm pod2html pod2latex pod2man pod2text pod2usage podchecker podselect post-grohtml pre-grohtml preconv prove psed pstruct ptar ptardiff pydoc ranlib rcs2log readelf recode-sr-latin recountdiff rediff refer rman roff2dvi roff2html roff2pdf roff2ps roff2text roff2x rpcgen s2p sane-config scrollkeeper-config scrollkeeper-extract scrollkeeper-gen-seriesid scrollkeeper-get-cl scrollkeeper-get-content-list scrollkeeper-get-extended-content-list scrollkeeper-get-index-from-docpath scrollkeeper-get-toc-from-docpath scrollkeeper-get-toc-from-id scrollkeeper-install scrollkeeper-preinstall scrollkeeper-rebuilddb scrollkeeper-uninstall scrollkeeper-update shasum size size86 soelim splain splitdiff sprof strace strace-graph strings strip svn svnadmin svndumpfilter svnlook svnserve svnsync svnversion sysprof sysprof-cli tbl texi2dvi texi2pdf texindex tfmtodit troff tzselect unwrapdiff update-mime-database vsyasm whatis xgettext xml2-config xslt-config xsubpp xtrace yacc yasm ytasm zsoelim iconvconfig makewhatis nscd rpcinfo visudo zic ' #11104 111204 remove zdump.
  651. cp -a -f packages-${DISTRO_FILE_PREFIX}/busybox/bin/busybox ./sandbox3/rootfs-complete/bin/
  652. osPTN="s%packages-${DISTRO_FILE_PREFIX}/busybox%%"
  653. for ONEAPPLET in `find packages-${DISTRO_FILE_PREFIX}/busybox -type l | tr '\n' ' '`
  654. do
  655. ONESPEC="`echo -n "$ONEAPPLET" | sed -e "$osPTN"`"
  656. ONEPATH="`dirname $ONESPEC`"
  657. ONENAME="`basename $ONESPEC`"
  658. FNDFULL="`find ./sandbox3/rootfs-complete/bin ./sandbox3/rootfs-complete/sbin ./sandbox3/rootfs-complete/usr/bin ./sandbox3/rootfs-complete/usr/sbin -name ${ONENAME}`"
  659. #130129 deb 'bsdmainutils' has broken 'cal' and 'hd' symlinks... 130204 01micko: fix for spaces in names...
  660. if [ "$FNDFULL" ];then
  661. if [ -h "$FNDFULL" ];then
  662. FULLPATH="$(dirname "$FNDFULL")"
  663. FULLLINK="$(readlink "$FNDFULL")"
  664. xFULLLINK="${FULLPATH}/${FULLLINK}"
  665. [ "`echo -n "$FULLLINK" | cut -c 1`" = "/" ] && xFULLLINK="sandbox3/rootfs-complete${FULLLINK}"
  666. if [ ! -e "${xFULLLINK}" ];then
  667. rm -f "$FNDFULL" #130130
  668. FNDFULL=""
  669. fi
  670. fi
  671. fi
  672. #111004 need to check in devx also...
  673. if [ ! "$FNDFULL" ];then
  674. if [ "$ONENAME" != "[" ];then
  675. if [ "$ONENAME" != "[[" ];then
  676. oaPTN=" ${ONENAME} "
  677. FNDFULL="`echo -n "$DEVXUTILS" | grep "$oaPTN"`"
  678. fi
  679. fi
  680. fi
  681. if [ "$FNDFULL" ];then
  682. cp -a -f $ONEAPPLET ./sandbox3/rootfs-complete${ONEPATH}/${ONENAME}-BB-NOTUSED
  683. else
  684. cp -a -f $ONEAPPLET ./sandbox3/rootfs-complete${ONEPATH}/
  685. fi
  686. done
  687. [ -f packages-${DISTRO_FILE_PREFIX}/busybox/pinstall.sh ] && cat packages-${DISTRO_FILE_PREFIX}/busybox/pinstall.sh >> sandbox3/pinstall.sh
  688. echo 'echo "END OF pinstall.sh SCRIPT."' >> sandbox3/pinstall.sh
  689. chmod 755 sandbox3/pinstall.sh
  690. #pemasu start 131207
  691. echo "Removing extra documentation"
  692. for i in sandbox3/rootfs-complete/usr/share/doc/*; do
  693. if [ -d $i ]; then
  694. keep=0
  695. for j in legal pmusic pburn pbackup help wvdial ffconvert cups nls; do #140128 added back legal, 01micko
  696. case `basename $i` in
  697. $j)
  698. keep=1
  699. break 1
  700. ;;
  701. esac
  702. done
  703. [ $keep -eq 0 ] && rm -rf $i
  704. fi
  705. done
  706. echo "Removing extra documentation"
  707. for i in sandbox3/rootfs-complete/usr/share/locale/*; do
  708. if [ -d $i ]; then
  709. keep=0
  710. for j in en en_US locale.alias fi; do
  711. case `basename $i` in
  712. $j)
  713. keep=1
  714. break 1
  715. ;;
  716. esac
  717. done
  718. [ $keep -eq 0 ] && rm -rf $i
  719. fi
  720. done
  721. rm -rf sandbox3/rootfs-complete/usr/share/man/* 2>/dev/null
  722. rm -rf sandbox3/rootfs-complete/usr/share/info/* 2>/dev/null
  723. rm -rf sandbox3/rootfs-complete/usr/share/cups/doc-root/help/* 2>/dev/null
  724. #pemasu end
  725. #run post-install script...
  726. echo
  727. echo "Executing sandbox3/pinstall.sh post-install script..."
  728. cd $WKGDIR/sandbox3/rootfs-complete
  729. SAVEWKGDIR="$WKGDIR"
  730. $WKGDIR/sandbox3/pinstall.sh
  731. echo "If you did not get 'End of pinstall.sh' message above, then"
  732. echo -n "it aborted before completion. Press ENTER or CTRL-C: "
  733. read isitbad
  734. WKGDIR="$SAVEWKGDIR"
  735. cd $WKGDIR
  736. #100316 script to handle improper shutdown, full hd install...
  737. if [ -f sandbox3/rootfs-complete/sbin/initNEW ];then
  738. rm -f sandbox3/rootfs-complete/sbin/init #a busybox link.
  739. mv -f sandbox3/rootfs-complete/sbin/initNEW sandbox3/rootfs-complete/sbin/init
  740. fi
  741. #now do dependency check...
  742. dependcheck() {
  743. echo -n "" > /tmp/missinglibs.txt
  744. echo -n "" > /tmp/notmissinglibs0.txt
  745. echo -n "" > /tmp/notusedlibs.txt
  746. #FNDFILES="`find $WKGDIR/sandbox3/rootfs-complete -type f | tr "\n" " "`"
  747. #for ONEFILE in $FNDFILES
  748. find $WKGDIR/sandbox3/rootfs-complete -type f | #110516
  749. while read ONEFILE #110516
  750. do
  751. echo -n '.'
  752. ISANEXEC="`file --brief $ONEFILE | grep -E "LSB executable|shared object"`"
  753. if [ ! "$ISANEXEC" = "" ];then
  754. #need to chroot into rootfs-complete...
  755. NUMBYTESALL="`echo -n "$ONEFILE" | wc -c | tr -s " " | cut -f 2 -d " "`"
  756. NUMBYTESHD=`echo -n "$WKGDIR/sandbox3/rootfs-complete" | wc -c | tr -s " " | cut -f 2 -d " "`
  757. NUMBYTESHD="`expr $NUMBYTESHD + 1`"
  758. NEWROOTFILE="`echo -n "$ONEFILE" | cut -b $NUMBYTESHD-$NUMBYTESALL`"
  759. LDDRESULT="`chroot ${WKGDIR}/sandbox3/rootfs-complete ldd ${NEWROOTFILE}`"
  760. MISSINGLIBS="`echo "$LDDRESULT" | grep "not found" | cut -f 2 | cut -f 1 -d " " | tr "\n" " "`"
  761. if [ ! "$MISSINGLIBS" = "" ];then
  762. echo "File $ONEFILE has these missing library files:" >> /tmp/missinglibs.txt
  763. echo " $MISSINGLIBS" >> /tmp/missinglibs.txt
  764. echo "The missing libs are in these packages:" >> /tmp/missinglibs.txt
  765. for ONEMISSING in $MISSINGLIBS
  766. do
  767. find ${WKGDIR}/packages-${DISTRO_FILE_PREFIX} -name $ONEMISSING >> /tmp/missinglibs.txt
  768. done
  769. fi
  770. #find all libs not missing...
  771. NOTMISSING="`file --brief $ONEFILE | grep -v "not found" | grep "shared object"`"
  772. if [ "$NOTMISSING" != "" ];then
  773. basename "$ONEFILE" >> /tmp/notmissinglibs0.txt
  774. fi
  775. fi
  776. done
  777. sync
  778. sort -u /tmp/notmissinglibs0.txt > /tmp/notmissinglibs.txt
  779. #now go thru rootfs-complete and see if any unused libs...
  780. #FNDFILES="`find $WKGDIR/sandbox3/rootfs-complete -type f | tr "\n" " "`"
  781. #for ONEFILE in $FNDFILES
  782. find $WKGDIR/sandbox3/rootfs-complete -type f | #110516
  783. while read ONEFILE #110516
  784. do
  785. ISANLIB="`file --brief $ONEFILE | grep "shared object"`"
  786. if [ ! "$ISANLIB" = "" ];then
  787. FILEBASE='/'"`basename $ONEFILE`"'$'
  788. FNDMATCH="`cat /tmp/notmissinglibs.txt | grep "$FILEBASE"`"
  789. if [ "$FNDMATCH" = "" ];then
  790. echo "File $ONEFILE is in Puppy but is not used." >> /tmp/notusedlibs.txt
  791. fi
  792. fi
  793. done
  794. }
  795. echo
  796. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  797. echo "This script can now optionally do a thorough dependency check. "
  798. echo "Note, this may take a long time."
  799. echo -e "Press \"c\" key then ENTER to do thorough check,"
  800. echo -n "else just press ENTER key to bypass check: "
  801. read mmnn
  802. else
  803. echo "Normally, the script now offers to perform a thorough dependency check."
  804. echo "However, as the host and target architectures are different, this cannot"
  805. echo "be done (host=${WOOF_HOSTARCH}, target=${WOOF_TARGETARCH})."
  806. echo "If you want to do this check, do a build with host and target the same,"
  807. echo "with same package selection."
  808. echo -n "Press ENTER key to continue: "
  809. read mmnn
  810. mmnn=""
  811. fi
  812. echo
  813. if [ "$mmnn" = "c" ];then
  814. echo "Wait awhile..."
  815. dependcheck
  816. if [ -s /tmp/missinglibs.txt ];then #true if file not zero size.
  817. echo
  818. echo "UNFORTUNATELY, these libs are missing:"
  819. cat /tmp/missinglibs.txt
  820. echo
  821. echo -e "Press \"c\" key then ENTER key to exit,"
  822. echo -n "or if you really want to ignore problem, just press ENTER: "
  823. read goto1
  824. fi
  825. [ "$goto1" = "c" ] && exit
  826. if [ -s /tmp/notusedlibs.txt ];then
  827. echo
  828. echo "INTERESTING, the following libs are in Puppy but apparently not used:"
  829. cat /tmp/notusedlibs.txt
  830. echo
  831. echo -e "Press \"c\" key then ENTER key to exit,"
  832. echo -n "or if you really want to ignore problem, just press ENTER: "
  833. read goto1
  834. fi
  835. [ "$goto1" = "c" ] && exit
  836. fi
  837. echo "...done."
  838. #now do the kernel...
  839. echo
  840. echo "Now installing the kernel into build/ and modules into rootfs-complete/..."
  841. rm -f sandbox3/$KERNELPKG
  842. KERNPKGNAMEONLY="`basename $KERNELPKG .pet`"
  843. rm -rf sandbox3/$KERNPKGNAMEONLY
  844. cp packages-pet/${KERNELPKG} sandbox3/
  845. cd sandbox3
  846. pet2tgz $KERNELPKG
  847. tar -xf $KERNPKGNAMEONLY.tar.?z #13124 xz
  848. cp -a --remove-destination $KERNPKGNAMEONLY/* rootfs-complete/
  849. #100603 i'm now putting common kernel files in here...
  850. cp -a -f ../kernel-skeleton/* rootfs-complete/
  851. #110918 kernel-skeleton now has a pinstall.sh script... 131207 revert ..131212 revert, revert!
  852. cd rootfs-complete
  853. ./pinstall.sh
  854. sync
  855. rm -f ./pinstall.sh
  856. cd ..
  857. mv -f rootfs-complete/etc/modules/firmware.dep rootfs-complete/etc/modules/firmware.dep.${KERNELVER}
  858. sync
  859. rm -rf build
  860. mkdir build
  861. #120613 kernel image can have different names. rename to vmlinuz, however change back later if build sd card...
  862. REALKERNAME='vmlinuz'
  863. [ -f rootfs-complete/boot/vmlinuz ] && cp rootfs-complete/boot/vmlinuz build/
  864. if [ -f rootfs-complete/boot/uImage ];then #mele a1000
  865. cp rootfs-complete/boot/uImage build/vmlinuz #120506 arm builds, using different name for kernel.
  866. REALKERNAME='uImage'
  867. fi
  868. if [ -f rootfs-complete/boot/kernel.img ];then #raspberry pi
  869. cp rootfs-complete/boot/kernel.img build/vmlinuz
  870. REALKERNAME='kernel.img'
  871. fi
  872. [ -f rootfs-complete/boot/System.map ] && cp rootfs-complete/boot/System.map ./
  873. sync
  874. rm -rf rootfs-complete/boot
  875. echo -n "$IDSTRING" >> build/vmlinuz #100911 16-byte id-string appended. init can determine boot partition.
  876. #110722 need this, to put into woof-installed-packages...
  877. KERNEL_DB_ENTRY="`cat rootfs-complete/pet.specs`"
  878. rm -f rootfs-complete/pet.specs
  879. #arch .INSTALL files
  880. #130316 NOTE: maybe could do this without chroot, as for slackware in 2createpackages (see 2createpackages-hack-install.sh).
  881. # ok, I have looked through all pkgs used in build, most .INSTALL are trivial. these are slight exceptions:
  882. # cmake glibc_dev_DEV libglade2 libwmf man_DEV openldap perl_DEV subversion_DEV
  883. # but, don't really need to execute those either. besides, the code below is only operating upon rootfs-complete, it would be better
  884. # to aufs mount the devx, as is done in sandbox2b in 2createpackages. comment out all of below...
  885. if [ "${DISTRO_BINARY_COMPAT}" = "arch" ]; then
  886. rm -f rootfs-complete/.INSTALL*
  887. # numberOfDotInstall=1
  888. # for FOLDER in `ls -1 ${WKGDIR}/packages-${DISTRO_FILE_PREFIX} | tr '\n' ' '` #130307
  889. # do
  890. # [ ! -f ${WKGDIR}/packages-${DISTRO_FILE_PREFIX}/${FOLDER}/.INSTALL ] && continue
  891. # PKGVER="`grep -e '^pkgver' "${WKGDIR}/packages-${DISTRO_FILE_PREFIX}/${FOLDER}/.PKGINFO" | sed 's/^pkgver\ =\ //' | sed 's/-[^-]//'`"
  892. # cp ${WKGDIR}/packages-${DISTRO_FILE_PREFIX}/${FOLDER}/.INSTALL "rootfs-complete/.INSTALL${numberOfDotInstall}-${PKGVER}"
  893. # let numberOfDotInstall++
  894. # done
  895. # if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #130316
  896. # cp ${WKGDIR}/support/arch/runDotInstalls rootfs-complete/
  897. # chroot "${PWD}/rootfs-complete" "/runDotInstalls" &> /dev/null
  898. # rm -f rootfs-complete/runDotInstalls
  899. # else
  900. # echo "Unfortunately, cannot execute Arch install scripts, as this is a cross-build."
  901. # fi
  902. # rm -f rootfs-complete/.INSTALL*
  903. fi
  904. #130314 want to run arch post-install script from ppm also...
  905. mkdir -p rootfs-complete/usr/local/petget
  906. cp ${WKGDIR}/support/arch/runDotInstalls rootfs-complete/usr/local/petget/ArchRunDotInstalls
  907. chmod 755 rootfs-complete/usr/local/petget/ArchRunDotInstalls
  908. if [ "$CHOICE_SCSI" = "" ];then
  909. #w462 true-scsi drives
  910. echo
  911. echo "Would you like the live-CD to be able to recognise and even boot from"
  912. echo "old true-SCSI hard drives and CD drives?"
  913. echo "Most likely you would just press the ENTER key only to decline, as the"
  914. echo "vast majority of PCs do not have true-SCSI hardware. However, 10-20 years"
  915. echo "ago it was popular in network server computers."
  916. echo "Note, really old pre-PCI computers will not be supported at all."
  917. echo -n "Enter only to decline, any other key for SCSI drivers in live-CD: "
  918. read wantscsi
  919. CHOICE_SCSI="Erase_SCSI"
  920. [ "$wantscsi" != "" ] && CHOICE_SCSI="Boot_SCSI"
  921. fi
  922. #130613 kmod depmod wants these two... they are moved in later, but do it here also...
  923. mkdir -p rootfs-complete/lib/modules/$KERNELVER
  924. [ -f rootfs-complete/etc/modules/modules.builtin ] && cp -a -f rootfs-complete/etc/modules/modules.builtin rootfs-complete/lib/modules/$KERNELVER/
  925. [ -f rootfs-complete/etc/modules/modules.order ] && cp -a -f rootfs-complete/etc/modules/modules.order rootfs-complete/lib/modules/$KERNELVER/
  926. #110712 modinfo won't work if modules.* files missing...
  927. #130418 if kmod, do not use busybox depmod...
  928. USINGKMOD='no'
  929. [ "`grep '^kmod' ../woof-installed-packages`" != "" ] && USINGKMOD='yes'
  930. if [ "$USINGKMOD" = "no" ];then
  931. cp -f ../boot/depmod ./
  932. if [ ! -f rootfs-complete/lib/modules/$KERNELVER/modules.dep ];then
  933. busybox depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  934. fi
  935. else
  936. cp -f ../boot/kmod ./
  937. ln -snf kmod depmod
  938. if [ ! -f rootfs-complete/lib/modules/$KERNELVER/modules.dep ];then
  939. ./depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  940. fi
  941. fi
  942. SCSIFLAG=""
  943. SCSIDRVS="parport.ko"
  944. if [ "$CHOICE_SCSI" = "Boot_SCSI" ];then #note, further down, scsi modules get moved to initrd.
  945. SCSIFLAG="-SCSI" #used in name of .iso file.
  946. #mkdir -p initrd-tree/lib/modules/$KERNELVER/kernel/drivers
  947. #cp -a -f rootfs-complete/lib/modules/$KERNELVER/kernel/drivers/scsi initrd-tree/lib/modules/$KERNELVER/kernel/drivers/
  948. for ONESCSI in `find rootfs-complete/lib/modules/$KERNELVER/kernel/drivers/scsi -type f -name \*.ko`
  949. do
  950. #really only want those with pci interface...
  951. SCSIBASE="`basename $ONESCSI`"
  952. SCSINAMEONLY="`basename $ONESCSI .ko`"
  953. ALIASFND="`modinfo -b rootfs-complete -k ${KERNELVER} ${SCSINAMEONLY} 2>/dev/null | grep '^alias:'`"
  954. if [ "$ALIASFND" ];then
  955. SCSIDRVS="$SCSIDRVS $SCSIBASE"
  956. #add any deps to list...
  957. SCSIDEPS="`modinfo -b rootfs-complete -k ${KERNELVER} ${SCSINAMEONLY} 2>/dev/null | grep '^depends:' | head -n 1 | tr -s ' ' | cut -f 2 -d ' ' | sed -e 's%,%.ko %g' -e 's%$%.ko%'`"
  958. [ "$SCSIDEPS" != ".ko" ] && SCSIDRVS="$SCSIDRVS $SCSIDEPS"
  959. fi
  960. done
  961. fi
  962. ##w479 ask about removing old analog modem modules...
  963. #INTELMODEMMOD="`find rootfs-complete/lib/modules/$KERNELVER/kernel/drivers/char -type f -name Intel*ko*`"
  964. #if [ "$INTELMODEMMOD" != "" ];then
  965. # echo
  966. # echo "Would you like to remove the Intel 536 and 537 analog modem modules?"
  967. # echo "These are an enormous waste of space (1MB and 4MB uncompressed) if you"
  968. # echo "don't have one of those particular old modem dialup cards."
  969. # echo -n "Press ENTER only to delete them: "
  970. # read DELINTEL
  971. # if [ "$DELINTEL" = "" ];then
  972. # for ONEMODEM in $INTELMODEMMOD
  973. # do
  974. # echo "Removing $ONEMODEM"
  975. # rm -f $ONEMODEM
  976. # done
  977. # fi
  978. #fi
  979. if [ "$CHOICE_BIGMODEM" != "Erase_big_modems" ];then #v431
  980. # INTELMODEMMOD="`find rootfs-complete/lib/modules/${KERNELVER} -type f -iname intel5*ko*`"
  981. INTELMODEMMOD="`find rootfs-complete/lib/modules/${KERNELVER} -type f -iname 'intel5*ko' -o -iname 'intel5*HIDE'`" #101222
  982. if [ "$INTELMODEMMOD" != "" ];then
  983. echo
  984. if [ "$CHOICE_BIGMODEM" ];then
  985. echo "You already selected what to do with the \"big modems\", however, this"
  986. echo "question is specifically about the Intel 536 and 537 analog modems, that"
  987. echo "are enormous and you might want to delete them, independently of the"
  988. echo "choice already made for the big modems."
  989. else
  990. echo "The next question will ask what to do with the \"big modems\", however, this"
  991. echo "question is specifically about the Intel 536 and 537 analog modems, that"
  992. echo "are enormous and you might want to delete them, independently of the"
  993. echo "choise that will be made next for the big modems."
  994. fi
  995. echo
  996. echo "Would you like to remove the Intel 536 and 537 analog modem modules?"
  997. echo "These are an enormous waste of space (1MB - 18MB uncompressed) if you"
  998. echo "don't have one of those particular old modem dialup cards."
  999. echo -n "Press ENTER only to delete them: "
  1000. read DELINTEL
  1001. if [ "$DELINTEL" = "" ];then
  1002. for ONEMODEM in $INTELMODEMMOD
  1003. do
  1004. echo "Removing $ONEMODEM"
  1005. rm -f $ONEMODEM
  1006. done
  1007. fi
  1008. fi
  1009. fi
  1010. #v425 offer to move all the big analog modem modules to zdrv...
  1011. rm -rf big-modem-modules 2>/dev/null
  1012. rm -rf big-modem-firmware 2>/dev/null
  1013. if [ "$CHOICE_BIGMODEM" = "" ];then
  1014. echo
  1015. echo "Some of the analog (dialup) modem drivers are massive."
  1016. echo "If you just press ENTER, the big drivers, for Conexant, Intel and Agere,"
  1017. echo "will be deleted, but there will still be support for many software modems"
  1018. echo "(Smartlink, Pctel, Lucent) as well as true hardware modems."
  1019. echo "Or, type 'z' then enter to move them to a separate zdrv,"
  1020. echo "or, any other printable char to keep them in the main live-cd file"
  1021. echo "(warning, last option will make main f.s. much bigger)"
  1022. echo -n "Press ENTER, 'z' or any other char: "
  1023. read DELHSF
  1024. CHOICE_BIGMODEM="Keep_big_modems"
  1025. [ "$DELHSF" = "" ] && CHOICE_BIGMODEM="Erase_big_modems"
  1026. [ "$DELHSF" = "z" ] && CHOICE_BIGMODEM="Zdrv_big_modems"
  1027. fi
  1028. if [ "$CHOICE_BIGMODEM" = "Erase_big_modems" ];then
  1029. echo
  1030. echo "ok, deleting big modem modules..."
  1031. #101028 added ko* as have some named .koHIDE
  1032. for BIGMODS in agr hcf hsf intel5 Intel5 esscom pctel
  1033. do
  1034. # for ONEBIGMOD in `find rootfs-complete/lib/modules/${KERNELVER}/ -type f -name ${BIGMODS}*.ko*`
  1035. for ONEBIGMOD in `find rootfs-complete/lib/modules/${KERNELVER}/ -type f -name ${BIGMODS}*.ko -o -name ${BIGMODS}*HIDE` #101222
  1036. do
  1037. BIGMODNAME="`basename $ONEBIGMOD`"
  1038. echo -n "$BIGMODNAME "
  1039. [ -f $ONEBIGMOD ] && rm -f $ONEBIGMOD
  1040. done
  1041. done
  1042. rm -rf rootfs-complete/lib/modules/all-firmware/hsfmodem 2>/dev/null
  1043. rm -f rootfs-complete/lib/modules/all-firmware/hsfmodem.tar.gz 2>/dev/null
  1044. rm -rf rootfs-complete/lib/modules/all-firmware/hcfpcimodem 2>/dev/null
  1045. rm -f rootfs-complete/lib/modules/all-firmware/hcfpcimodem.tar.gz 2>/dev/null
  1046. rm -rf rootfs-complete/lib/modules/all-firmware/intel536ep 2>/dev/null
  1047. rm -f rootfs-complete/lib/modules/all-firmware/intel536ep.tar.gz 2>/dev/null
  1048. rm -rf rootfs-complete/lib/modules/all-firmware/intel537* 2>/dev/null
  1049. rm -f rootfs-complete/lib/modules/all-firmware/intel537*.tar.gz 2>/dev/null
  1050. fi
  1051. MAKEZDRV="" #100903
  1052. if [ "$CHOICE_BIGMODEM" = "Zdrv_big_modems" ];then
  1053. echo "ok, moving big modem modules to separate zdrv sfs file..."
  1054. MAKEZDRV="big-modems" #100903
  1055. mkdir big-modem-modules
  1056. mkdir big-modem-firmware
  1057. #101028 added ko* as have some named .koHIDE
  1058. for BIGMODS in agr hcf hsf intel5 Intel5
  1059. do
  1060. # for ONEBIGMOD in `find rootfs-complete/lib/modules/$KERNELVER/ -type f -name ${BIGMODS}*.ko*`
  1061. for ONEBIGMOD in `find rootfs-complete/lib/modules/$KERNELVER/ -type f -name ${BIGMODS}*.ko -o -name ${BIGMODS}*HIDE` #101222
  1062. do
  1063. BIGMODNAME="`basename $ONEBIGMOD`"
  1064. echo -n "$BIGMODNAME "
  1065. ONEBIGDIR="`dirname $ONEBIGMOD`"
  1066. mkdir -p big-modem-modules/$ONEBIGDIR
  1067. mv $ONEBIGMOD big-modem-modules/$ONEBIGDIR/
  1068. done
  1069. done
  1070. mv -f rootfs-complete/lib/modules/all-firmware/hsfmodem big-modem-firmware/ 2>/dev/null
  1071. mv -f rootfs-complete/lib/modules/all-firmware/hsfmodem.tar.gz big-modem-firmware/ 2>/dev/null
  1072. mv -f rootfs-complete/lib/modules/all-firmware/hcfpcimodem big-modem-firmware/ 2>/dev/null
  1073. mv -f rootfs-complete/lib/modules/all-firmware/hcfpcimodem.tar.gz big-modem-firmware/ 2>/dev/null
  1074. mv -f rootfs-complete/lib/modules/all-firmware/intel536ep big-modem-firmware/ 2>/dev/null
  1075. mv -f rootfs-complete/lib/modules/all-firmware/intel536ep.tar.gz big-modem-firmware/ 2>/dev/null
  1076. mv -f rootfs-complete/lib/modules/all-firmware/intel537* big-modem-firmware/ 2>/dev/null
  1077. mv -f rootfs-complete/lib/modules/all-firmware/intel537*.tar.gz big-modem-firmware/ 2>/dev/null
  1078. fi
  1079. # 140309
  1080. echo
  1081. echo "Symlinking firmware"
  1082. cd rootfs-complete/lib/firmware
  1083. for ucode in RTL8192U RTL8192E rtlwifi libertas_firmware libertas_tf dvb-usb-firmware rt2x00 zd1201_firmware mwl8k rtl8188_8192su acx_firmware rtl_nic ipw2100_firmware-1.3 ipw2200_firmware-3.0 nouveau prism54_firmware iwlwifi
  1084. do ln -sf ../modules/all-firmware/${ucode}/lib/firmware/* .
  1085. done
  1086. cd -
  1087. echo
  1088. if [ "$CHK_FB_STATE" = "" ];then
  1089. #w481 remove framebuffer modules...
  1090. echo
  1091. echo "The kernel is configured with the vesafb driver builtin, which is usually enough"
  1092. echo "if it is ever required to boot in framebuffer video mode. The other framebuffer"
  1093. echo "modules take up about 1.4MB uncompressed and are not normally required."
  1094. echo -n "Press ENTER only to delete the other framebuffer modules: "
  1095. read DELFBM
  1096. CHK_FB_STATE="false"
  1097. [ "$DELFBM" = "" ] && CHK_FB_STATE="true"
  1098. fi
  1099. if [ "$CHK_FB_STATE" = "true" ];then
  1100. #130430 gpu/drm/sis.ko needs sisfb.ko, must keep...
  1101. echo
  1102. echo "Deleting framebuffer modules..."
  1103. find rootfs-complete/lib/modules/$KERNELVER/kernel/drivers/video -type f -name '*fb.ko' -o -name '*fb_*.ko' |
  1104. while read ONEMODULE
  1105. do
  1106. ONEBASE="`basename $ONEMODULE`"
  1107. [ "$ONEBASE" = "sisfb.ko" ] && continue #130430
  1108. echo -n "$ONEBASE "
  1109. rm -f $ONEMODULE
  1110. done
  1111. echo
  1112. fi
  1113. if [ "$CHK_EXOTIC_STATE" = "" ];then
  1114. echo
  1115. echo "A bit later in the script you will be asked if you would like to cut the modules"
  1116. echo "right down to a fairly basic selection. However, for now you can choose a minor"
  1117. echo "cutdown of some 'exotic' modules that are unlikely to be needed."
  1118. echo "Press any printable character to keep these, or"
  1119. echo "press ENTER only to remove 'exotic' modules: "
  1120. read keepexotic
  1121. CHK_EXOTIC_STATE="false"
  1122. [ "$keepexotic" = "" ] && CHK_EXOTIC_STATE="true"
  1123. fi
  1124. if [ "$CHK_EXOTIC_STATE" = "true" ];then
  1125. echo
  1126. echo "Deleting exotic modules..."
  1127. #v423 nfs.ko needs sunrpc.ko and lockd.ko... nfsd.ko needs exportfs.ko...
  1128. #v423 someone is working on autofs, so bring that back too...
  1129. #EXOTICFS=' fs/autofs fs/autofs4 fs/befs fs/bfs fs/coda fs/cramfs fs/exportfs fs/freevxfs fs/jffs2 fs/jfs fs/lockd fs/ncpfs fs/romfs fs/sysv '
  1130. #EXOTICNET=' net/appletalk net/ipv6 net/ipx net/llc net/sunrpc net/wanrouter '
  1131. EXOTICFS=' fs/befs fs/bfs fs/coda fs/cramfs fs/freevxfs fs/jffs2 fs/jfs fs/ncpfs fs/romfs fs/sysv '
  1132. EXOTICNET=' net/appletalk net/ipv6 net/ipx net/llc net/wanrouter '
  1133. EXOTICDRIVERS=' drivers/block/paride drivers/block/aoe drivers/mtd drivers/telephony '
  1134. for ONEDIR in $EXOTICFS $EXOTICNET $EXOTICDRIVERS
  1135. do
  1136. if [ -d rootfs-complete/lib/modules/$KERNELVER/kernel/$ONEDIR ];then
  1137. echo -n "$ONEDIR "
  1138. rm -rf rootfs-complete/lib/modules/$KERNELVER/kernel/$ONEDIR
  1139. fi
  1140. done
  1141. sync
  1142. echo
  1143. fi
  1144. #build the initrd-tree...
  1145. echo
  1146. echo "Now building initial ramdisk in initrd-tree/..."
  1147. rm -rf initrd-tree
  1148. cp -a ../boot/initrd-tree0 ./initrd-tree
  1149. cp ../DISTRO_SPECS ./initrd-tree/
  1150. #091222 support laptop internal sd/mmc cards at bootup...
  1151. MEMXTRAMODS='tifm_core.ko tifm_7xx1.ko mmc_core.ko mmc_block.ko tifm_sd.ko led-class.ko sdhci.ko sdhci-pci.ko'
  1152. #v423 2.6.29/30 kernels have extra hid-* modules needed for wireless keyboard to work...
  1153. #HIDXTRAMODS='hid-a4tech.ko hid-apple.ko hid-belkin.ko hid-cherry.ko hid-chicony.ko hid-cypress.ko hid-ezkey.ko hid-gyration.ko hid-logitech.ko hid-microsoft.ko hid-monterey.ko hid-ntrig.ko hid-petalynx.ko hid-pl.ko hid-samsung.ko hid-sony.ko hid-sunplus.ko hid-topseed.ko'
  1154. #110712 reduce list a bit, exclude hid drivers that are not keyboard (note, 2.6.39-3 kernel configured with them builtin)...
  1155. # removed: hid-gyration.ko hid-ntrig.ko hid-petalynx.ko hid-pl.ko hid-sony.ko hid-sunplus.ko hid-topseed.ko
  1156. HIDXTRAMODS='hid-a4tech.ko hid-apple.ko hid-belkin.ko hid-cherry.ko hid-chicony.ko hid-cypress.ko hid-ezkey.ko hid-logitech.ko hid-microsoft.ko hid-monterey.ko hid-samsung.ko'
  1157. #copy some modules to initrd-tree/... w007 added nls_utf8.ko w468 added nls_cp850.ko w476 added nls_iso8859-2.ko, nls_cp850.ko, nls_cp852.ko. 100214 added floppy.ko, psmouse.ko
  1158. #100406 add btrfs.ko and its deps libcrc32c.ko,zlib_deflate.ko
  1159. #121227 if kernel has f.s. drivers as modules (quirky6), added ext2.ko ext3.ko ext4.ko fat.ko msdos.ko vfat.ko ntfs.ko reiserfs.ko udf.ko, and deps: jbd.ko mbcache.ko jbd2.ko
  1160. NEEDEDINITRDMODS=" ${SCSIDRVS} aufs.ko cdrom.ko fuse.ko ide-cd.ko ide-floppy.ko nls_cp437.ko nls_cp850.ko nls_cp852.ko nls_iso8859-1.ko nls_iso8859-2.ko nls_utf8.ko nls_cp850.ko sqlzma.ko squashfs.ko sr_mod.ko unionfs.ko unlzma.ko aes.ko aes_generic.ko blkcipher.ko crypto_blkcipher.ko cbc.ko cryptoloop.ko rsrc_nonstatic.ko yenta_socket.ko ehci-hcd.ko ohci-hcd.ko uhci-hcd.ko usb-storage.ko usbcore.ko usbhid.ko scsi_wait_scan.ko ssb.ko ${HIDXTRAMODS} ${DISTRO_MODULES} ${MEMXTRAMODS} floppy.ko psmouse.ko btrfs.ko libcrc32c.ko zlib_deflate.ko ext2.ko ext3.ko ext4.ko fat.ko msdos.ko vfat.ko ntfs.ko reiserfs.ko udf.ko jbd.ko mbcache.ko jbd2.ko "
  1161. NEEDEDINITRDMODS="`echo -n "$NEEDEDINITRDMODS" | tr -s ' ' | tr ' ' '\n' | sort -u | tr '\n' ' '`"
  1162. for ONENEEDED in $NEEDEDINITRDMODS
  1163. do
  1164. echo -n "$ONENEEDED "
  1165. FNDONE="`find rootfs-complete/lib/modules -type f -name $ONENEEDED | sed -e 's/rootfs\-complete//'`"
  1166. if [ "$FNDONE" != "" ];then
  1167. FNDDIR="`dirname $FNDONE`"
  1168. mkdir -p initrd-tree$FNDDIR
  1169. cp -a rootfs-complete${FNDONE} initrd-tree${FNDONE}
  1170. gzip initrd-tree${FNDONE}
  1171. [ "$SDFLAG" = "" ] && rm -f rootfs-complete${FNDONE} #avoid duplication. 120521 SD-image, do not delete.
  1172. fi
  1173. done
  1174. #091121 want to load keyboard layout in initrd... (note, init script copies them back at bootup)
  1175. #120521 no, do not move, copy only, in situation where building for SD image (that has no initrd)...
  1176. if [ "$SDFLAG" != "" ];then
  1177. #not actually using an initrd, but let's keep the initrd functional...
  1178. cp -a -f rootfs-complete/lib/keymaps initrd-tree/lib/
  1179. cp -a -f rootfs-complete/lib/consolefonts initrd-tree/lib/
  1180. else
  1181. mv -f rootfs-complete/lib/keymaps initrd-tree/lib/
  1182. mv -f rootfs-complete/lib/consolefonts initrd-tree/lib/
  1183. fi
  1184. sync
  1185. if [ "$CHOICE_SCSI" != "Keep_SCSI" ];then #v431
  1186. #get rid of scsi modules except some essentials...
  1187. #note, above option to move some to initrd has left some old pre-PCI modules behind.
  1188. rm -rf /tmp/scsi-keep
  1189. mkdir /tmp/scsi-keep
  1190. for ONEKEEP in imm.ko ppa.ko raid_class.ko sg.ko scsi_wait_scan.ko
  1191. do
  1192. ONEFND="`find rootfs-complete/lib/modules/$KERNELVER/kernel/drivers/scsi -type f -name $ONEKEEP`"
  1193. [ "$ONEFND" ] && cp -a $ONEFND /tmp/scsi-keep/
  1194. done
  1195. rm -rf rootfs-complete/lib/modules/$KERNELVER/kernel/drivers/scsi
  1196. cp -a /tmp/scsi-keep rootfs-complete/lib/modules/$KERNELVER/kernel/drivers/scsi
  1197. fi
  1198. #091225 remove duplicate executables...
  1199. #busybox in initrd is different, cp needed in main f.s. later by 3builddistro...
  1200. #100101 find in initrd does not support '-L' option... bit nervous taking out 'rev'...
  1201. #100128 symlinks get lost, for now leave out e2fsck, resize2fs, fsck, e3...
  1202. #100527 leave out lsmod, modinfo, ntfs-3g as causes symlinks to get deleted...
  1203. #100527 in fact, abandon this whole thing...
  1204. #INITRDEXES="`find initrd-tree/bin -type f | grep -v 'e2fsck' | grep -v 'resize2fs' | grep -v 'fsck' | grep -v 'busybox' | grep -v 'e3' | grep -v 'cp' | grep -v 'find' | grep -v 'rev' | rev | cut -f 1 -d '/' | rev | tr '\n' ' '`"
  1205. #echo -n "" > initrd-tree/bin/TARGETEXES #init script will read this.
  1206. #for ONEINITRDEXE in $INITRDEXES
  1207. #do
  1208. # echo "Remove duplicate of $ONEINITRDEXE in main f.s."
  1209. # ONEEXE="`find rootfs-complete/bin -maxdepth 1 -type f -name $ONEINITRDEXE | cut -f 2,3 -d '/'`"
  1210. # if [ "$ONEEXE" ];then
  1211. # rm -f rootfs-complete/$ONEEXE
  1212. # echo "$ONEEXE" >> initrd-tree/bin/TARGETEXES
  1213. # continue
  1214. # fi
  1215. # ONEEXE="`find rootfs-complete/sbin -maxdepth 1 -type f -name $ONEINITRDEXE | cut -f 2,3 -d '/'`"
  1216. # if [ "$ONEEXE" ];then
  1217. # rm -f rootfs-complete/$ONEEXE
  1218. # echo "$ONEEXE" >> initrd-tree/bin/TARGETEXES
  1219. # continue
  1220. # fi
  1221. # ONEEXE="`find rootfs-complete/usr/bin -maxdepth 1 -type f -name $ONEINITRDEXE | cut -f 2-4 -d '/'`"
  1222. # if [ "$ONEEXE" ];then
  1223. # rm -f rootfs-complete/$ONEEXE
  1224. # echo "$ONEEXE" >> initrd-tree/bin/TARGETEXES
  1225. # continue
  1226. # fi
  1227. # ONEEXE="`find rootfs-complete/usr/sbin -maxdepth 1 -type f -name $ONEINITRDEXE | cut -f 2-4 -d '/'`"
  1228. # if [ "$ONEEXE" ];then
  1229. # rm -f rootfs-complete/$ONEEXE
  1230. # echo "$ONEEXE" >> initrd-tree/bin/TARGETEXES
  1231. # continue
  1232. # fi
  1233. #done
  1234. #w091029 use busybox depmod, creates smaller modules* files...
  1235. if [ "$USINGKMOD" = "no" ];then #130418
  1236. cp -f ../boot/depmod ./
  1237. #101007 the latest busybox depmod generates relative paths in modules.dep (it is a config option)
  1238. # but this breaks the older modprobe in the initrd, so use older depmod...
  1239. ./depmod -b $WKGDIR/sandbox3/initrd-tree -F $WKGDIR/sandbox3/System.map $KERNELVER
  1240. #./depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  1241. #busybox depmod -b $WKGDIR/sandbox3/initrd-tree -F $WKGDIR/sandbox3/System.map $KERNELVER
  1242. busybox depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  1243. else
  1244. cp -f ../boot/depmod ./depmod.veryold
  1245. cp -f ../boot/kmod ./kmod
  1246. ln -snf kmod depmod
  1247. #130418 we do not use kmod in initrd (as unable to compile statically)...
  1248. #101007 the latest busybox depmod generates relative paths in modules.dep (it is a config option)
  1249. # but this breaks the older modprobe in the initrd, so use older depmod...
  1250. ./depmod.veryold -b $WKGDIR/sandbox3/initrd-tree -F $WKGDIR/sandbox3/System.map $KERNELVER
  1251. ./depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  1252. fi
  1253. sync
  1254. #101027 Iguleder reported DISTRO_SPECS did not have a carriage-return on last line...
  1255. xDISTROSPECS="`cat initrd-tree/DISTRO_SPECS`"
  1256. echo "$xDISTROSPECS" > initrd-tree/DISTRO_SPECS
  1257. echo "$xDISTROSPECS" > rootfs-complete/etc/DISTRO_SPECS
  1258. #100911
  1259. NEWVARIABLES="#32-byte alpha-numeric ID-string appended to vmlinuz, ${PUPPYSFS}, ${ZDRVSFS} and devx.sfs:
  1260. DISTRO_IDSTRING='${IDSTRING}'
  1261. #Puppy default filenames...
  1262. #Note, the 'SFS' files below are what the 'init' script in initrd.gz searches for,
  1263. #for the partition, path and actual files loaded, see PUPSFS and ZDRV in /etc/rc.d/PUPSTATE
  1264. DISTRO_PUPPYSFS='${PUPPYSFS}'
  1265. DISTRO_ZDRVSFS='${ZDRVSFS}'"
  1266. #DISTRO_DEVXSFS='${DEVXSFS}'"
  1267. echo "$NEWVARIABLES" >> initrd-tree/DISTRO_SPECS
  1268. echo "$NEWVARIABLES" >> rootfs-complete/etc/DISTRO_SPECS
  1269. sync
  1270. #120225 this is read by /usr/share/doc/convert-raw-docs...
  1271. DISTRO_PUPPYDATE="`date | tr -s " " | cut -f 2,6 -d " "`"
  1272. echo "DISTRO_PUPPYDATE='${DISTRO_PUPPYDATE}'" >> rootfs-complete/etc/DISTRO_SPECS
  1273. echo "DISTRO_PUPPYDATE='${DISTRO_PUPPYDATE}'" >> initrd-tree/DISTRO_SPECS
  1274. #120215 language translations for init script...
  1275. INITRDTRANSFILES="`find ../rootfs-skeleton/usr/share/sss/initrd_strings -mindepth 1 -maxdepth 1 -type f -name 'initrd_strings.*'`"
  1276. if [ "$INITRDTRANSFILES" ];then
  1277. for ATRANS in $INITRDTRANSFILES
  1278. do
  1279. ENDBIT="`echo -n "$ATRANS" | rev | cut -f 1 -d '.' | rev`" #ex: de (from initrd_strings.de)
  1280. mkdir -p initrd-tree/locale/${ENDBIT}
  1281. #only supporting translating the init script for now...
  1282. sPTN="/^\[init\]/,/^$/p" #this is a multi-line block find expression.
  1283. CODEBLOCK="`sed -n "$sPTN" ${ATRANS} | sed -e '/^#/d' -e '/%%/d' -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
  1284. [ ! "$CODEBLOCK" ] && continue #precaution.
  1285. echo "$CODEBLOCK" > initrd-tree/locale/${ENDBIT}/init #translation file, read by /init script in initrd.
  1286. done
  1287. fi
  1288. #120216 set default LANG and KMAP... 120401 improve...
  1289. echo
  1290. echo
  1291. echo "Puppy is built with a default locale LANG=en_US and keyboard layout KMAP=us,
  1292. which may be changed after bootup.
  1293. However, if you are building a language-specific Puppy, you may change the
  1294. defaults now. But, please do make sure that your Puppy has a 'langpack' PET
  1295. for your language installed -- if one does not exist, then you will have to
  1296. create one -- see MoManager in the Utility menu, also read the Menu -> Help
  1297. -> HOWTO Internationalization."
  1298. echo
  1299. echo "These are the available LANG values (in /usr/share/i18n/locales):
  1300. aa_DJ aa_ER aa_ER@saaho aa_ET af_ZA am_ET an_ES ar_AE ar_BH ar_DZ ar_EG ar_IN ar_IQ ar_JO ar_KW ar_LB ar_LY ar_MA ar_OM ar_QA ar_SA ar_SD ar_SY ar_TN ar_YE as_IN ast_ES az_AZ be_BY be_BY@latin ber_DZ ber_MA bg_BG bn_BD bn_IN br_FR br_FR@euro bs_BA byn_ER ca_AD ca_ES ca_ES@euro ca_FR ca_IT crh_UA csb_PL cs_CZ cy_GB da_DK de_AT de_AT@euro de_BE de_BE@euro de_CH de_DE de_DE@euro de_LU de_LU@euro dz_BT el_CY el_GR el_GR@euro en_AU en_BW en_CA en_DK en_GB en_HK en_IE en_IE@euro en_IN en_NG en_NZ en_PH en_SG en_US en_ZA en_ZW es_AR es_BO es_CL es_CO es_CR es_DO es_EC es_ES es_ES@euro es_GT es_HN es_MX es_NI es_PA es_PE es_PR es_PY es_SV es_US es_UY es_VE et_EE eu_ES eu_ES@euro fa_IR fi_FI fi_FI@euro fil_PH fo_FO fr_BE fr_BE@euro fr_CA fr_CH fr_FR fr_FR@euro fr_LU fr_LU@euro fur_IT fy_DE fy_NL ga_IE ga_IE@euro gd_GB gez_ER gez_ER@abegede gez_ET gez_ET@abegede gl_ES gl_ES@euro gu_IN gv_GB ha_NG he_IL hi_IN hr_HR hsb_DE hu_HU hy_AM id_ID ig_NG ik_CA is_IS it_CH it_IT it_IT@euro iu_CA iw_IL ja_JP ka_GE kk_KZ kl_GL km_KH kn_IN ko_KR ks_IN ku_TR kw_GB ky_KG lg_UG li_BE li_NL lo_LA lt_LT lv_LV mai_IN mg_MG mi_NZ mk_MK ml_IN mn_MN mr_IN ms_MY mt_MT nb_NO nds_DE nds_NL ne_NP nl_BE nl_BE@euro nl_NL nl_NL@euro nn_NO nr_ZA nso_ZA oc_FR om_ET om_KE or_IN pa_IN pap_AN pa_PK pl_PL pt_BR pt_PT pt_PT@euro ro_RO ru_RU ru_UA rw_RW sa_IN sc_IT se_NO shs_CA sid_ET si_LK sk_SK sl_SI so_DJ so_ET so_KE so_SO sq_AL sr_ME sr_RS sr_RS@latin ss_ZA st_ZA sv_FI sv_FI@euro sv_SE ta_IN te_IN tg_TJ th_TH ti_ER ti_ET tig_ER tk_TM tl_PH tn_ZA tr_CY tr_TR ts_ZA tt_RU tt_RU@iqtelif ug_CN uk_UA ur_PK uz_UZ uz_UZ@cyrillic ve_ZA vi_VN wa_BE wa_BE@euro wal_ET wo_SN xh_ZA yi_US yo_NG zh_CN zh_HK zh_SG zh_TW zu_ZA"
  1301. echo "ENTER only for default, else type one of the above. Usually, you would want UTF-8 enabled, so append that. ex: de_DE.UTF-8."
  1302. echo "(the default is en_US.UTF-8)"
  1303. echo -n "ENTER only for default, or type it now: "
  1304. read DEFAULTLANG
  1305. if [ "$DEFAULTLANG" ];then
  1306. echo "...ok, set to ${DEFAULTLANG}"
  1307. DEFAULTLANG1="${DEFAULTLANG%_*}"
  1308. if [ "$DEFAULTLANG1" != "en" ];then
  1309. echo -n "$DEFAULTLANG" > initrd-tree/PUPPYLANG
  1310. echo
  1311. echo "These are the available keyboard layout values (in /lib/keymaps):
  1312. azerty be-latin1 br-abnt2 br-abnt br-latin1-abnt2 br-latin1-us by cf croat cz de de-latin1 dk dvorak dvorak-l dvorak-r es et fi fr gr hu101 hu il it jp106 lt mk nl no pl pt-latin1 ro ru se sg sk-qwerty sk-qwertz slovene sv-latin1 uk us wangbe"
  1313. echo "You don't have to choose a default, as Puppy will try and guess at bootup. Whatever, after bootup the user will have the opportunity to change it, in the QuickSetup window."
  1314. echo -n "Enter only for 'us', else type one of the above: "
  1315. read DEFAULTKMAP
  1316. [ "$DEFAULTKMAP" != "" ] && [ "$DEFAULTKMAP" != "us" ] && echo -n "$DEFAULTKMAP" > initrd-tree/PUPPYKEYMAP
  1317. [ "$DEFAULTKMAP" = "" ] && DEFAULTKMAP="us"
  1318. echo "...ok, set to ${DEFAULTKMAP}"
  1319. fi
  1320. else
  1321. DEFAULTLANG="en_US.UTF-8" #121123
  1322. echo "...ok, set to ${DEFAULTLANG}"
  1323. fi
  1324. #i think also, set LANG in /etc/profile...
  1325. sed -i -e "s%^LANG=.*%LANG=${DEFAULTLANG}%" rootfs-complete/etc/profile
  1326. echo
  1327. #130515
  1328. echo
  1329. echo "Puppy can create a file 'pupdesk.flg' on a hard-drive partition
  1330. (giving preference to a Linux f.s. if it exists) at first bootup (PUPMODE=5).
  1331. If the graphical desktop is successfully launched, the file is removed, and
  1332. never created again -- that is, it is a once-only ephemeral thing.
  1333. However, if the desktop fails, say hangs, and forced poweroff/reboot is
  1334. required, 'pupdesk.flg' will still exist at second bootup, which will force
  1335. the text-mode Xorg Video Wizard to run.
  1336. If you want to build a pup with this 'pupdesk.flg' mechanism, type the \"p\"
  1337. character now then press ENTER key. "
  1338. echo -n "Press ENTER only to disable 'pupdesk.flg' mechanism: "
  1339. read PUPDESKFLG
  1340. if [ "$PUPDESKFLG" = "p" ];then
  1341. echo '...enabled'
  1342. else
  1343. #change the message in iso 'help.msg', see further down.
  1344. #modify 'init' script in initrd...
  1345. sed -i -e 's%^PUPDESKFLG=.*%PUPDESKFLG=0%' initrd-tree/init
  1346. fi
  1347. #130618 check udev version... 130710 01micko: fix...
  1348. #130612 if kernel has CONFIG_DEVTMPFS=y (and CONFIG_DEVTMPFS_MOUNT=y) then empty /dev...
  1349. DEVTMPFSFLG=0
  1350. if [ "`grep 'CONFIG_DEVTMPFS.*=y' rootfs-complete/etc/modules/DOTconfig*`" != "" ];then
  1351. UDEV3=`grep -E '^udev[_-][0-9]' ../woof-installed-packages | cut -f 3 -d '|' | cut -c 1-3 | head -n 1`
  1352. [ ! $UDEV3 ] && UDEV3=200 #eudev
  1353. if [ $UDEV3 -ge 176 ];then #175 is last version that creates device nodes.
  1354. #modify 'init' script in initrd...
  1355. sed -i -e 's%^DEVTMPFSFLG=.*%DEVTMPFSFLG=2%' initrd-tree/init
  1356. DEVTMPFSFLG=2 #see further down.
  1357. fi
  1358. fi
  1359. sync
  1360. #build build/initrd.gz...
  1361. cp -f ../boot/makecpioinitrd ./
  1362. cp -f ../boot/cpio ./
  1363. ./makecpioinitrd
  1364. sync
  1365. mv -f initrd.gz build/
  1366. #offer to cutdown the modules, to build a smaller live-cd...
  1367. rm -rf zdrv 2>/dev/null #note, current dir is in sandbox3.
  1368. rm -f ${ZDRVSFS} #100911 zdrv.sfs
  1369. if [ "$CHK_RADICAL_STATE" = "" ];then
  1370. echo
  1371. echo -n "Press ENTER only to cutdown selection of modules, any other char to retain all: "
  1372. read cutthemdown
  1373. CHK_RADICAL_STATE="false"
  1374. [ "$cutthemdown" = "" ] && CHK_RADICAL_STATE="true"
  1375. fi
  1376. if [ "$CHK_RADICAL_STATE" = "true" ];then
  1377. if [ "$USINGKMOD" = "no" ];then #130418
  1378. busybox depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  1379. else
  1380. ./depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  1381. fi
  1382. cd rootfs-complete/lib/modules/$KERNELVER #makes it easier to handle find results.
  1383. #create a list of essential modules...
  1384. echo "Creating must-have lists..."
  1385. SOUNDMODS="`find ./kernel/sound/ -type f | sed -e 's/^\.\///g'`" #want all the alsa sound mods.
  1386. IPV4MODS="`find ./kernel/net/ipv4 -type f | sed -e 's/^\.\///g'`" #want all the firewall mods.
  1387. NETFILTERMODS="`find ./kernel/net/netfilter -type f | sed -e 's/^\.\///g'`"
  1388. #IEEE80211MODS="`find ./kernel/net/ieee80211 -type f | sed -e 's/^\.\///g'`" #want all the ieee80211 mods.
  1389. IEEE80211MODS="`find ./kernel/net/wireless -type f | sed -e 's/^\.\///g'`" #want all the wireless 80211 mods.
  1390. RFKILLMODS="`find ./kernel/net/rfkill -type f | sed -e 's/^\.\///g'`"
  1391. MAC80211MODS="`find ./kernel/net/mac80211 -type f | sed -e 's/^\.\///g'`"
  1392. WIMAXMODS="`find ./kernel/net/wimax -type f | sed -e 's/^\.\///g'`"
  1393. NETWORKMODS="`find ./kernel/drivers/net -type f | grep -vE '/wan/|/appletalk/' | sed -e 's/^\.\///g'`" #want all the network interface drivers.
  1394. UBUNTUMODS=""
  1395. [ -d ./kernel/ubuntu ] && UBUNTUMODS="`find ./kernel/ubuntu -type f | grep -vE '/compcache/|/gnbd/|/heci/|/lirc/' | sed -e 's/^\.\///g'`"
  1396. MMCMODS="`find ./kernel/drivers/mmc -type f | sed -e 's/^\.\///g'`" #include mmc/sd host drivers.
  1397. MEMSTICKMODS="`find ./kernel/drivers/memstick -type f | sed -e 's/^\.\///g'`"
  1398. MISCMODS="`find ./kernel/drivers/misc -type f | sed -e 's/^\.\///g'`"
  1399. USBMODS="`find ./kernel/drivers/usb -type f | sed -e 's/^\.\///g'`"
  1400. ACPIMODS="`find ./kernel/drivers/acpi -type f | sed -e 's/^\.\///g'`"
  1401. AGPMODS="`find ./kernel/drivers/char/agp -type f | sed -e 's/^\.\///g'`"
  1402. I2CMODS="`find ./kernel/drivers/i2c -type f | sed -e 's/^\.\///g'`"
  1403. PLATFORMMODS="`find ./kernel/drivers/platform -type f | sed -e 's/^\.\///g'`"
  1404. BLUETOOTHMODS="`find ./kernel/drivers/bluetooth -type f | sed -e 's/^\.\///g'`"
  1405. #w475 k2.6.29.3 has these usb webcam drivers...
  1406. GSPCAMODS=""
  1407. [ -d ./kernel/drivers/media/video/gspca ] && GSPCAMODS="`find ./kernel/drivers/media/video/gspca -type f | sed -e 's/^\.\///g'`"
  1408. #k2.6.25.16: kernel/drivers/char/drm, k2.6.27.4: kernel/drivers/gpu/drm...
  1409. DRMMODS="`find ./kernel/drivers -type f | grep '/drm/' | sed -e 's/^\.\///g'`"
  1410. USBMODEMLIST="cdc-acm.ko pl2303.ko nozomi.ko hso.ko option.ko sierra.ko"
  1411. ANALOGMODEMLIST="mwave.ko martian_dev.ko pctel.ko ltserial.ko slamr.ko slusb.ko esscom.ko"
  1412. CPUSCALING2MODS="`find ./kernel/drivers/cpufreq -type f | sed -e 's/^\.\///g'`" #100127
  1413. CPUSCALINGMODS="`find ./kernel/arch/x86/kernel/cpu/cpufreq -type f | sed -e 's/^\.\///g'`" #v431
  1414. CRYPTOMODS="`find ./kernel/crypto -type f | sed -e 's/^\.\///g'`" #100126
  1415. FBCONMODS="`find ./kernel/drivers/video/console -type f | sed -e 's/^\.\///g'`" #110518
  1416. #create a list of extra modules... w476 added nls_cp850.ko nls_cp852.ko...
  1417. EXTRALIST="blkcipher.ko cbc.ko apm.ko cdrom.ko mwave.ko synclink_cs.ko serial_cs.ko lp.ko n_hdlc.ko nvram.ko sonypi.ko generic_serial.ko agpgart.ko ali-agp.ko amd-k7-agp.ko amd64-agp.ko ati-agp.ko intel-agp.ko nvidia-agp.ko sis-agp.ko sworks-agp.ko via-agp.ko blowfish.ko aes.ko arc4.ko crc32c.ko deflate.ko des.ko md5.ko sha1.ko cramfs.ko ext3.ko fat.ko fuse.ko isofs.ko jbd.ko lockd.ko minix.ko msdos.ko nfs.ko nls_cp437.ko nls_cp850.ko nls_cp852.ko nls_iso8859-1.ko nls_iso8859-13.ko nls_iso8859-14.ko nls_iso8859-15.ko nls_iso8859-2.ko nls_iso8859-3.ko nls_iso8859-4.ko nls_iso8859-5.ko nls_iso8859-6.ko nls_iso8859-7.ko nls_iso8859-8.ko nls_iso8859-9.ko nls_utf8.ko ntfs.ko reiserfs.ko smbfs.ko squashfs.ko udf.ko unionfs.ko vfat.ko i2c-core.ko i2c-algo-bit.ko ide-cs.ko ide-tape.ko ide-cd.ko ide-floppy.ko gameport.ko analog.ko pcigame.ko pcspkr.ko psmouse.ko sermouse.ko serport.ko serio.ko evdev.ko joydev.ko input.ko keybdev.ko mousedev.ko crc32.ko crc-ccitt.ko libcrc32c.ko zlib_deflate.ko firmware_class.ko parport_pc.ko parport_serial.ko parport.ko parport_cs.ko i82365.ko pd6729.ko tcic.ko yenta_socket.ko i82092.ko rsrc_nonstatic.ko pcmcia_core.ko ds.ko imm.ko scsi_mod.ko scsi_transport_spi.ko sd_mod.ko sg.ko sr_mod.ko ide-scsi.ko scsi_debug.ko scsi_transport_fc.ko cdc-acm.ko usb-midi.ko usblp.ko audio.ko bluetty.ko usbcore.ko sl811-hcd.ko uhci-hcd.ko ehci-hcd.ko ohci-hcd.ko uhci.ko usb-ohci.ko usb-uhci.ko usbkbd.ko usbhid.ko hid.ko usbmouse.ko usbnet.ko ir-usb.ko usbserial.ko usb-storage.ko scanner.ko printer.ko fan.ko ibm_acpi.ko ac.ko battery.ko processor.ko thermal.ko paride.ko cryptoloop.ko pktcdvd.ko floppy.ko loop.ko 8250_pnp.ko serial_core.ko 8250.ko 8250_pci.ko ndiswrapper.ko ungrab-winmodem.ko cifs.ko ssb.ko pl2303.ko aufs.ko serio_raw.ko ecb.ko output.ko"
  1418. #FBMODS="intelfb.ko rivafb.ko sisfb.ko fbcon-vga-planes.ko fbcon-mfb.ko fbgen.ko mdacon.ko neofb.ko tridentfb.ko vgastate.ko vga16fb.ko "
  1419. EXTRAMODS=""
  1420. for ONEMOD in $EXTRALIST $USBMODEMLIST #$ANALOGMODEMLIST
  1421. do
  1422. ONEFND="`find ./ -type f -name $ONEMOD | sed -e 's/^\.\///g'`"
  1423. if [ "$ONEFND" != "" ];then
  1424. EXTRAMODS="$EXTRAMODS
  1425. $ONEFND"
  1426. fi
  1427. done
  1428. cd ../../../../ #back into sandbox3.
  1429. CHOSENMODS="$SOUNDMODS
  1430. $IPV4MODS
  1431. $NETFILTERMODS
  1432. $IEEE80211MODS
  1433. $RFKILLMODS
  1434. $MAC80211MODS
  1435. $WIMAXMODS
  1436. $NETWORKMODS
  1437. $UBUNTUMODS
  1438. $MMCMODS
  1439. $MEMSTICKMODS
  1440. $MISCMODS
  1441. $USBMODS
  1442. $ACPIMODS
  1443. $AGPMODS
  1444. $I2CMODS
  1445. $PLATFORMMODS
  1446. $GSPCAMODS
  1447. $BLUETOOTHMODS
  1448. $DRMMODS
  1449. $CPUSCALING2MODS
  1450. $CPUSCALINGMODS
  1451. $CRYPTOMODS
  1452. $FBCONMODS
  1453. $EXTRAMODS"
  1454. echo "$CHOSENMODS"| tr -s '\n' > /tmp/chosenmods.txt
  1455. echo "Finding all dependent modules..."
  1456. echo -n "" > /tmp/alldeps.txt
  1457. echo "$CHOSENMODS" |
  1458. while read ONEMOD
  1459. do
  1460. [ "$ONEMOD" = "" ] && continue #precaution
  1461. ONEBASE="`basename $ONEMOD`"
  1462. DPATTERN="/${ONEBASE}:"
  1463. PPATTERN="s/^\/lib\/modules\/${KERNELVER}\///g"
  1464. ONEDEPS="`cat rootfs-complete/lib/modules/$KERNELVER/modules.dep | grep "$DPATTERN" | cut -f 2 -d ':' | tr ' ' '\n' | sed -e "$PPATTERN"`"
  1465. [ "$ONEDEPS" != "" ] && echo "$ONEDEPS" >> /tmp/alldeps.txt
  1466. done
  1467. sync
  1468. sort -u /tmp/alldeps.txt > /tmp/alldepssorted.txt #remove duplicate lines.
  1469. cat /tmp/alldepssorted.txt >> /tmp/chosenmods.txt
  1470. sort -u /tmp/chosenmods.txt > /tmp/allmodssorted.txt
  1471. sync
  1472. #now delete all mods not in the list...
  1473. echo "Moving unwanted modules to a separate sfs file..." #"Deleting unwanted modules..."
  1474. find rootfs-complete/lib/modules/$KERNELVER/ -type f -name '*.ko' -o -name '*.HIDE' |
  1475. while read ONEMODSPEC
  1476. do
  1477. ONEMODNAME="`basename $ONEMODSPEC`"
  1478. mPATTERN='/'"$ONEMODNAME"
  1479. if [ "`grep "$mPATTERN" /tmp/allmodssorted.txt`" = "" ];then
  1480. ONEMODPATH="`dirname $ONEMODSPEC`"
  1481. xONEMODPATH="`echo -n "$ONEMODPATH" | sed -e 's%^rootfs\-complete/%%'`"
  1482. mkdir -p zdrv/${xONEMODPATH}
  1483. cp -a $ONEMODSPEC zdrv/${xONEMODPATH}/
  1484. rm -f $ONEMODSPEC
  1485. #091203 remove firmware tarball...
  1486. ONEMODBASE="`basename $ONEMODSPEC`"
  1487. ombPATTERN='[:,]'"$ONEMODBASE"
  1488. FWFND="`grep "$ombPATTERN" rootfs-complete/etc/modules/firmware.dep.${KERNELVER} | cut -f 1 -d ':'`"
  1489. if [ "$FWFND" ];then
  1490. if [ -f rootfs-complete/lib/modules/all-firmware/${FWFND}.tar.gz ];then
  1491. mkdir -p zdrv/lib/modules/all-firmware
  1492. mv -f rootfs-complete/lib/modules/all-firmware/${FWFND}.tar.gz zdrv/lib/modules/all-firmware/
  1493. fi
  1494. fi
  1495. fi
  1496. done
  1497. #special case:
  1498. mv -f rootfs-complete/lib/modules/all-firmware/intel537ep.tar.gz zdrv/lib/modules/all-firmware/
  1499. cp -a -f --remove-destination rootfs-complete/lib/modules/${KERNELVER}/intelmodem zdrv/lib/modules/${KERNELVER}/
  1500. rm -rf rootfs-complete/lib/modules/${KERNELVER}/intelmodem
  1501. echo "Creating ${ZDRVSFS} 'zdrv' file..." #100911
  1502. sync
  1503. #w091029 use busybox depmod, creates smaller modules* files...
  1504. #./depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  1505. if [ "$USINGKMOD" = "no" ];then #130418
  1506. busybox depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  1507. else
  1508. ./depmod -b $WKGDIR/sandbox3/rootfs-complete -F $WKGDIR/sandbox3/System.map $KERNELVER
  1509. fi
  1510. sync
  1511. MAKEZDRV="unwanted-modules" #w481 delay. 100903
  1512. else
  1513. #w460 retaining all modules, but offer to move them to a separate zdrv... 100911
  1514. if [ "$CHK_YES_ZDRV" = "" ];then #120506
  1515. echo
  1516. echo "If you wish, you can move the modules to a separate zdrv sfs file."
  1517. echo "Right now they are in rootfs-complete, which will become ${PUPPYSFS},"
  1518. echo "however there are advantages if the modules and firmware are in a separate"
  1519. echo "'zdrv' sfs file -- it will not be copied into RAM at bootup, speeding bootup"
  1520. echo "and using up less RAM, yet not sacrificing any speed."
  1521. echo -n "Press ENTER key only to leave them alone, else any char for a separate zdrv: "
  1522. read wantzdrv
  1523. CHK_YES_ZDRV="false"
  1524. [ "$wantzdrv" != "" ] && CHK_YES_ZDRV="true"
  1525. fi
  1526. if [ "$CHK_YES_ZDRV" = "true" ];then
  1527. echo
  1528. echo "Creating ${ZDRVSFS} 'zdrv' file..." #100911
  1529. mkdir -p zdrv/lib
  1530. mv -f rootfs-complete/lib/modules zdrv/lib/
  1531. sync
  1532. MAKEZDRV="all-modules" #w481 delay. 100903
  1533. else
  1534. echo "...okay, leaving modules inside ${PUPPYSFS}" #100911
  1535. fi
  1536. fi
  1537. ##091125 offer to cutdown fonts...
  1538. #echo
  1539. #echo "Would you like to cutdown the bitmap fonts in usr/share/X11/fonts/misc"
  1540. #echo "to the barest minimum? The bitmap fonts were used in older xlib apps"
  1541. #echo "(not gtk or qt) and some cli (non-X) apps. Okay to answer yes if want"
  1542. #echo "to build a small iso. Saving about 1.5MB uncompressed."
  1543. #echo -n "Hit ENTER only to cutdown 'misc' fonts: "
  1544. #read cutdownmisc
  1545. #if [ "$cutdownmisc" = "" ];then
  1546. # 7x14B-ISO8859-1.pcf
  1547. # 7x14-ISO8859-1.pcf #default for xlib, set in root/.Xresources
  1548. # cursor.pcf
  1549. # 8x16.pcf #used by yaf-splash, ex usr/sbin/pmount
  1550. # 9x15B-ISO8859-1.pcf #used by yaf-splash in usr/sbin/delayedrun, sbin/pup_event_frontend_d
  1551. # symb12.pcf #used by xcalc, see etc/X11/app-defaults/Xcalc
  1552. # helvB12-ISO8859-1.pcf #used by Xclipboard
  1553. # courR12-ISO8859-1.pcf # "
  1554. # helvR24-ISO8859-1.pcf #used by Xlock
  1555. # courB12-ISO8859-1.pcf #'fixed' font that some xlib apps use.
  1556. # helvR12-ISO8859-1.pcf #'variable' font that some xlib apps use.
  1557. #
  1558. #fi
  1559. #100622 slackware 13.1: just in case any got through, remove c-shell scripts...
  1560. rm -f rootfs-complete/etc/profile.d/*.csh* 2>/dev/null
  1561. #sanity check...
  1562. echo
  1563. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  1564. chroot rootfs-complete echo 'testing chroot'
  1565. if [ $? -ne 0 ];then
  1566. echo "ERROR: could not 'chroot' into sandbox3/rootfs-complete"
  1567. echo "This means that something is incomplete, perhaps a library"
  1568. echo "needed by bash. Check it out. Have to exit script now."
  1569. exit
  1570. fi
  1571. else
  1572. echo "Normally, the script now does a sanity-test by chrooting into"
  1573. echo "sandbox3/rootfs-complete, however as you are doing a cross-build, this"
  1574. echo "cannot be done."
  1575. fi
  1576. #before building puppy.sfs from rootfs-complete, check for any invalid symlinks
  1577. #and move them to the devx...
  1578. echo
  1579. echo "Finding invalid symlinks..."
  1580. rm -rf devx
  1581. mkdir devx
  1582. #v431 aaargh, latest pburn (3.1.1) has a symlink with spaces in name...
  1583. #for ONESYMLINK in `find rootfs-complete/ -type l`
  1584. find rootfs-complete/ -type l |
  1585. while read ONESYMLINK
  1586. do
  1587. [ "`echo -n "$ONESYMLINK" | grep '/dev/'`" != "" ] && continue
  1588. [ "`echo -n "$ONESYMLINK" | grep '/proc/'`" != "" ] && continue
  1589. xONESYMLINK="`echo -n "$ONESYMLINK" | sed -e 's/^rootfs\-complete//'`"
  1590. #w018 some symlinks become valid after puppy 1st boot...
  1591. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  1592. LINKTO="`chroot rootfs-complete readlink "$xONESYMLINK"`"
  1593. [ "`echo -n "$LINKTO" | grep 'lib/X11/pixmaps'`" != "" ] && continue #these images created 1st boot.
  1594. if [ "`chroot rootfs-complete readlink -e "$xONESYMLINK"`" = "" ];then
  1595. UPONE="`dirname "$xONESYMLINK"`"
  1596. mkdir -p devx${UPONE}
  1597. cp -a -f "$ONESYMLINK" devx${UPONE}/
  1598. rm -f "$ONESYMLINK"
  1599. fi
  1600. else
  1601. #do it without chroot...
  1602. LINKTO="`readlink rootfs-complete"${xONESYMLINK}"`" #120502 fix for spaces in path.
  1603. [ -e rootfs-complete${LINKTO} ] && continue #absolute path
  1604. UPONE="`dirname "$xONESYMLINK"`"
  1605. [ -e rootfs-complete${UPONE}/${LINKTO} ] && continue #relative path
  1606. mkdir -p devx${UPONE}
  1607. cp -a -f "$ONESYMLINK" devx${UPONE}/
  1608. rm -f "$ONESYMLINK"
  1609. fi
  1610. done
  1611. #for ONESYMLINK in `find rootfs-complete/ -type l`
  1612. #do
  1613. # [ "`echo -n "$ONESYMLINK" | grep '/dev/'`" != "" ] && continue
  1614. # [ "`echo -n "$ONESYMLINK" | grep '/proc/'`" != "" ] && continue
  1615. # xONESYMLINK="`echo -n "$ONESYMLINK" | sed -e 's/^rootfs\-complete//'`"
  1616. # #w018 some symlinks become valid after puppy 1st boot...
  1617. # LINKTO="`chroot rootfs-complete readlink $xONESYMLINK`"
  1618. # [ "`echo -n "$LINKTO" | grep 'lib/X11/pixmaps'`" != "" ] && continue #these images created 1st boot.
  1619. # if [ "`chroot rootfs-complete readlink -e $xONESYMLINK`" = "" ];then
  1620. # UPONE="`dirname $xONESYMLINK`"
  1621. # mkdir -p devx${UPONE}
  1622. # cp -a -f $ONESYMLINK devx${UPONE}/
  1623. # rm -f $ONESYMLINK
  1624. # fi
  1625. #done
  1626. sync
  1627. #get info about the ubuntu pkgs...
  1628. echo "Updating pkg data in rootfs-complete/root/.packages ..."
  1629. #copy them into the live-cd also...
  1630. #in case of Ppup4, PKGLISTS_COMPAT='Packages-puppy-4xx-official'
  1631. for ONELIST in $PKGLISTS_COMPAT
  1632. do
  1633. cp -f ../$ONELIST ./
  1634. cp -f ../$ONELIST rootfs-complete/root/.packages/
  1635. done
  1636. for ONELIST in $PACKAGELISTS_PET_ORDER #120506
  1637. do
  1638. cp -f ../$ONELIST ./
  1639. cp -f ../$ONELIST rootfs-complete/root/.packages/
  1640. done
  1641. #note, Ppup4, findwoofinstalledpkgs.sh (below) needs above file, then deletes it.
  1642. #also copy the pet package databases...
  1643. cp -f ../Packages-puppy-[0-9]-official rootfs-complete/root/.packages/ 2>/dev/null
  1644. cp -f ../Packages-puppy-common-official rootfs-complete/root/.packages/ 2>/dev/null #110608
  1645. #cp -f ../Packages-puppy-wary5-official rootfs-complete/root/.packages/
  1646. cp -f ../Packages-puppy-noarch-official rootfs-complete/root/.packages/ #120305
  1647. #121102
  1648. if [ -f ../Packages-puppy-${DISTRO_DB_SUBNAME}-official ];then #110723 ex: Packages-puppy-drake-official
  1649. cp -f ../Packages-puppy-${DISTRO_DB_SUBNAME}-official rootfs-complete/root/.packages/
  1650. cp -f ../Packages-puppy-${DISTRO_DB_SUBNAME}-official ./
  1651. #120506...
  1652. ../support/rationalize_categories Packages-puppy-${DISTRO_DB_SUBNAME}-official
  1653. cp -f /tmp/rationalized_categories rootfs-complete/root/.packages/Packages-puppy-${DISTRO_DB_SUBNAME}-official
  1654. fi
  1655. #101014 rationalise categories... 110726 must *always* copy Packages-puppy-wary5-official (it is going to be the fallback)...
  1656. #if [ "$DISTRO_COMPAT_VERSION" = "wary5" ];then #101025
  1657. if [ -f Packages-puppy-wary5-official ];then
  1658. ../support/rationalize_categories Packages-puppy-wary5-official
  1659. cp -f /tmp/rationalized_categories rootfs-complete/root/.packages/Packages-puppy-wary5-official
  1660. fi
  1661. #fi
  1662. #if [ "${DISTRO_FILE_PREFIX}" = "drake" ];then #110723
  1663. # ../support/rationalize_categories Packages-puppy-drake-official
  1664. # cp -f /tmp/rationalized_categories rootfs-complete/root/.packages/Packages-puppy-drake-official
  1665. #fi
  1666. #if [ "${DISTRO_FILE_PREFIX}" = "slacko" ];then #110816
  1667. # ../support/rationalize_categories Packages-puppy-slacko-official
  1668. # cp -f /tmp/rationalized_categories rootfs-complete/root/.packages/Packages-puppy-slacko-official
  1669. #fi
  1670. #also copy this...
  1671. cp -f ../PKGS_MANAGEMENT rootfs-complete/root/.packages/
  1672. #477 a puppy-puppy build will not have any compat-distro databases...
  1673. petcntlimit=3
  1674. COMPATDISTRO_DB_FILES="`ls -1 rootfs-complete/root/.packages/Packages-[^p]* 2>/dev/null`"
  1675. [ "$COMPATDISTRO_DB_FILES" = "" ] && petcntlimit=5
  1676. #w476 swap to make sure 3 pet repos get chosen...
  1677. enabledrepos=" "
  1678. #100207 now using the quirky pet repo for all puppy builds...
  1679. [ -f ../Packages-puppy-quirky-official ] && cp -f ../Packages-puppy-quirky-official rootfs-complete/root/.packages/
  1680. #100730 DISTRO_COMPAT_VERSION for puppy builds no longer limited to a number 1-5 (ex: wary5)
  1681. fNUM1=`echo -n "$DISTRO_COMPAT_VERSION" | wc -c`
  1682. #100116 quirky, want the quirky db first in list... 101126 no, now building quirky from wary5 pkgs...
  1683. #if [ "`echo "$DISTRO_NAME" | grep -i 'quirky'`" != "" ];then
  1684. # enabledrepos="Packages-puppy-quirky-official Packages-puppy-4-official Packages-puppy-3-official "
  1685. # #cp -f ../Packages-puppy-quirky-official rootfs-complete/root/.packages/
  1686. #else
  1687. repocnt=1
  1688. case $DISTRO_FILE_PREFIX in #110906 fix. $DISTRO_COMPAT_VERSION in #100911
  1689. lucid|lupu|luci) #110906 fix. 120305 120312
  1690. enabledrepos="Packages-puppy-lucid-official Packages-puppy-noarch-official "
  1691. ;;
  1692. wary|racy) #110906 110917 120305 120312 121105
  1693. enabledrepos="Packages-puppy-${DISTRO_DB_SUBNAME}-official Packages-puppy-quirky-official Packages-puppy-noarch-official Packages-puppy-4-official " #110824 added -common-
  1694. ;;
  1695. slacko) #110824 120305 120312 121105
  1696. enabledrepos="Packages-puppy-${DISTRO_DB_SUBNAME}-official Packages-puppy-noarch-official "
  1697. ;;
  1698. dpup|sqzd) #110824 110906 120305 120312
  1699. enabledrepos="Packages-puppy-dpup-official Packages-puppy-noarch-official "
  1700. ;;
  1701. *)
  1702. #add the puppy repos... (i want 5, 4, 3)...
  1703. for ONEREPO in `ls -1 rootfs-complete/root/.packages/Packages-puppy* | sort -r`
  1704. do
  1705. [ $repocnt -gt $petcntlimit ] && break #limit of 3 puppy repos.
  1706. BASEREPO="`basename $ONEREPO`"
  1707. [ "$BASEREPO" = "Packages-puppy-wary5-official" ] && continue #100911 handled above.
  1708. [ "$BASEREPO" = "Packages-puppy-lucid-official" ] && continue #100911 handled above.
  1709. [ "$BASEREPO" = "Packages-puppy-slacko-official" ] && continue #110824 handled above.
  1710. #w478 a problem if building an old puppy-puppy, don't want more recent db's... 100730...
  1711. if [ "$DISTRO_BINARY_COMPAT" = "puppy" ];then
  1712. ONEREPNUM=`echo -n "$BASEREPO" | cut -f 3 -d '-'`
  1713. fNUM2=`echo -n "$ONEREPNUM" | wc -c`
  1714. #[ "`echo -n "$ONEREPNUM" | grep '[a-z]'`" != "" ] && continue
  1715. [ $fNUM1 -eq 1 ] && [ $fNUM2 -eq 1 ] && [ $ONEREPNUM -gt $DISTRO_COMPAT_VERSION 2>/dev/null ] && continue
  1716. fi
  1717. # #w019 have decided don't want this showing up in PPM...
  1718. # [ "$BASEREPO" = "Packages-puppy-woof-official" ] && continue
  1719. enabledrepos="${enabledrepos}${BASEREPO} "
  1720. repocnt=`expr $repocnt + 1`
  1721. done
  1722. ;;
  1723. esac
  1724. #add compat-distro repos...
  1725. if [ "$COMPATDISTRO_DB_FILES" != "" ];then
  1726. for ONEREPO in `ls -1 rootfs-complete/root/.packages/Packages-[^p]*`
  1727. do
  1728. [ $repocnt -gt 5 ] && break #only allow 5 active repos in PPM.
  1729. BASEREPO="`basename $ONEREPO`"
  1730. enabledrepos="${enabledrepos}${BASEREPO} "
  1731. repocnt=`expr $repocnt + 1`
  1732. done
  1733. fi
  1734. #fi
  1735. #120831 above code ok, but really just want these...
  1736. case $DISTRO_BINARY_COMPAT in
  1737. ubuntu)
  1738. xPUPPYREPOS="Packages-puppy-${DISTRO_DB_SUBNAME}-official Packages-puppy-noarch-official" #Packages-puppy-common-official
  1739. xCOMPATREPOS="$(ls -1 rootfs-complete/root/.packages/Packages-[^p]* | grep -E '\-main$|\-universe$|\-multiverse$' | rev | cut -f 1 -d '/' | rev | tr '\n' ' ')"
  1740. #130330 would like universe first...
  1741. xCOMPATREPOS1="$(ls -1 rootfs-complete/root/.packages/Packages-[^p]* | grep -E '\-universe$' | rev | cut -f 1 -d '/' | rev | tr '\n' ' ')"
  1742. xCOMPATREPOS2="$(ls -1 rootfs-complete/root/.packages/Packages-[^p]* | grep -E '\-main$|\-multiverse$' | rev | cut -f 1 -d '/' | rev | tr '\n' ' ')"
  1743. enabledrepos=" ${xCOMPATREPOS1} ${xCOMPATREPOS2} ${xPUPPYREPOS} "
  1744. ;;
  1745. esac
  1746. echo "PKG_REPOS_ENABLED='${enabledrepos}'" >> rootfs-complete/root/.packages/PKGS_MANAGEMENT
  1747. if [ -f ../DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then #w478
  1748. cp -f ../DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} rootfs-complete/root/.packages/DISTRO_PKGS_SPECS
  1749. else
  1750. cp -f ../DISTRO_PKGS_SPECS-${DISTRO_BINARY_COMPAT} rootfs-complete/root/.packages/DISTRO_PKGS_SPECS
  1751. fi
  1752. #101013 remove wrong alternate choice (old/new kernel optional pkgs)...
  1753. if [ -f /tmp/3builddistro_removed_alt ];then
  1754. for ONEREMOVE in `cat /tmp/3builddistro_removed_alt | tr '\n' ' '`
  1755. do
  1756. orPATTERN='yes|'"$ONEREMOVE"'|'
  1757. grep -v "$orPATTERN" rootfs-complete/root/.packages/DISTRO_PKGS_SPECS > /tmp/DISTRO_PKGS_SPECS-tempor
  1758. cp -f /tmp/DISTRO_PKGS_SPECS-tempor rootfs-complete/root/.packages/DISTRO_PKGS_SPECS
  1759. done
  1760. fi
  1761. if [ -f ../DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} ];then
  1762. cp -f ../DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT}-${DISTRO_COMPAT_VERSION} rootfs-complete/root/.packages/DISTRO_COMPAT_REPOS
  1763. else #130306
  1764. cp -f ../DISTRO_COMPAT_REPOS-${DISTRO_BINARY_COMPAT} rootfs-complete/root/.packages/DISTRO_COMPAT_REPOS
  1765. fi
  1766. #this needed to update pkg db's in a running puppy...
  1767. cp -f ../0setup rootfs-complete/usr/local/petget/
  1768. #w015 0setup calls this for faster operation...
  1769. cp -f ../support/find_cat rootfs-complete/usr/local/petget/
  1770. #w091017 0setup also needs these, fast conversion created by Wosh...
  1771. [ -f ../support/ppkg ] && cp -f ../support/ppkg rootfs-complete/usr/local/petget/
  1772. [ -f ../support/ppkg.ctg ] && cp -f ../support/ppkg.ctg rootfs-complete/usr/local/petget/
  1773. #110612 0setup needs these...
  1774. [ -f ../support/rpm2ppm ] && cp -f ../support/rpm2ppm rootfs-complete/usr/local/petget/
  1775. [ -f ../support/mageia2ppm ] && cp -f ../support/mageia2ppm rootfs-complete/usr/local/petget/
  1776. #121111 new fast deb to pup db converter, called by 0setup...
  1777. [ -f ../support/debdb2pupdb ] && cp -f ../support/debdb2pupdb rootfs-complete/usr/local/petget/
  1778. #urls etc on the pet db's...
  1779. cp -f ../DISTRO_PET_REPOS rootfs-complete/root/.packages/
  1780. #w018 homepages of heaps of pkgs (see 0pre script)...
  1781. cp -f ../PKGS_HOMEPAGES rootfs-complete/root/.packages/
  1782. #cp -f ../support/inline_get_pet rootfs-complete/root/.packages/ #100801
  1783. #cp -f ../support/inline_get_compat rootfs-complete/root/.packages/ #100806
  1784. #cp -f ../support/findpkgs rootfs-complete/root/.packages/ #110821 110823 revert.
  1785. #130316 see 0setup and debdb2pupdb...
  1786. case ${DISTRO_BINARY_COMPAT} in
  1787. debian|ubuntu|raspbian)
  1788. if [ ! -f ../invaliddepslist ];then
  1789. echo "WARNING WARNING"
  1790. echo "File 'invaliddepslist' does not exist.
  1791. This is created by script '0setup'. You must go back and rerun all of the
  1792. scripts from 0setup, 1download, 2createpackages.
  1793. Recommend abort this script now (ctrl-c).
  1794. Or, if you press ENTER to continue, an empty 'invaliddepslist' file will
  1795. be created."
  1796. echo -n "Press ENTER to continue: "
  1797. read justgoon
  1798. touch ../invaliddepslist
  1799. fi
  1800. ;;
  1801. esac
  1802. [ -f ../invaliddepslist ] && cp -f ../invaliddepslist rootfs-complete/usr/local/petget/
  1803. #build a db of builtin packages, woof-installed-packages ... 110823 no need to chroot...
  1804. #chroot rootfs-complete /usr/local/petget/findwoofinstalledpkgs.sh
  1805. cp ../woof-installed-packages rootfs-complete/root/.packages/ #110823 already created earlier this script.
  1806. touch ../devx-only-installed-packages #121028
  1807. cp ../devx-only-installed-packages rootfs-complete/root/.packages/ #121028
  1808. #110722 add kernel db line...
  1809. echo "$KERNEL_DB_ENTRY" >> rootfs-complete/root/.packages/woof-installed-packages
  1810. #sort alphabetically...
  1811. sort --key=1 --field-separator="|" rootfs-complete/root/.packages/woof-installed-packages > /tmp/petget_woof-installed-packages
  1812. mv -f /tmp/petget_woof-installed-packages rootfs-complete/root/.packages/woof-installed-packages
  1813. #currently not using these...
  1814. rm -f rootfs-complete/etc/rc.d/rc.sysinit-UNIPUP
  1815. rm -f rootfs-complete/etc/rc.d/rc.shutdown-UNIPUP
  1816. #120628 certain utilities are not appropriate when booting on an arm board...
  1817. if [ "$SDFLAG" != "" ];then
  1818. rm -f rootfs-complete/usr/sbin/grubconfig
  1819. rm -f rootfs-complete/usr/sbin/remasterpup2
  1820. rm -f rootfs-complete/usr/sbin/resizepfile.sh
  1821. rm -f rootfs-complete/usr/sbin/wakepup2
  1822. rm -f rootfs-complete/usr/share/applications/Grub-bootloader-config.desktop
  1823. rm -f rootfs-complete/usr/share/applications/BootFlash-usb-installer.desktop
  1824. rm -f rootfs-complete/usr/share/applications/Puppy-universal-installer.desktop
  1825. rm -f rootfs-complete/usr/share/applications/Remaster-Puppy-live-CD.desktop
  1826. rm -f rootfs-complete/usr/share/applications/Resize-personal-storage-file.desktop
  1827. rm -f rootfs-complete/usr/share/applications/WakePup2.desktop
  1828. fi
  1829. #130326 script to adjust fonts to suit 96 dpi (puppy used to have 78 dpi)...
  1830. rootfs-complete/usr/sbin/hackfontsize
  1831. #130618 restore the "layer:" lines in /etc/xdg/templates/_root_.jwmrc...
  1832. #note, this file is now in Woof, I took it out of the JWM pet.
  1833. JWMFLG=0
  1834. JWM3=`grep -E '^jwm[_-][0-9]' rootfs-complete/root/.packages/woof-installed-packages | cut -f 3 -d '|' | cut -c 1-3 | head -n 1`
  1835. [ ! $JWM3 ] && JWMFLG=1 #assume too old. note, there is a jwm2 pet, which is older version.
  1836. if vercmp $JWM3 ge 2.2; then JWMFLG=2; fi
  1837. if vercmp $JWM3 ge 790; then JWMFLG=2; fi
  1838. case $JWMFLG in
  1839. 2)
  1840. sed -i -e 's%.*LAYER_MINIXCAL.*%\t\t<Option>layer:above</Option>%' rootfs-complete/etc/xdg/templates/_root_.jwmrc
  1841. sed -i -e 's%.*LAYER_GTKDIALOGSPLASH.*%\t\t<Option>layer:above</Option>%' rootfs-complete/etc/xdg/templates/_root_.jwmrc
  1842. sed -i -e 's%.*LAYER_SPLASHWINDOW.*%\t\t<Option>layer:above</Option>%' rootfs-complete/etc/xdg/templates/_root_.jwmrc
  1843. ;;
  1844. esac
  1845. #fix the menus...
  1846. #111123 ***NOTICE*** cross-build, will have to run fixmenus and indexgen.sh at first bootup.
  1847. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  1848. echo
  1849. echo "Constructing configuration files for JWM, Fvwm95, IceWM, openbox..."
  1850. chroot rootfs-complete /usr/sbin/fixmenus
  1851. #generate help index...
  1852. chroot rootfs-complete /usr/sbin/indexgen.sh
  1853. #...note, rootfs-skeleton/pinstall.sh pre-processes the help files.
  1854. fi
  1855. #shared library loading...
  1856. echo "/lib" > rootfs-complete/etc/ld.so.conf
  1857. echo "/usr/lib" >> rootfs-complete/etc/ld.so.conf
  1858. [ -d rootfs-complete/usr/local/lib ] && echo "/usr/local/lib" >> rootfs-complete/etc/ld.so.conf
  1859. [ -d rootfs-complete/usr/X11R7/lib ] && echo "/usr/X11R7/lib" >> rootfs-complete/etc/ld.so.conf
  1860. [ -d rootfs-complete/opt/gnome2/lib ] && echo "/opt/gnome2/lib" >> rootfs-complete/etc/ld.so.conf
  1861. [ -d rootfs-complete/opt/qt4/lib ] && echo "/opt/qt4/lib" >> rootfs-complete/etc/ld.so.conf
  1862. [ -d rootfs-complete/opt/mozilla.org/lib ] && echo "/opt/mozilla.org/lib" >> rootfs-complete/etc/ld.so.conf
  1863. [ -d rootfs-complete/opt/samba/lib ] && echo "/opt/samba/lib" >> rootfs-complete/etc/ld.so.conf
  1864. echo "/root/my-applications/lib" >> rootfs-complete/etc/ld.so.conf
  1865. #generate /etc/ld.so.cache shared lib loading cache file... w019 not always there...
  1866. #cp -a ../packages-${DISTRO_FILE_PREFIX}/glibc_DEV/sbin/ldconfig rootfs-complete/
  1867. #100527 stupid thing, needs '/' on end of path in case of 'packages-qret' being a symlink...
  1868. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  1869. LDCONFIG="`find ../packages-${DISTRO_FILE_PREFIX}/ -type f -name ldconfig | grep '/sbin/' | head -n 1`"
  1870. cp -a $LDCONFIG rootfs-complete/
  1871. chroot rootfs-complete ./ldconfig
  1872. rm -f rootfs-complete/ldconfig
  1873. sync
  1874. else
  1875. #***NOTICE*** have to run ldconfig at first boot.
  1876. LDCONFIG="`find ../packages-${DISTRO_FILE_PREFIX}/ -type f -name ldconfig | grep '/sbin/' | head -n 1`"
  1877. cp -a $LDCONFIG rootfs-complete/sbin/
  1878. fi
  1879. #i don't know what 'lintian' is for...
  1880. rm -rf rootfs-complete/usr/share/lintian 2>/dev/null
  1881. #maybe stray /install dir from slackware pkgs...
  1882. rm -rf rootfs-complete/install 2>/dev/null
  1883. #slackware pkg may create this...
  1884. rm -rf rootfs-complete/etc/cron.daily 2>/dev/null
  1885. #w460 theme selection...
  1886. echo
  1887. echo "Continuing to setup `pwd`/rootfs-complete..."
  1888. echo
  1889. #w478 now have a gui for theme selection...
  1890. eval "`../support/choose_themes`"
  1891. #...returns BACKGROUNDIMAGE, DESKICONS, GTKTHEME, JWMTHEME.
  1892. if [ "$EXIT" = "OK" ];then
  1893. #BACKGROUNDIMAGE="zzzzzzzz"
  1894. #echo "Here are the available background images (ref: usr/share/backgrounds):"
  1895. #ls -1 rootfs-complete/usr/share/backgrounds
  1896. #echo
  1897. #while [ ! -f rootfs-complete/usr/share/backgrounds/$BACKGROUNDIMAGE ];do
  1898. # echo "Type the full filename of the one you want as default"
  1899. # echo -n "(ENTER only will select the first): "
  1900. # read BACKGROUNDIMAGE
  1901. # [ "$BACKGROUNDIMAGE" = "" ] && BACKGROUNDIMAGE="`ls -1 rootfs-complete/usr/share/backgrounds | head -n 1`"
  1902. #done
  1903. case $BACKGROUNDIMAGE in #110831
  1904. *.png|*.PNG)
  1905. mv -f rootfs-complete/usr/share/backgrounds/$BACKGROUNDIMAGE rootfs-complete/usr/share/backgrounds/default.png
  1906. sed -i -e 's%default\.jpg%default.png%' rootfs-complete/root/Choices/ROX-Filer/PuppyPin
  1907. #i don't know what uses this, but change it anyway...
  1908. sed -i -e 's%default\.jpg%default.png%' rootfs-complete/etc/Puppybackgroundpicture
  1909. ;;
  1910. *)
  1911. mv -f rootfs-complete/usr/share/backgrounds/$BACKGROUNDIMAGE rootfs-complete/usr/share/backgrounds/default.jpg
  1912. ;;
  1913. esac
  1914. ##w477 choose gtk theme...
  1915. #echo
  1916. #echo "Here are the available GTK themes (ref: usr/share/themes):"
  1917. #ls -1 rootfs-complete/usr/share/themes/*/gtk-2.0 | grep '^rootfs-complete/usr/share/themes' | cut -f 5 -d '/'
  1918. #echo
  1919. #GTKTHEME="zzzzzzzzzz"
  1920. #while [ ! -d "rootfs-complete/usr/share/themes/$GTKTHEME" ];do
  1921. # echo "Type the full filename of the one you want as default"
  1922. # echo -n "(ENTER only will select the first): "
  1923. # read GTKTHEME
  1924. # [ "$GTKTHEME" = "" ] && GTKTHEME="`ls -1 rootfs-complete/usr/share/themes/*/gtk-2.0 | grep '^rootfs-complete/usr/share/themes' | cut -f 5 -d '/' | head -n 1`"
  1925. #done
  1926. #130329 append extra line, needed for Qt4 theme matching. (see also /etc/profile.d/pup_gtk and /root/.config/Trolltech.conf)...
  1927. echo "# -- THEME AUTO-WRITTEN DO NOT EDIT
  1928. include \"/usr/share/themes/${GTKTHEME}/gtk-2.0/gtkrc\"
  1929. include \"/root/.gtkrc.mine\"
  1930. # -- THEME AUTO-WRITTEN DO NOT EDIT
  1931. gtk-theme-name=\"${GTKTHEME}\"" > rootfs-complete/root/.gtkrc-2.0
  1932. #130401 01micko...
  1933. # gtk3 theme support thunor http://murga-linux.com/puppy/viewtopic.php?p=695722#695722
  1934. #[ -d rootfs-complete/root/.config/gtk-3.0 ] || mkdir -p rootfs-complete/root/.config/gtk-3.0
  1935. pathGTK3THEME="`find rootfs-complete/usr/share/themes/${GTKTHEME} -type d -name gtk-3.0`"
  1936. if [ "$pathGTK3THEME" ];then #XDG_CONFIG_HOME=/root/.config
  1937. # [ -f ${pathGTK3THEME}/settings.ini ] && cp -af ${pathGTK3THEME}/settings.ini rootfs-complete/root/.config/gtk-3.0/ || echo -e "[Settings] \ngtk-theme-name = \"${GTKTHEME}\" \ngtk-fallback-icon-theme = \"gnome\"" > rootfs-complete/root/.config/gtk-3.0/settings.ini
  1938. # #[ -f ${pathGTK3THEME}/gtk.css ] && cp -af ${pathGTK3THEME}/gtk.css rootfs-complete$XDG_CONFIG_HOME/gtk-3.0/ ||\# doesn't work
  1939. # echo "" > rootfs-complete/root/.config/gtk-3.0/gtk.css
  1940. #130404 link to actual theme...
  1941. ln -snf "$pathGTK3THEME" rootfs-complete/root/.config/gtk-3.0
  1942. fi
  1943. #echo
  1944. #DESKICONS="zzzzzzzzz"
  1945. #echo "Here are the available desktop icon themes (ref: usr/local/lib/X11/themes):"
  1946. #find rootfs-complete/usr/local/lib/X11/themes -maxdepth 1 -mindepth 1 -type d | rev | cut -f 1 -d '/' | rev
  1947. #while [ ! -d "rootfs-complete/usr/local/lib/X11/themes/$DESKICONS" ];do
  1948. # echo "Type the full filename of the one you want as default"
  1949. # echo -n "(ENTER only will select the first): "
  1950. # read DESKICONS
  1951. # [ "$DESKICONS" = "" ] && DESKICONS="`find rootfs-complete/usr/local/lib/X11/themes -maxdepth 1 -mindepth 1 -type d | rev | cut -f 1 -d '/' | rev | head -n 1`"
  1952. #done
  1953. echo -n "$DESKICONS" > rootfs-complete/etc/desktop_icon_theme
  1954. if [ -d rootfs-complete/root/.jwm/themes ];then
  1955. cp -f rootfs-complete/root/.jwm/themes/${JWMTHEME}-jwmrc rootfs-complete/root/.jwm/jwmrc-theme
  1956. cp -f rootfs-complete/root/.jwm/themes/${JWMTHEME}-colors rootfs-complete/root/.jwm/jwm_colors 2>/dev/null
  1957. fi
  1958. if [ -f rootfs-complete/root/.config/openbox/rc.xml ];then #20100406
  1959. obPATTERN="s%Natura%${OBTHEME}%"
  1960. sed -i -e "$obPATTERN" rootfs-complete/root/.config/openbox/rc.xml
  1961. fi
  1962. sync
  1963. fi #end theme chooser ok.
  1964. #110807 don't ask...
  1965. ##110803 workaround for 'pngoverlay' needs X runnning, also avoid cpu overhead at first startup...
  1966. ##/usr/sbin/icon_switcher_cli is called from /etc/rc.d/rc.update.
  1967. #echo
  1968. #echo "There are currently issues with building the default desktop icons in"
  1969. #echo "usr/local/lib/X11/pixmaps at first bootup of Puppy (PUPMODE=5)."
  1970. #echo "Recommend do it now, which will also save cpu time at first bootup."
  1971. #echo "Press any printable character then ENTER to defer building desktop icons."
  1972. #echo -n "Recommend press ENTER key only: "
  1973. #read DOITNOW
  1974. #if [ "$DOITNOW" = "" ];then
  1975. #110826 no longer calling icon_switcher_cli from rc.update, don't need this...
  1976. # #modify start of rootfs-complete/usr/sbin/icon_switcher_cli...
  1977. # sed -i -e 's%^#DONEINWOOF .*%[ "$PUPMODE" = "5" ] \&\& exit%' rootfs-complete/usr/sbin/icon_switcher_cli
  1978. #have copied code from icon_switcher_cli to here, modified...
  1979. NEWTHEME="$DESKICONS" #see above
  1980. for ONESVG in `find rootfs-complete/usr/local/lib/X11/themes/${NEWTHEME}/ -maxdepth 1 -name \*.svg | tr '\n' ' '` #140103 removed '-type f'
  1981. do
  1982. ONEBASENAME="`basename $ONESVG .svg`"
  1983. rm -f rootfs-complete/usr/local/lib/X11/pixmaps/${ONEBASENAME}48.png
  1984. rsvg-convert -w 48 -h 48 -o rootfs-complete/usr/local/lib/X11/pixmaps/${ONEBASENAME}48.png $ONESVG
  1985. rm -f rootfs-complete/usr/local/lib/X11/pixmaps/${ONEBASENAME}24.png 2>/dev/null #140102 sent to null, shouldn't exist here
  1986. #rsvg-convert -w 24 -h 24 -o /tmp/${ONEBASENAME}24.png $ONESVG
  1987. ##if svg has transparency, JWM does not render properly in x16 bit color, screen out...
  1988. #pngtopnm -mix /tmp/${ONEBASENAME}24.png | pnmtopng > /usr/local/lib/X11/pixmaps/${ONEBASENAME}24.png
  1989. #rsvg-convert -w 24 -h 24 -o rootfs-complete/usr/local/lib/X11/pixmaps/${ONEBASENAME}24.png $ONESVG #140102 removed
  1990. done
  1991. for ONEPNG in `find rootfs-complete/usr/local/lib/X11/themes/${NEWTHEME}/ -maxdepth 1 -type f -name \*.png | tr '\n' ' '`
  1992. do
  1993. ONEBASENAME="`basename $ONEPNG .png`"
  1994. cp -f $ONEPNG rootfs-complete/usr/local/lib/X11/pixmaps/
  1995. touch -m rootfs-complete/usr/local/lib/X11/pixmaps/${ONEBASENAME}.png #v3.98
  1996. xONEBASENAME="`basename $ONEBASENAME 48`"
  1997. #if [ "$xONEBASENAME" != "$ONEBASENAME" ];then #scale to 24 pixels... #140102 removed
  1998. #pngtopnm -alpha $ONEPNG > /tmp/temp.pbm #separate transparency channel.
  1999. #pnmscale -reduce 2 /tmp/temp.pbm > /tmp/temp2.pbm 2> /dev/null
  2000. #pngtopnm $ONEPNG | pnmscale -reduce 2 2>/dev/null | pnmtopng -alpha=/tmp/temp2.pbm > rootfs-complete/usr/local/lib/X11/pixmaps/${xONEBASENAME}24.png
  2001. #touch -m rootfs-complete/usr/local/lib/X11/pixmaps/${xONEBASENAME}24.png #v3.98
  2002. #fi
  2003. done
  2004. if [ "$DISPLAY" ];then #110726 pngoverlay does not work when X not running. --quick fix, perform this operation in woof in 3builddistro.
  2005. #110721 new standardised icons to show when mounted...
  2006. if [ -e rootfs-complete/usr/sbin/pngoverlay -a -e rootfs-complete/usr/local/lib/X11/pixmaps/closebox_outline48.png ];then #overlay app created by vovchik (see source /usr/sbin/pngoverlay.bac)
  2007. rm -f rootfs-complete/usr/local/lib/X11/pixmaps/*_mntd*.png
  2008. #cp -f rootfs-complete/usr/sbin/pngoverlay rootfs-complete/usr/local/lib/X11/pixmaps/ #dumb, but needs to be in same folder.
  2009. #111123 get pngoverlay from host, in case of cross-build...
  2010. cp -f /usr/sbin/pngoverlay rootfs-complete/usr/local/lib/X11/pixmaps/ #dumb, but needs to be in same folder.
  2011. cd rootfs-complete/usr/local/lib/X11/pixmaps
  2012. for ONEDRV in card drive floppy optical usbdrv
  2013. do
  2014. ./pngoverlay ${ONEDRV}48.png closebox_outline48.png ${ONEDRV}_mntd48.png #background foreground output.
  2015. ./pngoverlay ${ONEDRV}48.png locked_outline48.png ${ONEDRV}_mntd_boot48.png
  2016. done
  2017. rm -f rootfs-complete/usr/local/lib/X11/pixmaps/pngoverlay
  2018. cd ../../../../../../
  2019. fi
  2020. fi
  2021. #fi
  2022. #110912 modify jwm to use menu icon 'start-button.png' if present...
  2023. #note, similar code also in /usr/sbin/icon_switcher (desktop icon switcher script).
  2024. if [ -f rootfs-complete/root/.jwmrc-tray ];then
  2025. if [ -f rootfs-complete/usr/local/lib/X11/${NEWTHEME}/start-button.png ];then #default theme has menu icon.
  2026. if [ -f rootfs-complete/usr/local/lib/X11/pixmaps/start-button.png ];then #precaution.
  2027. if [ "`grep 'start-button\.png' rootfs-complete/root/.jwmrc-tray`" = "" ];then
  2028. #the default is to use 'mini-dog.xpm' with text "Menu"...
  2029. echo "rootfs-complete/root/.jwmrc-tray modified to use start-button.png menu icon"
  2030. echo "(which is in rootfs-complete/usr/local/lib/X11/pixmaps/)"
  2031. PTN1='s%label="Menu" icon="mini-dog\.xpm"%icon="start-button.png"%'
  2032. sed -i -e "$PTN1" rootfs-complete/root/.jwmrc-tray
  2033. fi
  2034. fi
  2035. fi
  2036. fi
  2037. #v423 moved down. remove 'default' image from cull list...
  2038. #w482 cutdown the background images, to 8 images, remove largest...
  2039. BIGBACKIMAGES="`ls -S -1 rootfs-complete/usr/share/backgrounds | head -n -8 | grep -v 'default' | tr '\n' ' '`"
  2040. for ONEBIGIMAGE in $BIGBACKIMAGES
  2041. do
  2042. rm -f rootfs-complete/usr/share/backgrounds/$ONEBIGIMAGE
  2043. done
  2044. #v424 rox desktop text is default white with black shadow, not suited all backgrounds...
  2045. echo
  2046. echo "The ROX-Filer desktop text defaults to white with black shadow, but this is"
  2047. echo "not best for some light backgound images. ENTER only to keep, but if you"
  2048. echo -n "want black text press any printable key then ENTER: "
  2049. read wantblacktext
  2050. if [ "$wantblacktext" != "" ];then
  2051. echo "...ok, black text"
  2052. grep -v 'pinboard_fg_colour' rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options > /tmp/3builddistro_rox_options
  2053. grep -v 'pinboard_shadow_labels' /tmp/3builddistro_rox_options > rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options
  2054. grep -v '^</Options>' rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options > /tmp/3builddistro_rox_options
  2055. mv -f /tmp/3builddistro_rox_options rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options
  2056. echo ' <Option name="pinboard_fg_colour">#000000000000</Option>' >> rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options
  2057. echo ' <Option name="pinboard_shadow_labels">0</Option>' >> rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options
  2058. echo '</Options>' >> rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options
  2059. fi
  2060. #111010 set desktop font...
  2061. echo
  2062. echo "Also, ROX-Filer defaults to 'DejaVu Sans 10' font for the desktop. To accept"
  2063. echo "that just press ENTER. If you would prefer bold text 'DejaVu Sans Bold 10',"
  2064. echo "hit 'b' key then ENTER, or type in a full font specification (ex: Mono 12)"
  2065. echo -n ": "
  2066. read wantfont
  2067. if [ "$wantfont" != "" ];then
  2068. grep -v 'label_font' rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options > /tmp/3builddistro_rox_options
  2069. grep -v '^</Options>' /tmp/3builddistro_rox_options > rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options
  2070. if [ "$wantfont" = "b" ];then
  2071. echo '...ok, bold'
  2072. echo ' <Option name="label_font">DejaVu Sans Bold 10</Option>' >> rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options
  2073. else
  2074. echo "...ok, $wantfont"
  2075. echo " <Option name=\"label_font\">${wantfont}</Option>" >> rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options
  2076. fi
  2077. echo '</Options>' >> rootfs-complete/root/.config/rox.sourceforge.net/ROX-Filer/Options
  2078. fi
  2079. #w464 maybe get rid of old mksquashfs... v424 fix
  2080. #w091019 running puppy with older glibc, mksquashfs may not work, so must chroot...
  2081. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  2082. if [ -e rootfs-complete/usr/sbin/mksquashfs ];then
  2083. if [ "`chroot rootfs-complete /usr/sbin/mksquashfs -version | grep 'mksquashfs version 4'`" = "" ];then
  2084. mv -f rootfs-complete/usr/sbin/mksquashfs rootfs-complete/usr/sbin/mksquashfs3
  2085. else
  2086. [ ! -e rootfs-complete/usr/sbin/mksquashfs4 ] && mv -f rootfs-complete/usr/sbin/mksquashfs rootfs-complete/usr/sbin/mksquashfs4
  2087. fi
  2088. if [ "$SQUASHFSMAJOR" = "4" ];then #100607
  2089. [ -e rootfs-complete/usr/sbin/mksquashfs4 ] && ln -s mksquashfs4 rootfs-complete/usr/sbin/mksquashfs
  2090. else
  2091. ln -s mksquashfs3 rootfs-complete/usr/sbin/mksquashfs
  2092. fi
  2093. fi
  2094. #ditto for unsquashfs... v424 fix w091019 chroot fix...
  2095. if [ -e rootfs-complete/usr/sbin/unsquashfs ];then
  2096. if [ "`chroot rootfs-complete /usr/sbin/unsquashfs -version | grep 'unsquashfs version 4'`" = "" ];then
  2097. mv -f rootfs-complete/usr/sbin/unsquashfs rootfs-complete/usr/sbin/unsquashfs3
  2098. else
  2099. [ ! -e rootfs-complete/usr/sbin/unsquashfs4 ] && mv -f rootfs-complete/usr/sbin/unsquashfs rootfs-complete/usr/sbin/unsquashfs4
  2100. fi
  2101. if [ "$SQUASHFSMAJOR" = "4" ];then #100607
  2102. [ -e rootfs-complete/usr/sbin/unsquashfs4 ] && ln -s unsquashfs4 rootfs-complete/usr/sbin/unsquashfs
  2103. else
  2104. ln -s unsquashfs3 rootfs-complete/usr/sbin/unsquashfs
  2105. fi
  2106. fi
  2107. else
  2108. #cross-build, assume recent kernel and has squashfs v4...
  2109. [ ! -e rootfs-complete/usr/sbin/mksquashfs4 ] && mv -f rootfs-complete/usr/sbin/mksquashfs rootfs-complete/usr/sbin/mksquashfs4
  2110. [ -e rootfs-complete/usr/sbin/mksquashfs ] && [ ! -h rootfs-complete/usr/sbin/mksquashfs ] && mv -f rootfs-complete/usr/sbin/mksquashfs rootfs-complete/usr/sbin/mksquashfs3 #120502
  2111. [ -e rootfs-complete/usr/sbin/mksquashfs4 ] && ln -s mksquashfs4 rootfs-complete/usr/sbin/mksquashfs
  2112. [ ! -e rootfs-complete/usr/sbin/unsquashfs4 ] && mv -f rootfs-complete/usr/sbin/unsquashfs rootfs-complete/usr/sbin/unsquashfs4
  2113. [ -e rootfs-complete/usr/sbin/unsquashfs ] && [ ! -h rootfs-complete/usr/sbin/unsquashfs ] && mv -f rootfs-complete/usr/sbin/unsquashfs rootfs-complete/usr/sbin/unsquashfs3 #120502
  2114. [ -e rootfs-complete/usr/sbin/unsquashfs4 ] && ln -s unsquashfs4 rootfs-complete/usr/sbin/unsquashfs
  2115. fi
  2116. #w469 delete /lib/modules/$KERNELVER/modules.* to save space...
  2117. #/etc/rc.d/rc.sysinit has code to run depmod.
  2118. #w481 ask delete modules.*...
  2119. echo
  2120. echo "Would you like to delete all the 'modules.*' files in lib/modules/${KERNELVER}?"
  2121. echo "This means that 'depmod' has to be run at first boot, but that is usually ok."
  2122. echo "These files occupy 600KB - 2MB uncompressed."
  2123. echo -n "Press ENTER only to delete them: "
  2124. read nodelmods
  2125. if [ "$nodelmods" = "" ];then
  2126. echo "...deleting modules.* files."
  2127. [ -d rootfs-complete/lib/modules/$KERNELVER ] && rm -f rootfs-complete/lib/modules/$KERNELVER/modules.* 2>/dev/null
  2128. [ -d zdrv/lib/modules/$KERNELVER ] && rm -f zdrv/lib/modules/$KERNELVER/modules.* 2>/dev/null
  2129. fi
  2130. #100628 my 2.6.34 pet has these...
  2131. mkdir -p rootfs-complete/lib/modules/$KERNELVER #101023 not there if separate zdrv built.
  2132. [ -f rootfs-complete/etc/modules/modules.builtin ] && mv -f rootfs-complete/etc/modules/modules.builtin rootfs-complete/lib/modules/$KERNELVER/
  2133. [ -f rootfs-complete/etc/modules/modules.order ] && mv -f rootfs-complete/etc/modules/modules.order rootfs-complete/lib/modules/$KERNELVER/
  2134. if [ "$MAKEZDRV" != "" ];then #w481 100903
  2135. #v425 big analog modules may have got moved out to the zdrv...
  2136. if [ -d big-modem-modules ];then
  2137. mkdir -p zdrv
  2138. cp -a -f big-modem-modules/rootfs-complete/* zdrv/
  2139. mkdir -p zdrv/lib/modules/all-firmware
  2140. cp -a -f big-modem-firmware/* zdrv/lib/modules/all-firmware/
  2141. sync
  2142. fi
  2143. if [ "$MAKEZDRV" = "all-modules" ];then #100903
  2144. mkdir -p zdrv/lib
  2145. mkdir -p zdrv/etc
  2146. mv -f rootfs-complete/lib/firmware zdrv/lib/
  2147. mv -f rootfs-complete/etc/modules zdrv/etc/
  2148. fi
  2149. echo
  2150. echo "Creating ${ZDRVSFS}..."
  2151. [ -f ${ZDRVSFS} ] && rm -f ${ZDRVSFS} #100911
  2152. ../support/${MKSQUASHFS} zdrv ${ZDRVSFS} ${COMPCHOICE} #100911 110713
  2153. sync
  2154. chmod 644 ${ZDRVSFS} #100903 100911
  2155. fi
  2156. #w470 create a table for dialog/Xdialog: /usr/share/i18n/dialog_table
  2157. #'chooselocale' is called from /etc/rc.d/rc.country at first boot and
  2158. #pre-creating this table speeds things up. 111123
  2159. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  2160. chroot rootfs-complete /usr/sbin/chooselocale composeonly
  2161. fi
  2162. [ -f rootfs-complete/pet.specs ] && rm -f rootfs-complete/pet.specs #w478
  2163. #w478 save some space if medit and gtksourceview both installed...
  2164. if [ -d rootfs-complete/usr/share/gtksourceview-2.0 ];then
  2165. if [ -d rootfs-complete/usr/share/moo/language-specs ];then
  2166. echo
  2167. echo "An optimisation can be done to share some files between medit and"
  2168. echo -n "gtksourceview. Press ENTER only to do this: "
  2169. read optsourceview
  2170. if [ "$optsourceview" = "" ];then
  2171. cp -f rootfs-complete/usr/share/gtksourceview-2.0/language-specs/convert.py rootfs-complete/usr/share/moo/language-specs/ 2>/dev/null
  2172. cp -f rootfs-complete/usr/share/gtksourceview-2.0/language-specs/language2.rng rootfs-complete/usr/share/moo/language-specs/ 2>/dev/null
  2173. cp -f rootfs-complete/usr/share/gtksourceview-2.0/language-specs/language.rng rootfs-complete/usr/share/moo/language-specs/ 2>/dev/null
  2174. cp -f rootfs-complete/usr/share/gtksourceview-2.0/language-specs/language.dtd rootfs-complete/usr/share/moo/language-specs/ 2>/dev/null
  2175. cp -f rootfs-complete/usr/share/gtksourceview-2.0/language-specs/styles.rng rootfs-complete/usr/share/moo/language-specs/ 2>/dev/null
  2176. rm -r -f rootfs-complete/usr/share/gtksourceview-2.0/language-specs
  2177. rm -r -f rootfs-complete/usr/share/gtksourceview-2.0/styles
  2178. ln -s /usr/share/moo/language-specs rootfs-complete/usr/share/gtksourceview-2.0/language-specs
  2179. ln -s /usr/share/moo/language-specs rootfs-complete/usr/share/gtksourceview-2.0/styles
  2180. echo "...usr/share/gtksourceview-2.0 now has links to usr/share/moo."
  2181. fi
  2182. fi
  2183. fi
  2184. #091123 t2 build get rid of some stray stuff...
  2185. [ -d rootfs-complete/usr/share/devhelp ] && rm -rf rootfs-complete/usr/share/devhelp
  2186. [ -d rootfs-complete/usr/share/man ] && rm -rf rootfs-complete/usr/share/man
  2187. [ -d rootfs-complete/usr/share/omf ] && rm -rf rootfs-complete/usr/share/omf
  2188. ##091206 cleanup some icons if quirky build...
  2189. #c1DFP="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1`" #100516
  2190. ##if [ "$DISTRO_FILE_PREFIX" = "quirky" ];then
  2191. #if [ "$c1DFP" = "q" ];then #100516
  2192. # ln -snf quirky-grey48x48.png rootfs-complete/usr/share/doc/puppylogo48.png
  2193. # ln -snf quirky-grey96x96.png rootfs-complete/usr/share/doc/puppylogo96.png
  2194. #else #111003
  2195. # rm -f rootfs-complete/usr/share/doc/quirky-grey48x48.png
  2196. # rm -f rootfs-complete/usr/share/doc/quirky-grey96x96.png
  2197. # case $DISTRO_FILE_PREFIX in
  2198. # racy)
  2199. # ln -snf racy48.png rootfs-complete/usr/share/doc/puppylogo48.png
  2200. # ln -snf racy96.png rootfs-complete/usr/share/doc/puppylogo96.png
  2201. # ;;
  2202. # *)
  2203. # rm -f rootfs-complete/usr/share/doc/racy48.png #111003
  2204. # rm -f rootfs-complete/usr/share/doc/racy96.png #111003
  2205. # ;;
  2206. # esac
  2207. #fi
  2208. #111006 generic logo mechanism for all pups...
  2209. if [ -f rootfs-complete/usr/share/doc/puplogos/${DISTRO_FILE_PREFIX}48.png ];then
  2210. mv -f rootfs-complete/usr/share/doc/puplogos/${DISTRO_FILE_PREFIX}48.png rootfs-complete/usr/share/doc/${DISTRO_FILE_PREFIX}48.png
  2211. ln -snf ${DISTRO_FILE_PREFIX}48.png rootfs-complete/usr/share/doc/puppylogo48.png
  2212. fi
  2213. if [ -f rootfs-complete/usr/share/doc/puplogos/${DISTRO_FILE_PREFIX}96.png ];then
  2214. mv -f rootfs-complete/usr/share/doc/puplogos/${DISTRO_FILE_PREFIX}96.png rootfs-complete/usr/share/doc/${DISTRO_FILE_PREFIX}96.png
  2215. ln -snf ${DISTRO_FILE_PREFIX}96.png rootfs-complete/usr/share/doc/puppylogo96.png
  2216. fi
  2217. rm -rf rootfs-complete/usr/share/doc/puplogos
  2218. #100208 hack so net-setup.sh can find ifplugstatus (pup 4.3.2 needs this)...
  2219. if [ ! -e rootfs-complete/sbin/ifplugstatus ];then
  2220. if [ -e rootfs-complete/sbin/ifplugstatus-0.18 ];then
  2221. ln -s ifplugstatus-0.18 rootfs-complete/sbin/ifplugstatus
  2222. else
  2223. if [ -e rootfs-complete/sbin/ifplugstatus-0.28 ];then
  2224. ln -s ifplugstatus-0.28 rootfs-complete/sbin/ifplugstatus
  2225. fi
  2226. fi
  2227. fi
  2228. #100524 fix cups for samba, got this code from /usr/sbin/cups_shell...
  2229. #fixes from rcrsn51 for samba printing...
  2230. [ -f rootfs-complete/etc/cups/snmp.conf ] && [ "`stat --format=%U%G rootfs-complete/etc/cups/snmp.conf | grep 'UNKNOWN'`" != "" ] && chown root:nobody rootfs-complete/etc/cups/snmp.conf
  2231. #100706 no, this goes against all the docs, restore to a symlink...
  2232. #if [ ! -e rootfs-complete/usr/lib/cups/backend/smb ];then
  2233. # [ -f rootfs-complete/opt/samba/bin/smbspool ] && cp -a rootfs-complete/opt/samba/bin/smbspool rootfs-complete/usr/lib/cups/backend/smb
  2234. # [ -f rootfs-complete/usr/bin/smbspool ] && cp -a rootfs-complete/usr/bin/smbspool rootfs-complete/usr/lib/cups/backend/smb
  2235. #fi
  2236. if [ ! -e rootfs-complete/usr/lib/cups/backend/smb ];then
  2237. [ -f rootfs-complete/opt/samba/bin/smbspool ] && ln -s /opt/samba/bin/smbspool rootfs-complete/usr/lib/cups/backend/smb
  2238. [ -f rootfs-complete/usr/bin/smbspool ] && ln -s /usr/bin/smbspool rootfs-complete/usr/lib/cups/backend/smb
  2239. fi
  2240. [ -f rootfs-complete/etc/opt/samba/smb.conf ] && chmod 755 rootfs-complete/etc/opt/samba/smb.conf #need world-readable.
  2241. [ -f rootfs-complete/etc/samba/smb.conf ] && chmod 755 rootfs-complete/etc/samba/smb.conf #need world-readable.
  2242. #110907 rcrsn51: network printing, need this... 111027 revert, must have actual pdftops from cups pkg...
  2243. #if [ ! -e rootfs-complete/usr/lib/cups/filter/pdftops ];then
  2244. # [ -f rootfs-complete/usr/bin/pdftops ] && ln -s /usr/bin/pdftops rootfs-complete/usr/lib/cups/filter/pdftops
  2245. #fi
  2246. #111026 davids45: /tmp needs 777 permissions. i do have this in rootfs-skeleton, but lost in sandbox3/rootfs-complete
  2247. # (http://murga-linux.com/puppy/viewtopic.php?t=72258&start=90)
  2248. #130203 01micko: make that 1777 ref: http://murga-linux.com/puppy/viewtopic.php?p=677630#677630
  2249. chmod 1777 rootfs-complete/tmp
  2250. chmod 777 rootfs-complete/var
  2251. #110911 fix if any alternate drivers still at old location...
  2252. mkdir -p rootfs-complete/usr/lib/x/drivers-alternate
  2253. if [ -d rootfs-complete/usr/lib/xorg/modules/drivers-alternate ];then
  2254. cp -a -f rootfs-complete/usr/lib/xorg/modules/drivers-alternate/* rootfs-complete/usr/lib/x/drivers-alternate/
  2255. rm -rf rootfs-complete/usr/lib/xorg/modules/drivers-alternate
  2256. fi
  2257. #100319 move more xorg drivers to 'drivers-alternate' so won't be chosen by xorg...
  2258. if [ -d rootfs-complete/usr/lib/xorg/modules/drivers ];then #well, always exists.
  2259. XORGBADDRIVERS=''
  2260. if [ -f rootfs-complete/usr/lib/xorg/modules/drivers/nvidia_drv.so -o -f rootfs-complete/usr/lib/xorg/modules/drivers/nouveau_drv.so ];then #100527 100629
  2261. [ -f rootfs-complete/usr/lib/xorg/modules/drivers/nv_drv.so ] && XORGBADDRIVERS='nv' #120922 note, some builds don't have nv, or it may already be in drivers-alternate dir.
  2262. fi
  2263. [ -f rootfs-complete/usr/lib/xorg/modules/drivers/modesetting_drv.so ] && XORGBADDRIVERS="${XORGBADDRIVERS} modesetting" #130330
  2264. echo
  2265. echo "Certain Xorg drivers have a bad reputation. Here you can choose to move them"
  2266. echo "to /usr/lib/x/drivers-alternate so Xorg will not use them, instead"
  2267. echo "will use the generic 'vesa' driver (or other more appropriate driver)."
  2268. echo "However the Xorg Wizard has a mechanism to move any drivers in "
  2269. echo "'drivers-alternate' back to 'drivers' directory."
  2270. echo "Here is the list of drivers currently in 'drivers-alternate':"
  2271. XORGBADDRIVERS="$XORGBADDRIVERS `ls -1 rootfs-complete/usr/lib/x/drivers-alternate | grep '_drv' | cut -f 1 -d '_' | tr '\n' ' '`"
  2272. echo " $XORGBADDRIVERS"
  2273. echo "Press ENTER only to accept this, or"
  2274. echo "type a space-delimited list of drivers"
  2275. echo -n " that you want to be in 'drivers-alternate': "
  2276. read NEWXORGBADDRVRS
  2277. [ "$NEWXORGBADDRVRS" = "" ] && NEWXORGBADDRVRS="$XORGBADDRIVERS"
  2278. for ONEBADX in $NEWXORGBADDRVRS
  2279. do
  2280. #some builds have i810_drv.so symlink to intel_drv.so...
  2281. if [ -h rootfs-complete/usr/lib/xorg/modules/drivers/${ONEBADX}_drv.so ];then
  2282. continue
  2283. fi
  2284. [ -f rootfs-complete/usr/lib/xorg/modules/drivers/${ONEBADX}_drv.so ] && mv -f rootfs-complete/usr/lib/xorg/modules/drivers/${ONEBADX}_drv.so rootfs-complete/usr/lib/x/drivers-alternate/
  2285. done
  2286. for ONECHK in `ls -1 rootfs-complete/usr/lib/x/drivers-alternate | grep '_drv' | cut -f 1 -d '_' | tr '\n' ' '` #110911
  2287. do
  2288. oPTN=" ${ONECHK} "
  2289. if [ "`echo -n " ${NEWXORGBADDRVRS} " | grep "$oPTN"`" = "" ];then
  2290. if [ ! -d $ONECHK ];then
  2291. mv -f rootfs-complete/usr/lib/x/drivers-alternate/${ONECHK}_drv.so rootfs-complete/usr/lib/xorg/modules/drivers/
  2292. else
  2293. echo "SORRY: cannot move '${ONECHK}_drv.so' from drivers-alternate back to"
  2294. echo "main drivers, it must stay as an alternate driver only."
  2295. fi
  2296. fi
  2297. done
  2298. fi
  2299. #101012 if 'depmod-FULL' exists, rename it to 'depmod'... 101024
  2300. if [ "$USINGKMOD" = "no" ];then #130418
  2301. if [ ! -h rootfs-complete/sbin/depmod-FULL ];then #if hyperlink then assume to depmod.
  2302. if [ -f rootfs-complete/sbin/depmod-FULL ];then
  2303. mv -f rootfs-complete/sbin/depmod rootfs-complete/sbin/depmod-BB-NOTUSED
  2304. mv -f rootfs-complete/sbin/depmod-FULL rootfs-complete/sbin/depmod
  2305. fi
  2306. ln -s depmod rootfs-complete/sbin/depmod-FULL
  2307. fi
  2308. else
  2309. [ -e rootfs-complete/bin/kmod ] && ln -snf ../bin/kmod rootfs-complete/sbin/depmod #130430 path fix.
  2310. fi
  2311. #101015 make sure our modified 'alsaconf' is used (just in case got overwritten)...
  2312. cp -a -f ../rootfs-skeleton/usr/sbin/alsaconf rootfs-complete/usr/sbin/
  2313. #w481 extra stripping...
  2314. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #120502 strip will not work for cross-build.
  2315. echo
  2316. echo "Would you like to strip all binary executables and shared library files?"
  2317. echo "These are usually already stripped, although some packages may have the shared"
  2318. echo "library files stripped with the '--strip-debug' option only, and extra stripping"
  2319. echo "should be okay. It won't do any harm answering yes here."
  2320. if [ "`which strip`" = "" ];then
  2321. echo
  2322. echo "OH, NO GOOD, you don't have the 'strip' executable. The 'devx' sfs has it."
  2323. echo "PLEASE DECLINE THIS OFFER..."
  2324. echo
  2325. fi
  2326. echo -n "ENTER only to strip, any other printable char to decline: "
  2327. read NOSTRIP
  2328. if [ "$NOSTRIP" = "" ];then
  2329. find rootfs-complete/bin rootfs-complete/sbin rootfs-complete/usr/bin rootfs-complete/sbin -type f |
  2330. while read ONEFILE
  2331. do
  2332. ONEBASE="`basename "$ONEFILE"`"
  2333. # if [ "`file "$ONEFILE" | grep 'ELF' | grep 'executable' | grep 'dynamically linked'`" != "" ];then #v424 fix.
  2334. [ "$ONEBASE" = "e3" ] && continue #v431 cannot be stripped.
  2335. [ "$ONEBASE" = "QtWeb" ] && continue #130721 cannot be stripped.
  2336. if [ "`file "$ONEFILE" | grep 'ELF' | grep 'executable'`" != "" ];then #v431
  2337. echo -n "$ONEBASE "
  2338. strip --strip-unneeded "$ONEFILE"
  2339. fi
  2340. done
  2341. echo
  2342. find rootfs-complete/usr/lib rootfs-complete/usr/X11R7/lib -type f -name \*.so* |
  2343. while read ONEFILE
  2344. do
  2345. ONEBASE="`basename "$ONEFILE"`"
  2346. #v431 libgdk-x11-2.0.so* compiled in pup4 with '--enable-debug', fixes insert-key mozilla crash.
  2347. # it may be unwise to strip its debug symbols... no, it's ok...
  2348. #[ "`echo "$ONEBASE" | grep 'libgdk'`" != "" ] && continue #v431
  2349. if [ "`file "$ONEFILE" | grep 'ELF' | grep 'shared object'`" != "" ];then
  2350. echo -n "$ONEBASE "
  2351. strip --strip-unneeded "$ONEFILE"
  2352. fi
  2353. done
  2354. echo
  2355. fi
  2356. fi
  2357. #100527 build a .pet with lists of all builtin files...
  2358. echo
  2359. echo "Now building sandbox3/0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}.pet,"
  2360. echo "which is a PET package with lists of all packages and files builtin to the SFS..."
  2361. rm -rf 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION} 2>/dev/null
  2362. mkdir 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}
  2363. mkdir /tmp/0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}
  2364. for ONEGENDIR in `find ../packages-${DISTRO_FILE_PREFIX} -maxdepth 1 -type d | tr '\n' ' '`
  2365. do
  2366. ONEGENNAME="`basename $ONEGENDIR`"
  2367. # [ "`echo "$ONEGENNAME" | grep -E '_DEV|_DOC|_NLS|_NULL'`" != "" ] && continue #not really needed.
  2368. ogPATTERN="|${ONEGENNAME}|"
  2369. [ "`echo "$PKGS_SPECS_TABLE" | grep '^yes' | grep "$ogPATTERN"`" == "" ] && continue
  2370. echo -n "$ONEGENNAME "
  2371. ogPATTERN="s%^\\.\\./packages-${DISTRO_FILE_PREFIX}/${ONEGENNAME}/%/%"
  2372. find $ONEGENDIR | sed -e "$ogPATTERN" | sort > /tmp/0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}/${ONEGENNAME}.files
  2373. sync
  2374. #store the information more efficiently...
  2375. mkdir -p 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}/root/.packages/builtin_files
  2376. PREVPATH=''; PREVPATH0=''
  2377. cat /tmp/0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}/${ONEGENNAME}.files |
  2378. while read ONELINE
  2379. do
  2380. [ "`echo "$ONELINE" | cut -c 1`" == "." ] && continue #catch ex: ../packages-qrky/abiword
  2381. if [ -d "rootfs-complete${ONELINE}" ];then
  2382. #120925 ignore debian/ubuntu multiarch circular symlink (these are create by 2createpackages)...
  2383. if [ -h "rootfs-complete${ONELINE}" ];then
  2384. if [ "$(readlink "rootfs-complete${ONELINE}")" = "./" ];then
  2385. PREVPATH0="$(dirname "$ONELINE")" #121010 fix, missing some files.
  2386. [ "$PREVPATH0" != "$PREVPATH" ] && echo "$PREVPATH0" >> 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}/root/.packages/builtin_files/${ONEGENNAME} #121010
  2387. continue
  2388. fi
  2389. fi
  2390. PREVPATH="$ONELINE"
  2391. echo "$ONELINE" >> 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}/root/.packages/builtin_files/${ONEGENNAME}
  2392. else
  2393. NEWPATH="`dirname "$ONELINE"`"
  2394. [ "$NEWPATH" == "/" ] && continue #ignore top-level files.
  2395. NEWFILE="`basename "$ONELINE"`"
  2396. if [ -e "rootfs-complete${ONELINE}" ];then #sanity check.
  2397. if [ "$PREVPATH" == "$NEWPATH" -o "$PREVPATH0" == "$NEWPATH" ];then #sanity check. 121010
  2398. echo " ${NEWFILE}" >> 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}/root/.packages/builtin_files/${ONEGENNAME}
  2399. fi
  2400. fi
  2401. fi
  2402. done
  2403. done
  2404. echo "0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}|0builtin_files_${DISTRO_FILE_PREFIX}|${DISTRO_VERSION}||BuildingBlock|||0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}.pet||Lists of files built-in to the SFS file||||
  2405. " > 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}/pet.specs
  2406. rm -f 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}.pet 2>/dev/null
  2407. dir2tgz 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}
  2408. tgz2pet 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}.tar.gz
  2409. rm -rf /tmp/0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}
  2410. echo
  2411. echo "installing pkg lists into rootfs-complete/root/.packages/builtin_files..."
  2412. cp -a -f 0builtin_files_${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}/root/.packages/builtin_files rootfs-complete/root/.packages/builtin_files
  2413. echo '...done'
  2414. #100613 create font cache for fontconfig (in /var/cache/fontconfig)...
  2415. echo
  2416. echo "Creating Fontconfig cache files..."
  2417. rm -rf rootfs-complete/var/cache/fontconfig
  2418. mkdir -p rootfs-complete/var/cache/fontconfig
  2419. #111123 ***NOTICE*** cross-build, this will have to be executed at first boot...
  2420. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  2421. chroot rootfs-complete /usr/bin/fc-cache -s -v
  2422. fi
  2423. if [ ! -e rootfs-complete/usr/bin/pango-querymodules ];then #110517 debian squeeze hack
  2424. #cp -f devx/usr/bin/pango-querymodules rootfs-complete/usr/bin/
  2425. cp -f ../packages-${DISTRO_FILE_PREFIX}/pango_DEV/usr/bin/pango-querymodules rootfs-complete/usr/bin/
  2426. fi
  2427. #100622 slackware 13.1: this file is zero bytes...
  2428. #111123 ***NOTICE*** cross-build, this will have to be executed at first boot...
  2429. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  2430. PANGOMODULES="`find rootfs-complete/etc/pango -type f -name pango.modules | sed -e 's%rootfs-complete%%'`"
  2431. [ "$PANGOMODULES" = "" ] && PANGOMODULES='/etc/pango/pango.modules'
  2432. if [ ! -s rootfs-complete${PANGOMODULES} ];then
  2433. echo "/usr/bin/pango-querymodules > ${PANGOMODULES}" > rootfs-complete/zz
  2434. chroot rootfs-complete /bin/ash zz
  2435. rm -f rootfs-complete/zz
  2436. fi
  2437. fi
  2438. #110622 hack for mageia 1 (otherwise can't find pango.modules)...
  2439. if [ -d rootfs-complete/etc/pango/i386 ];then
  2440. cp -a -f rootfs-complete/etc/pango/pango.modules rootfs-complete/etc/pango/i386/
  2441. [ -f rootfs-complete/etc/pango/pangox.aliases ] && cp -a -f rootfs-complete/etc/pango/pangox.aliases rootfs-complete/etc/pango/i386/
  2442. fi
  2443. #110622 /etc/rc.d/rc.update executes: gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders
  2444. #however, mageia1 requires above file to be at /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
  2445. #create a symlink...
  2446. VERDIR=''
  2447. if [ -d rootfs-complete/usr/lib/gdk-pixbuf-2.0 ];then
  2448. [ ! -f rootfs-complete/etc/gtk-2.0/gdk-pixbuf.loaders ] && touch rootfs-complete/etc/gtk-2.0/gdk-pixbuf.loaders
  2449. PIXBUFLOADERSDIR="`find rootfs-complete/usr/lib/gdk-pixbuf-2.0 -maxdepth 2 -mindepth 2 -type d -name loaders | head -n 1`"
  2450. if [ "$PIXBUFLOADERSDIR" ];then
  2451. PIXBUFCACHEDIR="`dirname $PIXBUFLOADERSDIR`"
  2452. VERDIR="`basename $PIXBUFCACHEDIR`" #2.10.0
  2453. ln -snf ../../../../etc/gtk-2.0/gdk-pixbuf.loaders ${PIXBUFCACHEDIR}/loaders.cache #110903 change -s to -snf
  2454. #there may be some loaders in wrong place...
  2455. [ -d rootfs-complete/usr/lib/gtk-2.0/loaders ] && mv -f rootfs-complete/usr/lib/gtk-2.0/loaders/*.so ${PIXBUFLOADERSDIR}/ 2>/dev/null
  2456. if [ -d rootfs-complete/usr/lib/gtk-2.0/${VERDIR}/loaders ];then
  2457. mv -f rootfs-complete/usr/lib/gtk-2.0/${VERDIR}/loaders/*.so ${PIXBUFLOADERSDIR}/ 2>/dev/null
  2458. rmdir rootfs-complete/usr/lib/gtk-2.0/${VERDIR}/loaders #111114
  2459. ln -s ../../gdk-pixbuf-2.0/${VERDIR}/loaders rootfs-complete/usr/lib/gtk-2.0/${VERDIR}/loaders #111114
  2460. else #111117
  2461. ln -s ../../gdk-pixbuf-2.0/${VERDIR}/loaders rootfs-complete/usr/lib/gtk-2.0/${VERDIR}/loaders
  2462. fi
  2463. fi
  2464. fi
  2465. #120605 shinobar ref: http://murga-linux.com/puppy/viewtopic.php?t=76961&start=195
  2466. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then
  2467. chroot rootfs-complete /usr/bin/gtk-query-immodules-2.0 > rootfs-complete/etc/gtk-2.0/gtk.immodules
  2468. else
  2469. touch rootfs-complete/etc/gtk-2.0/gtk.immodules
  2470. fi
  2471. [ "$VERDIR" ] && ln -snf ../../../../etc/gtk-2.0/gtk.immodules rootfs-complete/usr/lib/gtk-2.0/${VERDIR}/gtk.immodules
  2472. #100627 recent versions of xorg server, turn modesetting on... 110822 improve...
  2473. mkdir -p rootfs-complete/etc/modprobe.d
  2474. #110621 need to chroot...
  2475. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  2476. XORGINFO="`chroot rootfs-complete /usr/bin/Xorg -version 2>&1`"
  2477. XORGVER="`echo "$XORGINFO" | grep '^X\.Org' | rev | cut -f 1 -d ' ' | rev`"
  2478. else
  2479. #cross-build, assume recent xorg...
  2480. XORGVER='1.7.7'
  2481. fi
  2482. [ "$XORGVER" = "" ] && XORGVER="`echo "$XORGINFO" | grep '^X Window System Version' | rev | cut -f 1 -d ' ' | rev`" #xorg 7.3
  2483. [ "$XORGVER" = "" ] && XORGVER="1.3.0" #precaution. version used in original Xorg 7.3.
  2484. if vercmp "$XORGVER" gt "1.7.6";then
  2485. #120616 no, don't do this...
  2486. ##120516 check that these drivers exist...
  2487. #EXTRADRVPTH=''
  2488. #[ -d rootfs-complete/usr/X11R7/lib/dri ] && EXTRADRVPTH='rootfs-complete/usr/X11R7/lib/dri'
  2489. #[ -d rootfs-complete/usr/lib/dri ] && EXTRADRVPTH="${EXTRADRVPTH} rootfs-complete/usr/lib/dri"
  2490. #[ ! "$EXTRADRVPTH" ] && EXTRADRVPTH='/usr/lib'
  2491. #DRILIST=''
  2492. #for AXDRI in i915_dri.so radeon_dri.so nouveau_dri.so
  2493. #do
  2494. # if find ${EXTRADRVPTH} -mindepth 1 -maxdepth 1 -name ${AXDRI}; then
  2495. # ADRI="`echo -n "$AXDRI" | cut -f 1 -d '_'`"
  2496. # DRILIST="${DRILIST}${ADRI} "
  2497. # fi
  2498. #done
  2499. #120616 do this...
  2500. DRILIST='i915 radeon nouveau'
  2501. [ "$SDFLAG" ] && DRILIST='' #assume not using kms at all when boot from sd card (arm arch).
  2502. if [ "$DRILIST" != "" ];then
  2503. echo
  2504. echo "Certain Xorg drivers require KMS (Kernel ModeSetting)"
  2505. echo "A value of '1' means on, '0' means off."
  2506. echo "Press ENTER key only to accept the default, any other char to flip:"
  2507. for XDRIVER in $DRILIST #i915 radeon nouveau
  2508. do
  2509. KMSFLG='1'
  2510. #[ "$XDRIVER" = "radeon" ] && [ "$DISTRO_BINARY_COMPAT" = "slackware" ] && KMSFLG='0' #01micko.
  2511. #[ "$XDRIVER" = "radeon" ] && KMSFLG='0' #110918 seems need this off. 120526 try default on. 120605 turn off. 120903 on again.
  2512. echo -n "${XDRIVER} [${KMSFLG}]: "
  2513. read KMSREPLY
  2514. if [ "$KMSREPLY" ];then #110906 fix syntax error.
  2515. #not the default...
  2516. case $KMSFLG in
  2517. 0) echo "options ${XDRIVER} modeset=1" > rootfs-complete/etc/modprobe.d/${XDRIVER}.conf ;;
  2518. 1) echo "options ${XDRIVER} modeset=0" > rootfs-complete/etc/modprobe.d/${XDRIVER}.conf ;;
  2519. esac
  2520. else
  2521. echo "options ${XDRIVER} modeset=${KMSFLG}" > rootfs-complete/etc/modprobe.d/${XDRIVER}.conf
  2522. fi
  2523. done
  2524. fi
  2525. fi
  2526. #110213 fix if .utf8 entries missing...
  2527. if [ "`grep 'nb_NO\.utf8' rootfs-complete/usr/share/X11/locale/locale.alias`" = "" ];then
  2528. echo 'nb_NO.utf8: nb_NO.UTF-8' >> rootfs-complete/usr/share/X11/locale/locale.alias
  2529. fi
  2530. if [ "`grep 'nn_NO\.utf8' rootfs-complete/usr/share/X11/locale/locale.alias`" = "" ];then
  2531. echo 'nn_NO.utf8: nn_NO.UTF-8' >> rootfs-complete/usr/share/X11/locale/locale.alias
  2532. fi
  2533. if [ "`grep 'ru_UA\.utf8' rootfs-complete/usr/share/X11/locale/locale.alias`" = "" ];then
  2534. echo 'ru_UA.utf8: ru_UA.UTF-8' >> rootfs-complete/usr/share/X11/locale/locale.alias
  2535. fi
  2536. if [ "`grep 'ru_RU\.utf8' rootfs-complete/usr/share/X11/locale/locale.alias`" = "" ];then
  2537. echo 'ru_RU.utf8: ru_RU.UTF-8' >> rootfs-complete/usr/share/X11/locale/locale.alias
  2538. fi
  2539. #110329 some python files, move to 'devx'...
  2540. #121022 but only if python is supposed to be in devx...
  2541. if [ "$(echo "$PKGS_SPECS_TABLE" | grep '^yes|python|' | grep 'exe>dev')" != "" ];then
  2542. PYTHONDIR=''
  2543. [ -d rootfs-complete/usr/lib/python2.5 ] && PYTHONDIR='python2.5'
  2544. [ -d rootfs-complete/usr/lib/python2.6 ] && PYTHONDIR='python2.6'
  2545. [ -d rootfs-complete/usr/lib/python2.7 ] && PYTHONDIR='python2.7'
  2546. if [ "$PYTHONDIR" ];then
  2547. mkdir -p devx/usr/lib/${PYTHONDIR}
  2548. cp -a -f --remove-destination rootfs-complete/usr/lib/${PYTHONDIR}/* devx/usr/lib/${PYTHONDIR}/
  2549. rm -rf rootfs-complete/usr/lib/${PYTHONDIR}
  2550. fi
  2551. fi
  2552. #110412 move all .bac, .pot and .pupdev files to 'devx'...
  2553. find rootfs-complete/usr -type f -name '*.pot' -o -name '*.pupdev' -o -name '*.bac' |
  2554. while read ONEPD
  2555. do
  2556. DESTDIR="`dirname "$ONEPD" | sed -e 's%rootfs\-complete%%'`"
  2557. mkdir -p "devx${DESTDIR}"
  2558. mv -f "$ONEPD" "devx${DESTDIR}/"
  2559. done
  2560. #120224 move rootfs-complete/usr/share/doc/nls to 'devx'...
  2561. mkdir -p devx/usr/share/doc/nls
  2562. cp -a -f rootfs-complete/usr/share/doc/nls/* devx/usr/share/doc/nls/
  2563. rm -r -f rootfs-complete/usr/share/doc/nls
  2564. #110417 this may be helpful for more apps than Thunar...
  2565. #this will make Thunar use ROX-Filer's icons for files...
  2566. if [ -d rootfs-complete/usr/local/apps/ROX-Filer/ROX/MIME ];then
  2567. if [ ! -e rootfs-complete/usr/share/icons/hicolor/48x48/mimetypes ];then
  2568. ln -s ../../../../local/apps/ROX-Filer/ROX/MIME rootfs-complete/usr/share/icons/hicolor/48x48/mimetypes
  2569. fi
  2570. fi
  2571. #110421 get version compare utility...
  2572. cp -f ../boot/initrd-tree0/bin/vercmp rootfs-complete/bin/
  2573. #110429 fix just in case...
  2574. busybox chown -h -R spot:spot rootfs-complete/root/spot
  2575. #110429 this is difficult. may need a fix, think want glibc scsi headers in usr/include/scsi...
  2576. mkdir -p devx/usr/include
  2577. if [ -d ../packages-${DISTRO_FILE_PREFIX}/linux_headers_DEV/usr/include/scsi ];then
  2578. cp -a ../packages-${DISTRO_FILE_PREFIX}/linux_headers_DEV/usr/include/scsi devx/usr/include/scsi-KERNEL
  2579. fi
  2580. if [ -d ../packages-${DISTRO_FILE_PREFIX}/linux-header_DEV/usr/include/scsi ];then
  2581. cp -a ../packages-${DISTRO_FILE_PREFIX}/linux-header_DEV/usr/include/scsi devx/usr/include/scsi-KERNEL
  2582. fi
  2583. if [ -d ../packages-${DISTRO_FILE_PREFIX}/glibc_DEV/usr/include/scsi ];then
  2584. cp -a ../packages-${DISTRO_FILE_PREFIX}/glibc_DEV/usr/include/scsi devx/usr/include/scsi-GLIBC
  2585. fi
  2586. #also see further down, when building devx.
  2587. ##110517 kms may need to be turned on... ALREADY DONE, SEE 110621 ABOVE
  2588. #XINTELMINOR=`grep '^xserver-xorg-video-intel' rootfs-complete/root/.packages/woof-installed-packages | cut -f 3 -d '|' | cut -f 2 -d '.'` #110517 ex: xserver-xorg-video-intel_2.13.0-6_i386.deb extract 13.
  2589. #[ ! $XINTELMINOR ] && XINTELMINOR=`grep '^xf86-video-intel' rootfs-complete/root/.packages/woof-installed-packages | cut -f 3 -d '|' | cut -f 2 -d '.'`
  2590. #[ ! $XINTELMINOR ] && XINTELMINOR=0
  2591. #if [ $XINTELMINOR -gt 9 ];then
  2592. # echo 'options i915 modeset=1' > rootfs-complete/etc/modprobe.d/i915.conf
  2593. # [ "`grep '^xserver-xorg-video-nouveau' rootfs-complete/root/.packages/woof-installed-packages`" != "" ] && echo 'options nouveau modeset=1' > rootfs-complete/etc/modprobe.d/nvidia.conf
  2594. # [ "`grep '^xf86-video-nouveau' rootfs-complete/root/.packages/woof-installed-packages`" != "" ] && echo 'options nouveau modeset=1' > rootfs-complete/etc/modprobe.d/nvidia.conf
  2595. # [ "`grep '^xserver-xorg-video-radeon' rootfs-complete/root/.packages/woof-installed-packages`" != "" ] && echo 'options radeon modeset=1' > rootfs-complete/etc/modprobe.d/radeon.conf
  2596. # [ "`grep '^xf86-video-radeon' rootfs-complete/root/.packages/woof-installed-packages`" != "" ] && echo 'options radeon modeset=1' > rootfs-complete/etc/modprobe.d/radeon.conf
  2597. #fi
  2598. #110523 override files from rootfs-skeleton/root/Choices/MIME-types, if rox pkg has older files...
  2599. cp -a -f ../rootfs-skeleton/root/Choices/MIME-types/* rootfs-complete/root/Choices/MIME-types/
  2600. #110620 do same for mime icons...
  2601. cp -a -f --remove-destination ../rootfs-skeleton/usr/local/apps/ROX-Filer/ROX/MIME/* rootfs-complete/usr/local/apps/ROX-Filer/ROX/MIME/
  2602. #130320 these days, i think give util-linux the preference. note, should really fix in e2fsprogs template.
  2603. ##110701 possible lib clash between e2fsprogs and util-linux (i might use old util-linux pet). hack...
  2604. #if [ -e ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs/lib/libblkid.so.1 ];then
  2605. # if [ -e ../packages-${DISTRO_FILE_PREFIX}/util-linux/lib/libblkid.so.1 ];then
  2606. # #give e2fsprogs libs preference...
  2607. # cp -a -f --remove-destination ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs/lib/libblkid.so* rootfs-complete/lib/
  2608. # cp -a -f --remove-destination ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs/lib/libuuid.so* rootfs-complete/lib/
  2609. # rm -f ../packages-${DISTRO_FILE_PREFIX}/util-linux_DEV/lib/lib*
  2610. # fi
  2611. #fi
  2612. #130320 i don't think any of this is required, as util-linux is later in the pkg-list so will override anyway.
  2613. # so, comment this out also!...
  2614. #if [ -e ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs/lib/libblkid.so.1 ];then
  2615. # if [ -e ../packages-${DISTRO_FILE_PREFIX}/util-linux/lib/libblkid.so.1 ];then
  2616. # #give util-linux libs preference...
  2617. # cp -a -f --remove-destination ../packages-${DISTRO_FILE_PREFIX}/util-linux/lib/libblkid.so* rootfs-complete/lib/
  2618. # cp -a -f --remove-destination ../packages-${DISTRO_FILE_PREFIX}/util-linux/lib/libuuid.so* rootfs-complete/lib/
  2619. # cp -a -f --remove-destination ../packages-${DISTRO_FILE_PREFIX}/util-linux/usr/lib/libblkid.so* rootfs-complete/lib/ 2>/dev/null
  2620. # cp -a -f --remove-destination ../packages-${DISTRO_FILE_PREFIX}/util-linux/usr/lib/libuuid.so* rootfs-complete/lib/ 2>/dev/null
  2621. # #so that the 'devx' will build ok...
  2622. # rm -f ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs_DEV/lib/libblkid.so* 2>/dev/null
  2623. # rm -f ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs_DEV/lib/libuuid.so* 2>/dev/null
  2624. # rm -f ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs_DEV/usr/lib/libblkid.so* 2>/dev/null
  2625. # rm -f ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs_DEV/usr/lib/libuuid.so* 2>/dev/null
  2626. # rm -f ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs_DEV/usr/lib/pkgconfig/blkid.pc
  2627. # rm -f ../packages-${DISTRO_FILE_PREFIX}/e2fsprogs_DEV/usr/lib/pkgconfig/uuid.pc
  2628. # fi
  2629. #fi
  2630. #130111 fixed in 2createpackages...
  2631. ##110726 mageia does something weird, puts all these in wrong place (see also devx further down)...
  2632. #if [ -d rootfs-complete/usr/bin/multiarch-i386-linux ];then
  2633. # cp -a -f --remove-destination rootfs-complete/usr/bin/multiarch-i386-linux/* devx/usr/bin/
  2634. # rm -rf rootfs-complete/usr/bin/multiarch-i386-linux
  2635. #fi
  2636. #110806 if yad installed, no zenity, make sure zenity is symlink to yad...
  2637. YAD="`find ./rootfs-complete/bin ./rootfs-complete/sbin ./rootfs-complete/usr/bin ./rootfs-complete/usr/sbin ./rootfs-complete/usr/local/bin -type f -name yad`"
  2638. if [ "$YAD" ];then
  2639. ZENITY="`find ./rootfs-complete/bin ./rootfs-complete/sbin ./rootfs-complete/usr/bin ./rootfs-complete/usr/sbin ./rootfs-complete/usr/local/bin -name zenity`"
  2640. if [ ! "$ZENITY" ];then
  2641. YADDIR="`dirname $YAD`"
  2642. ln -s yad ${YADDIR}/zenity
  2643. fi
  2644. fi
  2645. #110904 no, now done in pet pkg 'zz_wary52_fixup'...
  2646. ##110901 i have experimented with building a wary "5.2pre" without libxcb.
  2647. ##however, many existing apps want it, even though don't use it.
  2648. ##this is a trick that satisfies them...
  2649. #if [ "`grep '^libxcb' rootfs-complete/root/.packages/woof-installed-packages`" = "" ];then
  2650. # if [ -e rootfs-complete/usr/X11R7/lib/libX11.so.6 ];then
  2651. # ln -s libX11.so.6 rootfs-complete/usr/X11R7/lib/libxcb-xlib.so.0
  2652. # ln -s libX11.so.6 rootfs-complete/usr/X11R7/lib/libxcb.so.1
  2653. # fi
  2654. #fi
  2655. #110901 temp hack, if only have gtkdialog4 pkg...
  2656. if [ ! -e rootfs-complete/usr/sbin/gtkdialog3 ];then
  2657. if [ ! -e rootfs-complete/usr/bin/gtkdialog3 ];then
  2658. [ -e rootfs-complete/usr/sbin/gtkdialog4 ] && ln -s gtkdialog4 rootfs-complete/usr/sbin/gtkdialog3
  2659. [ -e rootfs-complete/usr/bin/gtkdialog4 ] && ln -s gtkdialog4 rootfs-complete/usr/bin/gtkdialog3
  2660. fi
  2661. fi
  2662. #110910 make sure gtkdialog links to latest...
  2663. if [ ! -e rootfs-complete/usr/sbin/gtkdialog ];then
  2664. [ -e rootfs-complete/usr/sbin/gtkdialog3 ] && ln -s gtkdialog3 rootfs-complete/usr/sbin/gtkdialog
  2665. [ -e rootfs-complete/usr/sbin/gtkdialog4 ] && ln -snf gtkdialog4 rootfs-complete/usr/sbin/gtkdialog
  2666. fi
  2667. #110822 some customisations provided by 01micko for Slacko...
  2668. #if [ "$DISTRO_BINARY_COMPAT" = "slackware" ];then
  2669. if [ "$DISTRO_FILE_PREFIX" = "slacko" ];then #130321
  2670. if [ -f ../support/slacko/woof_base_hack ];then
  2671. echo "Running Slacko customization script ../support/slacko/woof_base_hack..."
  2672. ../support/slacko/woof_base_hack
  2673. fi
  2674. fi
  2675. #111123 put this into target, want to know if cross-build at 1st boot (see rc.update)...
  2676. [ -f ../WOOFMERGEVARS ] && cp -f ../WOOFMERGEVARS rootfs-complete/etc/rc.d/
  2677. #120522 precise puppy, seamonkey was crashing. needed /usr/share/glib-2.0/schemas/apps.gecko-mediaplayer.preferences,
  2678. # but also needs this compile operation...
  2679. # ***NOTICE*** cross-build, this will have to be executed at first boot...
  2680. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then
  2681. if [ -d rootfs-complete/usr/share/glib-2.0/schemas ];then
  2682. [ -e rootfs-complete/usr/bin/glib-compile-schemas ] && chroot rootfs-complete /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas
  2683. fi
  2684. #120523 seems need this too...
  2685. if [ -d rootfs-complete/usr/lib/gio/modules ];then
  2686. [ -e rootfs-complete/usr/bin/gio-querymodules ] && chroot rootfs-complete /usr/bin/gio-querymodules /usr/lib/gio/modules
  2687. fi
  2688. fi
  2689. #120618 raspi debian squeeze, links as main browser, helpsurfer html viewer, gtkmoz missing...
  2690. #120620 problem, helpsurfer cannot display /usr/share/doc/index.html, so do not point gtkmoz at basichtmlviewer...
  2691. if [ ! -e rootfs-complete/usr/local/bin/gtkmoz ];then
  2692. ln -s defaultbrowser rootfs-complete/usr/local/bin/gtkmoz
  2693. fi
  2694. #120704 some constraints in a small system...
  2695. if [ "$SDFLAG" != "" ];then
  2696. #ask if want to load swap partition/file...
  2697. echo
  2698. echo "Puppy will normally load a swap partition or swap file if it/they exist,
  2699. however you can choose to ignore them and not load them at bootup."
  2700. echo -n "Press ENTER key to load swap at bootup, any key otherwise: "
  2701. read wantswap
  2702. if [ "$wantswap" != "" ];then
  2703. echo "BOOT_DISABLESWAP='yes'" >> rootfs-complete/etc/rc.d/BOOTCONSTRAINED #read by /etc/rc.d/rc.sysinit
  2704. echo "...BOOT_DISABLESWAP='yes' in /etc/rc.d/BOOTCONSTRAINED, read by rc.sysinit."
  2705. fi
  2706. #this also reduces writes to flash card... um, relatime seems to be the default anyway... 120707 change to noatime...
  2707. echo "BOOT_ATIME='noatime'" >> rootfs-complete/etc/rc.d/BOOTCONSTRAINED #rc.sysinit will remount / with 'relatime' (constrains updating access time). 120707 change to noatime.
  2708. #this file in rootfs-skeleton, overwrite...
  2709. echo 'none /proc proc defaults,noatime 0 0
  2710. none /sys sysfs defaults,noatime 0 0
  2711. none /dev/pts devpts gid=2,mode=620,noatime 0 0
  2712. shmfs /dev/shm tmpfs defaults,noatime 0 0' > rootfs-complete/etc/fstab
  2713. echo "BOOT_DIRTYWRITE='1500'" >> rootfs-complete/etc/rc.d/BOOTCONSTRAINED #defer writing to disk. refer: http://www.lesswatts.org/tips/disks.php
  2714. echo "BOOT_SCHEDULER='deadline'" >> rootfs-complete/etc/rc.d/BOOTCONSTRAINED #my kernel defaults to 'cfq', change to 'deadline'. refer: http://tombuntu.com/index.php/2008/09/04/four-tweaks-for-using-linux-with-solid-state-drives/
  2715. #echo "BOOT_QUICKSETUP='quickarm'" >> rootfs-complete/etc/rc.d/BOOTCONSTRAINED #120708 leaves out X config frame. 120714 removed.
  2716. echo "BOOT_UDEVDCHILDREN='1'" >> rootfs-complete/etc/rc.d/BOOTCONSTRAINED #120709 is this a good idea? append --children-max=1 to udevd in rc.sysinit.
  2717. echo "BOOT_BOARD='${BOOT_BOARD}'" >> rootfs-complete/etc/rc.d/BOOTCONSTRAINED #120714 read by quicksetup.
  2718. echo "BOOT_DISABLEXORGWIZARD='yes'" >> rootfs-complete/etc/rc.d/BOOTCONSTRAINED #120723 read in xwin, also xorgwizard. also see below.
  2719. echo "BOOT_DISABLEALSACONF='yes'" >> rootfs-complete/etc/rc.d/BOOTCONSTRAINED #120724 'alsaconf' does not work on arm boards.
  2720. fi
  2721. #120723 code moved down, add BOOT_DISABLEXORGWIZARD test...
  2722. #110413 variable DISTRO_XORG_AUTO in /etc/DISTRO_SPECS, see also /usr/bin/xwin
  2723. autoflag='no'
  2724. if [ "$BOOT_DISABLEXORGWIZARD" != "yes" ];then
  2725. if [ "$DISTRO_XORG_AUTO" ];then
  2726. autoflag="$DISTRO_XORG_AUTO"
  2727. else
  2728. if vercmp "$XORGVER" ge "1.7.0";then #110621
  2729. echo
  2730. echo "Do you want Xorg to start automatically at first boot (or at 'pfix=ram'"
  2731. echo "kernel boot param) or run Xorg Wizard? The latter has been the case for"
  2732. echo "earlier puppies. Automatic startup of X usually works, though in some"
  2733. echo "cases may choose the wrong monitor resolution or driver -- which can be"
  2734. echo "fixed by running Xorg Wizard afterward."
  2735. echo -n "Press ENTER only for automatic Xorg: "
  2736. read xorgauto
  2737. [ "$xorgauto" = "" ] && autoflag='yes'
  2738. fi
  2739. fi
  2740. fi
  2741. if [ "`grep '^DISTRO_XORG_AUTO' rootfs-complete/etc/DISTRO_SPECS`" = "" ];then #110621
  2742. echo "DISTRO_XORG_AUTO='${autoflag}'" >> rootfs-complete/etc/DISTRO_SPECS
  2743. else
  2744. REGEXauto="s%^DISTRO_XORG_AUTO.*%DISTRO_XORG_AUTO='${autoflag}'%"
  2745. sed -i -e "$REGEXauto" rootfs-complete/etc/DISTRO_SPECS
  2746. fi
  2747. #121123 want this info in ppm...
  2748. echo '#multiarch distros, such as Ubuntu, will have this. ex: /usr/lib/i386-linux-gnu, so DISTRO_ARCHDIR=i386-linux-gnu' >> rootfs-complete/etc/DISTRO_SPECS
  2749. echo "DISTRO_ARCHDIR='${ARCHDIR}'" >> rootfs-complete/etc/DISTRO_SPECS
  2750. echo "DISTRO_ARCHDIR='${ARCHDIR}'" >> initrd-tree/DISTRO_SPECS
  2751. #130114 revert...
  2752. ##130112 just in case 2createpackages did not set this variable...
  2753. #[ "$DISTRO_ARCHDIR_SYMLINKS" = "" ] && echo "DISTRO_ARCHDIR_SYMLINKS='${xDISTRO_ARCHDIR_SYMLINKS}'" >> rootfs-complete/etc/DISTRO_SPECS
  2754. #[ "$DISTRO_ARCHDIR_SYMLINKS" = "" ] && echo "DISTRO_ARCHDIR_SYMLINKS='${xDISTRO_ARCHDIR_SYMLINKS}'" >> initrd-tree/DISTRO_SPECS
  2755. #120709 debian squeeze has /usr/share/misc/pci.ids, usb.ids, which confuses some apps, create symlinks...
  2756. if [ ! -e rootfs-complete/usr/share/pci.ids ];then
  2757. if [ -e rootfs-complete/usr/share/misc/pci.ids ];then
  2758. ln -s misc/pci.ids rootfs-complete/usr/share/pci.ids
  2759. fi
  2760. fi
  2761. if [ ! -e rootfs-complete/usr/share/usb.ids ];then
  2762. if [ -e rootfs-complete/usr/share/misc/usb.ids ];then
  2763. ln -s misc/usb.ids rootfs-complete/usr/share/usb.ids
  2764. fi
  2765. fi
  2766. #120830 my hunspell-en-us pet has pinstall.sh that creates symlinks of en_US.aff and en_US.dic
  2767. #from seamonkey and firefox. however, need to do this thoroughly...
  2768. #note: see also woof rootfs-skeleton/usr/share/doc/langpack-template (used by momanager).
  2769. if [ -d rootfs-complete/usr/share/hunspell ];then
  2770. for ONEHUN in `find rootfs-complete/usr/share/hunspell -mindepth 1 -maxdepth 1 -type f -name '*.dic' -o -name '*.aff' | tr '\n' ' '`
  2771. do
  2772. HUNBASE="`basename $ONEHUN`"
  2773. DICTDIRS="`find rootfs-complete/usr/lib -mindepth 2 -maxdepth 2 -type d -name dictionaries | tr '\n' ' '`"
  2774. for ONEDICTDIR in $DICTDIRS
  2775. do
  2776. [ ! -e ${ONEDICTDIR}/${HUNBASE} ] && ln -s ../../../share/hunspell/${HUNBASE} ${ONEDICTDIR}/${HUNBASE}
  2777. done
  2778. done
  2779. fi
  2780. #121022 may need this (see below similar code if python in devx)...
  2781. if [ "$(echo "$PKGS_SPECS_TABLE" | grep '^yes|python|' | grep 'exe>dev')" = "" ];then
  2782. [ -e rootfs-complete/usr/bin/python2.5 ] && ln -s python2.5 rootfs-complete/usr/bin/python 2>/dev/null
  2783. [ -e rootfs-complete/usr/bin/python2.6 ] && ln -s python2.6 rootfs-complete/usr/bin/python 2>/dev/null
  2784. [ -e rootfs-complete/usr/bin/python2.7 ] && ln -s python2.7 rootfs-complete/usr/bin/python 2>/dev/null
  2785. fi
  2786. #121203 bacon hug gui apps need some .so libs, for example libgtk-x11-2.0.so,
  2787. #(refer /usr/sbin/welcome1stboot.bac), however these are only in the devx.
  2788. #so need to create them...
  2789. #note, i think this problem only in wary/racy, as gtk template creates these symlinks.
  2790. if [ ! -e rootfs-complete/usr/lib/libgtk-x11-2.0.so ];then
  2791. FNDGTKLIB="$(find rootfs-complete/usr/lib/ -mindepth 1 -maxdepth 1 -name 'libgtk-x11-2.0.so.[0-9]' | head -n 1 | rev | cut -f 1 -d '/' | rev)"
  2792. [ "$FNDGTKLIB" ] && ln -s $FNDGTKLIB rootfs-complete/usr/lib/libgtk-x11-2.0.so #2> /dev/null
  2793. fi
  2794. #i'll do the same for libgdk-x11-2.0.so ...
  2795. if [ ! -e rootfs-complete/usr/lib/libgdk-x11-2.0.so ];then
  2796. FNDGDKLIB="$(find rootfs-complete/usr/lib/ -mindepth 1 -maxdepth 1 -name 'libgdk-x11-2.0.so.[0-9]' | head -n 1 | rev | cut -f 1 -d '/' | rev)"
  2797. [ "$FNDGTKLIB" ] && ln -s $FNDGTKLIB rootfs-complete/usr/lib/libgdk-x11-2.0.so #2> /dev/null
  2798. fi
  2799. #121212 puinstall.sh was not getting removed...
  2800. [ -f rootfs-complete/puninstall.sh ] && rm -f rootfs-complete/puninstall.sh
  2801. #130326 now permanently 96... 130327 reintroduce a choice...
  2802. ##130129 /root/.Xresources has dpi set to 78 in all prior pups. In future, might prefer 96...
  2803. DPILINE="$(grep '^Xft\.dpi:' rootfs-complete/root/.Xresources)"
  2804. DPIVALUE=$(echo -n "$DPILINE" | tr '\t' ' ' | tr -s ' ' | cut -f 2 -d ' ')
  2805. #if [ $DPIVALUE -lt 96 ];then
  2806. echo
  2807. echo "rootfs-complete/root/.Xresources has this line:"
  2808. echo "$DPILINE"
  2809. echo "which sets the displayed size of fonts on the screen (but not bitmap fonts)."
  2810. # echo "All puppies up until January 2013 have the value of '78', however, in future,
  2811. #especially with smaller high-resolution screens, a higher value (hence bigger
  2812. #font) would be better. We plan to standardise on the value of '96' for bigger
  2813. #font display. Just press ENTER only if you want to keep '${DPIVALUE}', or any printable
  2814. #character then ENTER for '96'.
  2815. #Choose '96' if you would like your pup to display with bigger fonts, even for
  2816. #large screens, or you are targeting running on a high-res small screen."
  2817. # echo -n "Press ENTER key for '${DPIVALUE}' dpi: "
  2818. # read dpisizeflag
  2819. # if [ "$dpisizeflag" ];then
  2820. # sed -i -e 's%^Xft\.dpi:.*%Xft.dpi: 96%' rootfs-complete/root/.Xresources
  2821. # fi
  2822. #fi
  2823. DPINEXT1=`expr $DPIVALUE + 6`
  2824. DPINEXT2=`expr $DPINEXT1 + 6`
  2825. echo "To accept this size, just press ENTER key."
  2826. echo "However, if you would like fonts to display bigger on the screen, type in
  2827. a value now. The value should be in steps of 6, for example ${DPINEXT1} or ${DPINEXT2}.
  2828. The default size is ${DPIVALUE}, you might try the next-up, ${DPINEXT1}."
  2829. echo -n "Press ENTER key for '${DPIVALUE}' dpi, or type a value: "
  2830. read dpisizeflag
  2831. if [ "$dpisizeflag" ];then #130512 scsijon: fix size...
  2832. fsPTN='s%^Xft\.dpi:.*%Xft.dpi: '"${dpisizeflag}%"
  2833. sed -i -e "$fsPTN" rootfs-complete/root/.Xresources
  2834. echo "...ok, now ${dpisizeflag}"
  2835. fi
  2836. #130226 wary: /usr/bin/X was missing...
  2837. if [ ! -e rootfs-complete/usr/bin/X ];then
  2838. if [ -e rootfs-complete/usr/bin/Xorg -o -h rootfs-complete/usr/bin/Xorg ];then
  2839. ln -s Xorg rootfs-complete/usr/bin/X
  2840. fi
  2841. fi
  2842. #130601 optional, run internet apps as user 'spot'...
  2843. echo
  2844. echo "Puppy is normally run as the 'administrator' (root) user, though there is
  2845. also 'fido' which is not currently very mature.
  2846. The structure of Puppy is such that we consider root to be safe (with a full
  2847. disclaimer of any responsibility if anything does go wrong), but there is a
  2848. compromise, to run as root but to run Internet apps as user 'spot'."
  2849. if [ -e rootfs-complete/usr/lib/seamonkey ];then
  2850. echo
  2851. echo "Type any character then ENTER if you want SeaMonkey to run as spot,
  2852. or just ENTER not to. Note, in a running 'Puppy Menu->System->Login & Security
  2853. Manager' can be used to enable or disable running as spot."
  2854. echo
  2855. echo -n "ENTER only to not run SeaMonkey as spot: "
  2856. read SPOTAPPS
  2857. if [ "$SPOTAPPS" ];then
  2858. ../support/setup-spot 'seamonkey=true' #130604
  2859. echo '...ok, SeaMonkey will run as spot.'
  2860. else
  2861. echo 'seamonkey=false' > rootfs-complete/root/.spot-status #130604 so that an unticked checkbox will display in loginmanager.
  2862. echo '...ok, SeaMonkey will not run as spot.'
  2863. fi
  2864. fi
  2865. if [ -e rootfs-complete/usr/lib/firefox* ];then
  2866. echo
  2867. echo "Type any character then ENTER if you want firefox to run as spot,
  2868. or just ENTER not to. Note, in a running Puppy 'Menu->System->Login & Security
  2869. Manager' can be used to enable or disable running as spot."
  2870. echo
  2871. echo -n "ENTER only to not run firefox as spot: "
  2872. read SPOTAPPS
  2873. if [ "$SPOTAPPS" ];then
  2874. ../support/setup-spot "firefox=true"
  2875. echo "...ok, firefox will run as spot."
  2876. else
  2877. echo "firefox=false" >> rootfs-complete/root/.spot-status #so that an unticked checkbox will display in loginmanager.
  2878. echo "...ok, firefox will not run as spot."
  2879. fi
  2880. fi
  2881. #130720 add QtWeb... 130723 add opera... 130821 add firefox... 132211 firefox didn't work, separate, see above
  2882. for AINTERNETAPP in QtWeb opera
  2883. do
  2884. [ -e rootfs-complete/usr/bin/${AINTERNETAPP} ] || continue
  2885. echo
  2886. echo "Type any character then ENTER if you want ${AINTERNETAPP} to run as spot,
  2887. or just ENTER not to. Note, in a running Puppy 'Menu->System->Login & Security
  2888. Manager' can be used to enable or disable running as spot."
  2889. echo
  2890. echo -n "ENTER only to not run ${AINTERNETAPP} as spot: "
  2891. read SPOTAPPS
  2892. if [ "$SPOTAPPS" ];then
  2893. ../support/setup-spot "${AINTERNETAPP}=true"
  2894. echo "...ok, ${AINTERNETAPP} will run as spot."
  2895. else
  2896. echo "${AINTERNETAPP}=false" >> rootfs-complete/root/.spot-status #so that an unticked checkbox will display in loginmanager.
  2897. echo "...ok, ${AINTERNETAPP} will not run as spot."
  2898. fi
  2899. done
  2900. #setup-spot is also called by the Login & Security Manager in running Puppy...
  2901. cp -f ../support/setup-spot rootfs-complete/usr/sbin/
  2902. #130618 code above sets DEVTMPFSFLG...
  2903. #130612 if kernel has CONFIG_DEVTMPFS=y (and CONFIG_DEVTMPFS_MOUNT=y) then empty /dev...
  2904. if [ $DEVTMPFSFLG -ne 0 ];then
  2905. rm -rf rootfs-complete/dev/* #see also 'init' script in initrd.
  2906. sed -i -e 's%^DEVTMPFSFLG=.*%DEVTMPFSFLG=2%' rootfs-complete/etc/rc.d/rc.sysinit
  2907. fi
  2908. #130725 want Menu -> Help to use secondary browser... 130726 fix...
  2909. #code to detect dual browsers, taken out of /usr/sbin/delayedrun...
  2910. ALTBROWSER=''
  2911. #the pinstall.sh script in qtweb and opera pets create separate desktop icon if there is another major browser...
  2912. [ "`grep 'QtWeb' rootfs-complete/root/Choices/ROX-Filer/PuppyPin`" != "" ] && ALTBROWSER='QtWeb'
  2913. [ "`grep 'opera' rootfs-complete/root/Choices/ROX-Filer/PuppyPin`" != "" ] && ALTBROWSER='opera'
  2914. if [ "$ALTBROWSER" != "" ];then
  2915. MAINBROWSER="`grep '^exec' rootfs-complete/usr/local/bin/defaultbrowser | tr '\t' ' ' | tr -s ' ' | cut -f 2 -d ' '`"
  2916. if [ "$MAINBROWSER" != "$ALTBROWSER" ];then
  2917. echo '#!/bin/sh' > rootfs-complete/usr/local/bin/defaulthtmlviewer
  2918. echo "exec ${ALTBROWSER} \"\$@\"" >> rootfs-complete/usr/local/bin/defaulthtmlviewer
  2919. chmod 755 rootfs-complete/usr/local/bin/defaulthtmlviewer
  2920. fi
  2921. fi
  2922. rm -rf rootfs-complete/tmp/* #121123 some above chroot operations may have left something behind in here.
  2923. ###########
  2924. #build the rootfs-complete sfs...
  2925. echo
  2926. echo "Now building the main f.s., ${PUPPYSFS}..."
  2927. sync
  2928. rm -f build/${PUPPYSFS} 2>/dev/null
  2929. ../support/${MKSQUASHFS} rootfs-complete build/${PUPPYSFS} ${COMPCHOICE} #100911 110713
  2930. sync
  2931. echo -n "$IDSTRING" >> build/${PUPPYSFS} #100911 16-byte id-string appended to file.
  2932. sync
  2933. ###########
  2934. #if separate 'zdrv' exists, copy that into live-cd also...
  2935. if [ -f ${ZDRVSFS} ];then #100911
  2936. echo -n "$IDSTRING" >> ${ZDRVSFS} #100911 16-byte id-string appended to file.
  2937. echo
  2938. echo "Press ENTER only to copy ${ZDRVSFS} into build/,"
  2939. echo -n "so that it becomes part of the live-CD. Any other char to leave it out: "
  2940. read insertzdrv
  2941. if [ "$insertzdrv" = "" ];then
  2942. echo "Copying ${ZDRVSFS} into build/" #100911
  2943. cp -a ${ZDRVSFS} build/ #100911
  2944. fi
  2945. sync
  2946. fi
  2947. ##create isolinux.cfg...
  2948. #echo "Creating build/isolinux.cfg..."
  2949. #echo "default puppy
  2950. #display boot.msg
  2951. #prompt 1
  2952. #label puppy
  2953. #kernel vmlinuz
  2954. #append initrd=initrd.gz pmedia=cd
  2955. #timeout 50" > build/isolinux.cfg
  2956. #build live-cd .iso file...
  2957. echo "Now building ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso"
  2958. rm -f ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso 2>/dev/null
  2959. if [ -f rootfs-complete/usr/lib/syslinux/isolinux.bin ];then
  2960. cp -a rootfs-complete/usr/lib/syslinux/isolinux.bin build/
  2961. else
  2962. cp -a ../boot/isolinux.bin build/
  2963. fi
  2964. case $DISTRO_FILE_PREFIX in #091203
  2965. wary) #101026
  2966. BOOTLOGO="puppy"
  2967. BOOTLABEL="puppy"
  2968. #REMOVELINE1='pfix=copy' #100916
  2969. REMOVELINE1=''
  2970. VERPREFIX="wary "
  2971. [ "`echo "$DISTRO_NAME" | grep "Racy"`" != "" ] && VERPREFIX="racy " #110917
  2972. ;;
  2973. racy) #110917
  2974. BOOTLOGO="racy-splash" #110928
  2975. BOOTLABEL="puppy"
  2976. REMOVELINE1=''
  2977. VERPREFIX="racy "
  2978. ;;
  2979. sqzd) #110517 squeeze debian
  2980. BOOTLOGO="puppy"
  2981. BOOTLABEL="puppy"
  2982. REMOVELINE1=''
  2983. VERPREFIX="squeezed "
  2984. ;;
  2985. drake|drak) #110721
  2986. BOOTLOGO="puppy"
  2987. BOOTLABEL="puppy"
  2988. REMOVELINE1=''
  2989. VERPREFIX="drake "
  2990. ;;
  2991. q*) #quirky, qurky, qrky
  2992. BOOTLOGO="quirky"
  2993. BOOTLABEL="puppy" #"quirky"
  2994. #REMOVELINE1='pfix=copy'
  2995. VERPREFIX="puppy " #100319
  2996. [ "$DISTRO_FILE_PREFIX" = "qret" ] && VERPREFIX="retro " #100514 quirky-retro.
  2997. ;;
  2998. *)
  2999. BOOTLOGO="puppy"
  3000. BOOTLABEL="puppy"
  3001. #REMOVELINE1='pfix=copy' #100916
  3002. VERPREFIX=""
  3003. ;;
  3004. esac
  3005. #111006 generic mechanism, boot logo for any pup...
  3006. [ -f ../boot/boot-dialog/${DISTRO_FILE_PREFIX}-splash.gif ] && BOOTLOGO="${DISTRO_FILE_PREFIX}-splash"
  3007. blPATTERN="s%BOOTLABEL%${BOOTLABEL}%"
  3008. namePATTERN="s/DISTRO_NAME/${DISTRO_NAME}/"
  3009. verPATTERN="s/DISTRO_VERSION/${DISTRO_VERSION}/"
  3010. prefixPATTERN="s/DISTRO_FILE_PREFIX/${DISTRO_FILE_PREFIX}/"
  3011. sed -e "$namePATTERN" -e "$verPATTERN" -e "$prefixPATTERN" -e "$blPATTERN" ../boot/boot-dialog/help.msg > build/help.msg
  3012. if [ "$REMOVELINE1" != "" ];then
  3013. grep -v "$REMOVELINE1" build/help.msg > /tmp/3builddistro-help.msg
  3014. mv -f /tmp/3builddistro-help.msg build/help.msg
  3015. fi
  3016. #100916 second help screen...
  3017. sed -e "$namePATTERN" -e "$verPATTERN" -e "$prefixPATTERN" -e "$blPATTERN" ../boot/boot-dialog/help2.msg > build/help2.msg
  3018. if [ "$REMOVELINE1" != "" ];then
  3019. grep -v "$REMOVELINE1" build/help2.msg > /tmp/3builddistro-help2.msg
  3020. mv -f /tmp/3builddistro-help2.msg build/help2.msg
  3021. fi
  3022. #130515 asked above whether to disable 'pupdesk.flg' mechanism...
  3023. if [ "$PUPDESKFLG" != "" ];then
  3024. sed -i -e 's%next bootup will force run of Video Wizard: choose alternate driver/settings%next startup type boot param "puppy pfix=nox" to enable run of Video Wizard%' build/help.msg
  3025. fi
  3026. cp -f ../boot/boot-dialog/boot.msg build/boot.msg
  3027. cat ../boot/boot-dialog/isolinux.cfg | sed -e "$blPATTERN" > build/isolinux.cfg
  3028. export RGBDEF=/usr/share/X11/rgb.txt
  3029. ../boot/boot-dialog/textongif.sh ../boot/boot-dialog/${BOOTLOGO}.gif "${VERPREFIX}${RIGHTVER}" > logo.gif
  3030. ../boot/boot-dialog/gif2lss logo.gif > build/logo.16
  3031. #120217 translate early-boot splash screens... (expect building with langpack)
  3032. if [ "$DEFAULTLANG" != "en_US" ];then
  3033. DEFAULTLANG1="${DEFAULTLANG%_*}" #ex: de
  3034. DEFAULTLANG12="${DEFAULTLANG%.*}" #ex: de_DE
  3035. SPLASHFILE=""
  3036. [ -f ../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG12} ] && SPLASHFILE="../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG12}"
  3037. [ ! "$SPLASHFILE" ] && [ -f ../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG1} ] && SPLASHFILE="../rootfs-skeleton/usr/share/sss/initrd_strings.${DEFAULTLANG1}"
  3038. if [ "$SPLASHFILE" ];then
  3039. #translate boot.msg...
  3040. sPTN="/^\[boot.msg\]/,/^$/p" #this is a multi-line block find expression.
  3041. CODEBLOCK="`sed -n "$sPTN" ${SPLASHFILE} | sed -e '/^#/d' -e '/%%/d' -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
  3042. if [ "$CODEBLOCK" ];then
  3043. echo "$CODEBLOCK" > /tmp/3builddistro-boot-splash-translation
  3044. sed -i -f /tmp/3builddistro-boot-splash-translation build/boot.msg
  3045. fi
  3046. #translate help.msg...
  3047. sPTN="/^\[help.msg\]/,/^$/p" #this is a multi-line block find expression.
  3048. CODEBLOCK="`sed -n "$sPTN" ${SPLASHFILE} | sed -e '/^#/d' -e '/%%/d' -e '/^$/d' -e '/^\[/d'`" #extracts just the relevant block of lines.
  3049. if [ "$CODEBLOCK" ];then
  3050. echo "$CODEBLOCK" > /tmp/3builddistro-boot-splash-translation
  3051. sed -i -f /tmp/3builddistro-boot-splash-translation build/help.msg
  3052. fi
  3053. fi
  3054. fi
  3055. #110426 help file for Windows users
  3056. CUT2INSERT="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1,2`"
  3057. CUT3INSERT="`echo -n "$DISTRO_FILE_PREFIX" | cut -c 1,2,3`"
  3058. cut2PATTERN="s%CUT2INSERT%${CUT2INSERT}%"
  3059. cut3PATTERN="s%CUT3INSERT%${CUT3INSERT}%"
  3060. sed -e "$verPATTERN" -e "$prefixPATTERN" -e "$cut2PATTERN" -e "$cut3PATTERN" ../boot/README.HTM > build/README.HTM
  3061. sync
  3062. if [ "$SDFLAG" = "" ];then #120506
  3063. $MKISOFS -D -R -o ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table ./build/
  3064. sync
  3065. # 131227 iguleder: made the generated ISO image hybrid, so it can be written to flash drives using dd
  3066. isohybrid="$(which isohybrid)"
  3067. [ -n "$isohybrid" ] && $isohybrid ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso
  3068. md5sum ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso > ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso.md5.txt
  3069. echo
  3070. echo "Would you like to burn it to a CD? "
  3071. echo -n "ENTER only for yes, or any printable char then ENTER not to: "
  3072. read writeitnow
  3073. if [ "$writeitnow" = "" ];then
  3074. CDR=""
  3075. [ -f /etc/cdburnerdevice ] && CDR="/dev/`cat /etc/cdburnerdevice`"
  3076. [ "$CDR" = "" ] && CDR='/dev/sr0'
  3077. CDDESCR="`probedisk2 | grep '|optical|' | grep "$CDR" | cut -f 3 -d '|'`"
  3078. echo -n 'Type "y" for multisession, else just ENTER: '
  3079. read BURNMULTI
  3080. if [ "$BURNMULTI" = "y" ];then
  3081. BURNMULTI="-multi -tao -pad"
  3082. else
  3083. BURNMULTI="-dao"
  3084. fi
  3085. echo "Please insert blank CD into $CDR
  3086. (which is described as: ${CDDESCR})
  3087. -- also be sure that it is unmounted."
  3088. echo -n "Then hit ENTER key: "
  3089. read yayburn
  3090. # $CDRECORD $BURNMULTI -data -eject -v speed=4 padsize=300k dev=ATAPI:$CDR ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso
  3091. $CDRECORD $BURNMULTI -data -eject -v speed=4 padsize=300k dev=$CDR ${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}${SCSIFLAG}.iso
  3092. sync
  3093. eject $CDR
  3094. echo "...done"
  3095. fi
  3096. else #120506 sd image
  3097. echo
  3098. echo "Please choose the SD-card skeleton image file, to suit target board."
  3099. CNT=1
  3100. echo -n "" > /tmp/3builddistro-probeimage
  3101. ls -1 ../sd-skeleton-images | grep 'xz$' | grep "$BOOT_BOARD" | #120714 BOOT_BOARD is raspi, mele, or odroidx.
  3102. while read ONEIMAGE
  3103. do
  3104. echo "${CNT} ${ONEIMAGE}" >> /tmp/3builddistro-probeimage
  3105. CNT=`expr $CNT + 1`
  3106. done
  3107. while [ 1 ];do
  3108. echo
  3109. echo "Type number which is your choice of SD image:"
  3110. cat /tmp/3builddistro-probeimage
  3111. read sdnumber
  3112. SDIMAGE="`cat /tmp/3builddistro-probeimage | head -n $sdnumber | tail -n 1 | cut -f 2 -d ' '`"
  3113. echo -n "You chose '${SDIMAGE}' Press ENTER if correct: "
  3114. read sdcorrect
  3115. [ "$sdcorrect" = "" ] && break
  3116. done
  3117. echo
  3118. echo "Please insert the SD card. Make sure that it is the same size or bigger than
  3119. indicated on the filename of the skeleton image file that you chose."
  3120. echo -n "Press ENTER after it is inserted: "
  3121. read waitinsert
  3122. sleep 2
  3123. while [ 1 ];do
  3124. CNT=1
  3125. echo -n "" > /tmp/3builddistro-probedisk
  3126. probedisk |
  3127. while read ONEPROBE
  3128. do
  3129. echo "${CNT} ${ONEPROBE}" >> /tmp/3builddistro-probedisk
  3130. CNT=`expr $CNT + 1`
  3131. done
  3132. echo
  3133. echo "Type number which is your SD card:"
  3134. cat /tmp/3builddistro-probedisk
  3135. read sdnumber
  3136. SDDEVICE="`cat /tmp/3builddistro-probedisk | head -n $sdnumber | tail -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '|'`"
  3137. echo -n "You chose ${SDDEVICE} Press ENTER if correct: "
  3138. read sdcorrect
  3139. [ "$sdcorrect" = "" ] && break
  3140. done
  3141. echo
  3142. echo "Sanity check: ../sd-skeleton-images/${SDIMAGE}
  3143. is to be written to ${SDDEVICE}."
  3144. echo -n "Press ENTER to continue: "
  3145. read yepgo
  3146. echo
  3147. #need to know uncompressed size of image...
  3148. echo "Uncompressing image, please wait..."
  3149. cp -f ../sd-skeleton-images/${SDIMAGE} ./${SDIMAGE}
  3150. sync
  3151. SDBASE="`basename $SDIMAGE .xz`"
  3152. [ -f ./${SDBASE} ] && rm -f ./${SDBASE}
  3153. unxz ${SDIMAGE}
  3154. if [ $? -ne 0 ];then
  3155. [ -f ./$SDIMAGE ] && rm -f ./$SDIMAGE
  3156. [ -f ./$SDBASE ] && rm -f ./$SDBASE
  3157. echo "Uncompress fail. Aborting."
  3158. exit 1
  3159. fi
  3160. sync
  3161. IMGBYTES=`stat --format=%s $SDBASE`
  3162. SDCARDINFO="`disktype ${SDDEVICE}`"
  3163. #120506b check that sd card big enough...
  3164. SDCARDBYTES=`echo "$SDCARDINFO" | grep '^Block device' | cut -f 2 -d '(' | cut -f 1 -d ' '` #ex: 4023386112
  3165. if [ $IMGBYTES -gt $SDCARDBYTES ];then
  3166. echo
  3167. echo "Sorry, the image file is ${IMGBYTES}bytes, however the
  3168. SD card is only ${SDCARDBYTES}bytes. Cannot continue."
  3169. exit 1
  3170. fi
  3171. #120703 allow 2nd partition to be ext2, ext3 or ext4...
  3172. SDIMGINFO="`disktype ${SDBASE}`"
  3173. SDFS2="`echo "$SDIMGINFO" | grep -o 'Ext[0-9] file system' | cut -f 1 -d ' ' | tr '[A-Z]' '[a-z]'`"
  3174. case $SDFS2 in
  3175. ext2|ext3|ext4) SDFS2="ext4" ;; #120706 hack for now. disktype misreports ext4 without journal as ext2.
  3176. *)
  3177. echo -n "wrong f.s. ${SDFS2} in ${SDBASE}, aborting. Press ENTER: "
  3178. read exitme
  3179. exit
  3180. ;;
  3181. esac
  3182. #130530 better to write everything to the image file first, then write to sd afterward...
  3183. #need to know the offsets of the filesystems...
  3184. P1BYTES=`echo "$SDIMGINFO" | grep '^Partition 1:' | cut -f 2 -d '(' | cut -f 1 -d ' '`
  3185. P1SECTORS=`echo "$SDIMGINFO" | grep '^Partition 1:' | cut -f 2 -d '(' | cut -f 3 -d ' '`
  3186. P1STARTSECTORS=`echo "$SDIMGINFO" | grep '^Partition 1:' | rev | cut -f 1 -d ' ' | rev | cut -f 1 -d ')'`
  3187. BYTESPERSECTOR=`expr $P1BYTES \/ $P1SECTORS` #normally 512.
  3188. P1STARTBYTES=`expr $P1STARTSECTORS \* $BYTESPERSECTOR`
  3189. P2BYTES=`echo "$SDIMGINFO" | grep '^Partition 2:' | cut -f 2 -d '(' | cut -f 1 -d ' '`
  3190. P2SECTORS=`echo "$SDIMGINFO" | grep '^Partition 2:' | cut -f 2 -d '(' | cut -f 3 -d ' '`
  3191. P2STARTSECTORS=`echo "$SDIMGINFO" | grep '^Partition 2:' | rev | cut -f 1 -d ' ' | rev | cut -f 1 -d ')'`
  3192. P2STARTBYTES=`expr $P2STARTSECTORS \* $BYTESPERSECTOR`
  3193. echo
  3194. echo "Copying Linux kernel to SD image file..."
  3195. mkdir -p /mnt/sdimagep1
  3196. mkdir -p /mnt/sdimagep2
  3197. mount-FULL -t vfat -o loop,offset=${P1STARTBYTES} ${SDBASE} /mnt/sdimagep1
  3198. if [ $? -ne 0 ];then
  3199. echo "Sorry, mounting vfat partition 1 (at offset ${P1STARTBYTES}) of ${SDBASE} failed. Aborting script."
  3200. exit 1
  3201. fi
  3202. #120613 restore correct kernel image name...
  3203. case $REALKERNAME in
  3204. uImage) cp -f build/vmlinuz /mnt/sdimagep1/uImage ;;
  3205. kernel.img) cp -f build/vmlinuz /mnt/sdimagep1/kernel.img ;;
  3206. *) cp -f build/vmlinuz /mnt/sdimagep1/ ;;
  3207. esac
  3208. echo -n "$REALKERNAME" > /mnt/sdimagep1/REALKERNAME #just in case need to know, in a running puppy.
  3209. sync
  3210. busybox umount /mnt/sdimagep1 2>/dev/null
  3211. echo "...done"
  3212. echo
  3213. echo "Copying Puppy filesystem to SD image file, please wait..."
  3214. mount-FULL -t ${SDFS2} -o loop,offset=${P2STARTBYTES} ${SDBASE} /mnt/sdimagep2
  3215. if [ $? -ne 0 ];then
  3216. echo "Sorry, mounting ${SDFS2} partition 2 (at offset ${P2STARTBYTES}) of ${SDBASE} failed. Aborting script."
  3217. exit 1
  3218. fi
  3219. cp -a rootfs-complete/* /mnt/sdimagep2/
  3220. sync
  3221. #120704 add to /etc/fstab...
  3222. echo "/dev/${SDDEVICE}2 / ${SDFS2} defaults,noatime 0 1" >> /mnt/sdimagep2/etc/fstab #120707 change relatime to noatime.
  3223. sync
  3224. echo "...done"
  3225. busybox umount /mnt/sdimagep2 2>/dev/null
  3226. echo
  3227. echo "Writing image file ${SDBASE} to SD card ${SDDEVICE}..."
  3228. dd if=${SDBASE} of=${SDDEVICE} bs=4M #120704 added bs=4M
  3229. if [ $? -ne 0 ];then
  3230. echo "Sorry, operation failure. Aborting script."
  3231. exit 1
  3232. fi
  3233. sync
  3234. echo
  3235. echo "Please type the name that you want to give the SD image file, or press ENTER"
  3236. SDBASEBASE="`basename $SDBASE .img | sed -e 's%-201[0-9]*%-%' -e 's%-skeleton%-%' | cut -f 1,2,3 -d '-'`"
  3237. PUPIMG="${SDBASEBASE}-${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}.img"
  3238. echo -n "only for the default [${PUPIMG}]: "
  3239. read PUPIMG1
  3240. [ "$PUPIMG1" != "" ] && PUPIMG="$PUPIMG1"
  3241. echo "...chosen $PUPIMG"
  3242. echo
  3243. IMGK=`expr $IMGBYTES \/ 1024`
  3244. echo "The image file is ${IMGK}KB, so needs to be compressed for distribution."
  3245. echo "Compressing, please wait..."
  3246. [ -f ./${PUPIMG}.xz ] && rm -f ./${PUPIMG}.xz
  3247. xz --stdout ${SDBASE} > ${PUPIMG}.xz
  3248. sync
  3249. rm -f ./${SDBASE}
  3250. echo "...${PUPIMG}.xz created."
  3251. #130530 this is old code...
  3252. # echo "Writing skeleton image to ${SDDEVICE}, please wait very patiently..."
  3253. # dd if=${SDBASE} of=${SDDEVICE} bs=4M #120704 added bs=4M
  3254. # if [ $? -ne 0 ];then
  3255. # echo "Sorry, operation failure. Aborting script."
  3256. # exit 1
  3257. # fi
  3258. # sync
  3259. # rm -f $SDBASE
  3260. #
  3261. # FIXEXTPTN=''
  3262. # if [ "$SDFS2" = "ext2" ];then #120704 120706 see hack above, bypass.
  3263. # echo
  3264. # echo "The 2nd partition is 'ext2', but you may bump it to 'ext4' if you wish."
  3265. # echo -n "ENTER only to keep ext2, any char for ext4: "
  3266. # read bumpit
  3267. # if [ "$bumpit" != "" ];then
  3268. # echo
  3269. # echo "Creating ext4 f.s. on partition ${SDDEVICE}2, without a journal..."
  3270. # #mke2fs -t ext4 -O ^has_journal -L puppy -m 0 -b 4096 ${SDDEVICE}2
  3271. # ##120705 add '-E stride=2,stripe-width=1024' refer: http://blogofterje.wordpress.com/2012/01/14/optimizing-fs-on-sd-card/
  3272. # #mke2fs -t ext4 -O ^has_journal -L puppy -m 0 -b 4096 -E stride=2,stripe-width=1024 ${SDDEVICE}2
  3273. # #120706 mavrothal reports may not suit many cards, so revert...
  3274. # mke2fs -t ext4 -O ^has_journal -L puppy -m 0 -b 4096 ${SDDEVICE}2
  3275. # sync
  3276. # FIXEXTPTN='s%ext2%ext4%' #see below.
  3277. # SDFS2='ext4'
  3278. # echo "...done"
  3279. # fi
  3280. # fi
  3281. #
  3282. # mkdir -p /mnt/sdimagep1
  3283. # mkdir -p /mnt/sdimagep2
  3284. # dd if=${SDDEVICE}1 of=/dev/null bs=1024 count=1 #trying to fix weird bug.
  3285. # dd if=${SDDEVICE}2 of=/dev/null bs=1024 count=1 #trying to fix weird bug.
  3286. # while [ "a" = "a" ];do
  3287. # mount -t vfat ${SDDEVICE}1 /mnt/sdimagep1
  3288. # MNTSTAT1=$?
  3289. # mount -t ${SDFS2} ${SDDEVICE}2 /mnt/sdimagep2
  3290. # MNTSTAT2=$?
  3291. # if [ $MNTSTAT1 -ne 0 -o $MNTSTAT2 -ne 0 ];then
  3292. # echo
  3293. # echo "Something is wrong. There should be two partitions on the SD card,"
  3294. # echo "vfat and ${SDFS2}. There was an error mounting them. Aborting script."
  3295. # echo "Attempted operations:"
  3296. # echo "mount -t vfat ${SDDEVICE}1 /mnt/sdimagep1 STATUS: ${MNTSTAT1}"
  3297. # echo "mount -t ${SDFS2} ${SDDEVICE}2 /mnt/sdimagep2 STATUS: ${MNTSTAT2}"
  3298. # umount /mnt/sdimagep1 2>/dev/null
  3299. # umount /mnt/sdimagep2 2>/dev/null
  3300. # echo "You might try replugging the card."
  3301. # echo -n "ENTER to quit, any other key to retry: "
  3302. # read weirdbug
  3303. # [ "$weirdbug" != "" ] && continue
  3304. # exit 1
  3305. # fi
  3306. # break
  3307. # done
  3308. # [ "$FIXEXTPTN" ] && [ -f /mnt/sdimagep1/cmdline.txt ] && sed -i -e "${FIXEXTPTN}" /mnt/sdimagep1/cmdline.txt #120704
  3309. # echo
  3310. # echo "Copying Linux kernel to SD card..."
  3311. # #120613 restore correct kernel image name...
  3312. # case $REALKERNAME in
  3313. # uImage) cp -f build/vmlinuz /mnt/sdimagep1/uImage ;;
  3314. # kernel.img) cp -f build/vmlinuz /mnt/sdimagep1/kernel.img ;;
  3315. # *) cp -f build/vmlinuz /mnt/sdimagep1/ ;;
  3316. # esac
  3317. # echo -n "$REALKERNAME" > /mnt/sdimagep1/REALKERNAME #just in case need to know, in a running puppy.
  3318. # sync
  3319. # echo "...done"
  3320. # echo "Copying Puppy filesystem to SD card, please wait..."
  3321. # cp -a rootfs-complete/* /mnt/sdimagep2/
  3322. # sync
  3323. # #120704 add to /etc/fstab...
  3324. # echo "/dev/${SDDEVICE}2 / ${SDFS2} defaults,noatime 0 1" >> /mnt/sdimagep2/etc/fstab #120707 change relatime to noatime.
  3325. # sync
  3326. # echo "...done"
  3327. # umount /mnt/sdimagep1 2>/dev/null
  3328. # umount /mnt/sdimagep2 2>/dev/null
  3329. #
  3330. # echo
  3331. # echo "Please type the name that you want to give the SD image file, or press ENTER"
  3332. # SDBASEBASE="`basename $SDBASE .img | sed -e 's%-201[0-9]*%-%' -e 's%-skeleton%-%' | cut -f 1,2,3 -d '-'`"
  3333. # PUPIMG="${SDBASEBASE}-${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}.img"
  3334. # echo -n "only for the default [${PUPIMG}]: "
  3335. # read PUPIMG1
  3336. # [ "$PUPIMG1" != "" ] && PUPIMG="$PUPIMG1"
  3337. # echo "...chosen $PUPIMG"
  3338. # echo
  3339. # echo "Now creating an image file of the SD card, please wait patiently..."
  3340. # IMGK=`expr $IMGBYTES \/ 1024` #assume size divisible by 1024!!!!***WARNING***
  3341. # dd if=$SDDEVICE of=$PUPIMG bs=1024 count=$IMGK
  3342. # sync
  3343. # echo "...done. The image file is named '${PUPIMG}'"
  3344. # echo
  3345. # echo "However, it is ${IMGK}KB, so needs to be compressed for distribution."
  3346. # echo "Compressing, please wait..."
  3347. # rm -f ${PUPIMG}.xz
  3348. # xz $PUPIMG
  3349. # sync
  3350. #update desktop drive icons. note, this is also done in /usr/sbin/bootflash, puppyinstaller, gparted_shell...
  3351. #/tmp/pup_event_frontend_block_request is used in /sbin/pup_event_frontend_d to refresh drv...
  3352. THEDRIVE="`echo -n "$SDDEVICE" | cut -f 3 -d '/'`"
  3353. echo "$THEDRIVE" > /tmp/pup_event_frontend_block_request
  3354. COMPRIMGBYTES=`stat --format=%s ${PUPIMG}.xz`
  3355. echo
  3356. echo "The image is now ${PUPIMG}.xz and is ${COMPRIMGBYTES}bytes."
  3357. COMPRIMGK=`expr $COMPRIMGBYTES \/ 1024`
  3358. echo "(${COMPRIMGK}KB)"
  3359. echo "Image file may be distributed to others!"
  3360. echo
  3361. #120510...
  3362. echo "If the SD card currently plugged in is bigger than the image, for example
  3363. you have a 4GB card and used a 1GB image, optionally now you may increase the
  3364. ${SDFS2} partition to fill the remaining space -- this is for your own use."
  3365. echo -n "ENTER only to decline: "
  3366. read makebig
  3367. if [ "$makebig" != "" ];then
  3368. if [ "`which gparted`" = "" ];then
  3369. echo "ERROR, gparted not installed!!!"
  3370. else
  3371. gparted $SDDEVICE
  3372. sync
  3373. echo
  3374. echo "Checking the ${SDFS2} filesystem..."
  3375. fsck.${SDFS2} -p ${SDDEVICE}2
  3376. sync
  3377. echo "$THEDRIVE" > /tmp/pup_event_frontend_block_request
  3378. fi
  3379. fi
  3380. fi
  3381. cd $WKGDIR
  3382. #now do the devx...
  3383. echo
  3384. echo -n "Hit ENTER to build the 'devx' SFS file, any other key to exit: "
  3385. read dodevx
  3386. [ "$dodevx" != "" ] && exit
  3387. echo
  3388. echo "Building ${DEVXSFS}..."
  3389. #rm -rf sandbox3/devx
  3390. #mkdir sandbox3/devx
  3391. echo " building sandbox3/devx ..."
  3392. rm -f /tmp/3builddistro_removed_alt_dev #101013
  3393. ALLGENNAMESD="`echo "$PKGS_SPECS_TABLE" | grep '^yes' | cut -f 2 -d '|' | sed -e 's%$%_DEV%'`"
  3394. rm -f sandbox3/${DEVXSFS} 2>/dev/null #100911
  3395. for ONEDEV in `ls -1 packages-${DISTRO_FILE_PREFIX} | grep '_DEV$' | tr '\n' ' '`
  3396. do
  3397. #110727 no longer using this...
  3398. ##101013 preferred pkg for an older kernel (see PKGS_MANAGEMENT file)...
  3399. ONEPKG="`echo -n "$ONEDEV" | sed -e 's%_DEV%%'`"
  3400. #for ONE_PPO in $PKG_PREFER_OLDER
  3401. #do
  3402. # one_KERNEL=`echo -n "$ONE_PPO" | cut -f 1 -d '|' | cut -f 1 -d '-' | cut -f 1 -d '_' | cut -f 3 -d '.'` #ex 34 (from 2.6.34)
  3403. # two_PKG="`echo -n "$ONE_PPO" | cut -f 2 -d '|'`"
  3404. # three_PKG="`echo -n "$ONE_PPO" | cut -f 3 -d '|'`"
  3405. # if [ $SUB_KERNELVER -le $one_KERNEL ];then
  3406. # if [ "$two_PKG" = "$ONEPKG" ];then
  3407. # #if PKGS_SPECS_TABLE has 'yes' for older pkg, bypass this one...
  3408. # if [ "`echo "$PKGLIST" | tr ' ' '\n' | grep "^${three_PKG}$"`" != "" ];then
  3409. # echo "$ONEDEV" >> /tmp/3builddistro_removed_alt_dev
  3410. # continue 2
  3411. # fi
  3412. # fi
  3413. # else
  3414. # if [ "$three_PKG" = "$ONEPKG" ];then
  3415. # #if PKGS_SPECS_TABLE has 'yes' for newer pkg, bypass this one...
  3416. # if [ "`echo "$PKGLIST" | tr ' ' '\n' | grep "^${two_PKG}$"`" != "" ];then
  3417. # echo "$ONEDEV" >> /tmp/3builddistro_removed_alt_dev
  3418. # continue 2
  3419. # fi
  3420. # fi
  3421. # fi
  3422. #done
  3423. devPATTERN='^'"$ONEDEV"
  3424. if [ "`echo "$ALLGENNAMESD" | grep "$devPATTERN"`" != "" ];then
  3425. cp -a --remove-destination packages-${DISTRO_FILE_PREFIX}/${ONEDEV}/* sandbox3/devx/
  3426. sync #110727 running drake pup 0.3 with k2.6.39-3 new laptop, mysterious loss of dirs/files. try sync.
  3427. fi
  3428. done
  3429. sync
  3430. #earlier above i moved all invalid symlinks into the devx module, yeah but i
  3431. #think should delete them if they really point nowhere...
  3432. echo " Deleting really invalid symlinks in devx..."
  3433. mkdir layer_top
  3434. LAYERFS="aufs"
  3435. [ "`lsmod | grep '^unionfs'`" != "" ] && LAYERFS="unionfs"
  3436. if [ "$LAYERFS" = "aufs" ];then
  3437. mount -t aufs -o udba=reval,diropq=w,dirs=sandbox3/devx=rw:sandbox3/rootfs-complete=ro layerfs layer_top
  3438. else
  3439. mount -t unionfs -o dirs=sandbox3/devx=rw:sandbox3/rootfs-complete=ro layerfs layer_top
  3440. fi
  3441. for ONESYMLINK in `find layer_top/ -type l`
  3442. do
  3443. [ "`echo -n "$ONESYMLINK" | grep '/dev/'`" != "" ] && continue
  3444. [ "`echo -n "$ONESYMLINK" | grep '/proc/'`" != "" ] && continue
  3445. xONESYMLINK="`echo -n "$ONESYMLINK" | sed -e 's/^layer_top//'`"
  3446. #111123 cross-build, cannot do chroot...
  3447. if [ "$WOOF_HOSTARCH" = "$WOOF_TARGETARCH" ];then #111123
  3448. if [ "`chroot layer_top readlink -e $xONESYMLINK`" = "" ];then
  3449. echo " $ONESYMLINK"
  3450. rm -f $ONESYMLINK
  3451. fi
  3452. else
  3453. #do it without chroot...
  3454. LINKTO="`readlink layer_top${xONESYMLINK}`"
  3455. [ -e layer_top${LINKTO} ] && continue #absolute path
  3456. UPONE="`dirname "$xONESYMLINK"`"
  3457. [ -e layer_top${UPONE}/${LINKTO} ] && continue #relative path
  3458. echo " $ONESYMLINK"
  3459. rm -f $ONESYMLINK
  3460. fi
  3461. done
  3462. sync
  3463. umount layer_top
  3464. rmdir layer_top
  3465. ###HACK###
  3466. if [ "$(echo "$PKGS_SPECS_TABLE" | grep '^yes|python|' | grep 'exe>dev')" != "" ];then #121022
  3467. [ -e sandbox3/devx/usr/bin/python2.5 ] && ln -s python2.5 sandbox3/devx/usr/bin/python 2>/dev/null
  3468. [ -e sandbox3/devx/usr/bin/python2.6 ] && ln -s python2.6 sandbox3/devx/usr/bin/python 2>/dev/null
  3469. [ -e sandbox3/devx/usr/bin/python2.7 ] && ln -s python2.7 sandbox3/devx/usr/bin/python 2>/dev/null
  3470. fi
  3471. rm -f sandbox3/devx/usr/lib/mozilla/plugins/* #100407 maybe .a, .la files in here.
  3472. ###END HACK###
  3473. #v424 no, i have needed docs in usr/share/doc...
  3474. #w003 there's docs here, move them out...
  3475. rm -rf packages-${DISTRO_FILE_PREFIX}/devx_DOC 2>/dev/null
  3476. mkdir -p packages-${DISTRO_FILE_PREFIX}/devx_DOC/usr/share
  3477. #mv sandbox3/devx/usr/share/doc packages-${DISTRO_FILE_PREFIX}/devx_DOC/usr/share/ 2>/dev/null
  3478. mv sandbox3/devx/usr/share/doc-base packages-${DISTRO_FILE_PREFIX}/devx_DOC/usr/share/ 2>/dev/null
  3479. mv sandbox3/devx/usr/share/man packages-${DISTRO_FILE_PREFIX}/devx_DOC/usr/share/ 2>/dev/null
  3480. #100831 hack, this symlink needed...
  3481. if [ -d sandbox3/devx/usr/X11R7/include/xorg ];then
  3482. [ ! -e sandbox3/devx/usr/include/xorg ] && ln -s ../X11/include/xorg sandbox3/devx/usr/include/xorg
  3483. fi
  3484. #100622 remove overhead of this script running every bootup...
  3485. mkdir -p sandbox3/devx/etc/profile.d
  3486. rm -f sandbox3/devx/etc/profile.d/pkgconfig* 2>/dev/null
  3487. PKG_CONFIG_PATH="`find sandbox3/devx/usr/lib sandbox3/devx/usr/X11R7/lib sandbox3/devx/opt sandbox3/devx/usr/local/lib -type d -name pkgconfig | sed -e 's%sandbox3/devx%%' | tr '\n' ':'`"
  3488. echo "export PKG_CONFIG_PATH='${PKG_CONFIG_PATH}'" > sandbox3/devx/etc/profile.d/pkgconfig
  3489. #maybe stray /install dir from slackware pkgs...
  3490. rm -rf sandbox3/devx/install 2>/dev/null
  3491. [ -f sandbox3/devx/pet.specs ] && rm -f sandbox3/devx/pet.specs #w478
  3492. #another slackware hack 131124
  3493. [ -x sandbox3/devx/usr/bin/strings-GNU ] && mv sandbox3/devx/usr/bin/strings-GNU sandbox3/devx/usr/bin/strings
  3494. sync
  3495. #110215 BaCon...
  3496. #111203 remove offer to download and compile bacon (no good for cross-builds)...
  3497. if [ ! -f sandbox3/devx/usr/bin/bacon ];then
  3498. #if [ -f sandbox3/devx/usr/bin/bacon ];then
  3499. # BACONPKG="`grep '|bacon|' sandbox3/rootfs-complete/root/.packages/woof-installed-packages | cut -f 1 -d '|'`"
  3500. # echo
  3501. # echo "The devx has BaCon compiler package: ${BACONPKG}"
  3502. # echo "Great, but if you have an Internet connection, you may update it, however this"
  3503. # echo "does not always work as a very recent /usr/bin/bacon must be installed..."
  3504. #else
  3505. echo
  3506. echo "Oh, you do not have the BaCon compiler in devx."
  3507. echo "It is recommended that variable PKGS_SPECS_TABLE in file DISTRO_PKGS_SPECS-* have this entry:"
  3508. echo "yes|bacon||exe>dev,dev,doc>dev,nls"
  3509. echo "It is recommended that all Puppy distros standardise on having BaCon available."
  3510. # echo "Anyway, if you have an Internet connection, BaCon can be downloaded now, however"
  3511. # echo "this does not always work as you need a very recent /usr/bin/bacon already installed..."
  3512. fi
  3513. echo -n "Press ENTER to continue: "
  3514. read keepgoing
  3515. ##101217 get latest BaCon...
  3516. #if [ -f support/fetch ];then #see http://www.basic-converter.org/fetch.bac
  3517. # if [ "`which bacon`" != "" ];then
  3518. # echo
  3519. # echo "Press any printable key (then ENTER) to download latest BaCon BASIC compiler"
  3520. # echo "and support files. You will need Internet access to do this."
  3521. # echo -n "ENTER key only to decline, any other printable char to download: "
  3522. # read dobacon
  3523. # if [ "$dobacon" != "" ];then
  3524. # mkdir -p sandbox3/devx/usr/share/BaCon
  3525. # rm -f sandbox3/devx/usr/share/BaCon/* 2>/dev/null
  3526. # cp support/fetch sandbox3/devx/usr/share/BaCon/
  3527. # cd sandbox3/devx/usr/share/BaCon
  3528. # ./fetch
  3529. # sync
  3530. # [ ! -f documentation.pdf ] && wget http://www.basic-converter.org/documentation.pdf
  3531. # [ ! -f documentation.html ] && wget http://www.basic-converter.org/documentation.html
  3532. # [ ! -f hug.txt ] && wget http://www.basic-converter.org/hug.txt
  3533. # [ ! -f sqlite3.txt ] && wget http://www.basic-converter.org/sqlite3.txt
  3534. # [ ! -f gmp.txt ] && wget http://www.basic-converter.org/gmp.txt
  3535. # [ ! -f curses.txt ] && wget http://www.basic-converter.org/curses.txt
  3536. # [ ! -f pthreads.txt ] && wget http://www.basic-converter.org/pthreads.txt
  3537. # [ ! -f gd.txt ] && wget http://www.basic-converter.org/gd.txt
  3538. # [ ! -f gtk.txt ] && wget http://www.basic-converter.org/gtk.txt
  3539. # [ ! -f gl.txt ] && wget http://www.basic-converter.org/gl.txt
  3540. # ##fetch has already downloaded bacon.bac, but want beta version...
  3541. # #mv -f bacon.bac bacon-released.bac
  3542. # #wget http://www.basic-converter.org/beta/bacon.bac
  3543. # #[ $? -ne 0 ] && mv -f bacon-released.bac bacon.bac
  3544. # #mv -f documentation.html documentation-released.html
  3545. # #wget http://www.basic-converter.org/beta/documentation.html
  3546. # #[ $? -ne 0 ] && mv -f documentation-released.html documentation.html
  3547. # sync
  3548. # if [ -f bacon.bac ];then
  3549. # bacon bacon.bac
  3550. # sync
  3551. # if [ -f bacon ];then
  3552. # cp -f -a bacon ../../bin/
  3553. # echo "...done"
  3554. # else
  3555. # echo "ERROR: bacon did not compile!"
  3556. # fi
  3557. # fi
  3558. # cd ../../../../../ #back to woof-tree project dir.
  3559. # fi
  3560. # else
  3561. # echo
  3562. # echo "WARNING: 'devx' SFS not loaded, cannot install latest BaCon BASIC compiler."
  3563. # echo " (or current loaded devx SFS does not have BaCon compiler in it)"
  3564. # fi
  3565. #fi
  3566. #110429 see above, think want glibc scsi headers in usr/include/scsi...
  3567. if [ -d sandbox3/devx/usr/include/scsi-GLIBC ];then
  3568. #probably have kernel scsi headers in usr/include/scsi, fix...
  3569. cp -a -f sandbox3/devx/usr/include/scsi-GLIBC/* sandbox3/devx/usr/include/scsi/
  3570. fi
  3571. #110702 mageia1 python puts 30python.csh here...
  3572. rm -f sandbox3/devx/etc/profile.d/*.csh
  3573. #130111 fixed in 2createpackages...
  3574. ##110726 mageia does something weird, puts all these in wrong place...
  3575. #if [ -d sandbox3/devx/usr/bin/multiarch-i386-linux ];then
  3576. # cp -a -f --remove-destination sandbox3/devx/usr/bin/multiarch-i386-linux/* sandbox3/devx/usr/bin/
  3577. # rm -rf sandbox3/devx/usr/bin/multiarch-i386-linux
  3578. #fi
  3579. echo "Now creating sandbox3/${DEVXSFS} ..."
  3580. ./support/${MKSQUASHFS} sandbox3/devx sandbox3/${DEVXSFS} ${COMPCHOICE} #100911 110713
  3581. sync
  3582. chmod 644 sandbox3/${DEVXSFS}
  3583. cd sandbox3
  3584. echo -n "$IDSTRING" >> ${DEVXSFS} #100911 16-byte id-string appended to file.
  3585. md5sum ${DEVXSFS} > ${DEVXSFS}.md5.txt #100911
  3586. cd ..
  3587. sync
  3588. echo "...done"
  3589. echo
  3590. echo "Script finished."
  3591. echo -n "Press ENTER key to exit: "
  3592. read yeahgetout
  3593. ###END###