Package Search
 
Members: 353 | Topics: 767 | Posts: 3211
We welcome our newest member: ClintBarton
Info
» You aren't logged in, login or registerOnline: No members and 21 guests | Time: 21:35
-bash-3.2$ instead my@my$
paldo Support Forum    Upkg    General Discussion
Reply Reply   Subscribe Topic Subscribe Topic
14 posts found.Page: 1 2
This topic contains previous posts. Back
 Re: -bash-3.2$ instead my@my$
Administrator
 
 
 
Posts: 426
Registered: 2004-09-09
Zitat
Original erstellt: 2007-06-23 08:37 von Amnon82
I almost used the same way as you:


You've removed the important step of copying the skeleton directory /etc/skel.

Zitat
And I can add this:

# copy bash settings
cp -a /root/mnt/$3/etc/skel /root/mnt/$3/home/$1


Yes, that would be fine but you have to put it on top of your script.

Zitat
cp -a $CHROOTDIR/etc/skel $CHROOTDIR/home/paldo

creates a folder skel in the homedir with the content in it but don't copy the content to the homedir.


That will only happen if $CHROOTDIR/home/paldo already exists; if it doesn't exist yet, it should work fine, else just copy the contents, i.e. cp -a $CHROOTDIR/etc/skel/* $CHROODIR/home/paldo/.
Profile   Private Message   Web
Created: 2007-06-23 09:00
Highlight selected Text   Edit   Delete   Quote Reply
 Re: -bash-3.2$ instead my@my$
Moderator
 
 
Linux-Dude
 
Posts: 1187
Registered: 2006-11-23
I just tested it on a local bash:

Code[In neuem Fenster öffnen]
[amnon@amnonspc:~]$ cp -a -v /etc/skel /home/amnon
`/etc/skel/.bash_profile' -> `/home/amnon/skel/.bash_profile'
`/etc/skel/.bashrc' -> `/home/amnon/skel/.bashrc'
[amnon@amnonspc:~]$ cp -a -v /etc/skel/.bash* /home/amnon
`/etc/skel/.bash_profile' -> `/home/amnon/.bash_profile'
`/etc/skel/.bashrc' -> `/home/amnon/.bashrc'


Seems it only works local on the same system.

Code[In neuem Fenster öffnen]
cp -a /root/mnt/$3/etc/skel/.bash* /root/mnt/$3/home/$1
should fix it on my 10_adduser.sh and

Code[In neuem Fenster öffnen]
<cmd>cp -a $CHROOTDIR/etc/skel/.bash* $CHROOTDIR/home/paldo</cmd>
should fix it during upkg-bootstrap.
Profile   Private Message   E-Mail
Created: 2007-06-23 09:04 | Modified: 2007-06-23 09:04 by Amnon82
Highlight selected Text   Edit   Delete   Quote Reply
 Re: -bash-3.2$ instead my@my$
Moderator
 
 
Linux-Dude
 
Posts: 1187
Registered: 2006-11-23
hmm you mean this way:

Code[In neuem Fenster öffnen]
sudo cp -a -v /etc/skel /home/newone
`/etc/skel' -> `/home/newone'
`/etc/skel/.bash_profile' -> `/home/newone/.bash_profile'
`/etc/skel/.bashrc' -> `/home/newone/.bashrc'


Code[In neuem Fenster öffnen]
#!/bin/bash
# expects <%username%> as $1 , <%userpw%> as $2 and <%TargetPart%> as $3
cp -a /root/mnt/$3/etc/skel /root/mnt/$3/home/$1
# copy paldo-chat to desktop
mkdir -p /root/mnt/$3/home/$1/Desktop
cp -a /root/mnt/$3/usr/share/applications/paldo-chat.desktop /root/mnt/$3/home/$1/Desktop
chown -R 1000:1000 /root/mnt/$3/home/$1
echo "$1:x:1000:1000::/home/$1:/bin/bash" >> /root/mnt/$3/etc/passwd
echo "$1:x:1000:" >> /root/mnt/$3/etc/group
sed -i -e 's/^wheel:.*/wheel:x:18:'$1'/' /root/mnt/$3/etc/group
sed -i -e 's/^audio:.*/audio:x:6:'$1'/' /root/mnt/$3/etc/group
sed -i -e 's/^cdrom:.*/cdrom:x:25:'$1'/' /root/mnt/$3/etc/group
echo "$1:$2" | chroot /root/mnt/$3 chpasswd --md5
Profile   Private Message   E-Mail
Created: 2007-06-23 09:18 | Modified: 2007-06-23 09:20 by Amnon82
Highlight selected Text   Edit   Delete   Quote Reply
 Re: -bash-3.2$ instead my@my$
Moderator
 
 
Linux-Dude
 
Posts: 1187
Registered: 2006-11-23
I found the bug in my script. Here is the fix:

Code[In neuem Fenster öffnen]
<!-- create livecd user paldo and let it autologin -->
<cmd>cp -a $CHROOTDIR/etc/skel $CHROOTDIR/home/paldo</cmd>
<!-- added by Amnon82 begin -->
<!-- copy installer desktop file to the tmp/desktop -->
<!-- new way for aufs copy files to /home/paldo instead of /etc/skel-->
<cmd>cp $CHROOTDIR/usr/share/applications/pinstaller.desktop $CHROOTDIR/home/paldo/Desktop/pinstaller.desktop</cmd>
<cmd>cp $CHROOTDIR/usr/share/applications/paldo-chat.desktop $CHROOTDIR/home/paldo/Desktop/paldo-chat.desktop</cmd>
<!-- added by Amnon82 end -->
<cmd>chown -R 1000:1000 $CHROOTDIR/home/paldo</cmd>
<cmd>echo "paldo:x:1000:1000::/home/paldo:/bin/bash" &gt;&gt; $CHROOTDIR/etc/passwd</cmd>
<cmd>echo "paldo:x:1000:" &gt;&gt; $CHROOTDIR/etc/group</cmd>
<cmd>sed -i -e 's/^wheel:.*/wheel:x:18:paldo/' $CHROOTDIR/etc/group</cmd>
<cmd>sed -i -e 's/^audio:.*/audio:x:6:paldo/' $CHROOTDIR/etc/group</cmd>
<cmd>sed -i -e 's/^video:.*/video:x:22:paldo/' $CHROOTDIR/etc/group</cmd>
<cmd>sed -i -e 's/^cdrom:.*/cdrom:x:25:paldo/' $CHROOTDIR/etc/group</cmd>
<cmd>sed -i -e 's/^disk:.*/disk:x:17:paldo/' $CHROOTDIR/etc/group</cmd><!-- add to disk group to allow gparted to run -->
<cmd>sed -i -e 's/^network:.*/network:x:23:paldo/' $CHROOTDIR/etc/group</cmd>
<cmd>echo "paldo:paldo" | chroot $CHROOTDIR chpasswd --md5</cmd>
Profile   Private Message   E-Mail
Created: 2007-06-23 09:35 | Modified: 2007-06-23 09:36 by Amnon82
Highlight selected Text   Edit   Delete   Quote Reply
Page: 1 2
Subscribe Topic Subscribe Topic
powered by bitron board 1.23a