:: Re: [DNG] Debianising my uploaded v…
Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: aitor_czr
Fecha:  
A: Edward Bartolo, dng@lists.dyne.org
Asunto: Re: [DNG] Debianising my uploaded version of netman.
Hi Edward,

On 14/12/15 13:00, Edward Bartolo <edbarx@???> wrote:
> I am thinking about making autostarting and connecting automatically
> to wifi optional during the installation process of netman. This
> means, I need to write a post installation script or if its already
> exists, add a few lines to it, so that users can choose how to set up
> netman.


This is a good idea. You can use a netman-gui.postinst file for that.

> Pseudo code:
>
> echo "Do you want netman to use a systray icon?"
> get answer (yes1)
>
> if yes1
>        echo "Do you want netman to automatically connect on startup?"
>        get answer (yes2)
> else
>       create a simple launcher without parameters
>       exit

>
> if yes2
>        create a launcher to use --auto-conn --use-tray-icon
> else
>        create a launcher with only --use-tray-icon

>
>
> Some hints as to where I should place this script, and which files
> under netman/debian I have to edit, would be of a considerable help to
> me.
>
>
> Edward


The content of the netman-gui.postinst could be something like this:


#!/bin/sh
if [ "$1" = "configure" ]; then
     /sbin/ldconfig
fi


while true; do
  read -p "Do you want netman to use a systray icon? (Y/n)" yn
  case $yn in
    [Yy]* ) LINE1="Exec=netman --use-tray-icon"; break;;
    [Nn]* ) LINE1="Exec=netman "; break;;
    * ) LINE1="Exec=netman--use-tray-icon"; break;;
  esac
done


while true; do
  read -p "Do you want netman to automatically connect on startup? (Y/n)" yn
  case $yn in
    [Yy]* ) LINE2=" --auto-conn"; break;;
    [Nn]* ) LINE2=""; break;;
    * ) LINE2="--auto-conn"; break;;
     esac
done


LINE=${LINE1}${LINE2}
sed -i "4i ${LINE}" /etc/xdg/autostart/netman.desktop;

#DEBHELPER#
exit 0


HTH,

     Aitor.