Error building a script for linux - linux

I'm trying to build a script for linux to help me each time I install linux from scratch.
The Script have to 1.- Add repositories 2.- Install software from those repositories.
Adding repositories are not the problem, the problem is when i try to install software from this repo.
For the Repo:
sudo add-apt-repository -y ppa:webupd8team/java
After that, the script should make an update, so:
sudo apt-get update
It looks simple, but is not, because I receive an error:
The command Update could not be found.
And so on the rest of the softwares
apt-get -y install oracle-java8-installer
The package oracle-java8-installer couldn't be found..
I really don't know what should I do, nothing looks to work, I gave full rigths to the file and so on... always the same error.
But if I run the command apt-get install direct from the terminal, works without problem..
Any help?

actually I wrote a script in windows to use it in future Linux installations, for some reasons it doesn't work as I want it. Thinking it was a command or misspelled words, I search for a solution, wich didn't help anyways.
Debugging my script in a virtual Machine, I found that the script was giving some random errors like '/r' doesn't support and like that. Really weird because after searching in my script for that line code I didn't find it.
With that in mind, I search again for those errors, and found that for some reasons, if you write your code in a Windows maschine, it save it in a crlf type, wich in a Linux system is interpreted really wrong.
A solution of some users was converting the type from CRLF to LF, wich in linux is using the command dos2unix.
dos2unix filename.sh
After making that and runing my script again everything works perfectly.

Related

How is possible that a not installed application still runs in Linux?

I am working with this software (rtabmap in Ubuntu 14.04 with ROS Indigo) and I was having some trouble with the installation. So I decided to remove eveything and uninstall it:
apt-get remove rtabmap
apt-get remove ros-indigo-rtabmap
cd rtabmap/build
make uninstall
And late I have removed the whole rtabmap folder.
So now I just run in the console rtabmap and it initiates, it even shows me other options like rtabmap-camera.
My question is, how is this even possible? And how can I locate the damm package in order to remove it?
Note: dpkg does not find it in any way.
So actually I found the answer myself. It turned out that the binary files of rtabmap where written in /usr/local/bin and there were 2 versions of rtabmap. This way the make was taking the incorrect version and was giving me weird errors.
I just removed the binary files and reinstall over eveything again and now it works.
Cheers

node.js help for creating a silent doorbell

I'm not a coder (just wanted to get that out there). I read an article about creating a silent doorbell (I have a dog that's insane).
https://github.com/initialstate/silent-doorbell/wiki/Part-2.-Finding-the-Button's-Address
I'm relatively computer literate. I followed the instructions for windows and download node.js. The instructions say to open a node.js command prompt and put in the following command:
sudo apt-get install npm
sudo apt-get install libpcap-dev
npm install node-dash-button
the problem i'm having is 1) I'm getting an error saying "apt-get" is not recognized as an internal or external command operable program or batch file.
Reiterating that I am no nowhere near as sophisticated as the users i've seen on here and am just a guy trying to keep the baby sleeping b/c the dog can't shut up - is anyone able to help so I can then go to the next step of instructions?
Thanks so much in advance.
Brad
sudo apt-get is a linux packet manage, so you wouldn't want to do this on windows. As they have mentioned raspberry-pi's I gather that they have made the assumption that you would be on linux.
If you ran that command in a linux terminal it would install the preqequisites and then install node-dash-button in node.
Try just running the nodejs packet manager part:
npm install node-dash-button
The rest of that line is not node or windows.
Hopefully this will get you to the next stage :)
The whole tutorial asumes you being on a Linux/Unix system.
If you solve this issue you will run into the next if you don't know what the commands mean and how to translate them to windows.
For example
sudo node bin/findbutton
is a linux/unix command as well (which is the next step in your tutorial).
So i strongly suggest setting up a VM with linux (debian should do).

/usr/bin/time: No such file or directory

