Sabtu, 10 Juli 2021

How to Dual Boot Fedora and Windows

Brief: This detailed tutorial shows you how to dual boot Fedora Linux with Windows 10, step-by-step, accompanied by proper screenshots.

Dual booting Linux and Windows is one of the popular ways to enjoy the full potential of the two operating systems. You have both Linux and Windows installed on the same system and you can choose which one to use after starting your system.

dual boot grub screen fedora windows
On the grub screen, you can select the operating system

If you have a system with Windows installed already, you’ll learn how to install Fedora alongside Windows in this tutorial.

Installing Fedora alongside Windows

fedora windows dual boot

The tutorial has been performed on a system with Windows already installed, GPT partitioning and UEFI boot. It should be applicable to other systems with MBR partitioning and legacy BIOS system as well, but I cannot confirm that.

Note: If your Windows system uses BitLocker encryption, it will be a good idea to disable it first before you go on installing Fedora.

Requirements

Here’s what you’ll need to follow this tutorial:

  • A system preinstalled with Windows
  • Good speed internet connection
  • A USB key (pen drive) with at least 4 GB in size
  • Optional: External USB disk for making back up of your existing data on Windows.
  • Optional: Windows recovery or bootable disk (if you encounter any major boot issues, you can fix with it).

Let’s see the steps.

Step 1: Make a backup of data on your Windows system [optional]

Backup is always a good idea. You will be dealing with the disk partitions. In the rare unfortunate case, if you make a mistake and delete the wrong partition, you’ll lose your data.

The simplest way would to be to copy the data in Documents, Videos, Music, Pictures and other folders to an external USB disk. You can use an external HDD (slower but cheaper) or SSD (faster but expensive) and copy the important files and folders on it.

Step 2: Make some free space for Fedora installation

You need to create a partition where you’ll be installing Fedora. If you just have C drive, shrink it. If you have D, E or F drive, see if you can move their data to some other partition and delete or shrink one of them. Anything above 40 GB should be comfortable enough space for Fedora.

In the Windows menu, search for ‘disk partitions’ and go to ‘Create and format hard disk partitions’.

disc management windows

In the Disk Management tool, right-click on the drive which you want to partition and select shrink volume.

If you have just one partition like this, you need to make some free space out of it for Linux. If you have several partitions of considerable size, use any of them except C drive because it may erase the data.

making free space for dual boot

Step 3: Making a live USB of Fedora in Windows

Now, this can be done in different ways. You can download the ISO and use Etcher or Rufus or some other tool to write the ISO image to the USB disk.

However, Fedora provides a dedicated tool for downloading and making live USB. I am going to use that in this tutorial. The Fedora team put some effort in creating this tool, so why not use it.

But first, plug in the USB key. Now, go to the download page of Fedora:

You’ll see the option to download the Fedora Media Writer tool for Windows.

download fedora media writer tool

It will download an exe file. Once downloaded, go to your downloads folder and double-click the FedoraMediaWriter exe file to install the Fedora Media Writer tool. Just keep on hitting next.

installing fedora media writer tool windows

Once installed, run the Fedora Media Writer tool. But before that, make sure that you have plugged in the USB.

It will give you the option to install various editions of Fedora. For desktops, go with Workstation.

Downloading and installing Fedora

On the next screen, you’ll get the option to create live USB. When you hit that button, it starts downloading the ISO. It will also recognize your inserted USB key.

You need to have a good speed internet connection to download the 2 GB of ISO in a comfortable time span.

Downloading Fedora with Fedora Media Writer

After downloading the ISO, it checks the download automatically and then gives you the option to write the ISO image to the USB disk, i.e. create the live USB. Hit the “Write to Disk” button.

writing fedora iso to usb with fedora media writer tool

It will take a couple of minutes to complete the process. It displays “Finished” message and you can close the Fedora Media Writer tool now.

fedoa live usb with fedora media writer

Good! So now you have the Fedora live USB ready with you. Time to use it for installing Fedora with Windows.

Step 4: Boot from live USB and install Fedora

Some systems do not allow you to boot from live USB with secure boot. If that’s the case with you, please disable secure boot.

At the screen that shows the logo of your system manufacturer, press the F2 or F10 or F12 key. You may try pressing all of them one by one if you are not sure of the key. But be quick when you do that otherwise it will boot into the operating system.

