Author Topic: Attempting to make an install script  (Read 2024 times)

Offline Will Dojinn

  • Member
  • ***
  • Posts: 55
  • Karma: 1
  • Rocket Hamster!
    • View Profile
  • Peppermint version(s): Six and Seven
Attempting to make an install script
« on: March 22, 2016, 06:43:48 am »
Short of it is there are things I want to have that aren't installed by default, and because I have this terrible habit of distro hopping (yet always coming back here) I figure automate as much of the process as possible.

I've got the add-apt-repository bits chained together for the different PPAs to stuff I want, Update, Dist-Update, Autoremove, etc. However I have a few questions.

1. how do I enable the canonical partners thing from the commandline (for skype primarily but I suspect it would make installing other things simpler.)

2. At the end of the apt(add/update/install) chain is it sudo apt-get autoremove or sudo apt-get purge to clear out un-needed things?

3. I already have made my current install about as lean as i think I can by uninstalling stuff, so is there a list of what's installed on a stock peppermint install so I can go through and add a bunch of 'apt-get remove' to the list?

3b. How do you remove dropbox? 'remove' won't get rid of it, and I've double checked with the icon to see what the exec is so I'm pointing apt at the right thing.

4. I want a newer kernel than what the repositories give (I have noticed the 4.x kernels have better performance than the 3.x line.) Best way to do this? Also which kernel in the 4.x line works best with atom processors? I've heard 4.1 works better than 4.0, but 4.5 has a performance drop.

4b. While doing things like making directories, moving directories/files, and the like is there any way to have say /home/$currentuser/ instead of /home/USERNAME/? I ask because while the script works fine For Me as is given I use a consistent username across systems, I might want to use this to set up my nephew's machine with the basics.

5. Is there any way to have ICE work from the command line both in adding and removing things? Granted this would probably just pull the favicon, which is not ideal but would do til I get the proper icons I want together.

6. so long as I'm making a script to automate a lot of installation and first time setup things for my specific wants, is there anything else I should get it to do?

7. Is there a better way to do this?

Edit: Other things.

8. Can wget pull from a google drive? If so that'd be kinda nice since i could save all the icons I want to use there and just have the script pull from that just so even if I have to manually configure things that's one less thing i have to grab.

9. Is there any way to set up theme and icon set used from commandline? I know I can grab via wget and then make the proper .themes nd .icons directories but I don't know if there's a way to set either.

10. Similarly I want to be able to change the default font sizes, wallpaper, the panel size/applettes shown and such. Yes yes we're bordering on silly but if I'm going to have a one button script that I only need to be involved in to give it my password I might as well do it as far as humanly possible.

11. I'm willing to post said script in a form that's human readable instead of one gigantic commandline blob of text for review. The adding of ppa's, automated installers, and running a program I can do. It's the settings changing and the like I'm iffy on and will want a spare set of eyes double checking to make sure I'm not doing anything weird.
« Last Edit: March 22, 2016, 08:01:10 am by Will Dojinn »

Offline AndyInMokum

  • Global Moderator
  • Hero
  • *****
  • Posts: 4889
  • Karma: 1058
  • "Keep on Rockin' in the Free World"
    • View Profile
  • Peppermint version(s): PM 9 & PM 10 (64-bit)
Re: Attempting to make an install script
« Reply #1 on: March 22, 2016, 08:06:24 am »
Hi Will Dojinn, Why don't you just take an image of your disk with Clonezilla.  You can get the distro hopping urges out of your system and then flash the image back to your drive.  Run an update, upgrade and dist-upgrade and you're away to the races  ;).  To clean out redundant software run the autoremove command.
Backup! Backup! Backup! If you're missing any of these -  you ain't Backed Up!
For my system info please L/click HERE.

Offline Will Dojinn

  • Member
  • ***
  • Posts: 55
  • Karma: 1
  • Rocket Hamster!
    • View Profile
  • Peppermint version(s): Six and Seven
Re: Attempting to make an install script
« Reply #2 on: March 22, 2016, 08:30:13 am »
Well for One I don't have a spare drive laying around i can use to dump disk images to and two, this is a learning experiance for me since while proper programming leaves me @.@ maybe i can learn how to do bash scripts (and I can't just go with abstract examples to lear noff of else i lose interest, I need something that 'oh hey that's useful/neat/stupid but funny.)

Offline Slim.Fatz

  • Global Moderator
  • Veteran
  • *****
  • Posts: 2373
  • Karma: 623
  • Where's the mouse?
    • View Profile
  • Peppermint version(s): Peppermint 7, 8.5 & 10 - 64bit
Re: Attempting to make an install script
« Reply #3 on: March 22, 2016, 10:04:28 am »
Hi Will Dojinn,

Since you mentioned that you use Google Drive, then why not follow AndyInMokum's advice and use Clonezilla to take an image of your disk and put it on Google Drive:-\

As for learning how to program/write a bash script: after cloning your disk and saving it to Google Drive, start testing your bash scripting skills with your project. The best way to learn is by trying and doing it, not simply asking the experts and then copying what they tell you. The thinking that you will do while trying to get the script working is a much better way to learn programming (or just about anything, in fact).  ;)

If you totally bork your installation, you still have the cloned disk on Google Drive to get you back to where you started from.

Regards,

-- Slim
Respect science, respect nature, respect each other.

Tread lightly: Fluxbox, JWM, i3, Openbox, awesome

Offline Will Dojinn

  • Member
  • ***
  • Posts: 55
  • Karma: 1
  • Rocket Hamster!
    • View Profile
  • Peppermint version(s): Six and Seven
Re: Attempting to make an install script
« Reply #4 on: March 22, 2016, 10:24:38 am »
Is it really a better solution compared to install and run a script that grabs everything to install over clean instead of risking all the fluff that's gathered while I poke about learning?

More to the poitn. Why are you pressing 'clone drive' over what I want to do? Peppermint Seven is probably going to hit in a few months right? How does a clone drive help me there where what I'm asking for help on would just install everything overtop the new install.

I realize I can oft get stubborn and dig heels in when I want an answer to the thing I'm asking instead of 'here this way might be better' but the useage I have in mind isn't just for that one single machine so much as 'here, I can use this on my desktop because I'm thinking of swapping it over, and my nephew's machine if I can scavange him something together for his own use.' This is why one of the questions involved 'what variable can I put ot represent 'currently logged in user's home directory as opposed to the script assuming it's going in /home/ThisGuy/ for everything.

So if I'm coming off as short I apologize, but it seems you're pitching a solution twice over that does not entirely fit my needs or is future proof against new(er) OS versions or in case I want to try other ubuntu variants.

Offline Slim.Fatz

  • Global Moderator
  • Veteran
  • *****
  • Posts: 2373
  • Karma: 623
  • Where's the mouse?
    • View Profile
  • Peppermint version(s): Peppermint 7, 8.5 & 10 - 64bit
Re: Attempting to make an install script
« Reply #5 on: March 22, 2016, 01:41:45 pm »
Hi Will Dojinn,

Fine. I can be stubborn too. Especially when people reply like you just did. AndyInMokum and I have not attempted to brush you off.

Rather than reacting in a hostile tone, it might be a good idea to think about the time needed for others to answer all of your questions.

Good luck.

Regards,

-- Slim
Respect science, respect nature, respect each other.

Tread lightly: Fluxbox, JWM, i3, Openbox, awesome

Offline Will Dojinn

  • Member
  • ***
  • Posts: 55
  • Karma: 1
  • Rocket Hamster!
    • View Profile
  • Peppermint version(s): Six and Seven
Re: Attempting to make an install script
« Reply #6 on: March 22, 2016, 03:03:26 pm »
Pardon?

All I did was admit it might be me being stubborn rather than what you offered not fitting my needs, but it didn't look like what you were offering would fit my needs and I wanted clarification on how your way was better than my way.

So What advantages does making a backup image for a home user have when that disk image is for one computer out of at a maximum three, and the best case being the OS being imaged is going to getreplaced inside of a couple months.

