Using downloaded wget - wget

I downloaded the source code of wget using apt-get source wget. I want to modify it a little, then use this wget rather than the one I'm using in /usr/bin/wget. How can I do that?

apt-get source wget is retrieving your distribution's source code of wget.
You may want to work on the genuine upstream wget source, which you can get (with some wget or some browser) by following links from http://www.gnu.org/software/wget/
Then you configure, build and install - usually with ./configure; make; sudo make install but the details may vary from package to package. You should look into files named README and INSTALL
You could also be interested by libcurl
Notice that the GPL license requires more or less that you publish your patch (in source form) if you redistribute your patched version of your improved wget software binary

Related

take long time installing and updating packages by wget on arch linux

I don't know why, when im downloding or installing or updating package, download speed is very slow?
and take very long time!!!!
when im working in windows my download speed is 1M but in arch is changable ,is between 50k to 100k?
im using wget in pacman.conf
I use reflector but it had nothing changed and my package download speed is to slow.
can i create list from pacman update package and then download those from windows and again install all packages in Arch?
Please consider reading the documentation about pacman performance here.
You can manually force pacman to refresh the package lists (mirror list) with:
pacman -Syyu
To answer your question about downloading out of arch, the first part of the following will be with laverna which is a software I maintain on AUR, and the second part will be with a package in official repository.
AUR
Download
We have 2 solutions:
Use git
Download snapshot
Using Git
Clone in the current folder the repository with
git clone https://aur.archlinux.org/packages/laverna/ .
Using Snapshot
Just wget the snapshot or download directly with the browser.
wget https://aur.archlinux.org/cgit/aur.git/snapshot/laverna.tar.gz
Official Repositories
You can easily get a download link the package web page.
For example with sqlite-doc the web page link is here and the download link (from a mirror) is here.
Back to Arch
Then back to arch, we have to build and install packages. To do so we navigate to the folder where you cloned/downloaded the package (cf. cd) then execute the following to build.
(Only if packageName-version.pkg.tar.xz doesn't exist)
makepkg
Finally, after makepkg you obtain a file in the current directory which is in our AUR example laverna-0.7.4-RC1-linux-x64.pkg.tar.xz.
To install the packageName-version.pkg.tar.xz file we just have to execute the following and answer the questions as usually.
sudo pacman -U laverna-0.7.4-RC1-linux-x64.pkg.tar.xz
Check out your network settings,ip dns route... sometimes this will solve download speed problem.
Find the fastest mirror.
$ cd /etc/pacman.d/
$ cp mirrorlist mirrorlist.bak
$ rankmirrors -n 6 mirrorlist.bak > mirrorlist
Check mirrors status https://www.archlinux.org/mirrors/status/.
You can see more from Archwiki Mirrors.
Hope this helps.

Install a package to a docker container (managed by dokku)

I have a hard time understanding where is the right place to place a code that will install the needed packages for the given docker container managed by dokku.
We have a scala application and, unfortunately, we need to have one shell call that is dependent on an environment. I would like to install the given package for the given container using "apt-get install". Right now I am using a custom plugin with a file named "post-release-build". However, I don't have the permission to install anything in that phase.
Basically, my script that should be invoked looks like this (based on a dockerfile that is available online):
apt-get update
apt-get install -y build-essential xorg libssl-dev libxrender-dev wget gdebi
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
gdebi --n wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
echo "-----> wkhtmltox installed!"
Is there a way how to make it work? I would also prefer to have such a file somewhere in the application so I don't need to setup environment before pushing the app (in the future).
EDIT:
I have found a plugin that should be capable of installing packages using apt-get (https://github.com/F4-Group/dokku-apt) however, I am a little bit unlucky because it downloads a package that is not working properly.
Since just downloading with apt-get will download a package that fails, I investigated deeper into dokku and came out with a new plugin that should install the package for you.
I have created a script, documented how to use it and licenced it over MIT license so feel free to use it. Hopefully it will save you the time I had to spend realizing what is going on.
URL: https://github.com/mbriskar/dokku-wkhtmltopdf

How to download, compile & install ONLY the libpq source on a server that DOES NOT have PostgreSQL installed

How can I download, compile, make & install ONLY the libpq source on a server (Ubuntu) that DOES NOT have PostgreSQL installed?
I have found the libpq source here. However it does NOT seem to be separable from the entire PostgreSQL. Thanks in advance.
I DO NOT want to install the entire PostgreSQL. I want to use libpq as a C interface to PostgreSQL on a DIFFERENT server (also Ubuntu) that DOES have it installed.
I also found this old link which indicates that the above is POSSIBLE but not HOW to do it.
I have found the libpq source here. However it does NOT seem to be separable from the entire PostgreSQL.
It has to be configured with the entire source tree because that's what generates the necessary Makefile parts. But once configured, make && make install can run inside the src/interfaces/libpq directory alone, and the rest being left out completely.
In steps:
download the source code archive, for example https://ftp.postgresql.org/pub/source/v9.4.1/postgresql-9.4.1.tar.bz2
unpack into a build directory: tar xjf ~/Downloads/postgresql-9.4.1.tar.bz2
apt-get install libssl-dev if it's not installed already
cd into it and configure: cd postgresql-9.4.1; ./configure --with-openssl --without-readline
Assuming configure succeeds, cd into src/interfaces/libpq and run make
still in the libpq directory, run make install as root: sudo make install.
That will install into /usr/local/pgsql and subdirectories as a library independent and insulated from the one packaged in Ubuntu if it happens to be installed. To install it elsewhere, specify the location with the --prefix option to configure.
Besides downloading and configuration, the steps are:
cd src/interfaces/libpq; make; make install; cd -
cd src/bin/pg_config; make install; cd -
cd src/backend; make generated-headers; cd -
cd src/include; make install; cd -
These steps will give you the library and headers of libpq, and a binary called pg_config, and all postgresql backend headers, so that you could compile things like libpqxx correctly.
(I've just tested with postgresql-9.6.5.)

wget :: rename downloaded files and only download if newer

I am trying to use wget to download a file under a different local name and only download if the file on the server is newer.
What I thought I could do was use the -O option of wget so as to be able to choose the name of the downloaded file, as in:
wget http://example.com/weird-name -O local-name
and combine that with the -N option that doesn't download anything except if the timestamp is newer on the server. For reasons explained in the comments below, wget refuses to combine both flags:
WARNING: timestamping does nothing in combination with -O. See the manual
for details.
Any ideas on succinct work-arounds ?
Download it, then create a link
wget -N example.com/weird-name
ln weird-name local-name
After that you can run wget -N and it will work as expected:
Only download if newer
If a new file is downloaded it will be accessible from either name, without
costing you extra drive space
If using other tool is possible in your case, I recommend the free, open source lwp-mirror:
lwp-mirror [-options] <url> <file>
It works just as you wish, with no workarounds.
This command is provided by the libwww-perl package on Ubuntu and Debian among other places.
Note that lwp-mirror doesn't support all of wget's other features. For example, it doesn't allow you to set a User Agent for the request like wget does.

How to build gstreamer ugly plugins from source

I would like to change some code in one element X in gstreamer ugly plugin and rebuild and use it.
How I can do it?
I have gstreamer-0.10 and installed gstreamer-ugly plugin.
I would like to download only gstreamer0-10 ugly plugin code and change it and would like to use the new lib file. How I can do it?
unfortunately gstreamer-ugly depends on a lot of stuff in at least libgstreamer and plugins-base (if you're using linux and your distro provides *-dev packages as debian/ubuntu does).
If you're on debian you could use dpkg-buildpackage after checking out the source using apt-source. The big advantage here is that all the build dependencies can be easily installed.
The manual way will probably need you to first build all the other gstreamer packages have a close look on what ./configure tells you
I'm workin on debian and have already built gstreamer+plugins to backport the recent ones to ubuntu (although I'm not sure if I did it in a best-practice way ;) )
/edit: I'll try to cover the basic steps for ubuntu here:
add the source repositories to apt (check the "source code" checkbox in the ubuntu software center's "software sources" tool
sudo apt-get install dpkg-dev devscripts
sudo apt-get build-dep gst-plugins-ugly0.10
apt-get source gst-plugins-ugly0.10
change to the newly created gst-plugins-base* folder
dpkg-buildpackage (and make sure it works)
change the source to your needs
you can rebuild it any time using dpkg-buildpackage (to simply see if it compiles make might be faster though). This creates a .deb file in the parent folder that you can simply install using dpkg -i
If it's a useful change you might want to get in touch with the gstreamer-devs ;)
On a debian system, run apt-get build-dep gstreamer0.10-plugins-ugly to get all the build dependencies for that package. After that you can build the package from git, source tarball or even rebuild the debian package (using dkgp-buildpackage).