{"id":802,"date":"2011-04-16T13:24:29","date_gmt":"2011-04-16T11:24:29","guid":{"rendered":"https:\/\/thebc.ch\/blog\/?p=802"},"modified":"2013-02-01T13:00:25","modified_gmt":"2013-02-01T12:00:25","slug":"tiny-core-linux-shrink-your-virtual-machines-to-nothing","status":"publish","type":"post","link":"https:\/\/thebc.ch\/blog\/?p=802","title":{"rendered":"Tiny Core Linux &#8211; Shrink your Virtual Machines to nothing"},"content":{"rendered":"<p>Last weekend I decided to clean up my VmWare folder. As you may know I&#8217;m using a lot of virtual machines to teach IT-security to some students. There are &#8220;hackits&#8221; for SQL-Injection, Command-Injection, XSS, sniffing and so on. Each of this hackits life within their own virtual machine and consume disk space. A lot of disk space. Actually to much space for my laptop. On the other hand, most of them only have some basic services installed, like apache, bind, mysql, dhcpd and so on. Until now i&#8217;ve used the relatively slick debian distribution. As small as you can setup debian, it&#8217;s about 1 GiB in size. It actually doesn&#8217;t matter if you install one service or 10.<\/p>\n<p>Then, some days ago, I&#8217;ve stumped across &#8220;Tiny Core Linux&#8221;. There exist two versions of it: one with a nice X-desktop and one with only the command line. But the greatest thing about it is that it only consumes &lt;10MiB of space, it&#8217;s running completely from RAM and it&#8217;s fast as light!<\/p>\n<p>At this point I&#8217;ve started about fascinating about how great this distribution would be for creating hackits. I could create hundreds of them and still using less disk space than one debian based installation. WOW!<\/p>\n<p><a rel=\"attachment wp-att-822\" href=\"https:\/\/thebc.ch\/blog\/802\/tiny-core-linux-shrink-your-virtual-machines-to-nothing\/tc_logo\/\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-822\" title=\"tc_logo\" src=\"http:\/\/thebc.ch\/upload\/2011\/04\/tc_logo.png\" alt=\"\" width=\"286\" height=\"123\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<div class='toc toc'>\n<h2>Contents<\/h2>\n<ul class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Setup_a_basic_Tiny_Core_Linux\">Setup a basic Tiny Core Linux<\/a>\n\t\t<ul class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#What_you_need\">What you need<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Setting_up_the_VMWare\">Setting up the VMWare<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Pepare_the_harddrive\">Pepare the harddrive<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Define_the_tce_drive\">Define the \"tce\" drive<\/a>\n\t\t\t<\/li>\n\t\t<\/ul>\n\t<li>\n\t\t<a href=\"#Basic_concepts_of_TinyCore\">Basic concepts of TinyCore<\/a>\n\t\t<ul class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Important_files\">Important files<\/a>\n\t\t\t\t<ul class='toc-odd level-3'>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href=\"#opt.filetool.lst\">\/opt\/.filetool.lst<\/a>\n\t\t\t\t\t<\/li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href=\"#optbootsync.sh\">\/opt\/bootsync.sh<\/a>\n\t\t\t\t\t<\/li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href=\"#optbootlocal.sh\">\/opt\/bootlocal.sh<\/a>\n\t\t\t\t\t<\/li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href=\"#optshutdown.sh\">\/opt\/shutdown.sh<\/a>\n\t\t\t\t\t<\/li>\n\t\t\t\t<\/ul>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Structure_of_the_tce_partition\">Structure of the tce partition<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Content_of_mydata.tgz\">Content of mydata.tgz<\/a>\n\t\t\t<\/li>\n\t\t<\/ul>\n\t<li>\n\t\t<a href=\"#Install_openssh-server\">Install openssh-server<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Install_apache2\">Install apache2<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Creating_extension_packages\">Creating extension packages<\/a>\n\t\t<ul class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Basic_package_concept\">Basic package concept<\/a>\n\t\t\t<\/li>\n\t\t\t<li>\n\t\t\t\t<a href=\"#Building_CLISH_CommandLineSHell\">Building CLISH (CommandLineSHell)<\/a>\n\t\t\t\t<ul class='toc-odd level-3'>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href=\"#Create_the_build_environment\">Create the build environment<\/a>\n\t\t\t\t\t<\/li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href=\"#Get_the_software_source\">Get the software source<\/a>\n\t\t\t\t\t<\/li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href=\"#Build_the_software\">Build the software<\/a>\n\t\t\t\t\t<\/li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<a href=\"#Creating_the_package\">Creating the package<\/a>\n\t\t\t\t\t<\/li>\n<\/ul>\n<\/ul>\n<\/ul>\n<\/div>\n<div class='toc-end'>&nbsp;<\/div>\n<hr \/>\n<p>So here we go&#8230; Enjoy this mini-HowTo&#8230;<\/p>\n<p>&nbsp;<\/p>\n<span id=\"Setup_a_basic_Tiny_Core_Linux\"><h1>Setup a basic Tiny Core Linux<\/h1><\/span>\n<span id=\"What_you_need\"><h2>What you need<\/h2><\/span>\n<p>All you need is to download the ISO for their website<\/p>\n<ul>\n<li><a href=\"http:\/\/distro.ibiblio.org\/tinycorelinux\/downloads.html\">http:\/\/distro.ibiblio.org\/tinycorelinux\/downloads.html<\/a><\/li>\n<\/ul>\n<p>I&#8217;ve choosen the microcore iso because I don&#8217;t use any GUI but it doesn&#8217;t matter if you take the other one. It&#8217;s all the same \ud83d\ude42<\/p>\n<span id=\"Setting_up_the_VMWare\"><h2>Setting up the VMWare<\/h2><\/span>\n<ol>\n<li>Create a new virtual machine<\/li>\n<li>Select the downloaded ISO as boot CDROM<\/li>\n<li>As operating system choose &#8220;Linux&#8221; \/ &#8220;Other Linux 2.6.x kernel&#8221;<\/li>\n<li>Select &#8220;Customize Settings&#8221; because we don&#8217;t need a hard drive of 8GiB \ud83d\ude42<\/li>\n<li>Remove the existing 8GiB hard drive<\/li>\n<li>Add a new hard drive (make sure to select IDE and NOT SCSI, it wont get recognized by Tiny Core) with ~1GiB in size<\/li>\n<li>Boot!<\/li>\n<\/ol>\n<span id=\"Pepare_the_harddrive\"><h2>Pepare the harddrive<\/h2><\/span>\n<p>After the boot we will be presented with a shell. Then go and find the harddisk with the command:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\">tc@box:~$ sudo fdisk -l<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>So \/dev\/hda is our hard disk. Lets make one big parition on it using fdisk.<\/p>\n<p>Now we can format the disk. I&#8217;ve choose a ext4 filesystem. Then reboot.<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> mkfs.ext4 <span class=\"sy0\">\/<\/span>dev<span class=\"sy0\">\/<\/span>hda1<br \/>\n<span class=\"kw2\">sudo<\/span> reboot<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<span id=\"Define_the_8220tce8221_drive\"><h2>Define the &#8220;tce&#8221; drive<\/h2><\/span>\n<p>At the boot prompt (before the kernel gets loaded) you can define wich is your tce partition. You only have to do this once.<\/p>\n<pre>boot: microcore tce=hda1<\/pre>\n<p>This is where our changes to the live-system will get saved if we instruct TinyCore to do so.<\/p>\n<span id=\"Basic_concepts_of_TinyCore\"><h1>Basic concepts of TinyCore<\/h1><\/span>\n<hr>\n<p><center><br \/>\n   I could call TC is revolutionary simple and its the &#8220;revolutionary&#8221; part making it difficult to understand it, not the &#8220;simple&#8221; part \ud83d\ude09<br \/>\n   <sub>Quote from Bloodhound in IRC #tinycorelinux@freenode<\/sub><br \/>\n<\/center><\/p>\n<hr>\n<p>TinyCore \/ MicroCore Linux is different than other distributions. <\/p>\n<ol>\n<li>The whole system is loaded into RAM at boottime<\/li>\n<li>The system is reseted to it&#8217;s original state after every boot by default<\/li>\n<li>Theres actually no such thing like &#8220;installation&#8221; (at least it&#8217;s not recommendet)<\/li>\n<\/ol>\n<p>If you want to read the whole story (and you really should) you&#8217;ll find it here: <a href=\"http:\/\/distro.ibiblio.org\/tinycorelinux\/concepts.html\">Core Concepts<\/a>.<\/p>\n<p>The &#8220;setup&#8221; we are having here is the following:<\/p>\n<ul>\n<li>OS is booted from original CDROM-ISO<\/li>\n<li>We keep track of changes we&#8217;d like to be persistent within a file (\/opt\/.filetool.lst)<\/li>\n<li>Everytime we make persistent changes to our system we create a backup. So all files or directories we have defined within .filetool.lst will be saved to our disk and reapplied after reboot.<\/li>\n<\/ul>\n<p><!--### Important Files ##################################################################### --><\/p>\n<span id=\"Important_files\"><h2>Important files<\/h2><\/span>\n<span id=\"opt.filetool.lst\"><h3>\/opt\/.filetool.lst<\/h3><\/span>\n<p>With this file you define what you would like to backup. Every directory path or file name you add to this file will get backed up (if you tell the system to do so) and gets restored after the reboot. All the data get stored on the tce-partition (\/mnt\/hda1\/tce\/mydata.tgz). The file looks like this:<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/><\/div><\/td><td><div class=\"bash codecolorer\">opt<span class=\"sy0\">\/<\/span>bootlocal.sh<br \/>\nopt<span class=\"sy0\">\/<\/span>bootsync.sh<br \/>\nopt<span class=\"sy0\">\/<\/span>shutdown.sh<br \/>\nopt<span class=\"sy0\">\/<\/span>tcemirror<br \/>\nopt<span class=\"sy0\">\/<\/span>.filetool.lst<br \/>\nopt<span class=\"sy0\">\/<\/span>.xfiletool.lst<br \/>\nhome &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"co0\"># everything within the \/home partition<\/span><br \/>\nusr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">ssh<\/span> &nbsp; &nbsp; &nbsp; <span class=\"co0\"># this directory holds the sshd_config and the private\/public key's so they don't gets recreated after every reboot<\/span><br \/>\netc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"co0\"># if you add a user this file needs to be saved<\/span><br \/>\netc<span class=\"sy0\">\/<\/span>group &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co0\"># this is only important if you change \/ add groups<\/span><br \/>\netc<span class=\"sy0\">\/<\/span>shadow &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class=\"co0\"># if you change a password or add a user you have to save this file<\/span><br \/>\nusr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>apache2<span class=\"sy0\">\/<\/span>conf &nbsp;<span class=\"co0\"># this is used if you have apache2 installed to safe the apache configuration<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<blockquote><p>The comments in the above file listing aren&#8217;t within the file! I don&#8217;t know if comments are allowed!<\/p><\/blockquote>\n<span id=\"optbootsync.sh\"><h3>\/opt\/bootsync.sh<\/h3><\/span>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"co0\">#!\/bin\/sh<\/span><br \/>\n<span class=\"co0\"># put other system startup commands here, the boot process will wait until they complete.<\/span><br \/>\n<span class=\"co0\"># Use bootlocal.sh for system startup commands that can run in the background <\/span><br \/>\n<span class=\"co0\"># and therefore not slow down the boot process.<\/span><br \/>\n<span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>bootlocal.sh <span class=\"sy0\">&amp;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<span id=\"optbootlocal.sh\"><h3>\/opt\/bootlocal.sh<\/h3><\/span>\n<p>Within this shell file you write everything you would like to be executed during startup. This can be ip-configurations or the starting of daemons. The file looks basicaly like this:<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"co0\">#!\/bin\/sh<\/span><br \/>\n<span class=\"co0\"># put other system startup commands here<\/span><br \/>\n<span class=\"kw2\">sudo<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>init.d<span class=\"sy0\">\/<\/span>openssh start<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<span id=\"optshutdown.sh\"><h3>\/opt\/shutdown.sh<\/h3><\/span>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"co0\">#!\/bin\/sh<\/span><br \/>\n<span class=\"co0\"># put user shutdown commands here<\/span><br \/>\n<br \/>\n<span class=\"co0\"># If no backup of home was done then loop through valid users to clean up.<\/span><br \/>\n<span class=\"kw1\">if<\/span> <span class=\"br0\">&#91;<\/span> <span class=\"sy0\">!<\/span> <span class=\"re5\">-e<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span>backup_done <span class=\"br0\">&#93;<\/span> <span class=\"sy0\">||<\/span> <span class=\"sy0\">!<\/span> <span class=\"kw2\">grep<\/span> <span class=\"re5\">-q<\/span> <span class=\"st0\">&quot;^home&quot;<\/span> <span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>.filetool.lst; <span class=\"kw1\">then<\/span><br \/>\n&nbsp; <span class=\"kw2\">awk<\/span> <span class=\"st_h\">'BEGIN { FS=&quot;:&quot; } &nbsp;$3 &gt;= 1000 &amp;&amp; $1 != &quot;nobody&quot; { print $1 }'<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span> <span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span><span class=\"kw2\">users<\/span><br \/>\n&nbsp; <span class=\"kw1\">while<\/span> <span class=\"kw2\">read<\/span> U; <span class=\"kw1\">do<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw1\">while<\/span> <span class=\"kw2\">read<\/span> F; <span class=\"kw1\">do<\/span><br \/>\n&nbsp; &nbsp; &nbsp; <span class=\"re2\">TARGET<\/span>=<span class=\"st0\">&quot;\/home\/<span class=\"es3\">${U}<\/span>\/<span class=\"es2\">$F<\/span>&quot;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#91;<\/span> <span class=\"re5\">-d<\/span> <span class=\"st0\">&quot;<span class=\"es2\">$TARGET<\/span>&quot;<\/span> <span class=\"br0\">&#93;<\/span>; <span class=\"kw1\">then<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw2\">rm<\/span> <span class=\"re5\">-rf<\/span> <span class=\"st0\">&quot;<span class=\"es2\">$TARGET<\/span>&quot;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; <span class=\"kw1\">else<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">if<\/span> <span class=\"br0\">&#91;<\/span> <span class=\"re5\">-f<\/span> <span class=\"st0\">&quot;<span class=\"es2\">$TARGET<\/span>&quot;<\/span> <span class=\"br0\">&#93;<\/span>; <span class=\"kw1\">then<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw2\">rm<\/span> <span class=\"re5\">-f<\/span> <span class=\"st0\">&quot;<span class=\"es2\">$TARGET<\/span>&quot;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"kw1\">fi<\/span><br \/>\n&nbsp; &nbsp; &nbsp; <span class=\"kw1\">fi<\/span><br \/>\n&nbsp; &nbsp; <span class=\"kw1\">done<\/span> <span class=\"sy0\">&lt;<\/span> <span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>.xfiletool.lst &nbsp; &nbsp; &nbsp;<br \/>\n&nbsp; <span class=\"kw1\">done<\/span> <span class=\"sy0\">&lt;<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span><span class=\"kw2\">users<\/span> <br \/>\n<span class=\"kw1\">fi<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<span id=\"Structure_of_the_tce_partition\"><h2>Structure of the tce partition<\/h2><\/span>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"sy0\">\/<\/span>mnt<span class=\"sy0\">\/<\/span>hda1<span class=\"sy0\">\/<\/span>.<br \/>\n&nbsp; &nbsp; <span class=\"sy0\">|<\/span>-- lost+found<br \/>\n&nbsp; &nbsp; <span class=\"sy0\">`<\/span>-- tce<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">|<\/span>-- mydata.tgz &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co0\"># all data defined within \/opt\/.filetool.lst gets saved within this archive<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">|<\/span>-- onboot.lst &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co0\"># this is the startup script responsible for booting daemons<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">`<\/span>-- optional &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"co0\"># here you will find all extension installed<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">|<\/span>-- apache2.tcz<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">|<\/span>-- apache2.tcz.dep<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class=\"sy0\">|<\/span>-- apache2.tcz.md5.txt<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &nbsp;<span class=\"co0\"># more extensions...<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<span id=\"Content_of_mydata.tgz\"><h2>Content of mydata.tgz<\/h2><\/span>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"bash codecolorer\">&nbsp;<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p><!-- \n##########################################################################################\n### \n###  Installing openssh-server \n###\n##########################################################################################\n--><\/p>\n<span id=\"Install_openssh-server\"><h1>Install openssh-server<\/h1><\/span>\n<p>To install the openssh-server enter the folowing commands:<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"co0\"># Install the server<\/span><br \/>\ntce-load <span class=\"re5\">-wi<\/span> openssh<br \/>\n<br \/>\n<span class=\"co0\"># Configure the server (you may edit\/add security to the sshd_config file)<\/span><br \/>\n<span class=\"kw2\">sudo<\/span> <span class=\"kw2\">cp<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>ssh<span class=\"sy0\">\/<\/span>sshd_config.example <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>ssh<span class=\"sy0\">\/<\/span>sshd_config<br \/>\n<br \/>\n<span class=\"co0\"># Make the settings permanent (so you are able to reboot without destroying your config)<\/span><br \/>\n<span class=\"kw3\">echo<\/span> usr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">ssh<\/span> <span class=\"sy0\">&gt;&gt;<\/span> <span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>.filetool.lst<br \/>\n<br \/>\n<span class=\"co0\"># Enable the server at startup<\/span><br \/>\n<span class=\"kw3\">echo<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>init.d<span class=\"sy0\">\/<\/span>openssh start <span class=\"sy0\">&gt;&gt;<\/span> <span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>bootlocal.sh<br \/>\n<br \/>\n<span class=\"co0\"># Change the password of tc and make sure to save the changes from now on<\/span><br \/>\n<span class=\"co0\"># and add \/etc\/passwd, \/etc\/groups and \/etc\/shadow to backup-list<\/span><br \/>\n<span class=\"kw2\">sudo<\/span> <span class=\"kw2\">passwd<\/span> tc<br \/>\n<span class=\"kw3\">echo<\/span> etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span> <span class=\"sy0\">&gt;&gt;<\/span> <span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>.filetool.lst<br \/>\n<span class=\"kw3\">echo<\/span> etc<span class=\"sy0\">\/<\/span>group <span class=\"sy0\">&gt;&gt;<\/span> <span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>.filetool.lst<br \/>\n<span class=\"kw3\">echo<\/span> etc<span class=\"sy0\">\/<\/span>shadow <span class=\"sy0\">&gt;&gt;<\/span> <span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>.filetool.lst<br \/>\n<br \/>\n<span class=\"co0\">#\u00c2\u00a0Save the configuration permanently within mydata.tgz<\/span><br \/>\nfiletool.sh <span class=\"re5\">-b<\/span> <span class=\"re5\">-p<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p><!-- \n##########################################################################################\n### \n###  Installing apache2\n###\n##########################################################################################\n--><\/p>\n<span id=\"Install_apache2\"><h1>Install apache2<\/h1><\/span>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"co0\"># Install apache and some missing dependencies<\/span><br \/>\ntce-load <span class=\"re5\">-wi<\/span> ncurses<br \/>\ntce-load <span class=\"re5\">-wi<\/span> apache2<br \/>\n<br \/>\n<span class=\"co0\"># Make sure it loads after reboot<\/span><br \/>\n<span class=\"kw3\">echo<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apachectl start<\/span> <span class=\"sy0\">&gt;&gt;<\/span> <span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>bootlocal.sh<br \/>\n<br \/>\n<span class=\"co0\"># Make shure that the config gets backed-up<\/span><br \/>\n<span class=\"kw3\">echo<\/span> usr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>apache2<span class=\"sy0\">\/<\/span>conf <span class=\"sy0\">&gt;&gt;<\/span> <span class=\"sy0\">\/<\/span>opt<span class=\"sy0\">\/<\/span>.filetool.lst<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>By default apache is running as user <em>nobody<\/em> which and group <em>stuff<\/em>. I prefere apache to run as user <em>apache<\/em> and group <em>apache<\/em>. Therefore we have to create the corresponding user and groups.<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"co0\"># Add a system group for our apache daemon<\/span><br \/>\n<span class=\"kw2\">sudo<\/span> addgroup <span class=\"re5\">-g<\/span> <span class=\"nu0\">500<\/span> apache<br \/>\n&nbsp; &nbsp; &nbsp; <br \/>\n<span class=\"co0\"># Add user with it's home \/home\/apache, no shell, no password and a userid <\/span><br \/>\n<span class=\"co0\"># 500 and member of the apache group. This will also create the directory <\/span><br \/>\n<span class=\"co0\"># \/home\/apache for you.<\/span><br \/>\n<span class=\"kw2\">sudo<\/span> adduser <span class=\"re5\">-h<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>apache <span class=\"re5\">-s<\/span> <span class=\"sy0\">\/<\/span>bin<span class=\"sy0\">\/<\/span><span class=\"kw2\">false<\/span> <span class=\"re5\">-D<\/span> <span class=\"re5\">-u<\/span> <span class=\"nu0\">500<\/span> <span class=\"re5\">-G<\/span> apache apache<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>Also I prefer having the webroot directory within apache&#8217;s home directory<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"co0\"># Now create some more directories<\/span><br \/>\n<span class=\"kw2\">mkdir<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>apache<span class=\"sy0\">\/<\/span>cgi-bin<br \/>\n<span class=\"kw2\">mkdir<\/span> <span class=\"sy0\">\/<\/span>home<span class=\"sy0\">\/<\/span>apache<span class=\"sy0\">\/<\/span>htdocs<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>To reflect this changes we have to modify some entries in <em>\/usr\/local\/apache2\/conf\/httpd.conf<\/em><\/p>\n<ul>\n<li>User apache<\/li>\n<li>Group apache<\/li>\n<li>DocumentRoot &#8220;\/home\/apache\/htdocs&#8221;<\/li>\n<li>ScriptAlias \/cgi-bin\/ &#8220;\/home\/apache\/cgi-bin\/&#8221;<\/li>\n<\/ul>\n<p>Afterward it&#8217;s time to backup<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"bash codecolorer\">filetool.sh <span class=\"re5\">-b<\/span> <span class=\"re5\">-p<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<span id=\"Creating_extension_packages\"><h1>Creating extension packages<\/h1><\/span>\n<p>Even if the <h href=\"http:\/\/distro.ibiblio.org\/pub\/linux\/distributions\/tinycorelinux\/3.x\/tcz\/\">repository<\/a> of TinyCore extensions is huge, now and then rise the need of installing some software which isn&#8217;t in the repository already. In this section we will look at the process of creating a extension from source-tarball.<\/p>\n<p>The official guide can be found <a href=\"http:\/\/wiki.tinycorelinux.net\/doku.php?id=creating_extensions\">here<\/a>.<\/p>\n<span id=\"Basic_package_concept\"><h2>Basic package concept<\/h2><\/span>\n<p>A package consist of several files. These are:<\/p>\n<ul>\n<li><strong>[package].tcz<\/strong> &#8211; This is the actual package with its binaries, libraries and configfiles<\/li>\n<li><strong>[package].tcz.md5.txt<\/strong> &#8211; This file contains the md5-sum of the [package].tcz. It is generated by md5sum [package].tcz > [package].tcz.md5.txt<\/li>\n<li><strong>[package].tcz.list<\/strong> &#8211; This file contains a listing of all files contained in [package].tcz<\/li>\n<li><strong>[package].tcz.info<\/strong> &#8211; This file contains a description of the package (Version, License, Developer, Packager,Pourpose of the software&#8230;)<\/li>\n<li><strong>[package].tcz.dep<\/strong> &#8211; This file contains the list of prerequisit software packages (dependencies) which have to be installed to use the package.<\/li>\n<li><strong>[package].tcz.build-dep<\/strong> &#8211; This file documents the package build process (Compiler-Flags, Applied patches&#8230;)<\/li>\n<li><strong>[package].tar.gz<\/strong> &#8211; This is the actual sourcecode used to build the software<\/li>\n<\/ul>\n<blockquote><p>Note that not all of these files are mandatory.<\/p><\/blockquote>\n<p>The easiest way to understand the process of building extensions is to do it. So here&#8217;s an example:<\/p>\n<span id=\"Building_CLISH_CommandLineSHell\"><h2>Building CLISH (CommandLineSHell)<\/h2><\/span>\n<p>CLISH is a modular framework for implementing a CISCO-like CLI on a *NIX system. Arbitary command menus and actions can be defined using XML files. This software handles the user interaction, and forks the appropriate system commands to perform any actions. <\/p>\n<span id=\"Create_the_build_environment\"><h3>Create the build environment<\/h3><\/span>\n<p>For my build environment I&#8217;ve copied my virtual machine with <em>mircocore + ssh<\/em>. Than you have to install some package to get the compiler, libraries and tools.<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"bash codecolorer\">tce-load <span class=\"re5\">-wi<\/span> compiletc<br \/>\ntce-load <span class=\"re5\">-wi<\/span> squashfs-tools<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<span id=\"Get_the_software_source\"><h3>Get the software source<\/h3><\/span>\n<p>Download the software you&#8217;ll like to compile. In our case this is CLISH from <a href=\"http:\/\/clish.sourceforge.net\/\">http:\/\/clish.sourceforge.net\/<\/a>. Then you have to extract the source. This is everithing done as the <em>tc<\/em> user.<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">wget<\/span> <span class=\"st_h\">'http:\/\/prdownloads.sourceforge.net\/clish\/clish-0.7.3.tar.gz?download'<\/span><br \/>\n<span class=\"kw2\">mv<\/span> clish-0.7.3.tar.gz?download clish-0.7.3.tar.gz<br \/>\n<span class=\"kw2\">tar<\/span> xvfz clish-0.7.3.tar.gz<br \/>\n<span class=\"kw3\">cd<\/span> clish-0.7.3<span class=\"sy0\">\/<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<span id=\"Build_the_software\"><h3>Build the software<\/h3><\/span>\n<p>According to the official <a href=\"http:\/\/wiki.tinycorelinux.net\/doku.php?id=creating_extensions\">&#8220;creating extension manual&#8221;<\/a> the following compiler flags are recommendet for compatibility:<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw3\">export<\/span> <span class=\"re2\">CFLAGS<\/span>=<span class=\"st0\">&quot;-march=i486 -mtune=i686 -Os -pipe&quot;<\/span><br \/>\n<span class=\"kw3\">export<\/span> <span class=\"re2\">CXXFLAGS<\/span>=<span class=\"st0\">&quot;-march=i486 -mtune=i686 -Os -pipe&quot;<\/span><br \/>\n<span class=\"kw3\">export<\/span> <span class=\"re2\">LDFLAGS<\/span>=<span class=\"st0\">&quot;-Wl,-O1&quot;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>Then compile the software as usual (read README, INSTALL&#8230; contained in the source tar-ball). In our example CLISH doesn&#8217;t reflect the option &#8220;<em>&#8211;sysconfdir<\/em>&#8221; correctly. If we define &#8211;prefix=\/usr\/local then the configuration directory should be <em>\/usr\/local\/etc\/clish<\/em> but its <em>\/etc\/clish<\/em>. So we have to modify the source code within the file <em>clish\/shell\/shell_spawn.c<\/em>. To create a patch we copy the folder <em>clish-0.7.3<\/em> to <em>clish-0.7.3.work<\/em> and modify the the folowing line within <em>clish\/shell\/shell_spawn.c<\/em>:<\/p>\n<div class=\"codecolorer-container c default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"c codecolorer\"><span class=\"kw4\">const<\/span> <span class=\"kw4\">char<\/span> <span class=\"sy0\">*<\/span>default_path <span class=\"sy0\">=<\/span> <span class=\"st0\">&quot;\/etc\/clish;~\/.clish&quot;<\/span><span class=\"sy0\">;<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>Then we create the patch with:<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"bash codecolorer\">&nbsp;<span class=\"kw2\">diff<\/span> <span class=\"re5\">-Naur<\/span> clish-0.7.3 clish-0.7.3.work <span class=\"sy0\">&gt;<\/span> clish-0.7.3.sysconfdir.patch<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>This will result in a patch with the folowing content:<\/p>\n<div class=\"codecolorer-container diff default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/><\/div><\/td><td><div class=\"diff codecolorer\">diff -Naur clish-0.7.3\/clish\/shell\/shell_spawn.c clish-0.7.3.work\/clish\/shell\/shell_spawn.c<br \/>\n<span class=\"re3\">--- clish-0.7.3\/clish\/shell\/shell_spawn.c &nbsp; 2008-03-07 08:42:59.000000000 +0000<\/span><br \/>\n<span class=\"re4\">+++ clish-0.7.3.work\/clish\/shell\/shell_spawn.c&nbsp; 2011-04-16 18:10:37.402454276 +0000<\/span><br \/>\n<span class=\"re6\">@@ -16,7 +16,7 @@<\/span><br \/>\n&nbsp;\/*<br \/>\n&nbsp; * if CLISH_PATH is unset in the environment then this is the value used. <br \/>\n&nbsp; *\/<br \/>\n<span class=\"re7\">-const char *default_path = &quot;\/etc\/clish;~\/.clish&quot;;<\/span><br \/>\n<span class=\"re8\">+const char *default_path = &quot;\/usr\/local\/etc\/clish;~\/.clish&quot;;<\/span><br \/>\n&nbsp;<br \/>\n&nbsp;\/*-------------------------------------------------------- *\/<br \/>\n&nbsp;\/*<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>Now we can apply the patch to the original source code with:<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">patch<\/span> <span class=\"re5\">-p0<\/span> <span class=\"sy0\">&lt;<\/span> clish-0.7.3.patch<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>&#8230; and build the software:<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw3\">cd<\/span> clish-0.7.3<br \/>\n.<span class=\"sy0\">\/<\/span>configure <span class=\"re5\">--prefix<\/span>=<span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span><span class=\"kw3\">local<\/span><br \/>\n<span class=\"kw2\">make<\/span><br \/>\n<span class=\"kw2\">touch<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span>mark<br \/>\n<span class=\"kw2\">make<\/span> <span class=\"re2\">DESTDIR<\/span>=<span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span>package <span class=\"kw2\">install<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>This should build and install the software under <em>\/tmp\/package<\/em>. Next we are populate <em>\/usr\/local\/etc\/clish\/<\/em> with some default configuration files&#8230;<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">mkdir<\/span> <span class=\"re5\">-p<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span>package<span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>clish<br \/>\n<span class=\"kw2\">cp<\/span> xml-examples<span class=\"sy0\">\/*<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span>package<span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>local<span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>clish<span class=\"sy0\">\/<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>&#8230; and we are ready to create the extension-package.<\/p>\n<span id=\"Creating_the_package\"><h3>Creating the package<\/h3><\/span>\n<p>First we are going to cleanup the \/tmp\/package directorie a bit. We are stripping binaries, removing documentation (if there&#8217;s any), if there are a lot of development files move them to a dedicated [package]-dev package and so on.<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw3\">cd<\/span> <span class=\"sy0\">\/<\/span>tmp<span class=\"sy0\">\/<\/span>package<br \/>\n<span class=\"kw2\">find<\/span> . <span class=\"sy0\">|<\/span> <span class=\"kw2\">xargs<\/span> <span class=\"kw2\">file<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> <span class=\"st0\">&quot;executable&quot;<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> ELF <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> <span class=\"st0\">&quot;not stripped&quot;<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">cut<\/span> <span class=\"re5\">-f<\/span> <span class=\"nu0\">1<\/span> <span class=\"re5\">-d<\/span> : <span class=\"sy0\">|<\/span> <span class=\"kw2\">xargs<\/span> <span class=\"kw2\">strip<\/span> <span class=\"re5\">--strip-unneeded<\/span><br \/>\n<span class=\"kw2\">find<\/span> . <span class=\"sy0\">|<\/span> <span class=\"kw2\">xargs<\/span> <span class=\"kw2\">file<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> <span class=\"st0\">&quot;shared object&quot;<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> <span class=\"st0\">&quot;not stripped&quot;<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">cut<\/span> <span class=\"re5\">-f<\/span> <span class=\"nu0\">1<\/span> <span class=\"re5\">-d<\/span> : <span class=\"sy0\">|<\/span> <span class=\"kw2\">xargs<\/span> <span class=\"kw2\">strip<\/span> <span class=\"re5\">-g<\/span><\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>then we are creating a listing of all files which gets installed if you apply this package<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw2\">find<\/span> usr <span class=\"re5\">-not<\/span> <span class=\"re5\">-type<\/span> d <span class=\"sy0\">&gt;<\/span> ..<span class=\"sy0\">\/<\/span>clish.tcz.list<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<blockquote><p>This create our first mandatory file: the listing of all files wich get installed when we apply the package!<\/p><\/blockquote>\n<p>then we create the package itself<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"bash codecolorer\"><span class=\"kw3\">cd<\/span> <span class=\"sy0\">\/<\/span>tmp<br \/>\nmksquashfs package clish.tcz<br \/>\nmd5sum clish.tcz <span class=\"sy0\">&gt;<\/span> clish.tcz.md5.txt<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<blockquote><p>Two more mandatory files of our package: the software itself and a md5 sum of it saved in a seperate file.<\/p><\/blockquote>\n<p>But there are still some files missing. Since clish doesn&#8217;t have any dependencies to other packages we don&#8217;t have to create the file clish.tcz.dep. But if it would then this file is pretty easy to create. It just lists all packages wich have to be installed prior our package. Here is a example of the <em>.dep<\/em> file of apache2:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"text codecolorer\">apr-util.tcz<br \/>\nopenssl-0.9.8.tcz<br \/>\npcre.tcz<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<blockquote><p>If you are following this mini-HowTo you may have noticed, that there&#8217;s one dependency missing: ncurses.tcz \ud83d\ude42<\/p><\/blockquote>\n<p>Theres still some files missing: <em>clish.tcz.info<\/em> and <em>clish.tcz.build-dep<\/em>. So lets create <em>clish.tcz.info<\/em> first:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/><\/div><\/td><td><div class=\"text codecolorer\">Title: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;clish.tcz<br \/>\nDescription: &nbsp; &nbsp;Modular CISCO-like CLI for tinycore<br \/>\nVersion: &nbsp; &nbsp; &nbsp; &nbsp;0.7.3<br \/>\nAuthor: &nbsp; &nbsp; &nbsp; &nbsp; Graeme McKerrell<br \/>\nOriginal-site: &nbsp;http:\/\/clish.sourceforge.net\/<br \/>\nCopying-policy: GPL<br \/>\nSize: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 240.0K<br \/>\nExtension_by: &nbsp; &lt;your name&gt;<br \/>\nComments: &nbsp; &nbsp; &nbsp; Clish is a modular framework for implementing a CISCO-like <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; CLI on a *NIX system. Arbitary command menus and actions <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; can be defined using XML files. This software handles the <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; user interaction, and forks the appropriate system commands <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; to perform any actions.<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; This extension is PPI compatible. <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ----------<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Change-log: &nbsp; &nbsp; 2011\/04\/16 First version<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>and the <em>clish.tcz.build-dep<\/em>. Here you write down how you have build your package. Something like:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;width:100%;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/>29<br \/><\/div><\/td><td><div class=\"text codecolorer\">wget 'http:\/\/prdownloads.sourceforge.net\/clish\/clish-0.7.3.tar.gz?download'<br \/>\nmv clish-0.7.3.tar.gz?download clish-0.7.3.tar.gz<br \/>\ntar xvfz clish-0.7.3.tar.gz<br \/>\ncd clish-0.7.3\/<br \/>\nexport CFLAGS=&quot;-march=i486 -mtune=i686 -Os -pipe&quot;<br \/>\nexport CXXFLAGS=&quot;-march=i486 -mtune=i686 -Os -pipe&quot;<br \/>\nexport LDFLAGS=&quot;-Wl,-O1&quot;<br \/>\n<br \/>\n--- patch ---<br \/>\nvi clish\/shell\/shell_spawn.c<br \/>\nconst char *default_path = &quot;\/usr\/local\/etc\/clish;~\/.clish&quot;;<br \/>\n--- patch ---<br \/>\n<br \/>\n.\/configure --prefix=\/usr\/local --sysconfdir=\/usr\/local\/etc<br \/>\nmake<br \/>\ntouch \/tmp\/mark<br \/>\nmake DESTDIR=\/tmp\/package install<br \/>\n<br \/>\nmkdir -p \/tmp\/package\/usr\/local\/etc\/clish<br \/>\ncp xml-examples\/* \/tmp\/package\/usr\/local\/etc\/clish\/<br \/>\n<br \/>\ncd \/tmp\/package<br \/>\nfind . | xargs file | grep &quot;executable&quot; | grep ELF | grep &quot;not stripped&quot; | cut -f 1 -d : | xargs strip --strip-unneeded<br \/>\nfind . | xargs file | grep &quot;shared object&quot; | grep &quot;not stripped&quot; | cut -f 1 -d : | xargs strip -g<br \/>\nfind usr -not -type d &gt; ..\/clish.tcz.list<br \/>\n<br \/>\ncd \/tmp<br \/>\nmksquashfs package clish.tcz<br \/>\nmd5sum clish.tcz &gt; clish.tcz.md5.txt<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p>Now we have the following files:<\/p>\n<ul>\n<li>clish.tcz<\/li>\n<li>clish.tcz.md5.txt<\/li>\n<li>clish.tcz.list<\/li>\n<li>clish.tcz.info<\/li>\n<li>clish.tcz.build-dep<\/li>\n<li>clish-0.7.3.tar.gz<\/li>\n<li>clish-0.7.3.sysconfdir.patch<\/li>\n<\/ul>\n<p>save your files to a save directory, and install it with:<\/p>\n<div class=\"codecolorer-container bash default\" style=\"overflow:auto;white-space:nowrap;width:100%;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"bash codecolorer\">tce-load <span class=\"re5\">-i<\/span> clish.tcz<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<p><strong>Important: Test your package!<\/strong> If you would like to contribute to the project there seems some more hurdles to take. Please refer to the official documentation <a href=\"http:\/\/wiki.tinycorelinux.net\/doku.php?id=creating_extensions\">here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a little HowTo creating a really small (<10MiB) VMWare image based on Tiny Core Linux with openssh installed. It also explains how to create packages and install your own extension-repository... enjoy and have fun! Please comment... <a href=\"https:\/\/thebc.ch\/blog\/?p=802\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,17],"tags":[],"class_list":["post-802","post","type-post","status-publish","format-standard","hentry","category-tinycore","category-vmware"],"_links":{"self":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=802"}],"version-history":[{"count":115,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/802\/revisions"}],"predecessor-version":[{"id":2675,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=\/wp\/v2\/posts\/802\/revisions\/2675"}],"wp:attachment":[{"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thebc.ch\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}