ive been wracking my brains out trying to figure out how to do this one thing I need and I cant seem to figure it out, so im asking in this post in case someone knows a solution. any help would greatly be appreciated.

ok heres what im trying to do. Im working on a script which is posted here:
http://bashscripts.org/viewtopic.php?t=268and it is supposed to install programs that the user requests to be installed. it works great, but only on the Dapper version of Ubuntu, Xubuntu and Kubuntu. I'm wanting to make this script work on Dapper and Edgy.

the idea is the only things different between the 2 versions that i need to worry with it the sources.list file. this file tells apt-get the repositories to look in to find software.

since the script uses apt-get a LOT this is the issue im having. the sources.list for dapper will not work with edgy and vice versa.

so, what i was thinking is to make the script ask the user are they using dapper or edgy. and if they answer dapper then it will copy the dapper sources.list and if they answer edgy then it will copy the edgy sources.list and continue.

i tried some variations of the read -P thing but im still not skilled enough to figure out how to do this. any help would be GREATLY appreciated.

and check the result of each for a non-empty string. This should tell you if you're using Dapper or Edgy (of course, that presumes that the text 'Dapper' and 'Edgy' are somewhere in the 1-line output of 'cat /proc/version'.

actually /proc/version doesn't say edgy or dapper in it.. just the version number... but he said he was running dapper so i'll give him the edgy (current) version number so he can use that instead
cat /proc/version
Linux version 2.6.17-10-386 (root@vernadsky) (gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)) #2 Fri Oct 13 18:41:40 UTC 2006 (Ubuntu 2.6.17-10.33-386)

but it seems to me if a user has edgy then they have the edgy sources.list and if they have dapper they have the dapper sources.list so why is it so important to know which they have if they already have their own sources.list... then again i haven't looked at your script so maybe you're trying to write the sources list for them

but on that note... you could grep their existing sources.list for either dapper or edgy and that would tell you which version they have and the script could go from there

Try checking in /etc for something that references Ubuntu's version......For example, Slackware has a file called slacksare-version with a single line in it: Slackware 11.0.0.............In Debian Sarge, the file is /etc/debian_version with only the version number: 3.1.........Most distros usually have a similar file in it for the purpose of identifying the version, so if you know what the different version numbers are for Dapper and Edgy, then you can grep that file in your script........

Okay, after a bit of checking, when Ubuntu first came out it had /etc/debian_version with testing/unstable in it but, like Debian, also had an /etc/issue with something like Ubuntu 5.04 "Hoary Hedgehog" n l...............Although there seems to have been a change by replacing debian_version with ubuntu_version.............Whether Ubuntu still has /etc/issue, you'll have to check for it 'cause I don't know.........

but it seems to me if a user has edgy then they have the edgy sources.list and if they have dapper they have the dapper sources.list so why is it so important to know which they have if they already have their own sources.list... then again i haven't looked at your script so maybe you're trying to write the sources list for them

well some of the applications that would be installed need repositories that the default ubuntu install doesnt have.

Quote:

Whether Ubuntu still has /etc/issue, you'll have to check for it 'cause I don't know.........

yes it does appear ubuntu (dapper at least) has a /etc/issueUbuntu 6.06.1 LTS \n \l is my results from cat /etc/issue

it does seem that looking at the /etc/apt/sources.list on the target machine would tell if its dapper or edgy, but that still leaves me with trying to figure out "how" to make the script figure it all out and copy the right sources.list for the version.

im still not familiar with grep or sed and still learning how to make bash scripts do what i need so excuse me if i sound like a total idiot with bash scripts, lol.

i tried this little snippet inside the script and it failed to work, to me it looked like it should work but it doesnt surprise me that it doesnt, lol.

so another option is to have the script check the version of ubuntu and copy the sources without user interaction. i do know the dapper sources.list has dapper inside it a lot and the edgy sources.list has edgy in it a lot.

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum