Refracta Development, Scripts, etc.
Post a reply
dzz

- dzz
- Posts: 647
- Joined: Wed Apr 27, 2011 11:53 am
- Location: Devon, England

## Re: New versions of installer and snapshot (9.1.x) for sid

Fri Jun 06, 2014 10:04 pm

> Installer has no_format and snapshot has nocopy. (no_copy is in the setup options in the gui script and is the -n command-line option in the cli script.) Is that what you mean?

Installer's "noformat" option is for when a partition is already prepared and formatted.. if files already exist in the target, rsync options "--delete-before --delete-excluded" are needed. Although it's not recommended to use other than a clean partition it's possible and very fast.. e.g. loading a newer sid image. This is what I have used in my experimental installer (note how it handles lost+found):

Code:
  `# copy everything over except the things listed in the exclude list
  rsync -av / /target/ --filter='P lost+found' --filter='H lost+found' --exclude-from="$rsync_excludes" ${sep_home_opt} ${sep_boot_opt} --delete-before --delete-excluded | \
  tee >(yad --progress --pulsate --width=350 --auto-close --title=$"Copying system to new partition.")`

> What's needed for TDE R14?

It's (not many lines) again in my most recent experimental installer and works for all TDE versions.

> Is this an example of making it more hackable

Yes.. but remember the point is ability to customise cleanly, preferably without needing to "hack" anything.
fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: New versions of installer and snapshot (9.1.x) for sid

Mon Jul 07, 2014 10:52 am

Did some work on the installer yesterday. Took refractainstaller-yad from the +dzz3 package and added a couple things to it. The diff is below. Main changes are in root_ssh setting and check_exit function. Debug is off, but can be invoked on command line (for a single run) or in the config file (for every run).
Also added the better handling of sudo along with change user and password to the cli installer. That script is posted here - https://gist.github.com/fsmithred/68b2326bcae54c4e0641 Only minimal testing has been done on this one. (Three or four installs to single partition eliminated a few bugs.)
Shouldn't the rsync filters and deletes be added to the rsync commands for separate /home and /boot?

Code:
  `--- ../Desktop/refractainstaller-yad_9.1.0+dzz3 2014-06-21 08:14:48.000000000 -0400
  +++ ../refractainstaller-gui-9.1.1/refractainstaller-yad 2014-07-06 23:20:41.371714773 -0400
  @@ -71,10 +71,6 @@
  # Record errors in a logfile.
  exec 2>"$error_log"
  -if [ "$debug" = "yes" ] || [ "$DEBUG" = "yes" ]; then
  -set -x
  -fi
  -
  # greeter window title
  if [ -z "$window_title" ]; then
  window_title="$version"
  @@ -121,6 +117,9 @@
  esac
  done
  +if [ "$debug" = "yes" ] || [ "$DEBUG" = "yes" ]; then
  + set -x
  +fi
  # Check that xserver is running and user is root.
  [[ $DISPLAY ]] || { echo $"There is no xserver running. Exiting..." ; exit 1 ; }
  @@ -206,9 +205,10 @@
  # function to exit the script if there are errors
  check_exit () {
  -if [[ $? -ne 0 ]] ; then
  +exit_code="$?"
  +if [[ $exit_code -ne 0 ]] ; then
  yad --question --title=$"Error" --window-icon=error --button=$"Continue":0 --button=$"Exit now":1 \
  - --text=$"Error detected: $? $error_message
  + --text=$"Error detected: $exit_code $error_message
  \nSee $error_log for details. \n\nThis may not be fatal.. Press \"Continue\" to proceed anyway"
  if [[ $? -ne 0 ]] ; then
  @@ -1324,6 +1324,9 @@
  if [[ -f /***etc***/ssh/sshd_config ]] ; then
  if [[ $root_ssh = "no" ]] ; then
  sed -i~ 's/PermitRootLogin yes/PermitRootLogin no/' /target/***etc***/ssh/sshd_config
  + elif [[ $root_ssh = "auth" ]] ; then
  + sed -i~ 's/PermitRootLogin yes/PermitRootLogin without-password/' /target/***etc***/ssh/sshd_config
  + sed -i~ 's/PermitRootLogin no/PermitRootLogin without-password/' /target/***etc***/ssh/sshd_config
  fi
  fi
  @@ -1524,7 +1527,7 @@
  fi
  fi
  -if [ $sudo_is_default != "TRUE" ]; then
  +if [ "$sudo_is_default" != "TRUE" ]; then
  # files that may have been written by live-config to force live sudo mode
  `

Almost forgot this - configfile diffs:

Code:
  `--- /***etc***/refractainstaller.conf 2013-12-06 08:44:19.000000000 -0500
  +++ /refractainstaller-base-9.1.1/refractainstaller.conf 2014-07-06 12:01:03.748363128 -0400
  @@ -8,6 +8,13 @@
  +# Uncomment this if you want to *always* run in debug mode. Otherwise,
  +# run the installer with the -d/--debug option to debug a single run.
  +
  +#DEBUG="yes"
  +
  +
  +
  # Run all executable pre-instal or post-install scripts found in
  # /usr/lib/refractainstaller/pre-install and
  # /usr/lib/refractainstaller/post-install
  @@ -72,7 +79,13 @@
  # Sets PermitRootLogin to "no" in /***etc***/ssh/sshd_config to disallow
  -# root login through ssh.
  +# root login through ssh with password. New default requires key
  +# authentication for root login.
  +#
  +# If root_ssh="no" then PermitRootLogin will be changed from "yes" to "no".
  +# If root_ssh="auth" then PermitRootLogin will be changed from either
  +# "yes" or "no" to "without-password" which is the new debian default.
  +# Note: setting it to "yes" will do nothing.
  -root_ssh="no"
  +root_ssh="auth"
  `

dzz

- dzz
- Posts: 647
- Joined: Wed Apr 27, 2011 11:53 am
- Location: Devon, England

## Re: New versions of installer and snapshot (9.1.x) for sid

Tue Jul 08, 2014 1:56 am

Copying and pasting the (yad) patch in the code box into a text editor (geany and kwrite-trinity) came out with 3-space indent and caused errors when applying. Code boxes are known for copy/paste problems. Anyway, I edited manually then did another diff to be sure the changes were the same as you intended.
Tested here with a current sid XFCE ISO, booted from HD with grub-pc, installed to a single partition, debug log enabled in config file. A few non-critical gripes in the log, otherwise a flawless install.

> Shouldn't the rsync filters and deletes be added to the rsync commands for separate /home and /boot?

Two reasons for those rsync options for / : (1) sort lost+found cleanly (2) a (not normally recommended) possibility to install without format to a partition containing existing files. As is, everything will be deleted (except lost+ found) in the rsync "target" which does not exist in the "source". If that's desirable for an existing /home or /boot is difficult to say as I don't use them at all.
Did you notice this bit I added to the conf file? This allows to change window title and add some custom text in the yad installer, without script-hacking (the code to process it is already in the yad script and works):

Code:
  `#### additional custom option examples:
  #### the greeter window title can be customized
  #### and/or the window text appended:
  # window_title=" Your custom title "
  # custom_text=" Your custom text. \n Next line. "`

Good work on the cli installer (but not yet tested here).. that is important to keep for those who do not run yad, zenity or maybe no GUI at all. I keep a minimal "service" install with no GUI containing the main bootloader and other things like weasel and mail profiles.
fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: New versions of installer and snapshot (9.1.x) for sid

Tue Jul 08, 2014 3:14 am

I saw the window title bit, but I thought it was in the script. I only got a -gui package, so I didn't see your config file. Ah, ok, I just looked in the script, where it sets window_title to the version if it's an empty var. I'll add the lines to the config file.
If /home or /boot is on a separate partition, it'll have its own lost+found, so I guess they should be saved. (I've been deleting mine on /home for the past few years and haven't had any problems, but maybe that's not such a good idea.) You're the only one I know who uses the no_format option. If you ever want to do that with separate /home or /boot, you'll need the delete options in those rsync commands. BTW, I added the deletes to the system rsync in the cli script, but I just realized there's no point, because it doesn't have the no_format option. It also doesn't have the option to use disk labels. I might fix that last one.
The other thing I did yesterday was finally run dist-upgrade on my sid. Added systemd-shim first. Haven't booted with systemd yet. One issue I'm curious about is console autologin and how that's accomplished by systemd. With sysv, it's in inittab, and the script will replace the inittab with the default debian inittab if you check the box for disabling console autologin.
dzz

- dzz
- Posts: 647
- Joined: Wed Apr 27, 2011 11:53 am
- Location: Devon, England

## Re: New versions of installer and snapshot (9.1.x) for sid

Tue Jul 08, 2014 2:43 pm

> If you ever want to do that with separate /home or /boot, you'll need the delete options in those rsync commands.

Probably yes, on review.. if someone wants to reuse an existing /home and keep user data there are other ways to do that, post-install. Maybe a warning (if "noformat" is chosen and files exist) that they will be deleted is a good idea. I only ever installed to a partition with existing files to speed up testing.
I won't start on systemd now.. I'm having a good day so far!
fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: New versions of installer and snapshot (9.1.x) for sid

Tue Jul 08, 2014 11:19 pm

Here's an idea. The delete options for rsync could be turned on or off in the config file. The explanation required is too complex for a warning window in the middle of an installation, but the config file can have plenty of comments that can be read at the user's leisure.
[code]# If you use the no_format option, you may want to uncomment the following line...
#delete_option_1="--delete-before"
and rsync would look something like
rsync -av ${delete_option_1} blahblahblah.
dzz

- dzz
- Posts: 647
- Joined: Wed Apr 27, 2011 11:53 am
- Location: Devon, England

## Re: New versions of installer and snapshot (9.1.x) for sid

Thu Jul 10, 2014 1:12 pm

If using noformat, The only possible case where rsync deletes should not be used on other than a new manually-formatted partition is re-use of an existing /home which contains user data. This might not work as expected anyway. Definitely not on a "root" partition where files exist.
If you wanted to put that option in the conf file something like this might do:

Code:
  `# If "noformat" option is chosen: existing files will still be deleted.
  # You may optionally re-use a separate /home partition and keep existing files.
  # This may not work as expected! DO NOT uncomment this unless you know what you are doing.
  #rsync_home_delete="no"`

Then in the script:

Code:
  `# copy separate /home if needed
  if ! [[ -z $home_dev ]] ; then
  if [ -z "$rsync_home_delete" ]; then
  home_delete_opts="--delete-before --delete-excluded"
  fi
  rsync -av /home/ /target_home/ --filter='P lost+found' --filter='H lost+found' --exclude-from="$home_boot_excludes $home_delete_opts" | \
  tee >(yad --progress --pulsate --width=350 --auto-close --title=$"Copying home folders to home partition.")
  fi
  # copy separate /boot if needed
  if [[ -n $boot_dev ]] ; then
  rsync -av /boot/ /target_boot/ --filter='P lost+found' --filter='H lost+found' --exclude-from="$home_boot_excludes $boot_delete_opts" --delete-before --delete-excluded | \
  tee >(yad --progress --pulsate --width=350 --auto-close --title=$"Copying files to boot partition.")
  fi
  `

I thought to be more simple, a check for existing files (other than lost+found) and a warning (maybe in the summary) that they will be deleted and keep deletes for all. You're right, I seem to be the only one interested anyway so don't spend too much time on it.
debnet

- debnet
- Posts: 3
- Joined: Sat Jul 19, 2014 11:48 am

## Re: New versions of installer and snapshot (9.1.x) for sid

Sat Jul 19, 2014 12:12 pm

On a debian sid system built today the refractsnapshot-base_9.1.2_all.deb would not install. Issues with isolinux/syslinux versions. I used the stable version 9.0.9-4 to create the snapshot.
The refractainstaller-base_9.1.0_all worked a treat.
[edit] typo vmlinux ---> isolinux
Last edited by debnet on Sun Jul 20, 2014 7:04 am, edited 1 time in total.
fsmithred

- fsmithred
- Posts: 2101
- Joined: Wed Mar 09, 2011 9:13 pm

## Re: New versions of installer and snapshot (9.1.x) for sid

Sun Jul 20, 2014 5:21 am

What version of syslinux and isolinux do you have? What's the output of

Code:
  `apt-cache policy syslinx
  apt-cache policy isolinux`

debnet

- debnet
- Posts: 3
- Joined: Sat Jul 19, 2014 11:48 am

## Re: New versions of installer and snapshot (9.1.x) for sid

Sun Jul 20, 2014 7:15 am

Nevermind - I believe I know what happened and the issue is primarily me not reading stuff correctly . Sorry to trouble you and thanks for these great tools.
Post a reply
Jump to:

Powered by phpBB © phpBB Group.

phpBB Mobile / SEO by Artodia.