First working version. rpm created and tested (a little).
This commit is contained in:
commit
81ecbffc53
8 changed files with 868 additions and 0 deletions
32
root/etc/e-smith/events/actions/profile-clean
Executable file
32
root/etc/e-smith/events/actions/profile-clean
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
package esmith;
|
||||
|
||||
use strict;
|
||||
use Errno;
|
||||
use esmith::DB::db;
|
||||
use IO::File;
|
||||
use English;
|
||||
|
||||
# This scripts helps out cleaning the whole profile (data and settings) for a
|
||||
# single user using LDAP/SAMBA.
|
||||
|
||||
my $db_users = esmith::DB::db->open('accounts') || die("Cannot open e-smith db accounts: " . esmith::DB::db->error . "\n");
|
||||
|
||||
my $event = $ARGV[0];
|
||||
|
||||
defined $ARGV[1] || die("No user specified");
|
||||
my $user = $ARGV[1];
|
||||
|
||||
profile_clean($user);
|
||||
|
||||
sub profile_clean {
|
||||
my ($username) = @_;
|
||||
my @u = $db_users->get($username) || die("No user record for '$username'.");
|
||||
|
||||
system("find /var/lib/nethserver/home/$username -delete");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
39
root/etc/e-smith/events/actions/profile-gui-clean
Executable file
39
root/etc/e-smith/events/actions/profile-gui-clean
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/perl -w
|
||||
# vim:sts=4:sw=4:tw=78
|
||||
|
||||
package esmith;
|
||||
|
||||
use strict;
|
||||
use Errno;
|
||||
use esmith::DB::db;
|
||||
use IO::File;
|
||||
use English;
|
||||
|
||||
# This script helps cleaning up only graphical settings for a user.
|
||||
|
||||
my $db_users = esmith::DB::db->open('accounts') || die("Cannot open e-smith db accounts: " . esmith::DB::db->error . "\n");
|
||||
|
||||
my $event = $ARGV[0];
|
||||
|
||||
defined $ARGV[1] || die("No user specified");
|
||||
my $user = $ARGV[1];
|
||||
|
||||
profile_gui_clean($user);
|
||||
|
||||
sub profile_gui_clean {
|
||||
my ($username) = @_;
|
||||
my @u = $db_users->get($username) || die("No user record for '$username'.");
|
||||
|
||||
my @directories = (
|
||||
".cache",
|
||||
".config",
|
||||
".gconf",
|
||||
".kde",
|
||||
".gnome2",
|
||||
".gnome2_private"
|
||||
);
|
||||
|
||||
foreach (@directories) {
|
||||
system("rm -rf /var/lib/nethserver/home/$username/$_") == 0 || die("Error cleaning up graphics settings for $username. Exiting.");
|
||||
}
|
||||
}
|
28
root/etc/e-smith/events/actions/profile-lo-clean
Executable file
28
root/etc/e-smith/events/actions/profile-lo-clean
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/perl -w
|
||||
# vim:sts=4:sw=4:tw=78
|
||||
|
||||
package esmith;
|
||||
|
||||
use strict;
|
||||
use Errno;
|
||||
use esmith::DB::db;
|
||||
use IO::File;
|
||||
use English;
|
||||
|
||||
# This script helps cleaning up only LibreOffice settings.
|
||||
|
||||
my $db_users = esmith::DB::db->open('accounts') || die("Cannot open e-smith db accounts: " . esmith::DB::db->error . "\n");
|
||||
|
||||
my $event = $ARGV[0];
|
||||
|
||||
defined $ARGV[1] || die("No user specified");
|
||||
my $user = $ARGV[1];
|
||||
|
||||
profile_lo_clean($user);
|
||||
|
||||
sub profile_lo_clean {
|
||||
my ($username) = @_;
|
||||
my @u = $db_users->get($username) || die("No user record for '$username'.");
|
||||
|
||||
system("rm -rf /var/lib/nethserver/home/$username/.config/libreoffice") == 0 || die("Error removing libreoffice profile for $username.");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue