LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   building slackware packages: optimum file structure (https://www.linuxquestions.org/questions/slackware-14/building-slackware-packages-optimum-file-structure-4175462555/)

textillis 05-19-2013 05:09 AM

building slackware packages: optimum file structure
 
edit: tues 2am GMT+10
I'm opening this up again since it is still attracting some great contributions.

1. Please, could people share their thoughts on:
- the best way to structure one's file system before starting to download tar balls and making a mess everywhere.

Facing Mount Slack. Man pages are sheer rock walls where one is looking for a gentle track.

I'm still at base-camp guys and I need a little help in getting my spike boots on, oxygen-mask adjusted and other survival gear sorted before I start the first leg of the ascent.

(I know i will have to come to terms with my distaste for man pages, eventually, but in the meantime I need to pick people's brains just to get the first stage of the climb pegged out)

Thanks in anticipation,
Tex

wildwizard 05-19-2013 05:21 AM

Answering 2 as 1 is more personal choice than anything else

root doesn't actually care about the file ownership so if your downloading stuff as a normal user and then doing things with those files as root the only problems will be new files created by root.

root can open and modify files owned by other users even when the permissions say otherwise, the modifications will also not result in changes to those permissions.

The only gotcha in this scenario will be with files created by root as they will have root.root as the owner, however a quick chown can fix that, assuming that you even need to access those files as a normal user.

jstg 05-19-2013 05:28 AM

You could look at this and this. It's more about different ways to set up for working with SlackBuilds but it's easy enough to adapt to your own needs. If nothing else it should give you some ideas.

textillis 05-19-2013 05:35 AM

Thanks Wild and jstg!
So, as to Q1., would somethingg like:

home/tex/slackware be okay, with "tex" being me as user?

edit: or perhaps /home/slackware, cutting "tex" out of the tree, putting them rather on root's home directory?

And, if so, is slackware then the directory into which i expand the dloaded tar and/or gz files?

jstg 05-19-2013 05:51 AM

I do /home/jstg/slackware/

And then under my slackware directory I have a directory for SlackBuilds that I build from slackbuilds.org. Anything that I build that isn't a SlackBuild goes in it's own directory.

/home/jstg/slackware/slackbuilds

or

/home/jstg/slackware/name_of_package_to_be_built

But that is just the way I do it. I can still do all of the ./configure and make as my own user then switch to root to build the packages.

edorig 05-19-2013 05:58 AM

Quote:

Originally Posted by textillis (Post 4954172)
1. Please, could people share their thoughts on:
- the best way to structure one's file system before starting to download tar balls and making a mess everywhere.

2. An important associated question:
- when creating such a file structure, how do I make sure that it is owned by both me and root?
Tex

Usually, you need 3 partitions to hold a Linux operating system on a workstation.
/ that receives the operating system proper (kernel, executables, libraries, documentation etc...) typically 10 Gb for a workstation.
/home that will receive the user files.
a swap partition (twice your RAM in size: bigger is normally useless).
/ and /home will have to be mounted at boot time (entries in /etc/fstab).

You can create a single large / partition instead of / and /home, but it is not practical when you upgrade the system since it will force you to restore the user files from backups. Concerning the filesystems you can use,
you have the choice between ext3/4, jfs, xfs and btrfs. I would not recommend btrfs as it is still an experimental filesystem. ext3/4 is the standard linux journaling filesystem. It is very reliable and supported by all Linux distributions.jfs is another journaling filesystem provided by IBM and used on AIX. It is said to be less demanding in terms of CPU power. xfs is a third journaling filesystem provided by SGI and used on Irix. It demands more memory, but is good for large files. One inconvenient is that you can only enlarge xfs partitions, but you
can't shrink them. A common inconvenient of jfs and xfs is that they are not all supported by all Linux distributions. In particular, RedHat Linux and its derivatives (CentOS, Scientific Linux) only support xfs in
the 64-bit version. If for some reason you have to replace Slackware with one of those distros, you will be forced
to reinstall /home from backups if you used jfs or xfs. For that reason, I would recommend you to use ext4 or ext3
for your / and /home unless you have some special needs to work with very large files or spare your CPU power. In that case use xfs or jfs for /home and leave / as ext3/4.

/ and /home are owned by root. You add users with the adduser command. A directory owned by the user will be created under /home. root can access any file on the system, so there is no need to add root as owner. If you
need finer control on file access, you may use ACLs (supported on ext3/4, jfs and xfs).

If you are going to use linux on flash devices, you should not use any journaling filesystem (jfs,xfs,ext3/4). Flash devices die after a rather small number of writes compared to magnetic devices so you don't want Linux
to write constantly to a journal file. A simple option is to use ext2 format on these devices, or if you don't
need to preserve permissions, user and group, vfat. There are also some optimized filesystems for those devices (yaffs, etc...).

If you are thinking of a server configuration, you should add a /tmp and a /var partition. These partitions must be sufficiently large not to get filled by the normal operation of your server. Again, the choice of xfs, jfs or ext3/4 depends on your particular needs.

edorig 05-19-2013 06:04 AM

Sorry for that stupid answer. I understood that you wanted help to organize your filesystem prior to installing
Slackware not that you only wanted to create a directory to build packages.

textillis 05-19-2013 06:13 AM

Quote:

Originally Posted by jstg (Post 4954180)
I do /home/jstg/slackware/

And then under my slackware directory I have a directory for SlackBuilds that I build from slackbuilds.org. Anything that I build that isn't a SlackBuild goes in it's own directory.

/home/jstg/slackware/slackbuilds

or

/home/jstg/slackware/name_of_package_to_be_built

But that is just the way I do it. I can still do all of the ./configure and make as my own user then switch to root to build the packages.

Perfect. Thanks friend.
Tex

textillis 05-19-2013 06:14 AM

Quote:

Originally Posted by edorig (Post 4954184)
Sorry for that stupid answer. I understood that you wanted help to organize your filesystem prior to installing
Slackware not that you only wanted to create a directory to build packages.

Please, no need to apologize!
This is great stuff!

Very, very helpful.

Thanks big time,
Tex

jstg 05-19-2013 06:20 AM

I'd definately look into sbopkg and slackbuilds.org if you haven't already. It's a wonderful resource.

It makes building and installing packages simple and easy to keep track of.

GazL 05-19-2013 06:35 AM

I think most of us use some variant on:
Code:

.
|-- packages
|  |-- conky-1.9.0-x86_64-1_local.tgz
|  |-- dmenu-4.5.gazl1-x86_64-1_local.txz
|  |-- dvdauthor-0.7.1-x86_64-1_local.tgz
|  |-- dwm-6.0.gazl5-x86_64-1_local.txz
|  |-- ...etc.
|  `-- xvidcore-1.3.2-x86_64-1_local.txz
`-- source
    |-- conky.SBo
    |  |-- README
    |  |-- conky-1.9.0.tar.bz2
    |  |-- conky.SlackBuild
    |  |-- conky.info
    |  |-- doinst.sh
    |  `-- slack-desc
    |-- dmenu
    |  |-- dmenu-4.5.gazl1.tar.gz
    |  |-- dmenu.SlackBuild
    |  `-- slack-desc
    |-- dvdauthor.SBo
    |  |-- README
    |  |-- dvdauthor-0.7.1.tar.gz
    |  |-- dvdauthor.SlackBuild
    |  |-- dvdauthor.info
    |  `-- slack-desc
    |-- dwm
    |  |-- dwm-6.0.gazl5.tar.gz
    |  |-- dwm.SlackBuild
    |  `-- slack-desc
    .etc

Where you locate the top of this directory structure is entirely down to your own preferences. I used to use /root/build until I moved it all into its own filesystem under /local.

I've been contemplating adding a ./distfiles/ directory the way that the *bsd guys do and moving the tarballs out of the build directories: the idea being that I could then put all the build directories themselves under a revision control system such as mercurial or git without the tarballs getting in the way, but as yet I haven't done so.

textillis 05-19-2013 07:22 AM

Quote:

Originally Posted by GazL (Post 4954197)
I think most of us use some variant on:
Code:

.
|-- packages
|  |-- conky-1.9.0-x86_64-1_local.tgz
|  |-- dmenu-4.5.gazl1-x86_64-1_local.txz
|  |-- dvdauthor-0.7.1-x86_64-1_local.tgz
|  |-- dwm-6.0.gazl5-x86_64-1_local.txz
|  |-- ...etc.
|  `-- xvidcore-1.3.2-x86_64-1_local.txz
`-- source
    |-- conky.SBo
    |  |-- README
    |  |-- conky-1.9.0.tar.bz2
    |  |-- conky.SlackBuild
    |  |-- conky.info
    |  |-- doinst.sh
    |  `-- slack-desc
    |-- dmenu
    |  |-- dmenu-4.5.gazl1.tar.gz
    |  |-- dmenu.SlackBuild
    |  `-- slack-desc
    |-- dvdauthor.SBo
    |  |-- README
    |  |-- dvdauthor-0.7.1.tar.gz
    |  |-- dvdauthor.SlackBuild
    |  |-- dvdauthor.info
    |  `-- slack-desc
    |-- dwm
    |  |-- dwm-6.0.gazl5.tar.gz
    |  |-- dwm.SlackBuild
    |  `-- slack-desc
    .etc

Where you locate the top of this directory structure is entirely down to your own preferences. I used to use /root/build until I moved it all into its own filesystem under /local.

I've been contemplating adding a ./distfiles/ directory the way that the *bsd guys do and moving the tarballs out of the build directories: the idea being that I could then put all the build directories themselves under a revision control system such as mercurial or git without the tarballs getting in the way, but as yet I haven't done so.

Thanks Gaz; this is some meat to chew on.
Tex
(incidentally: what is the hidden directory /.etc doing down the bottom there?)

torimus 05-19-2013 09:07 AM

You've probably already read about it in FAQs but I would like to point out direct installation of software, ie. not with the Slackware's package system called pkgtools, is strongly discouraged. Even compiling/building as root is recommend to avoid and use tools like fakeroot or set non-standard privileges manually.
To the good practices also belongs creating a dedicated user account for the purpose of building packages only.

sbopkg (the last time I did tested it) requires root account to create packages which I find a bit unfortunate. Hope the dev will discover fakeroot someday.

textillis 05-19-2013 09:27 AM

Quote:

Originally Posted by torimus (Post 4954252)
You've probably already read about it in FAQs but I would like to point out direct installation of software, ie. not with the Slackware's package system called pkgtools, is strongly discouraged. Even compiling/building as root is recommend to avoid and use tools like fakeroot or set non-standard privileges manually.
To the good practices also belongs creating a dedicated user account for the purpose of building packages only.

sbopkg (the last time I did tested it) requires root account to create packages which I find a bit unfortunate. Hope the dev will discover fakeroot someday.

Point noted. Thanks. For the moment though, I'm trying to work out why I can't make the following an executable:

i give the commmand: chmod +* <*.SlackBuild>

and it returns no error message, but then when I check the directory, I see no yellow, nor any * marking the file as executable.

here is the output:

Code:

root@tickles:/home/tex/slackware/packages/source/libisoburn/libisoburn# chmod +x libisoburn.SlackBuild
root@tickles:/home/tex/slackware/packages/source/libisoburn/libisoburn# dir
README        libisoburn.SlackBuild  libisoburn.info        slack-desc

Can you spot what is wrong with this?
Thanks if you can,
Tex

psionl0 05-19-2013 10:47 AM

There doesn't seem to be much point to having anybody but root own the SlackBuild files. You can still read them as an ordinary user but you need to be root to run the SlackBuild and to install the resulting package.

With that in mind, I have a directory structure called "/home/slackbuilds" and each SlackBuild application has its own sub-directory (all owned by root of course).

psionl0 05-19-2013 10:50 AM

Quote:

Originally Posted by textillis (Post 4954260)
I'm trying to work out why I can't make the following an executable:

i give the commmand: chmod +* <*.SlackBuild>

and it returns no error message, but then when I check the directory, I see no yellow, nor any * marking the file as executable.

It might be and xterm setting problem.

Try ls -l to see the attributes of each file.

Didier Spaier 05-19-2013 11:20 AM

I don't know what "chmod +* <*.SlackBuild>" could mean. To make a file executable type either "chmod +x <*.SlackBuild>" or "chmod 755 <*.SlackBuild>"

EDIT. Maybe you meant chmod +rwxXst. That would be an overkill, doesn't make sense to set both x and X bits in the same command, and s and t are not needed.

textillis 05-20-2013 07:08 AM

Quote:

Originally Posted by Didier Spaier (Post 4954305)
I don't know what "chmod +* <*.SlackBuild>" could mean. To make a file executable type either "chmod +x <*.SlackBuild>" or "chmod 755 <*.SlackBuild>"

EDIT. Maybe you meant chmod +rwxXst. That would be an overkill, doesn't make sense to set both x and X bits in the same command, and s and t are not needed.

Merci beaucoup pour l'explication; c'est gentil de vous m'avoir repondu.

(I love French but can't get accents on my keyboard, not yet at least)

cheers Didier,
Tex

irgunII 05-20-2013 08:31 AM

1 Attachment(s)
I do my builds completely in an single krusader instance (I hate Dolphin! Been using krusader at least 5 or 6 years minimum).

I have a dir for the 'building' of packages, a dir for keeping the 'built_srcs' (a holdover thing from when I was stuck with dialup only, not necessary really with anything faster), and a dir for the finished/built packages called 'installed'.

I open up the konsole from the bottom-half of krusader and 'su -' to get to root control there.

I download the build package to my 'build' dir and in krusader I right-click on it to extract the tarball in that dir (I've bad carpal tunnel so I cannot touch-type and being a two-finger typist it's way, way too slow looking up and down from keyboard to monitor just to type 'tar -xvf' etc when it's just as fast and easy for me with the mouse and krusader).

I now have a dir with all the components needed for the build of a particular package. Download the source tarball into the extracted dir in 'build'.

Click on the extracted package dir and in krusader the konsole prompt automatically follows the working directory.

Do 'ls' and then type in konsole './package_name' and let it build.

When it's done, I have /tmp/package_name.txz ready to install. I simply double-click on the '/tmp/package_name.txz to highlight it to klipper, type in 'installpkg then click to paste, hit enter and it's installed.

Next, I simply type in 'mv (click to paste again) /home/me/installed' and all my built packages are in one single dir on my home partition where I own them and don't have to become root to do anything with them - other than install them again if need be.

This is my way that I learned to do through experimenting and which I've stuck with now for over a year or so (I've only been using Slackware for a year plus, used to be a SuSE user for 11 or so years). It's fast (for me, heh), simple (again, for me), and is easy to backup to a bd-r to have in an emergency. Hopefully this is something you were also hoping to see/read/try and not just a waste of everyone's time.

textillis 05-20-2013 09:11 AM

Irgun, this is most excellent and I thank you very much.
As it happens, I am not a fan of KDE and don't have it on my install of Slack.
However, I am very new to all this, so, just to let you know:
I am so desperate to "get a leg up" as far as configuring my system is concerned (and, at the core of that, finding a way I can safely build up some favorite programs that don't come with slack, like Geogebra, for instance) that I am considering geting KDE back and having a play along the lines you suggest.

Whatever the outcome, please know that your post was in no way "a waste of [my] time"

cheers,
Tex
PS very cool setup

Quote:

Originally Posted by irgunII (Post 4954898)
I do my builds completely in an single krusader instance (I hate Dolphin! Been using krusader at least 5 or 6 years minimum).

I have a dir for the 'building' of packages, a dir for keeping the 'built_srcs' (a holdover thing from when I was stuck with dialup only, not necessary really with anything faster), and a dir for the finished/built packages called 'installed'.

I open up the konsole from the bottom-half of krusader and 'su -' to get to root control there.

I download the build package to my 'build' dir and in krusader I right-click on it to extract the tarball in that dir (I've bad carpal tunnel so I cannot touch-type and being a two-finger typist it's way, way too slow looking up and down from keyboard to monitor just to type 'tar -xvf' etc when it's just as fast and easy for me with the mouse and krusader).

I now have a dir with all the components needed for the build of a particular package. Download the source tarball into the extracted dir in 'build'.

Click on the extracted package dir and in krusader the konsole prompt automatically follows the working directory.

Do 'ls' and then type in konsole './package_name' and let it build.

When it's done, I have /tmp/package_name.txz ready to install. I simply double-click on the '/tmp/package_name.txz to highlight it to klipper, type in 'installpkg then click to paste, hit enter and it's installed.

Next, I simply type in 'mv (click to paste again) /home/me/installed' and all my built packages are in one single dir on my home partition where I own them and don't have to become root to do anything with them - other than install them again if need be.

This is my way that I learned to do through experimenting and which I've stuck with now for over a year or so (I've only been using Slackware for a year plus, used to be a SuSE user for 11 or so years). It's fast (for me, heh), simple (again, for me), and is easy to backup to a bd-r to have in an emergency. Hopefully this is something you were also hoping to see/read/try and not just a waste of everyone's time.


Didier Spaier 05-20-2013 09:21 AM

You are welcome, Tex.

Quote:

Originally Posted by textillis (Post 4954835)
(I love French but can't get accents on my keyboard, not yet at least)Tex

Yes you can!

In fact you can even type every character you want on your keyoard.

You just have to:
(1) know the UTF-8 code of the character you want to reproduce (four hexadecimal digits)
(2) type and hold together Ctrl+Shift+u => this will output an underlined "u", telling you that your keyboard just entered in UTF-8 mode
(3) release these three keys
(4) type the four hexadecimal digits
(5) press Enter

Let's take an example. On this page I see that the UTF-8 code for the Euro symbol is "20ac" so if you type Ctrl+Shift+u (release the keys) 20ac [Enter] you get: €

Tip: if you type in your Slackware system:
Code:

  cat /usr/share/i18n/charmaps/UTF-8.gz|gunzip|less
you will see a list of characters with their UTF-8 encoding (left column) and their name (right column).

You can navigate in the list with the down and up arrows, just type "q" to quit when you are done.

chess 05-20-2013 09:31 AM

I'll also throw in a suggestion of installing slackware into a chroot and then building your packages in the chroot to prevent stuff getting polluted in your main environment. I have done this for years and it has served me well.

textillis 05-20-2013 09:45 AM

Quote:

Originally Posted by chess (Post 4954939)
I'll also thrown in a suggestion of installing slackware into a chroot and then building your packages in the chroot to prevent stuff getting polluted in your main environment. I have done this for years and it has served me well.

Thanks Chess.
I'm filing away all these suggestions so as to open them up and look into them 2mro and in coming days.
Just had a quick read of man chroot; seems like the way to go.

cheers,
Tex

tronayne 05-20-2013 10:34 AM

OK, here's a monkey wrench in the works...

I long ago developed rules for file systems, mostly based upon AT&T Unix System V Release 3 supplemented by Release 4 (SVR4 is the usual abbreviation for that).

Yes, I am well aware that Linux is Not Unix (as in GNU is Not Unix) but Slackware, in particular, is sorta-kinda the most like SVR4 of the Linux distributions and I have, for some 12+ years (don't remember exactly) set up my mounted file systems like this:
  • root 10-20 G (used to be 10, now 20 looks better)
  • /home 20 G
  • /usr/local 20 G
  • /opt 20 G
  • /var/lib/psql 150 G (that's a little overkill)
  • /var/lib/mysql 50 G (so's that)
  • /var/lib/virtual 100 G
  • /spares 100 G
Now, those are all mounted file systems on one or more drives and, of course, you may or may not need a large PostgreSQL partition or a largish MySQL partition bu I do.

/usr/local looks like this:
Code:

tree -L 1 /usr/local
/usr/local
|-- bin
|-- cvsroot
|-- doc
|-- etc
|-- games
|-- include
|-- info
|-- lib
|-- lib64
|-- lost+found
|-- man
|-- openils
|-- opt
|-- packages
|-- patches
|-- sbin
|-- share
|-- src
|-- tmp
|-- usr
`-- var

Look familiar? Ought to: it's a duplicate of the system tree (mostly).

When I build software, be it SlackBuilds, non-SlackBuild source or whatever, it gets built in /usr/local/packages/src; e.g.,
Code:

tree -L 1 /usr/local/packages/src
/usr/local/packages/src
|-- Evergreen
|-- GMT
|-- KDevelop
|-- Misc
|-- Opensrf
|-- Python
|-- academic
|-- ap
|-- audio
|-- database
|-- development
|-- games
|-- gimp-help-2
|-- graphics
|-- hdf5
|-- hplip
|-- hplip-3.12.10a
|-- hplip-3.12.11
|-- hplip-3.13.2
|-- hplip-3.13.3
|-- hplip-3.13.4
|-- index.html
|-- java
|-- jdk
|-- jdk.old
|-- jre
|-- koha-3.10.03
|-- libraries
|-- lifelines
|-- multimedia
|-- netcdf
|-- network
|-- office
|-- openjava
|-- phoronix
|-- system
|-- xap
`-- zoom

Most of those directory names are the sections of SlackBuilds; e.g.,
Code:

tree -L 1 /usr/local/packages/src/libraries
/usr/local/packages/src/libraries
|-- FreeImage
|-- GConf
|-- GeoIP
|-- GraphicsMagick
|-- ORBit2
|-- atkmm
|-- atlas
|-- blas
|-- cairomm
|-- ctemplate
|-- eigen3
|-- exempi
|-- ftgl
|-- gdal
|-- geos
|-- gl2ps
|-- glibmm
|-- gsl
|-- gtkmm
|-- idzebra
|-- lapack
|-- libbonobo
|-- libdvdcss
|-- libdvdnav
|-- libevent
|-- libglademm
|-- libgnome
|-- libgsasl
|-- libircclient
|-- libmemcached
|-- libsigc++
|-- libtxc_dxtn
|-- libv4l
|-- muParser
|-- pangomm
|-- paramiko
|-- pexpect
|-- pycrypto
|-- reportlab
|-- rrdtool
|-- tbb
|-- tinyxml
|-- wxGTK
|-- wxPython
|-- xerces-c
|-- yaz
`-- yaz-4.1.2

For some reason, SlackBuilds seem to want to install in the root tree -- which I just flat do not like, I want locally-added software in the /usr/local tree (that's what it's there for) or, in the case of things like LibreOffice, in /opt (optional software). I tend to edit the SlackBuild files so that things do install in /usr/local (which is a pain in the butt to do most of the time). That keeps church and state separate and distinct.

I'm running four servers, two 64-bit and two 32-bit (the 32-bit boxes are data base servers, no window managers, administered with SSH from my main work station). There are all kept up to date with patches, there are all kept at Slackware stable; I don't do fiddling with kernel or any of that sort of thing; the patches are all kept in /usr/local/patches.

When a new release of Slackware comes along, it's really easy to do a clean install (takes about 20 minutes per box) -- because there is nothing in the root tree that is not on the distribution DVD (that's why the root can be 10 G -- you start adding stuff the root tree and you'll need 20 G).

As you step through the installation where you're adding file systems, you just format root but don't format any of the other partitions and you haven't lost everything that was there. 99-44/100% of the time, everything just works. You copy /etc off to, in my case, /spares and you get back in business real quick by merging the saved /etc with the newly installed /etc. I'm serious, 20 minutes from start to running server, configured the way I need it to be (and no recovering add-on stuff).

The virtual partition is where Win7 lives (I have to have it, so I hold my nose and keep it up to date every Patch Tuesday but otherwise it sits there unused). It's also where I play with Linux every now and again but not all that often. If you think about what a royal pain in the ass it is to install Win7 (then sit for house while it does a couple of hundred critical updates, you'll know why it's a separate partition).

Is there any problem with /usr/local? Nope, works just fine, already in your PATH environment, no problem. Over the long haul, you do not want to build stuff in your home directory and you do not want to run virtual machines from your home directory. Trust me on this, it'll byte you in the butt someday.

Works for me, might work for you.

Hope this helps some.

textillis 05-20-2013 11:08 AM

Hey Tron,
Thanks heaps for a thorough and engaging response.
I hope this attracts some divergent opinion.

It is wayyyy past where I'm at (if you look at my emended initial post you will understand why I say this) but I am determined to keep reading and doing and learning, so that, soon, the stuff you have offered will become a real matter of choice for me.

In the meantime, as i say, I hope the posts keep coming: I find it a fundamentally interesting question (it is almost tautological to observe: you know, like: laying in the foundations of a system or a structure; planting a tree; laying out lines of development; setting plumb and line for the first line of bricks and then building up the corners etc)

Cheers,
Tex


All times are GMT -5. The time now is 01:55 AM.