This key is different for different brand of computers. Some may even use Esc or Del keys for this purpose.

acer predator boot
Quickly press F2, F10 or F12 keys at the screen showing your system manufacturer’s logo

In some rare cases, you may have to access the UEFI boot settings from within Windows.

In the BIOS settings, normally, you should see a screen like this. Here, you use the arrow keys to move down to USB option and press enter to boot from the USB. Please note that the screen may look different in different systems.

select boot from live usb

If things go right, you should see a screen like below. Go with the first option “Start Fedora Workstation”:

fedora live screen

After some seconds, you should boot into the live Fedora session and see the option to try or install it. Go with “Install to Hard Drive”.

fedora install screen

It will ask to choose the language of choice for the installation process.

installing fedora Linux

The next screen is important. If you had created the free space in the step 2, you should be able to hit on the “Begin Installation”. If you see an exclamation mark on the disk icon under System, click on it and see what kind of disk configuration you can use here.

If you have more than one disk, you can choose which disk to use for Fedora.

Choosing the disk to install Fedora

Select the disk and click on Done. You may see a warning message now. In my case, I did not create free space in the step 2 and hence it complained that there is not enough free space to install Fedora.

Making free disk space to install Fedora

I clicked on reclaim space and shrank the Windows partition here.

Installing Fedora alongside Windows on the same disk by shrinking Windows partition

After this, the “Begin Installation” option appeared to start the installation.

Begin Fedora installation

Now it’s just a waiting game. It will take a few minutes to extract files and install them.

Installing Fedora

When the process completes, you’ll see the “Finish Installation” button. Hit it.

Finishing Fedora installation

You’ll be back to Fedora live session. Click the top right corner to bring down the menu and select Restart.

restart gnome fedora

When the system starts now, you should see the Grub bootloader screen with option to boot into Fedora and Windows.

dual boot grub screen fedora windows

Step 5: Complete Fedora setup

You are almost there. Did you notice that Fedora didn’t ask you to enter username and password? Many distributions like Ubuntu ask you to create an admin user during the installation itself. On the other hand, Fedora gives you this option when you log in to the installed system for the first time.

When you first log in, it runs a setup and creation of user and password is part of this initial setup.

Once you do that, you are ready to enjoy Fedora Linux.

fedora setup completed

That’s it. You can enjoy Fedora Linux and Windows in dual boot mode on the same system.

If you have any questions or if you are facing any issues while following this tutorial, please let me know in the comment system.



from It's FOSS https://ift.tt/3yIgnWF
via IFTTT

Rabu, 07 Juli 2021

ProtonVPN on Linux Review: An Open-Source VPN Service for Privacy Minded Users

ProtonVPN is a popular open-source VPN service available for Linux and other platforms that include Windows, Mac, iOS, and Android. You can also set it up for routers.

In fact, as far as I’m aware, ProtonVPN is one of the few VPN services for Linux that offer a GUI application.

I’ve been using it for a few years now, on and off. Now that it has a proper GUI app for Linux and the command-line tool is reliable enough, let me share some detailed insights on what you can expect from ProtonVPN.

ProtonVPN: Is it Just Another VPN Service?

protonvpn linux

While there are hundreds of VPN providers out there, often linked to common companies. ProtonVPN is a creation by the team behind ProtonMail.

The key highlights of the service include enhanced privacy, ad/tracker blocking capabilities, and open-source apps.

Also, they happen to own some of their servers while keeping them at secure locations, like an underground facility in Ireland.

So, among privacy-oriented VPN services, ProtonVPN deserves some attention, I think.

But, is it worth it? How good is it? Can you use it for free? What exactly does it offer you if you pay?

Before I dive into some details, let me highlight the features that it offers.

Key Highlights of ProtonVPN Service

While many of the features will be common to every other VPN of your choice, some are unique to ProtonVPN:

  • Strict no logs policy
  • All open-source apps and independently audited
  • Secure core servers
  • Adblocker
  • Website tracking protection
  • Forward Secrecy
  • Multiple protocols supported—IKEv2/IPSec, OpenVPN, L2TP, PPTP
  • Full disk encryption servers
  • Swiss-based
  • Tor over VPN support
  • Peer-to-Peer servers

To clarify some of the features:

  • NetShield lets you block advertisements and trackers when you visit websites in the DNS-level.
  • Secure Core server is another layer of protection (connecting any remote VPN server through a VPN server owned by ProtonVPN).

Both of these features are only accessible to paid subscribers.

Now that you know what you can expect from it, let us go through some of the details.

ProtonVPN User Interface & Features

ProtonVPN lets you use the command-line interface (CLI) or the GUI app on Linux. The application is user-friendly, so we’ll start with how useful it is.

protonvpn ui

As you can notice from the screenshot above, it is quite simple, with options to enable features like NetShield, Kill Switch, and Secure Core.

Unfortunately, you do not get a choice to tweak the protocol of your connection with the GUI app.

But, you can choose between TCP/UDP using the command-line interface.

However, it integrates with the system tray, giving you a way to quickly disconnect or connect when needed.

protonvpn system tray

In case you do not use the GUI but prefer the CLI, here’s how that looks:

protonvpn cli

No matter what you use, it will display the load (in percentage) for the server you want to choose.

In other words, the less load displayed, the faster the server can perform.

If you have a free plan, chances are that most of the servers are fully loaded with users and may perform poorly. With paid subscription, you can find more server options that have less load.

Here’s how it looks with the GUI:

protonvpn server load

And, this is what you can expect in the CLI:

protonvpn cli load

Now that we’re done with what the user interface offers, let me show you some of my speedtest results to give a reference to how well it performs.

ProtonVPN Performance

As I mentioned before, the free servers will have a significant impact on your Internet connection speed.

To expect the fastest performance, choose the nearest server and a server with less load.

For this test, I chose a “Plus” server from India with 13% load on a 100 Mbps connection with UDP protocol.

Here’s what my speed looks like while being connected to ProtonVPN:

protonvpn india

Of course, the ping is high: 179 ms, which could have been better, but you can try a variety of server locations to see if that improves for you.

The download speed recorded (83 Mbps) is not too bad, but with room for improvement.

However, the upload speed did take a big hit at 50 Mbps.

To give it another go, I tried a Singapore-based server with a similar load and, surprisingly, that performed better than my nearest location.

protonvpn singapore

And, with 86ms ping, 90 Mbps DL / 74 Mbps UL, it is certainly impressive and doable.

This also tells us that you need to try a number of server locations available to find your best fit for performance and privacy.

Undoubtedly, if you opt for Tor over VPN or Secure Core servers, it may have a significant hit on your Internet speed.

This is what I ended up with when choosing a Singapore-based Secure Core server:

300+ ms ping, 80 Mbps DL, and 53 Mbps UL.

It could have been worse, but I think that’s something that you can work with. And it should be comfortable enough to easily utilize torrent clients for Linux as well.

ProtonVPN Server Availability and IP/DNS Protection Test

You get a wide range of server locations from across the globe. And, if you opt for a paid plan, no matter whether it is the “Basic” or “Plus” subscription, you should easily be able to find several server options with minimal load.

I shall highlight the differences in the pricing plans next, but before that, let us test whether ProtonVPN manages to successfully hide the IP address and DNS while using it.

To do that, we’re going to use an effective and popular online tool —IPleak.net

protonvpn ip test

And that looks to be perfectly fine, which is a good thing. Previously (almost a year ago), I did encounter some servers that were leaking IPv6, but looks like that is not a problem anymore.

It is worth noting that ProtonVPN does not support IPv6 and blocks IPv6 traffic by default.

Additionally, you can also try using DNS leak test tool to see if it detects your ISP’s DNS. In my case, it was not leaking any DNS.

ProtonVPN Pricing Plans

ProtonVPN is on the expensive side of VPN services. However, with their transparency through open-source applications and some unique features, it is an attractive offering.

The basic plan starts at $48 per year or $5/month if billed monthly. It gives you access to basic servers, which comes with P2P support and NetShield feature.

It should be good enough for most, but it is limited to just two devices and has no streaming support.

The plus plan starts at $96 per year or $8/month if billed monthly. You get access to Secure Core servers, streaming support, Tor over VPN, and way more server location choices.

With the plus plan, you can actively use it on up to ten devices. Also, if you have a super-fast Internet (say between of 1-10Gbps), you may want to go for the Plus plan to get that kind of speed.

And the visionary plan is for users who just want all the features and support ProtonVPN in the process with extra funds. You will also get access to all ProtonMail paid features with this plan.

Installing and Using ProtonVPN on Linux

First, you need to sign up for ProtonVPN with a valid account. Once done, you need to download the DEB or RPM package available for the suitable distribution.

