Refracta Development, Scripts, etc.
Post a reply
fsmithred

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

## Re: New versions of installer and snapshot (9.1.0) for sid

Thu Apr 10, 2014 3:04 pm

Also changed the ssh piece. You can set root_ssh to "no" or to "auth" in the config file. New default will match official debian and be "auth". (If you set it to "yes" it won't do anything. Anyone who really wants "yes" in their installation will have to do it afterward.)
Don't copy/paste without fixing etc.

Code:
  `# Disable root login through ssh for the installed system
  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`

dzz

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

## Re: New versions of installer and snapshot (9.1.0) for sid

Thu Apr 10, 2014 4:42 pm

Some of my experimental stuff you looked at is probably outdated. It keeps changing. It began as an idea with some problems and evolved into something that seems to work. Sometimes I don't even remember what I did!
http://paste.debian.net/92978/ is what I'm using at the moment (based on 9.1.0). The password dialog check there works and sends you back if there is a mismatch or one is blank
Some dialog wordings were also simplified from earlier versions.
fsmithred

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

## Re: New versions of installer and snapshot (9.1.0) for sid

Thu Apr 10, 2014 5:30 pm

I isolated the problem. Single-bracket test doesn't like comparing two command substitutions, but it works fine if you set each to a variable. (to compare the first and second password entries.) Double-bracket test (bash builtin) works either way.
Edit: I take that back. When I test it on the command line, single-bracket works with comparing two command substitutions. So... I don't know why it won't in the script.
thwak

- thwak
- Posts: 174
- Joined: Tue Nov 20, 2012 3:58 am

## Re: New versions of installer and snapshot (9.1.0) for sid

Thu Apr 10, 2014 7:36 pm

> don't know why it won't in the script

my guess: Debian command shell is dash vs script shell is bash
http://www.in-ulm.de/~mascheck/various/echo+printf/
fsmithred

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

## Re: New versions of installer and snapshot (9.1.0) for sid

Fri Apr 11, 2014 1:37 am

Nice reference. Thanks. I need to pay attention to that, because I tend to write non-portable code. I use a lot of bash builtins.
/bin/sh is a symlink to /bin/dash, so that would be the shell used for any scripts that call /bin/sh. My shell is bash, accoring to 'echo $SHELL' and etc/passwd, and the scripts I write all call bash.
dzz

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

## Re: New versions of installer and snapshot (9.1.0) for sid

Sun Apr 13, 2014 10:03 am

Since the installer script header is "#!/usr/bin/env bash" surely bash will be used regardless of what is "default shell"?
snip from my latest test script http://paste.debian.net/92978/ (not yet seen to fail here):

Code:
  `pass_entry=$(yad --form --title=$"Configure $pass_dialog password" --button="OK":0 \
  --text=$"You should reset the $pass_dialog password.\n" \
  --field=$"Enter new $pass_dialog password::H" \
  --field=$"Confirm new $pass_dialog password::H" \
  --field=$"Use current password\? (not recommended)":CHK \
  "$field_four")
  newpass=$(echo $pass_entry|awk -F "|" '{print $1}')
  confirm_newpass=$(echo $pass_entry|awk -F "|" '{print $2}')
  use_existing=$(echo $pass_entry|awk -F "|" '{print $3}')
  disable_root=$(echo $pass_entry|awk -F "|" '{print $4}')
  # **************************
  if [ "$use_existing" = "TRUE" ] && [ "$disable_root" = "TRUE" ] ; then
  pass_error
  configure_pass
  fi
  if [ -n "$newpass" ] && [ "$use_existing" = "TRUE" ]; then
  pass_error
  configure_pass
  fi
  if [ "$use_existing" = "TRUE" ] || [ "$disable_root" = "TRUE" ] ; then
  return
  fi
  if [ -z "$newpass" ] || [ "$newpass" != "$confirm_newpass" ]; then
  pass_error
  configure_pass
  fi`

$pass_dialog is either "root" or "user", set elsewhere in turn. $field_four is a checkbox to disable root which only appears if sudo was set as default.
Note a different way to keep passwords out of the log was used, to prevent any problem with IO redirection.
fsmithred

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

## Re: New versions of installer and snapshot (9.1.0) for sid

Thu Apr 17, 2014 5:26 pm

Wow. Nice job on the installer. When I looked at the code (briefly) I saw the forms, and knew right away I like that, but I didn't realize until I ran it that you mixed text-entry boxes with checkboxes in the same window. Didn't know it was possible.
One glitch I noticed: 'use uuid in fstab' was checked by default, and I left it, but the uuid did not get used in fstab. It just had the device name. Tried it again with an encrypted /home, and I got the warning that you can't use uuid with encrypted partitions, so that part isn't broken.
There was nothing in the error log about it, and that revealed another problem - debug mode isn't working. All I got was a normal error log. It doesn't look like you changed anything there, so I don't know what the problem is. I'll have to debug debug.
dzz

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

## Re: New versions of installer and snapshot (9.1.0) for sid

Thu Apr 17, 2014 6:58 pm

> the uuid did not get used in fstab

Thanks.. never noticed that! (uuid as default is a personal preference) Simple fix should be:

Code:
  `if $(echo $opts | grep -q 10) || [ "$use_uuid" = "yes" ]; then
  if [[ $encrypt_os = "yes" ]] || [[ $encrypt_home = "yes" ]]; then
  uuid_message=$"--> UUIDs in fstab won't work with encrypted filesystems and
  will not be used. Edit fstab manually after the installation."
  ############ add this:
  else
  use_uuid="yes"
  #############
  fi`

> debug mode isn't working

My mistake again. It did work here because it is set it in my conf file. I had put this (don't remember why) before the bit where $debug can be set by command option. It needs to be after.

Code:
  `if [ "$debug" = "yes" ] || [ "$DEBUG" = "yes" ]; then
  set -x
  fi`

Hope some of this can help future official versions.
EDIT Tested fixed as suspected. At first glance, the debug bug might also apply to the official version (I never got much useful info from other than a full log, why not make it default, in the config file?)
fsmithred

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

## Re: New versions of installer and snapshot (9.1.0) for sid

Fri May 16, 2014 1:28 pm

dzz, what's the purpose of the dollar sign before the quoted text in the yad windows? Oh, it's on more than just the '--text=' parts.
example:

Code:
  `yad --question --title=$"Error" --window-icon=error --button=$"Continue":0 --button=$"Exit now":1`

dzz

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

## Re: New versions of installer and snapshot (9.1.0) for sid

Fri May 16, 2014 1:59 pm

> what's the purpose of the dollar sign before the quoted text in the yad windows

To automatically call any future translation files (e.g. /usr/share/locale/es/LC_MESSAGES/whatever.mo) using GNU gettext (the proper way to do it). It is harmless but unnecessary if translations are not wanted or used. Translations should not involve further mods to the actual script but any available files go in a deb package.
There are Spanish users for my TDE images who asked for this. I would like to switch my own installer for the superior refractainstaller, preferably the "official" version, in due course.
Post a reply
Jump to:

Powered by phpBB © phpBB Group.

phpBB Mobile / SEO by Artodia.