Add usbinstall.sh in sudoers
This commit is contained in:
parent
6a9f8d584d
commit
3dca414f8c
6
Makefile
6
Makefile
@ -11,6 +11,7 @@ dist_archive := $(distdir).tar.bz2
|
||||
|
||||
# Directory
|
||||
bindir := /usr/bin
|
||||
sysconfdir := /etc
|
||||
datadir := /usr/share
|
||||
mambadir := /usr/share/openmamba
|
||||
localesdir := ${datadir}/locale
|
||||
@ -46,16 +47,17 @@ install-dirs:
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(bindir)
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(mambadir)/usbinstall
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(mambadir)/usbinstall/img
|
||||
@$(INSTALL_DIR) $(DESTDIR)$(sysconfdir)/sudoers.d/
|
||||
|
||||
|
||||
install: install-dirs install-locales
|
||||
$(INSTALL_PROGRAM) src/usbinstall.py $(DESTDIR)$(mambadir)/usbinstall/usbinstall.py
|
||||
$(INSTALL_SCRIPT) src/usbinstall.sh $(DESTDIR)$(mambadir)/usbinstall/usbinstall.sh
|
||||
$(INSTALL_SCRIPT) src/usbinstall.sh $(DESTDIR)$(bindir)/usbinstall.sh
|
||||
$(INSTALL_DATA) src/fdisk_template $(DESTDIR)$(mambadir)/usbinstall/fdisk_template
|
||||
$(INSTALL_DATA) src/img/*.png $(DESTDIR)$(mambadir)/usbinstall/img/
|
||||
${INSTALL} -m 440 src/usbinstall-sudoers $(DESTDIR)$(sysconfdir)/sudoers.d/usbinstall
|
||||
# Crea un link in /usr/bin agli eseguibili in $(mambadir)/usbinstall
|
||||
ln -s $(mambadir)/usbinstall/usbinstall.py $(DESTDIR)$(bindir)/usbinstall.py
|
||||
ln -s $(mambadir)/usbinstall/usbinstall.sh $(DESTDIR)$(bindir)/usbinstall.sh
|
||||
|
||||
|
||||
clean:
|
||||
|
11
src/usbinstall-sudoers
Normal file
11
src/usbinstall-sudoers
Normal file
@ -0,0 +1,11 @@
|
||||
# usbinstall sudoers.d file.
|
||||
#
|
||||
# This file MUST be edited with the 'visudo' command as root.
|
||||
#
|
||||
# See the sudoers man page for the details on how to write a sudoers file.
|
||||
#
|
||||
|
||||
# Cmnd alias specification
|
||||
Cmnd_Alias USBINSTALL = /usr/bin/usbinstall.sh
|
||||
|
||||
%sysadmin ALL = NOPASSWD: USBINSTALL
|
5
src/usbinstall.py
Normal file → Executable file
5
src/usbinstall.py
Normal file → Executable file
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2011 michiamophil (openmamba user :-)
|
||||
# ChangeLog:
|
||||
@ -368,7 +368,8 @@ def step4():
|
||||
# Show the progressBar
|
||||
window.p_install.show()
|
||||
dbus_start()
|
||||
process_sh = Popen(["/usr/bin/usbinstall.sh", "start", path_dev, path_cpio, path_iso])
|
||||
# NON FUNZIONA...
|
||||
process_sh = Popen(["sudo", "/usr/bin/usbinstall.sh", path_dev, path_cpio, path_iso], env={"DBUS_USBINSTALL": "1"})
|
||||
|
||||
|
||||
# Show a list of object (step 1 and 2)
|
||||
|
@ -53,18 +53,22 @@ org.freedesktop.DBus.Properties.Get string:$3 string:$4`
|
||||
return 0
|
||||
}
|
||||
|
||||
# Set progressbar
|
||||
# Set progressbar (only if $DBUS_USBINSTALL = 1)
|
||||
# Arg 1: value%
|
||||
set_pbar()
|
||||
{
|
||||
dbus-send --print-reply --session --dest=org.openmamba.usbinstall /org/openmamba/usbinstall org.openmamba.usbinstall.Set_progressBar int32:$1
|
||||
if [ $DBUS_USBINSTALL == 1 ]; then
|
||||
dbus-send --print-reply --session --dest=org.openmamba.usbinstall /org/openmamba/usbinstall org.openmamba.usbinstall.Set_progressBar int32:$1
|
||||
fi
|
||||
}
|
||||
|
||||
# Set status label
|
||||
# Arg 1: string
|
||||
set_status()
|
||||
{
|
||||
dbus-send --print-reply --session --dest=org.openmamba.usbinstall /org/openmamba/usbinstall org.openmamba.usbinstall.Set_description "string:$1"
|
||||
if [ $DBUS_USBINSTALL == 1 ]; then
|
||||
dbus-send --print-reply --session --dest=org.openmamba.usbinstall /org/openmamba/usbinstall org.openmamba.usbinstall.Set_description "string:$1"
|
||||
fi
|
||||
}
|
||||
####################################(DBUS)###########################################
|
||||
|
||||
@ -78,7 +82,6 @@ export SELECT_USB=$1
|
||||
export SELECT_BOOT=$2
|
||||
export SELECT_ISO=$3
|
||||
|
||||
|
||||
set_status "Smonto la chiavetta"
|
||||
LANG=C udisks --unmount ${SELECT_USB}1 | grep failed && {
|
||||
echo "Error: fail to umount the usb key (${SELECT_USB}1)"
|
||||
@ -118,11 +121,11 @@ set_status "Copia del file iso di openmamba in corso..."
|
||||
ORIG_SIZE=`stat -c %s $SELECT_ISO`
|
||||
cp $SELECT_ISO ./ &
|
||||
DEST_SIZE=0
|
||||
sleep 2
|
||||
while [ $ORIG_SIZE -gt $DEST_SIZE ]; do
|
||||
DEST_SIZE=$(stat -c %s ./"`basename $SELECT_ISO`")
|
||||
percentuale=$((45 + ( 50 * $DEST_SIZE ) / $ORIG_SIZE ))
|
||||
set_pbar $percentuale
|
||||
sleep 2
|
||||
done
|
||||
ln -fs `basename $SELECT_ISO` ./openmamba-live.iso
|
||||
popd
|
||||
|
Loading…
Reference in New Issue
Block a user