I'm trying to run the time command for a file on a virtual machine running Fedora 19 64-bit and I get the message "/usr/bin/time: No such file or directory". I tried googling, but it appears it's something that I should already have. How do I get this on my computer?
For those on a raspberry pi or similar debian-based distributions, I found that I could install the package time (sudo apt install time) to obtain access to the time command.
Edit: For Fedora-based systems, the package name might be different. Try a dnf search time, followed by a sudo dnf install {package_name}. I don't have a Fedora machine immediately to hand to get the exact package name from.
bash/zsh/modern shells usually implement a basic time command as a builtin. So it won't exist on the filesystem, but time mycommand should work.
If you want the "proper" time command (with more options eg: -l/-v), then you'll need to install it via apt/yum/etc. You'll need to run it as /usr/bin/time mycommand so the shell-builtin doesn't get invoked.
It might be in other locations. I'd start by typing:
which time
This command will give you the path to time, if it's anywhere in your path.
If you need to build it yourself, you can get the source here:
http://directory.fsf.org/wiki/Time

Xampp on linux mint

im trying to install xampp on "new" linux mint machine.
However im quite a noob to linux since i havnt used it for that long.
When i try to run the file that ive download from the following page:
Xampp download
i get the following error two errors:
Could not display "/home/marc/Downloads/xampp-linux-x64-1.8.3-0-installer.run".
and if i click yes
Installing mime type handlers isn't supported
To search and install software which can open certain file types you have to install app-install-data.
can anyone tell me what the problem is and how i might fix it?
you need to execute the file (e.g. open a terminal, navigate to your Downloads folder and run bash xampp-linux-x64-1.8.3-0-installer.run (possibly it might need to be run otherwise, but thats my best guess)).
alternatively you might be presented to run/execute the file (instead of displaying it). if so, choose this option.
on the other hand, you might consider installing apache/php/mysql via your package manager.
what you can do is that you can use the chmod +x /your folder location/.run file that you want to install
after that you can run following command
./and your .run file name
example:-
in my case :- User#user~$su root
it will ask for password so give it
User#user~chmod +x /Downloads/xampp-linux-x64-1.8.3-0-installer.run
User#user~./xampp-linux-x64-1.8.3-0-installer.run

autoconf error on ubuntu 11.04

i've been googling and installing libraries for a while, but I couldn't quite handle this problem with autoconf.
i have downloaded a program that i want to compile, made a few changes, and need to run autogen.sh and ./configure and make install respectively.
however, when i try to run autogen.sh, i get the following error;
configure.ac:225: error: possibly undefined macro: AM_PATH_GTK_2_0
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
so i went on, downloaded autoconf-2.68, automake-1.11, m4-1.4.16, and tried sudo apt-get install libgtk2.0-dev, none of which changed the outcome. when i try aclocal, i again get the error
configure.ac:225: warning: macro `AM_PATH_GTK_2_0' not found in library
i'm currently stuck, and got nowhere to go. so i'd be glad for any suggestion.
I know it's a bit late, but you just have to install the library libgtk2.0-dev:
sudo apt-get install libgtk2.0-dev
If you get errors about something related to GLIB, then install libglib2.0-dev as well:
sudo apt-get install libglib2.0-dev
Given the name AM_PATH_GTK_2_0, one makes the following sequence of observations:
1) "AM_" is in automake's namespace, so that m4 macro must come from automake.
2) Hmmm, it isn't in automake.
3) It probably comes from gtk, so the gtk developer's have made an error in naming
their m4 macro in conflict with automake. That's a bug in gtk, but I'll probably need
to download the newest version of gtk to get the macro.
The problem is that you don't have the m4 macro that gtk expects you to have. You probably need to install libgtk-devel (or something like that). If I am correct and libgtk is indeed installing an m4 macro named AM_..., please report that as a bug to the developers. They are stomping on automakes' namespace (this is, unfortunately, an extremely common error.)
Since you mention downloading automake, I think the problem is that you are running aclocal that is not looking in /usr/share/aclocal, but in a different location (ie, you installed automake in /usr/local) When you installed libgtk-dev, it probably installed the *.m4 file in /usr/share/aclocal, but you need that file in /usr/local/share/aclocal (or $prefix/share/aclocal, where prefix is what you used to install automake.) The simplest solution is to copy that file to $(aclocal --print) That is, run "aclocal --print" to see where aclocal is looking for m4 files, then find the file that libgtk-dev installed that defines the improperly named m4 macro and copy that file to the appropriate location. Alternatively (and probably a better solution) you can put a file named dirlist in $(aclocal --print) that contains the single line "/usr/share/aclocal", so that your hand installed aclocal will always look for m4 files that are installed in /usr/share.
In case of same issue on CenOS/RedHat:
sudo yum install gtk2-devel

Resources