wok-next rev 19068

conky-theme-onsea: take care on root in post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Apr 21 22:04:50 2016 +0200 (2016-04-21)
parents 26cea0618c07
children 4bccb65c3f35
files conky-theme-onsea/receipt
line diff
     1.1 --- a/conky-theme-onsea/receipt	Thu Apr 21 06:40:20 2016 -0300
     1.2 +++ b/conky-theme-onsea/receipt	Thu Apr 21 22:04:50 2016 +0200
     1.3 @@ -37,12 +37,12 @@
     1.4  
     1.5  # Build current ".conkyrc" backup.
     1.6  
     1.7 -if [ -e /home/$USER/.conkyrc ]; then
     1.8 -mkdir -p /home/$USER/$BAK_DIR/$BAK_FILE
     1.9 -mv /home/$USER/.conkyrc /home/$USER/$BAK_DIR/$BAK_FILE
    1.10 +if [ -e $1/home/$USER/.conkyrc ]; then
    1.11 +mkdir -p $1/home/$USER/$BAK_DIR/$BAK_FILE
    1.12 +mv $1/home/$USER/.conkyrc $1/home/$USER/$BAK_DIR/$BAK_FILE
    1.13  
    1.14  # README (Alert file only).
    1.15 -cat > /home/$USER/$BAK_DIR/README <<EOT
    1.16 +cat > $1/home/$USER/$BAK_DIR/README <<EOT
    1.17  
    1.18    $PACKAGE Backup
    1.19    ==============================================
    1.20 @@ -66,12 +66,13 @@
    1.21  # Install new ".conkyrc" to (home/user).
    1.22  # And create a link to the original file.
    1.23  
    1.24 -  cd /home/$USER
    1.25 -  ln -s /usr/share/conky/themes/$SOURCE/.conkyrc .conkyrc
    1.26 -  chmod 755 /home/$USER/.conkyrc
    1.27 +  cd $1/home/$USER
    1.28 +  ln -s /usr/share/conky/themes/$SOURCE/.conkyrc $1/home/$USER/.conkyrc
    1.29 +  chmod 755 $1/home/$USER/.conkyrc
    1.30  
    1.31  # Check the conky process and run new theme.
    1.32  
    1.33 +  [ "$1" ] ||
    1.34    if busybox pidof conky >>/dev/null 2>&1; then
    1.35      su - $USER -c "killall conky" && su - $USER -c "conky &";
    1.36    else
    1.37 @@ -85,11 +86,11 @@
    1.38  
    1.39  # Restore old ".conkyrc" backup.
    1.40  
    1.41 -  if [ -e /home/$USER/$BAK_DIR/$BAK_FILE/.conkyrc ]; then
    1.42 -    mv /home/$USER/$BAK_DIR/$BAK_FILE/.conkyrc /home/$USER
    1.43 -    chmod 777 /home/$USER/.conkyrc
    1.44 -    rm -rf /home/$USER/$BAK_DIR/$BAK_FILE
    1.45 -    rm -rf /home/$USER/$BAK_DIR/README
    1.46 +  if [ -e $1/home/$USER/$BAK_DIR/$BAK_FILE/.conkyrc ]; then
    1.47 +    mv $1/home/$USER/$BAK_DIR/$BAK_FILE/.conkyrc $1/home/$USER
    1.48 +    chmod 777 $1/home/$USER/.conkyrc
    1.49 +    rm -rf $1/home/$USER/$BAK_DIR/$BAK_FILE
    1.50 +    rm -rf $1/home/$USER/$BAK_DIR/README
    1.51    else
    1.52      echo "Empty! No backup files.";
    1.53    fi
    1.54 @@ -101,6 +102,7 @@
    1.55  
    1.56  # Check the conky process and run old theme.
    1.57  
    1.58 +  [ "$1" ] ||
    1.59    if busybox pidof conky >>/dev/null 2>&1; then
    1.60      su - $USER -c "killall conky" && su - $USER -c "conky &";
    1.61    else