# [Question]Making your very own "ports" system



## Samantha1996 (Aug 18, 2019)

Greetings.
I was a BSD user a long time ago, and I just came back to the squad this week. I knew BSD variants are easy to hack and this is what make them awesome! But I have a problem in the process of hacking.
I just changed the system name variable in `newvers.sh` file and it's not FreeBSD anymore. And when I try to make a port, it says there's a variable which doesn't match. I think the ports system checks output of `uname` and this is why it doesn't work.
What should I do now, to customize ports system?


----------



## shkhln (Aug 18, 2019)

A link to the same question on reddit for a bit more context: /r/BSD/comments/crjdbs/questionmaking_your_very_own_ports_system/.



Samantha1996 said:


> What should I do now, to customize ports system?



You should think rather hard about your goals.


----------



## Samantha1996 (Aug 18, 2019)

shkhln said:


> A link to the same question on reddit for a bit more context: /r/BSD/comments/crjdbs/questionmaking_your_very_own_ports_system/.
> 
> 
> 
> You should think rather hard about your goals.



Ok, I'm the same person who asked on reddit, but I thought forums can lead me to a better way of thinking. BTW, thanks for your reply.


----------



## ralphbsz (Aug 18, 2019)

Instead of making your own port system, back up one step: Why are you changing the system name? What is that supposed to accomplish? It seems from your description that right now it only has a negative side-effect (namely preventing you from using ports), and I don't see a positive benefit from it.


----------



## Samantha1996 (Aug 18, 2019)

ralphbsz said:


> Instead of making your own port system, back up one step: Why are you changing the system name? What is that supposed to accomplish? It seems from your description that right now it only has a negative side-effect (namely preventing you from using ports), and I don't see a positive benefit from it.



It's just experimenting with the operating system and nothing more. I'm currently doing it again, and I will tell you what the error exactly says.


----------



## tingo (Aug 18, 2019)

Samantha1996 said:


> What should I do now, to customize ports system?


You should (of course) find out where it (the ports system) breaks, and fix it so it works again. /usr/ports/Mk would be a place to start.


----------



## Samantha1996 (Aug 21, 2019)

tingo said:


> You should (of course) find out where it (the ports system) breaks, and fix it so it works again. /usr/ports/Mk would be a place to start.



Well, I did make a release and this is the result of "uname -v" : 

```
uname -v
# TestOS 1.0-RELEASE GENERIC
```

This is fine, but when I go to a port and start making it ("make clean install") it says something like somewhere in /usr/ports/Mk/bsd.port.mk , the variables OSVERSION (which I should change I think) and UNAME_r are not matching what they should actually be.


----------



## getopt (Aug 21, 2019)

The OP does not talk about the motivation and intentions behind his desire, which could be commercial or just evil. No word has been said on licenses.

Our support should not include the help for damaging, deceiving or fraud.


----------



## shkhln (Aug 21, 2019)

To me that looks like OP is trying to make a vanity fork of the OS. Not evil, just an extremely stupid idea. A good way to damage your reputation as well.


----------



## getopt (Aug 21, 2019)

shkhln said:


> Not evil, just extremely stupid idea.


Yeah! Mad or bad? That is the question.


----------



## Samantha1996 (Aug 21, 2019)

getopt said:


> The OP does not talk about the motivation and intentions behind his desire, which could be commercial or just evil. No word has been said on licenses.
> 
> Our support should not include the help for damaging, deceiving or fraud.



It's not fraud or damaging. It's just something in case of curiosity. Just experimenting with operating systems and how they work.


----------



## getopt (Aug 21, 2019)

Samantha1996 said:


> Just experimenting with operating systems and how they work.


If that is what you claim, then you should not shrink your fun and do your homework yourself.


----------



## SirDice (Aug 21, 2019)

Samantha1996 said:


> Just experimenting with operating systems and how they work.


There are better ways to achieve this, like reading "The Design and Implementation of the FreeBSD Operating System". You can probably get the first edition really cheap. The first edition covers older FreeBSD versions (up to version 5) but still contains a lot of interesting information.


----------



## badbrain (Aug 21, 2019)

So he going to create another MidnightBSD or DFBSD?


----------



## shkhln (Aug 21, 2019)

badbrain said:


> another MidnightBSD or DFBSD?



DragonFly BSD is a legit project. Nobody takes MidnightBSD seriously.


----------



## ralphbsz (Aug 21, 2019)

getopt said:


> Yeah! Mad or bad? That is the question.


Actually, there are many other options. I am going with "well intended, not knowledgeable, and silly".

Completely changing the name of the OS wil have very nasty side effects, in unexpected places. For example: there is lots of software that checks the name of the OS and adjusts behavior accordingly. One common place this happens is selecting where files are stored, like in Linux package configuration files are in /etc/ and binaries installed in /usr/bin, on FreeBSD this is /usr/local/etc and /usr/local/bin, and in AIX it's /etc/ and either /opt or /usr/lpp, and so on. All these tests will break on "TestOS". But if the OP is just on a voyage of discovery, and doesn't have an expectation that this will function correctly, it can be interesting to see what breaks: learn by destroying (and putting it back together).

But a warning: The copyright on *BSD requires that the system identify itself. Read the FreeBSD copyright notice sometime, and try to not violate it.


----------



## tingo (Aug 22, 2019)

Samantha1996 said:


> This is fine, but when I go to a port and start making it ("make clean install") it says something like somewhere in /usr/ports/Mk/bsd.port.mk , the variables OSVERSION (which I should change I think) and UNAME_r are not matching what they should actually be.


Then you have to identify how bsd.ports.mk creates or sets the value of OSVERSION and UNAME_r, and anything else that breaks. When you have, you need to change those places so the ports build system works with the values your OS generates.


----------

