Difference between Terminal and script for install

More
21 May 2016 21:06 #74924 by jwsigler
I have been working on getting linuxcnc installed on my amd64 system so it works with the realtime kernel and will operate my mill, and I want to be able to use the alternative GUI's and possibly customize one of them to my own liking. I have tried lots of system configurations and finally settled on LinuxMint LMDE2 x64. I can get it to install along with the realtime kernel, LinuxCNC, and I can launch version of LinuxCNC with both Axis and Gmoccapy. I now want to install Glade3.8.5 so I have the ability to customize the control panels. I have identified the files and commands needed to perform the Glade3.8.5 installation, and I can do it by typing, or cut /pasting the commands into a terminal window. Since I spent a lot of time figuring how to compile and install Glade3.8.5 and what packages need to be installed first, I am trying to automate the process so I can post the instructions and a script file so others can benefit from my efforts and they can easily duplicate what I am doing. Attached is the script file I have come up with, which unfortunately does not work. I can take each and every line in the script file and cut/paste them into a terminal window set with 'su' and each line will execute with no problem, but the commands will not execute if I run the script file from terminal using sh GladeInstall.sh. Anyone have an idea what I am doing wrong with the script file? Attached is the script file (I had to add the .txt on the end so the forum will accept it as an attachment) as well as a copy of the terminal listing and the errors I get. Thanks.
Attachments:

Please Log in or Create an account to join the conversation.

More
21 May 2016 23:09 #74927 by tommylight
you have to add the link for downloading glade ( missing on your script ), and do an update before trying to install anything on a new installation.
I have attached the modified file so give it a try, i did not try it and let us know how it goes.
Regards,
Tom
Attachments:

Please Log in or Create an account to join the conversation.

More
22 May 2016 10:32 #74940 by cncbasher
did you make your script execuitable ? ( right cliick , properties )

Please Log in or Create an account to join the conversation.

More
22 May 2016 16:37 #74951 by jwsigler
Still can not get this to work. I tried copying the file tommylight sent, but it did not work and really, it did not address the problem I am having. As I stated in my original post, all the commands that I have in my script file will execute if I cut and paste them separately into a terminal window. Thus, the command of "tar -xvf glade3-3.8.5.tar.xz" listed in my script file will work if I cut and paste it into a terminal window which means that I already have the archive file in the proper folder and that my terminal window is set to the correct folder. Also, my command of "sudo apt-get install gnome-common" will work if I cut and paste it into a terminal window, but in the script it will not work. I had hoped that cncBasher's response was the solution since it did address the condition I am having, but after selecting "allow executing file as program" under properties, the script file still did not work.
Linux is totally new to me so this may be something really stupid that I am doing. I understand the principles of a script file and that it is similar to a bat file under dos. My terminal window is set to the proper directory because if I cut and paste the commands, like the "tar" command, it finds the archive file and it extracts the files. Does a script file automatically revert to some default folder other than the current folder a terminal window is using when it is executed in a terminal window? It should also be noted that when I took tommylight's suggested script file and attempted to run it by renaming it to LCNCRepsonse-01.sh" and then placing it in the proper folder and typing "sh LCNCRepsonse-01.sh" into the terminal window, none of the commands in it would work either. Why did that not work? I would have thought at least his script would have gone out and downloaded the file which his first command said to do? (yes I have internet access so it should have found the download). I even made a really simple script file with only one command in it of "sudo apt-get update", and it would not execute in terminal. the response was "Invalid operation update". None of this makes sense which is really frustrating to new users of Linux. I created these files in Linux's text editor, is that wrong? Is the text editor placing some un-seen characters into the file? The file type is listed under properties as "shell script (application/x-shellscript". There has got to be something really stupid I am doing or else it is simply a matter that Linux personally hates me.

Please Log in or Create an account to join the conversation.

More
22 May 2016 17:03 #74952 by cncbasher
make sure your user id is listed in /etc/sudoers with full rights
easy way to check is open su gedit /etc/sudoers in an editor find the entry for root and copy to the next line , and change 'root' to your login user name , and then logout and log back in ,

this problem is more to do with permissions , and depends if your using ubuntu or a debian install
ubuntu hide most of the permissions .

Please Log in or Create an account to join the conversation.

More
22 May 2016 23:13 #74958 by tommylight
I presume you are connected to internet while you are trying this, right?
Otherwise you get exactly what you have in your attached error file.
Regards

Please Log in or Create an account to join the conversation.

More
23 May 2016 05:02 - 23 May 2016 05:05 #74967 by jwsigler
Well I have still not solved this problem. I tried modifying the sudoer file by entering my username and duplicating the exact line that gave root sudo privileges. Re-booted the PC and no difference. Since I am running LinuxMint LMDE2, the system is Debian based. I also tried to eliminate all possible outside considerations such as connection to the internet by making a script file with the one command "cp test.txt test-02.txt". The file test.txt is in my top level user directory /home/john/, the terminal window was opened in "tree325 john" (tree325 is the computer's name) and when I tried to execute the script file in the terminal window, it would not work. If I cut and paste the cp command onto a command line in the terminal window and hit return, the command works and copies the file. When I opened the terminal window, the first thing I did was do a "su" to give the terminal window administrator privilege so maybe this is screwing things up. One thing I did notice is that when I cut/pasted the "cp test.txt test-02.txt" command into the terminal window and ran it, which it did run, execute, and copied the file; the new file was owned by root. This is probably a hint as to what I am doing wrong, but I do not know what this hint is telling me.

I can simply cut and paste each of the commands that I have in my original script file into a terminal window and that will allow me to compile and install the Glade files and be on my way. The only reason I am trying to set up this script file is so other new users can use it to duplicate what I did to get a working 64 Bit version of Linuxcnc on a modern AMD 64 computer with a functional version of Glade that will allow customizing of the various GUIs. I had thought this was going to be something easy to do to document my process, but linux is making this next to impossible.

I am giving up on this for a couple of days and taking my son riding out in the desert to clear my mind and unwind. If anyone knows what I am doing wrong, please let me know. It really should not be this hard.
Last edit: 23 May 2016 05:05 by jwsigler.

Please Log in or Create an account to join the conversation.

More
23 May 2016 09:30 #74970 by cncbasher
ok
the answer is in your description of what you saw 'root '
you are doing everything with su , and therefore using root priveledges and not your own id login
make sure the entry in sudoers is still there and otherwise saved .

login using your user id
and open a terminal to execuite a file make sure the permissions of that file allow execuitable .
then in the same terminal start the file using ./ ( this essentially says run the file ) so ./filename

do not use su

Please Log in or Create an account to join the conversation.

More
24 May 2016 11:54 #75033 by andypugh
You might want to add "#!/bin/bash" (without quotes) to the beginning of the file so that it gets run as a series of terminal commands.

Please Log in or Create an account to join the conversation.

Time to create page: 0.241 seconds
Powered by Kunena Forum