You should find the packages and the instructions to get it installed in their official FAQ page for Linux.

The GUI and the CLI are not separately available. You will need to install the packages to install ProtonVPN on your Linux machine. And, then choose to use the command-line interface or the GUI.

Using the GUI is easy and to get started with the CLI, all you have to do is type in:

protonvpn-cli connect

And, replace connect with disconnect in the command to drop the VPN connection.

If you are using the command-line, you must enable the NetShield feature and adblocker protection before connecting to the VPN. To do that, just type in:

protonvpn-cli netshield --ads-malware

If you just want to block malware, type in:

protonvpn-cli netshield --malware

Final Thoughts

If you want an enhanced level of privacy protection, transparency of the VPN service, and full-fledged Linux support, ProtonVPN is a fantastic choice.

However, the pricing plan may prove to be expensive if you want to use it on more than two devices compared to other VPN providers.

I think it is worth it if you regularly rely on a VPN connection to hide your IP address, use torrents, unblock geological restrictions, and more. And if you rarely use a VPN, you could look at some of the other VPN options available for Linux.

What do you think about ProtonVPN? Have you tried it yet? Let me know your thoughts in the comments down below.

The article contains affiliate links. Please read our affiliate policy.



from It's FOSS https://ift.tt/3yylGI7
via IFTTT

Selasa, 06 Juli 2021

How to Know if Your System Uses MBR or GPT Partitioning [on Windows and Linux]

Knowing the correct partitioning scheme of your disk could be crucial when you are installing Linux or any other operating system.

There are two popular partitioning schemes; the older MBR and the newer GPT. Most computers use GPT these days.

While creating the live or bootable USB, some tools (like Rufus) ask you the type of disk partitioning in use. If you choose GPT with an MBR disk, the bootable USB might not work.

In this tutorial, I’ll show various methods to check the disk partitioning scheme on Windows and Linux systems.

Check whether your system uses MBR or GPT on Windows systems

While there are several ways to check the disk partitioning scheme in Windows including command line ones, I’ll stick with the GUI methods.

Press the Windows button and search for ‘disk’ and then click on “Create and format disk partitions“.

disc management windows

In here, right-click on the disk for which you want to check the partitioning scheme. In the right-click context menu, select Properties.

Check disk partitioning scheme in Windows
Right click on the disk and select properties

In the Properties, go to Volumes tab and look for Partition style.

Check if disk uses MBR or GPT in Windows
In Volumes tab, look for Partition style

As you can see in the screenshot above, the disk is using GPT partitioning scheme. For some other systems, it could show MBR or MSDOS partitioning scheme.

Now you know how to check disk partitioning scheme in Windows. In the next section, you’ll learn to do the same in Linux.

Check whether your system uses MBR or GPT on Linux

There are several ways to check whether a disk uses MBR or GPT partitioning scheme in Linux as well. This includes commands and GUI tools.

Let me first show the command line method and then I’ll show a couple of GUI methods.

Check disk partitioning scheme in Linux command line

The command line method should work on all Linux distributions.

Open a terminal and use the following command with sudo:

sudo parted -l

The above command is actually a CLI-based partitioning manager in Linux. With the option -l, it lists the disks on your system along with the details about those disks. It includes partitioning scheme information.

In the output, look for the line starting with Partition Table:

check if mbr or gpt in linux

In the above screenshot, the disk has GPT partitioning scheme. For MBR, it would show msdos.

You learned the command line way. But if you are not comfortable with the terminal, you can use graphical tools as well.

Checking disk information with GNOME Disks tool

Ubuntu and many other GNOME-based distributions have a built-in graphical tool called Disks that lets you handle the disks in your system.

You can use the same tool for getting the partition type of the disk as well.

Check if MBR or GPT in Linux GUI

Checking disk information with Gparted graphical tool

If you don’t have the option to use GNOME Disks tool, no worries. There are other tools available.

One such popular tool is Gparted. You should find it in the repositories of most Linux distributions. If not installed already, install Gparted using your distribution’s software center or package manager.

In Gparted, select the disk and from the menu select View->Device Information. It will start showing the disk information in the bottom-left area and this information includes the partitioning scheme.

check disk partitioning scheme linux gparted

See, not too complicated, was it? Now you know multiple ways of figuring our whether the disks in your system use GPT or MBR partitioning scheme.

