|
@@ -134,13 +134,18 @@ def executeSudoCmds(cmds):
|
134
|
134
|
for cmd in cmds:
|
135
|
135
|
if type(cmd).__name__ == 'list' :
|
136
|
136
|
for subCmd in cmd:
|
137
|
|
- end.append(subCmd)
|
|
137
|
+ if subCmd.find('cd ') == -1:
|
|
138
|
+ end.append(sudoCmd(subCmd))
|
|
139
|
+ else:
|
|
140
|
+ end.append(subCmd)
|
138
|
141
|
|
139
|
142
|
else:
|
140
|
|
- end.append(cmd)
|
141
|
|
- dump(end)
|
|
143
|
+ if cmd.find('cd ') == -1:
|
|
144
|
+ end.append(sudoCmd(cmd))
|
|
145
|
+ else:
|
|
146
|
+ end.append(cmd)
|
142
|
147
|
|
143
|
|
- cmd = sudoPath + (' ' + cmdsSeparator + ' ' + sudoPath).join(end)
|
|
148
|
+ cmd = (' ' + cmdsSeparator +' ').join(end)
|
144
|
149
|
executeCmd(cmd)
|
145
|
150
|
#executeSudoCmd('; '.join(end))
|
146
|
151
|
|
|
@@ -175,7 +180,7 @@ sudoPath = '/usr/bin/sudo '
|
175
|
180
|
chattrPath = '/usr/bin/chattr '
|
176
|
181
|
chownPath = '/bin/chown '
|
177
|
182
|
runuserPath = '/sbin/runuser '
|
178
|
|
-jupyterPath = '/usr/bin/jupyter '
|
|
183
|
+jupyterPath = 'jupyter '
|
179
|
184
|
mvPath = '/bin/mv '
|
180
|
185
|
cpPath = '/bin/cp '
|
181
|
186
|
rmPath = '/bin/rm '
|
|
@@ -763,7 +768,7 @@ def nbGraderInstallCmd(user,options):
|
763
|
768
|
for option in options:
|
764
|
769
|
result.append(jupyterPath + ' ' + nbextensionPath + ' enable --user ' + option)
|
765
|
770
|
|
766
|
|
- return result
|
|
771
|
+ return sudoCmd(runAsUser(user,(' ' + cmdsSeparator + ' ').join(result)))
|
767
|
772
|
|
768
|
773
|
def writeConfigurations(jupyterUsername,useSource=True):
|
769
|
774
|
# config du notebook jupyter => changement de la racine d'exploration
|
|
@@ -825,15 +830,15 @@ def createTrainerServer(username,folder,notebookname):
|
825
|
830
|
# + change les droits du groupe sur le dossier de l'utilisateur
|
826
|
831
|
jupyterUsername = getJupyterName(username)
|
827
|
832
|
cmd = changeFolderRightForGroup(jupyterUsername)
|
828
|
|
- executeCmd(cmd)
|
|
833
|
+ executeSudoCmd(cmd)
|
829
|
834
|
|
830
|
835
|
cmd = addCurrentUserToJupyterUserGroup(jupyterUsername)
|
831
|
|
- executeCmd(cmd)
|
|
836
|
+ executeSudoCmd(cmd)
|
832
|
837
|
|
833
|
838
|
# configuration des extensions de l'utilisateur
|
834
|
839
|
# config formateur de nbgrader
|
835
|
840
|
myCmds = nbGraderInstallCmd(jupyterUsername,['create_assignment/main','validate_assignment/main'])
|
836
|
|
- executeSudoCmds(myCmds)
|
|
841
|
+ executeCmd(myCmds)
|
837
|
842
|
|
838
|
843
|
#myCmd += ' && ' + sudoPath + ' -u ' + currentUserName + ' ' + chmodPath + ' 770 ' + buildPath(['home',jupyterUsername,'.jupyter'])
|
839
|
844
|
writeConfigurations(jupyterUsername)
|
|
@@ -896,13 +901,13 @@ def createStudentServer(trainername,username,folder,notebookname):
|
896
|
901
|
# + change les droits du groupe sur le dossier de l'utilisateur
|
897
|
902
|
jupyterUsername = getJupyterName(username)
|
898
|
903
|
cmd = changeFolderRightForGroup(jupyterUsername)
|
899
|
|
- executeCmd(cmd)
|
|
904
|
+ executeSudoCmd(cmd)
|
900
|
905
|
|
901
|
906
|
cmd = addCurrentUserToJupyterUserGroup(jupyterUsername)
|
902
|
|
- executeCmd(cmd)
|
|
907
|
+ executeSudoCmd(cmd)
|
903
|
908
|
|
904
|
|
- myCmds = nbGraderInstallCmd(jupyterUsername,[])
|
905
|
|
- executeSudoCmds(myCmds)
|
|
909
|
+ myCmd = nbGraderInstallCmd(jupyterUsername,[])
|
|
910
|
+ executeCmd(myCmd)
|
906
|
911
|
|
907
|
912
|
# config du notebook jupyter => changement de la racine d'exploration
|
908
|
913
|
mkdirCmds = mkdirCmd(buildPath(['home',jupyterUsername,'.jupyter']),jupyterUsername,770)
|