I've always taken imaging/flashing as 'this does great if you have a whole horde of machiens that are nearenough identical.'
« Last Edit: March 22, 2016, 03:09:53 pm by Will Dojinn »

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Attempting to make an install script
« Reply #7 on: March 23, 2016, 05:53:07 pm »
1) how about:
Code: [Select]
echo "deb http://archive.canonical.com/ubuntu $(cat /etc/lsb-release | grep DISTRIB_CODENAME | sed 's/.*=//g') partner" | sudo tee -a /etc/apt/sources.listthough there will obviously be other (probably better) ways to do it .. and do NOT miss out the -a (append) after "sudo tee" or you'll destroy your sources.list .. in fact it would probably be best to create a backup first, so make that
Code: [Select]
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak && echo "deb http://archive.canonical.com/ubuntu $(cat /etc/lsb-release | grep DISTRIB_CODENAME | sed 's/.*=//g') partner" | sudo tee -a /etc/apt/sources.list(which will only add the line to your sources.list if the backup was successful.

WARNING - As I can't say what other distros will have in the "DISTRIB_CODENAME=" line of lsb-release, i cannot guarantee the above command(s) for anything other than Peppermint

Be aware, if your script is to be run as root (so you're not prompted for the root password), these commands will need modifying slightly .. I've just posted them as I tested them, and off the top of my head.

2)
Code: [Select]
sudo apt-get autoremovewill clear any orphaned dependencies .. but I wouldn't add it to a script that's not going to display what its going to remove before acceptance.

3)
No .. but you can always export the package markings yourself.

4)
Best way to do this would be to download/install the newer kernel directly from the Ubuntu mainline kernel PPA .. but again, I'd not automate it.
http://kernel.ubuntu.com/~kernel-ppa/mainline/

4b)
Code: [Select]
/home/$USERtest:
Code: [Select]
echo /home/$USER
5)
Not really .. you could always "echo" the correct contents that make up the .desktop files in
/home/$USER/.local/share/applications
but I can see no easy way to grab the favicons besides calling a python script

6)
Hey it's your script .. so you'll need to be the one to decide what you want it to do

7)
Yes .. MANUALLY .. scripting half of what you're talking about is risky, specially on an "unknown" like the next version of a distro  ..  not trying to be funny, but if you're asking these questions you're probably not ready to be automating these kinds of procedures yet .. but it's your system, and sometimes "the deep end" is the best way to learn, so good luck.

8.)
I'm not sure ..

9)
yes, they're controlled by the

sNet/ThemeName=Peppermix
sNet/IconThemeName=Peppermix

lines in
system wide = /etc/xdg/lxsession/Peppermint/desktop.conf
per user = /home/$USER/.config/lxsession/Peppermint/desktop.conf

10)
that's too many questions in one .. break it down into separate questions as that lot covers quite a few separate config files.

11)
Is there a question in there ? .. if you're asking anyone from the team to look it over you've chosen the worst possible moment .. we're too busy with PM7 ;)

BTW, see (7) above .. if you end up posting the script, I'd probably have to advise people not to use ;)
« Last Edit: March 24, 2016, 12:48:35 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline Will Dojinn

  • Member
  • ***
  • Posts: 55
  • Karma: 1
  • Rocket Hamster!
    • View Profile
  • Peppermint version(s): Six and Seven
Re: Attempting to make an install script
« Reply #8 on: March 24, 2016, 11:33:38 am »
Interesting and thank you. Going to have to poke about to see why the things you posted work the way they do, but always nice to have a 'correct' answer I can look at and pick apart why it's correct.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Attempting to make an install script
« Reply #9 on: March 24, 2016, 01:11:55 pm »
No worries :), but please remain civil with the other forum members they are only trying to help .. a LOT of first time users come here, so often it's 'right' to point them in a different direction rather than just answer their question, sometimes it takes a bit of 'back and forth' before the question itself, the goals, and skill levels are properly gauged and understood. ;)
« Last Edit: March 24, 2016, 01:13:30 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline Will Dojinn

  • Member
  • ***
  • Posts: 55
  • Karma: 1
  • Rocket Hamster!
    • View Profile
  • Peppermint version(s): Six and Seven
Re: Attempting to make an install script
« Reply #10 on: March 24, 2016, 01:32:05 pm »
Fair enough, and I did mention that what I'm asking might be a poor solution, but hearing why a thing is wrong instead of just 'no this is wrong. Do this instead' when I don't understand isn't helpful either.

Offline PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 26452
  • Karma: 65531
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 10
Re: Attempting to make an install script
« Reply #11 on: March 24, 2016, 02:13:13 pm »
I get it, I really do...

I have no doubt it's frustrating for a blind foreigner that gets helped across a road he didn't want to cross, but it would equally be frustrating for the boy scout if he got punched in the mouth for simply misjudging the guys needs and trying to help.

The issue is one of communication, not one that calls for anyone to get "shirty" ;)

Problem is it's my job to squash "shirtiness" here, and it's not something I enjoy doing .. so I'm just asking for everyone to play nicely and save me the bother :)
« Last Edit: March 24, 2016, 02:17:49 pm by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec