summaryrefslogtreecommitdiffstats
path: root/application/controllers
diff options
context:
space:
mode:
authormichael pereira2011-05-05 12:42:04 +0200
committermichael pereira2011-05-05 12:42:04 +0200
commitaf94207f963a2d1ca139cadf6e159149ad6cedc2 (patch)
treed2b6cdd709d275a96a6dce92015b2f9dbb059c90 /application/controllers
parentuser (diff)
downloadpbs2-af94207f963a2d1ca139cadf6e159149ad6cedc2.tar.gz
pbs2-af94207f963a2d1ca139cadf6e159149ad6cedc2.tar.xz
pbs2-af94207f963a2d1ca139cadf6e159149ad6cedc2.zip
postinit script in view ausgelagert
Diffstat (limited to 'application/controllers')
-rw-r--r--application/controllers/ResourceController.php49
1 files changed, 28 insertions, 21 deletions
diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php
index c078fb2..6ae3aed 100644
--- a/application/controllers/ResourceController.php
+++ b/application/controllers/ResourceController.php
@@ -272,7 +272,7 @@ class ResourceController extends Zend_Controller_Action
$prebootpath = "../resources/bootmedium/".$prebootID."/";
mkdir($prebootpath ,0777, true);
- if($_FILES['preboot']['name'] != ''){
+ if($_FILES['preboot']['name'] != '' ){
move_uploaded_file($_FILES['preboot']['tmp_name'], $prebootpath."preboot.zip");
}
@@ -369,6 +369,8 @@ class ResourceController extends Zend_Controller_Action
public function getconfigAction()
{
+ $this->initView();
+
$bootmenuentryID = $this->thisSession->getBootmenuentryID();
$bootmenuentry = new Application_Model_BootMenuEntries();
$bmm = new Application_Model_BootMenuEntriesMapper();
@@ -417,47 +419,52 @@ class ResourceController extends Zend_Controller_Action
foreach($bootosuser as $user)
$test[] = $user->getLogin();
}
+
+ $f = fopen("$tmp_conf/initramfs/postinit.local", "a");
+
foreach($bootosuser as $user){
if($user->getLogin() == '%username%'){
- $loginname = $username;
- }else{
- $loginname = $user->getLogin();
+ $this->view->loginname = $username;
+ }else{
+ $this->view->loginname = $user->getLogin();
}
if($user->getPassword() == '%password%'){
- $password = $userpassword;
+ $this->view->password = $userpassword;
}else{
- $password = $user->getPassword();
+ $this->view->password = $user->getPassword();
}
if($user->getHometypeID() == 2){
- $homepath = $user->getHomepath();
+ $this->view->homepath = $user->getHomepath();
}elseif($user->getHometypeID() == 1){
- $homepath = "/media/openslx-stick/home/$loginname";
+ $this->view->homepath = "/media/openslx-stick/home/".$this->view->loginname;
}else{
- $homepath = "/home/$loginname";
+ $this->view->homepath = "/home/".$this->view->loginname;
}
-
- if($loginname != '' && $password != ''){
+
+ if($this->view->loginname != '' && $this->view->password != ''){
+
if($user->getHometypeID() == 1){
- exec("echo 'modprobe usb_storage' >> $tmp_conf/initramfs/postinit.local");
- exec("echo 'echo -n 'Mounting OpenSLX-Stick:'; while [ ! -e /dev/sdb1 ] \n do \n\t usleep 500000 \n\t mdev -s \n\t echo -n . \n done' >> $tmp_conf/initramfs/postinit.local");
- exec("echo 'mkdir -p /mnt/media/openslx-stick' >> $tmp_conf/initramfs/postinit.local");
- exec("echo 'mount /dev/sdb1 /mnt/media/openslx-stick' >> $tmp_conf/initramfs/postinit.local");
- exec("echo 'if [ -d /mnt/media/openslx-stick/boot ]; then \n\t if [ ! -d '".escapeshellarg("'"."/mnt/media/openslx-stick/home/".$loginname."'")."' ]; then \n\t\t mkdir -p '".escapeshellarg("'"."/mnt/media/openslx-stick/home/'")."' \n\t\t chroot /mnt useradd -m -d '".escapeshellarg("'".$homepath."'")."' -s /bin/bash -p '".escapeshellarg("'".$password."'")."' '".escapeshellarg("'".$loginname."'")."' \n\t else \n\t\t chroot /mnt useradd -d '".escapeshellarg("'".$homepath."'")."' -s '/bin/bash' -p '".escapeshellarg("'".$password."'")."' '".escapeshellarg("'".$loginname."'")."' \n\t fi \n else \n\t chroot /mnt useradd -d '".escapeshellarg("'"."/home/".$loginname."'")."' -m -s '/bin/bash' -p '".escapeshellarg("'".$password."'")."' '".escapeshellarg("'".$loginname."'")."' \n fi' >> $tmp_conf/initramfs/postinit.local");
+ $this->view->usb = true;
}
else{
- exec("echo 'chroot /mnt useradd -d '".escapeshellarg("'".$homepath."'")."' -m -s /bin/bash -p '".escapeshellarg("'".$password."'")."' '".escapeshellarg("'".$loginname."'")."'' >> $tmp_conf/initramfs/postinit.local",$restul);
+ $this->view->usb = false;
if($anzUsers <= 2 && $user->getLogin() == 'kiosk' && in_array('%username%',$test) && $this->thisSession->getMembershipID() == null)
- exec("echo 'chroot /mnt sed -e \"s/AutoLoginEnable=.*/AutoLoginEnable=true/g;\" /etc/kde4/kdm/kdmrc > /tmp/tmpkdmrc && sed 21iAutoLoginUser=kiosk /tmp/tmpkdmrc > /mnt/etc/kde4/kdm/kdmrc && rm /tmp/tmpkdmrc' >> $tmp_conf/initramfs/postinit.local");
-
- if($anzUsers <= 2 && $user->getLogin() == '%username%')
- exec("echo 'chroot /mnt sed -e \"s/AutoLoginEnable=.*/AutoLoginEnable=true/g;\" /etc/kde4/kdm/kdmrc > /tmp/tmpkdmrc && sed 21iAutoLoginUser='".escapeshellarg("'".$loginname."'")."' /tmp/tmpkdmrc > /mnt/etc/kde4/kdm/kdmrc && rm /tmp/tmpkdmrc' >> $tmp_conf/initramfs/postinit.local");
+ $this->view->autologin = true;
+ elseif($anzUsers <= 2 && $user->getLogin() == '%username%' && $this->thisSession->getMembershipID() != null)
+ $this->view->autologin = true;
+ else
+ $this->view->autologin = false;
}
+ $this->render();
+ fputs($f, $this->view->script);
+
}
}
+ fclose($f);
// create the gzipped tarfile.
chdir($tmp_conf);