On the same note, I would also like to mention that sometimes disks also have a hybrid partitioning scheme. This is not common and most of the time it is either MBR or GPT.

Questions? Suggestions? Please leave a comment below.



from It's FOSS https://ift.tt/3jQQXlw
via IFTTT

Minggu, 04 Juli 2021

Element: A Cross-Platform Decentralized Open-Source Messaging App

There are many open-source messaging applications available, especially if you are looking for WhatsApp replacements on both desktop and mobile.

Element is one of them, which is a decentralized alternative for private messaging that you can use to interact with individuals, communities, or businesses.

Element: Privacy-Friendly Open-Source Messenger Built on Matrix Network

element io

Matrix is an open standard for secure and decentralized communication. And Element is the messaging client that uses that.

Element is also a part of the Matrix.org Foundation — so you will find most of the same team responsible for this.

Originally, it was known as Riot, which we covered back then. But, after the rebranding, it is now known as “Element”, which comes with an improved user experience and constantly focusing on making decentralized communication common for instant messaging.

element ui

Element is not just another open-source messenger, it gives you the ability to do a lot of things.

Here, let me highlight some of the key features along with some details about it that follows as you read on.

Features of Element

element settings

Element is more of an all-in-one messenger than a replacement of something. You could choose it as an open-source alternative to Slack or a private alternative to any instant messenger like Telegram.

Some of the options that you get with it are:

  • End-to-End encryption chat room
  • Public communities (may not be encrypted)
  • Direct voice call
  • Conference call in the community
  • Meet Jitsi integration (one of the open-source alternatives to Zoom)
  • File sharing
  • Emoji and Sticker support
  • Moderation tools for managing communities
  • Extensive anti-spam options
  • Ability to bridge other services like Slack, Discord, IRC, and more
  • Offers paid managed hosting to have control over your data
  • Cross-signed device verification for message privacy/security
  • Fine grained notification settings
  • Email notifications
  • Ability to restore using encryption keys
  • Make yourself discoverable to the entire Matrix network using your email or number

The features offered by Element may sound to be overwhelming for a user who just wants private messaging.

But fortunately, all those features do not get in the way unless you explicitly access/configure them. So that’s a good thing.

First, let me address the installation instructions for Linux and I’ll give you some insights on how my experience with Element was (on both Linux desktop and Android).

Installing Element in Linux

Element officially supports Debian/Ubuntu for installation. You can just add the package repository and install element.

The commands used for this is:

sudo apt install -y wget apt-transport-https

sudo wget -O /usr/share/keyrings/riot-im-archive-keyring.gpg https://packages.riot.im/debian/riot-im-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/riot-im-archive-keyring.gpg] https://packages.riot.im/debian/ default main" | sudo tee /etc/apt/sources.list.d/riot-im.list

sudo apt update

sudo apt install element-desktop

Do note that they are still using Riot.im domain to host packages even after rebranding — so not to be confused with the older Riot messaging app.

You can also find it in AUR for Arch-based distros — but I’m not quite sure about how well it works.

Unfortunately, there’s no Flatpak or Snap package available. So, if you are using a distribution that isn’t officially supported by Element, the best place to explore solutions/raise issues will be their GitHub page.

Now, before you get started using it, let me give you some heads up with my thoughts on it.

Element on Linux and Android: Here’s What You Need to Know

To start with — the user experience is fantastic on both Android and desktop. I tried it on Linux Mint, and it worked flawlessly.

You do not need a mobile number to sign up. Just create a username and add an email account to it, and you’re done.

element sign in

One can opt for a paid homeserver (your own matrix network) or just join the free Matrix homeserver offered.

Keep in mind, if you are signing up for free, you may not get to experience all the features — like the ability to see who’s online. You can only do that with your own server, the free Matrix server restricts certain functionalities like that to be able to accommodate an unlimited number of free users.

When signing in to a mobile device, you will have to verify the session by scanning a QR code prompted on Element’s desktop app.

Once done, you can explore and join public communities available or create your own.

Most of the existing public communities do not have end-to-end encryption enabled. So make sure you know what you are doing before messaging in any of the public communities.

While Element supports bridging IRC, Slack, and others or adding bots to a community — it is just not supported for an encrypted community. So, you need to have an unencrypted community to be able to use bots and bridges.

element bridge bots

A word of caution:

