[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Alias setup through preseed in Wheezy



On Thu, 23 Jan 2014, Todd Maurice wrote:

> 1.
My username is "user" and hand-editing works fine but I want the preseed to
do the work for me.

> 2.
I wasn't clear here. I don't want to invoke the script directly. I want for
the script (or alias which then run the script) to start without any user
input at all. User logs on, script starts. No typing.

Like you have "Start softwareX when Windows starts" option in that OS.

So maybe what you want to do is to have preseed write the script and then have .profile run it automatically when you log in. Since the name of the script wouldn't change (just the contents), the contents of $HOME/.bashrc would be constant.

--------------------------|
John L. Ries              |
Salford Systems           |
Phone: (619)543-8880 x107 |
or     (435)867-8885      |
--------------------------|


> Date: Thu, 23 Jan 2014 11:13:46 -0700
> From: jries@salford-systems.com
> To: debian-user@lists.debian.org
> Subject: Re: Alias setup through preseed in Wheezy
>
> On Thu, 23 Jan 2014, Todd Maurice wrote:
>
> > 1.
> > I would like to set d-i preseed/late_command in such way that a line
> > containing alias instructions would get added to ~/.bashrc. That way
alias
> > would be active when I first login after the installation (typing
'myalias'
> > would start script1).
> >
> >
> > I tried
> > d-i preseed/late_command string in-target echo "alias myalias='sh
> > ./script1'" >> /home/user/.bashrc
> >
> > but it failed with "Exit code 1"
> >
> >
> > I tried
> > d-i preseed/late_command string in-target sed -i '1i alias myalias='sh
> > ./script1'' /home/user/.bashrc
> >
> > but it failed with "Exit code 2"
> >
> > I suspect that one of the attempts failed due some sort of syntax error.
> >
> >
> Unless your username is "user", it looks like you're going to have a
> problem writing to a file in a non-existent directory. On the whole I
> think you'd be better off hand-editing $HOME/.bashrc in your favorite text
> editor. It's only one line of code and you get to verify that it was
> entered correctly.
>
> I'm not a bash user (ksh has long been my usual shell), but the line will
> look something like:
>
> alias myalias="sh ./script1"
>
> > 2.
> > Is there a way to make that alias run automatically when the user logs
in?
> > With "run automatically" I mean that alias would execute script1 as soon
as
> > the user logs on without requiring the user to type 'myalias'.
> >
> You simply invoke the script in your $HOME/.profile, like so:
>
> #We can't assume the script is in the current directory
> #The source command executes the commands contained in the script without
> #spawning a new process
> source $HOME/script1
>
>
>
> --------------------------|
> John L. Ries |
> Salford Systems |
> Phone: (619)543-8880 x107 |
> or (435)867-8885 |
> --------------------------|
>
>
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org
> Archive:http://lists.debian.org/alpine.LSU.2.11.1401231103120.12032@falcor.salford.
riesenhaus.local
>




Reply to: