[Rear-users] rear.sh questions

Schlomo Schapiro schlomo at schapiro.org
Thu May 19 12:24:37 CEST 2011


Hi,

Am 19.05.2011 02:44, schrieb Stefan Kuttler:
> Hi all,
> 
> had a quick look at rear.sh and now I have some questions.
> 
> 1. rear.sh RELEASE_DATE
> 
> I kindof didn't like how it is cut together, so either
> 
> ,echo ${RELEASE_DATE[@]:1:3}
> 2011-05-12 10:22:20 +0200
> 
> or
> 
> ,echo ${RELEASE_DATE:6:26}
> 2011-05-12 10:22:20 +0200
> 
> should work. The latter doesn't need to be RELEASE_DATE
> declared an array.
> 

did you try latest trunk? I get this from current trunk:

sschapiro at isdeblnnb081:~$ RELEASE_DATE='$Date: 2011-05-12 10:22:20 +0200
(Do, 12 Mai 2011) $'
sschapiro at isdeblnnb081:~$ RELEASE_DATE="${RELEASE_DATE#\$Date: }"
sschapiro at isdeblnnb081:~$ RELEASE_DATE="${RELEASE_DATE% (*}"
sschapiro at isdeblnnb081:~$ declare -p RELEASE_DATE
declare -- RELEASE_DATE="2011-05-12 10:22:20 +0200"

> 
> 2. rear.sh Portability
> 
> # are we root ?
> -if [ $(id --user) -ne 0 ]; then
> +if [ $(id -u) -ne 0 ]; then
>         echo  "** ERROR **      $PRODUCT needs ROOT privileges!"
>         exit 1
> fi
> 
> IHMO, one should not use GNU options. Also, I suggest replacing
> pidof with pgrep -x

What is bad about GNU options? I would guess that we use a lot of GNU
stuff in ReaR. I think that once somebody starts to seriously port ReaR
to other operating systems it would be a good time to fix these issues.

I was not aware of pgrep. Could you please give us a good reason for
your suggestion and check how well pgrep would work in place of pidof
and make sure that pgrep is available on all supported platforms (we did
this check for pidof).

> 
> 
> 3. rear.sh source builtin
> 
> -. $SHARE_DIR/conf/default.conf
> +test -d $SHARE_DIR && . $SHARE_DIR/conf/default.conf

if SHARE_DIR is not there then ReaR won't work.

The Source function will skip non-existing files.

> 
> Do we test anywhere for SHARE_DIR? I for example did svn co and don't have
> /usr/share/rear

Testing for SHARE_DIR would be a good idea. ReaR cannot run from a svn
working copy. use usr/share/rear/contrib/svn2host <hostname> to install
a snapshot from your working copy onto a test host.

> 
> 
> 4. secure tempfiles
> 
> BUILD_DIR="$( mktemp -d -t rear.XXXXXXXXXXXXXXX)" || Error "Could not cre=
> ate build area '$BUILD_DIR'"
> 
> Is this secure way of creating tempfiles?

We believe that this is more secure than what we did before. Do you have
a suggestion to make it more secure?

> 
> 5 ./rescue/default/50_ssh.sh
> 
> What is the intended purpose of this the following line:
> 
> echo "ssh:23:respawn:/bin/sshd -D" >>$ROOTFS_DIR/etc/inittab

start ssh daemon on rescue system.

Kind Regards,
Schlomo




More information about the rear-users mailing list