Welcome
Welcome to refracta

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

some feedback on refracta2usb/installer

Refracta Development, Scripts, etc.

Re: some feedback on refracta2usb/installer

Postby dzz » Thu Feb 13, 2014 12:37 am

Thanks thwak, those links helped.

Code: Select all
# comment them all in locale.gen
sed -i '/^[a-z][a-z]_/s/^/# /' /CENSORED/locale.gen

# find the current active locale and uncomment it
CURRENT_LOCALE=$(cat /CENSORED/default/locale | grep -o "[a-z].*")
sed -i "0,/# $CURRENT_LOCALE/s/# $CURRENT_LOCALE/$CURRENT_LOCALE/" /CENSORED/locale.gen

Voila! The current active one only is now checked when dpkg-reconfigure locales is run. Works also in installer preinst script.

BTW a sid image rebuilt with the line for "user" removed from sudoers has sudo working with "components=sudo" (config=sudo in old live-config) on cmdline.
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: some feedback on refracta2usb/installer

Postby fsmithred » Thu Feb 13, 2014 1:13 pm

dzz wrote:
Code: Select all
# comment them all in locale.gen
sed -i '/^[a-z][a-z]_/s/^/# /' /CENSORED/locale.gen

# find the current active locale and uncomment it
CURRENT_LOCALE=$(cat /CENSORED/default/locale | grep -o "[a-z].*")
sed -i "0,/# $CURRENT_LOCALE/s/# $CURRENT_LOCALE/$CURRENT_LOCALE/" /CENSORED/locale.gen



That second part doesn't work for me. CURRENT_LOCALE gets part of the comment at the head of locale.gen along with the default locale. I get the following sed error:
Code: Select all
sed: -e expression #1, char 34: unterminated `s' command


The following does work for me.
Code: Select all
CURRENT_LOCALE=$(grep -v ^\# CENSORED/default/locale | cut -d= -f2)
sed -i "s/# $CURRENT_LOCALE/$CURRENT_LOCALE/" /CENSORED/locale.gen
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: some feedback on refracta2usb/installer

Postby dzz » Thu Feb 13, 2014 2:43 pm

That code to get $CURRENT_LOCALE likely didn't work for you because /***/default/locale looks like this:

Code: Select all
#  File generated by update-locale
#LANG=en_US.UTF-8

It does in official refracta7 (BTW no set default can cause other problems) and maybe in a debootstrap.

Code: Select all
cat /***/default/locale |grep -o "[a-z].*"
ile generated by update-locale
en_US.UTF-8

It works if you boot using "config-locales locales=whatever" because that file gets overwritten by live-config with no header. Therefore your way is more robust (the header, if exists, is excluded) Thanks for clarifying that.

However.. there could be duplicate entries in locale.gen, official refracta7 has. Maybe the duplicates came from package upgrades. My last sed line was done to get the first matching line only. I don't know what happens if two duplicate lines are uncommented.

This tangent really belongs in "experimental"..
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: some feedback on refracta2usb/installer

Postby fsmithred » Thu Feb 13, 2014 6:42 pm

I can tell you that the duplicate entries don't come from changing the default to a different locale and then changing it back. I went from us to gb and back to us, and only the current one was in default/locales.

Um, I thought there were problems with no default locale set and other problems when a default locale was set. Don't remember particulars, though. I've been running for awhile with no default and haven't had a problem. (Also pretty sure I was the one who had the problem when no default was set, but that was on a previous installation.)
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: some feedback on refracta2usb/installer

Postby dzz » Mon Feb 17, 2014 4:09 pm

Don't remember what happened with no default locale, might have been something in newer xfce. It will pop up again somewhere.

Saw this today in a live custom sid:
Code: Select all
# dpkg-divert --list

# (SNIP)

diversion of /usr/sbin/update-initramfs to /usr/sbin/update-initramfs.orig.initramfs-tools by live-tools

diversion of /usr/share/man/man8/update-initramfs.8.gz to /usr/share/man/man8/update-initramfs.orig.initramfs-tools.8.gz by live-tools

diversion of /usr/share/man/man1/uptime.1.gz to /usr/share/man/man1/uptime.orig.procps.1.gz by live-tools

diversion of /usr/bin/uptime to /usr/bin/uptime.orig.procps by live-tools

The installer should probably cleanly reverse those dpkg-diverts. They are still listed in my (wheezy) installed system.

EDIT
I noticed also, in one of my live-builds made from debootstrap, there was no /***/shadow. I haven't tried refractainstaller on that yet but would expect a problem. It is there in official Debian xfce image. To run "shadowconfig on" however does no harm if is already is.
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: some feedback on refracta2usb/installer

Postby fsmithred » Mon Feb 17, 2014 10:36 pm

It was wicd that wanted a default locale. I guess that's no longer a problem.
wicd-problem-t236.html

Guess I'll also need to do something about this bit of code, in case someone is using the installer on a system that does not have live-tools installed.
Code: Select all
# Run update-initramfs to include dm-mod if using encryption
if [[ $encrypt_os = yes ]] || [[ $encrypt_home = yes ]] ; then
    chroot /target /usr/sbin/update-initramfs.orig.initramfs-tools -u >> "$error_log"
fi
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: some feedback on refracta2usb/installer

Postby dzz » Tue Feb 18, 2014 12:51 am

My mistake.. seems live-tools does the diversions in the installed system then installs its own version (which automatically detects if it's a live running system or not) Therefore the diversions should be there. I'm still not clear what happens to (live) update-initramfs if live-tools is not installed.
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

Re: some feedback on refracta2usb/installer

Postby fsmithred » Tue Feb 18, 2014 10:46 am

I'm not clear on any of this. Here's what you get if live-tools is not installed. This is the same on an installation and in a snapshot iso (in sid).
Code: Select all
locate update-initramfs

(slash)etc/initramfs-tools/update-initramfs.conf
/usr/sbin/update-initramfs
/usr/share/man/man5/update-initramfs.conf.5.gz
/usr/share/man/man8/update-initramfs.8.gz
/var/lib/dpkg/triggers/update-initramfs


And this is with live-tools installed (in refracta 7). Here, /usr/sbin/update-initramfs is s symlink to /bin/live-update-initramfs.
Code: Select all
/bin/live-update-initramfs
(slash)etc/initramfs-tools/update-initramfs.conf
/usr/sbin/update-initramfs
/usr/sbin/update-initramfs.orig.initramfs-tools
/usr/share/man/ca/man8/live-update-initramfs.8.gz
/usr/share/man/de/man8/live-update-initramfs.8.gz
/usr/share/man/es/man8/live-update-initramfs.8.gz
/usr/share/man/fr/man8/live-update-initramfs.8.gz
/usr/share/man/man5/update-initramfs.conf.5.gz
/usr/share/man/man8/live-update-initramfs.8.gz
/usr/share/man/man8/update-initramfs.8.gz
/usr/share/man/man8/update-initramfs.orig.initramfs-tools.8.gz
/var/lib/dpkg/triggers/update-initramfs
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: some feedback on refracta2usb/installer

Postby fsmithred » Sun Feb 23, 2014 11:10 pm

Here's some code that's been in the installer since Dean's version(s). I don't think it's needed anymore. If it is, I need to understand how it relates to what live-tools does with update-initramfs. I'm going to comment out these lines.
Code: Select all
# copy the real update-initramfs back in place
if [[ -f /target/usr/sbin/update-initramfs.distrib ]] ; then
    cp /target/usr/sbin/update-initramfs.distrib /target/usr/sbin/update-initramfs
fi
if [[ -f /target/usr/sbin/update-initramfs.debian ]] ; then
    cp /target/usr/sbin/update-initramfs.debian /target/usr/sbin/update-initramfs
fi


And here's the replacement for the section I posted a couple of messages up. This should work whether or not live-tools is installed, but I haven't tested it yet.
Code: Select all
# Run update-initramfs to include dm-mod if using encryption
if [[ $encrypt_os = yes ]] || [[ $encrypt_home = yes ]] ; then
   if [[ -f /usr/sbin/update-initramfs.orig.initramfs-tools ]] ; then
      chroot /target /usr/sbin/update-initramfs.orig.initramfs-tools -u >> "$error_log"
   else
      chroot /target /usr/sbin/update-initramfs -u >> "$error_log"
   fi
fi
User avatar
fsmithred
 
Posts: 2101
Joined: Wed Mar 09, 2011 9:13 pm

Re: some feedback on refracta2usb/installer

Postby dzz » Mon Feb 24, 2014 12:36 am

Here's some code that's been in the installer since Dean's version(s). I don't think it's needed anymore

It reverses what live-config (/lib/live/config/)105-initramfs-tools in pre-wheezy does. I think it's deprecated now and live-tools does the job (stops update-initramfs on an RO filesystem) Little of this is documented to that level, we have to work it out for ourselves by reading those scripts and experimenting.

You probably should have live-tools installed (although I don't think it's a dependency of live-boot) It is in the official Debian xfce image.
dzz
 
Posts: 647
Joined: Wed Apr 27, 2011 11:53 am
Location: Devon, England

PreviousNext

Return to Discuss

Who is online

Users browsing this forum: No registered users and 0 guests

cron
suspicion-preferred