Element is getting popular, and scammers/spammers are attracted to the platform because it does not need any valuable personal information to get started.

So make sure that you do not trust anyone and keep your identity safe by not using your real profile picture or work email, especially if you are joining the public communities.

Element is constantly improving and offers plenty of features for several use-cases. I don’t see a problem with it being an open-source Discord replacement as well (in some way).

I was impressed with the level of notification controls that it gives and an added email notification option (which is enabled by default). You can choose to have notifications based on the keywords that you find interesting, what an exciting feature to have!

element notifications

Overall, Element may not be the perfect replacement for everything you use right now but it is shaping up to be an all-in-one alternative to many proprietary options.

I’ve had a good experience with Element so far and I’m confident about its future. What do you think? Willing to try Element on Linux?

Feel free to let me know your thoughts on this.



from It's FOSS https://ift.tt/3Avbzpi
via IFTTT

Kamis, 01 Juli 2021

Creating a PKGBUILD to Make Packages for Arch Linux

PKGBUILD files are how packages are built and created for Arch Linux and its derivatives such as Manjaro.

You may have even come across them a bit yourself if you’ve ever used the AUR, Arch Linux’s user-curated repository of PKGBUILDs.

But how exactly do you go from a PKGBUILD to an installable package? What exactly is going on between the two, and how can you make them for your own packages? You’ll learn them in this article.

PKGBUILD basics

For those who are familiar with Bash or other shells, you’ll be delighted to know, if you didn’t already, that a PKGBUILD is pretty much just a shell script with some variables.

PKGBUILD files consist of variables and functions, all of which are used to define the package itself, and how to build it.

To create a package from a PKGBUILD, the makepkg command line utility is used. After obtaining a PKGBUILD, you simply run makepkg inside the directory containing the PKGBUILD, and voila, you have an installable package!

PKGBUILD

In this tutorial, you’ll be going over the package I just made, which prints “Hello World!” when run:

PKGBUILD example

Getting set up

To follow along with this tutorial, you need to create a couple of files.

First, you need to make a file called PKGBUILD. If it wasn’t already made clear, this will serve as the “recipe” for building your package.

The other file you’ll need to make is a file called hello-world.sh. I’ll explain its purpose a bit later.

You can create both of these files with a single command as well.

touch PKGBUILD hello-world.sh

You can check that the files were created with the ls command:

PKGBUILD basic guide

And you’re ready to go!

Setting up your PKGBUILD file

Instead of having you copy paste the whole file, I’ll be going over entering every line with you, so you can better understand the purpose of everything that’s happening. If you don’t prefer to learn this way, I’d highly recommend the Arch Wiki article on creating packages for Arch Linux.

This article also doesn’t go over every single option you can set in a PKGBUILD, but rather some commonly used ones so you can get going as quickly as possible.

With that out of the way, open up your text editor, and let’s get straight into it!

pkgname

First things first, the pkgname variable. This is what defines the name of your package when installing, and how Arch Linux’s package manager pacman keeps track of the package.

The format of this variable (and some others) takes the form of variable=value, with the variable name on the left, the value of the variable on the right, separated by an equals sign.

To set the package name, enter the following into the PKGBUILD:

pkgname="hello-world"
  • To set a different package name, replace hello-world with the name of the package.
  • This doesn’t set the command used to run the program. That’s handled a bit below in the package() section.

pkgver

As is stated in the variable name itself, this sets the version of your package (i.e. 1.0.0). This is useful when a user updates their system, as setting a higher version will result in the user being prompted for an upgrade.

To set, enter the following into the PKGBUILD (after the previous line):

pkgver="1.0.0"

pkgrel

This is related to the pkgver variable, and isn’t normally important to know about. Like the pkgver variable though, it will notify users for upgrades if it’s moved to a higher number.

It serves for any changes that require the pkgver to remain the same, such as any changes to the PKGBUILD itself. This would be useful if you’ve created a PKGBUILD for a program you use (and want to keep the version the same as the package’s), and you need to fix a bug in the PKGBUILD itself.

To set the variable, enter the following in the PKGBUILD:

pkgver="1"

This variable should always start at 1, and then move up one at a time. When the pkgver itself moves up, this can (and should) be reset to 1, as the pkgver itself will notify users that upgrades are available.

pkgdesc

This will set the description of the package, which is used to help better identify the package.

To set it, just put the description inside of quotation marks:

pkgdesc="Hello world in your terminal!"

arch

This variable sets the architecture the package is compatible with. It’s fine if you don’t understand what an architecture is, as it’s pretty much useless in most cases.

Regardless, makepkg still needs it to be set so it knows the package is compatible with our system.

This variable supports setting multiple values, so makepkg requires a different syntax as shown below.

To set it, enter the following in the PKGBUILD:

arch=("x86_64")

If you were to set multiple values for this, you would separate each value with a space and quotation marks like so: arch=(“x86_x64” “arm”)

depends

This lists all of the packages that our package needs to function. Like arch, it can also contain multiple values, and thus must use the parenthesis syntax.

Since our package won’t have any dependencies, we don’t have to enter this field in the PKGBUILD. If our package did have dependencies however, we’d just use the same syntax as arch.

optdepends

This lists packages that aren’t required to function, but that are needed for extra functionality.

This follows the same syntax as depends.

conflicts

This tells pacman what packages would cause our package to act up or behave in a way we wouldn’t want.

Any package listed here would be uninstalled before ours is installed.

This follows the same syntax as depends as well.

license

This defines the software license that your program is licensed under. The Arch Wiki has some info if you need help choosing a license. Setting this to custom will work if you don’t know what to set this to.

This takes the same syntax as arch and depends:

license=("custom")

source

This is how makepkg knows what files to use to build our package. This can contain a variety of different kinds of sources, including local files and URLs.

When adding local files, enter the file’s name relative to the PKGBUILD i.e. consider the following directory layout:

PKGBUILD
file.txt
src/file.sh

If you wanted to include file.sh in our PKGBUILD, you would enter src/file.sh as its name.

When entering URLs, you simply enter the full URL, i.e. https://ift.tt/3w8YGOt.

Your package only needs the hello-world.sh file, and since it’s in the same directory as the PKGBUILD, you just type its name as the value for source.

This variable also uses the same syntax as arch and depends:

source=("hello-world.sh")

sha512sums

This is used to verify that the files in source haven’t been modified or downloaded incorrectly. Information on obtaining the values for this can be found in the Arch Wiki article on PKGBUILDs.

If you’d rather just not set this (or you just don’t need to, i.e. for local files), you can just enter SKIP for every file in the source variable:

sha512sums=("SKIP")

package()

This is the last, and most important part to actually making our package. It’s important to know two variables when working with this:

  • ${srcdir}: This is where makepkg puts the files in the source variable. This is the directory where you can interact with the files, and do any other needed modification to the files.
  • ${pkgdir}: This is where we place the files that will be installed on our system.
    The folder structure for ${pkgdir} is set up as if it was on an actual system (i.e. ${pkgdir}/usr/bin/hello-world would create the file /usr/bin/hello-world when installing with pacman.

package() contains a list of commands used create a package.

So, if (hypothetically) you needed to have a file that reads Linux is superior to Windows at /usr/share/motto.txt, you would run something like this:

package() {
  mkdir -p "${pkgdir}/usr/share"
  echo "Linux is superior to Windows" | tee "${pkgdir}/usr/share/motto.txt"
}

A few notes on the above command:

  • ${pkgdir} contains no directories inside it at first. If you skipped the mkdir command, tee would output an error saying the directory doesn’t exist.
  • When specifying directories, always prepend them with the ${pkgdir} or ${srcdir} variable. Entering something like /usr/share/motto.txt without such would point to the literal directory /usr/share/motto.txt on your currently running system.

For your PKGBUILD, you’re going to place the file hello-world.sh at /usr/bin/hello-world on your target system. You’ll also be making the file say “Hello to you!” when ran.

To do so, enter the following into your PKGBUILD:

package() {
  echo 'Hello to you!' > "${srcdir}/hello-world.sh"
  mkdir -p "${pkgdir}/usr/bin"
  cp "${srcdir}/hello-world.sh" "${pkgdir}/usr/bin/hello-world"
  chmod +x "${pkgdir}/usr/bin/hello-world"
}

And you’re done! Build and install the package with makepkg -si, and then run hello-world in your terminal to see its output.

image 1

Wrapping Up

And just like that, you have made your first PKGBUILD! You’re on your way to making actual packages for yourself, and maybe even the AUR.

Got any questions, or something just not working right? Feel free to post it in the comment section below.



from It's FOSS https://ift.tt/3hb6lY4
via IFTTT