langage de programmation
-
@george1421 en passant george je travail sur des VM sur virtualbox et lors de la création de mon pc ubuntu desktop, j’ai partitionner mon dique dur virtuel. es ce cela le problème.
-
@george1421 oui george, voici à quoi ressemble ma partition sur la machine cliente ubuntu.
-
@julio said in langage de programmation:
en passant george je travail sur des VM sur virtualbox et lors de la création de mon pc ubuntu desktop, j’ai partitionner mon dique dur virtuel. es ce cela le problème.
No works the same. I was just warning if you use real hardware that it could change the way your script runs because hardware changes.
-
@george1421 juste pour me rassurer, je ne vais pas par hasard modifier mon fichier host…
-
@julio I will give you a hint to maybe help you with your scripting.
FOG has a special mode you can use to debug your programs right on the target computer. So do the following.
- Register your VM with fog (if you have not done so already)
- Schedule a new deployment task, but before you press the Schedule Task button, enable the Debug checkbox, then schedule the task.
- PXE boot the target computer.
- After several screens of text, you can clear by pressing the ENTER key. You will land on the FOS LINUX command prompt.
Now run
lsblk
to find your hard drive. See if you can find fromlsblk
your root partition.Now manually run
mkdir -p /ntfs mount /dev/sdaX /ntfs
Just as a test run the echo command the variable ${hostname} will not be set yet so you can’t use it here. But you can find out the right location and partition to use. You will not see all of the loop devices that ubuntu creates so it will be clear what partitions you want.
-
@julio said in langage de programmation:
juste pour me rassurer, je ne vais pas par hasard modifier mon fichier host…
This is why I suggested to test your program using FOS Linux in debug mode. No chance to break your FOG server.
-
@george1421 j’essaye ça et je te tiens au courant merci beaucoup.
-
@julio When you added the
echo "OK, osid is 50/Linux"
into your script, did you see that message on the console??You might want to add the mentioned
read
command as well so it waits for your input… -
@sebastian-roth salut roth. non je ne vois rien sur la console de mon serveur fog apparement le script ne fonctionne pas. je veux bien savoir.
comment verifier que le script est bien fonctionnel???
j’ai bien donner les droits d’execution à savoir chmod +x renamehost.sh -
@george1421 salut george. oui j’ai fais ce que tu m’as démander mais je n’arrive pas sur l’invite de commande de fos linux. y’a t’il pas une autre manière???
-
@julio OK give me 5 minutes and I will give you more hints.
-
@julio To get into debug mode on the pxe booting computer make sure you enabled debug mode.
See the Schedule as debug task option? When you do this and pxe boot the target computer you will end at the FOS Linux command prompt.
In your script for debugging purposes you should add
echo "Some step in the script" debugPause;
This way you will know when and where your script is in the program. I add these quite often at specific points in my scripts.
Also make sure you add your script like
fog.custominstall
orrenamehost.sh
to the master script offog.postdownload
or your script will not be called by fog.IF you are ready to debug your script AND you are at the FOS Linux command prompt key in
fog
to start the deployment. The FOG deployment will stop at all of thedebugPause
commands during deployment. Press enter to go to the next step. When / IF you get to seeOK, osid is 50/Linux
on the screen and you see a bug you can press CTRL-C to exit the script. The FOG Postinstall scripts are run right after the last partclone copy screen. You can fix what you need then restart the deployment process again by typingfog
in again. You can do this testing as many times as you want without needing to reboot the pxe target computer. -
@george1421
j’ai reussi à entrer dans la partition de debogage. j’ai executer la commande lsblk. voici ce que j’obtient. -
@george1421 salut george. j’ai eu une erreur qui s’affiche on me precise syntax error. donc le script essaye de s’executer mais petite erreur. voici l’image en question
-
@sebastian-roth oui roth j’ai vu ou il y’a erreur: c’est au niveau de la ligne5 dans mon code: ici
if [[“$osid”==“50”]]; then ça me dire sysntax error. juste pour vous donner un indice.
-
@julio said in langage de programmation:
’ai reussi à entrer dans la partition de debogage. j’ai executer la commande lsblk. voici ce que j’obtient
Ok I see only one partition then /dev/sda1. Now you know what your target partition is.
donc le script essaye de s’executer mais petite erreur.
Here is an example of my if/then
if [[ -z $hd ]]; then handleError "Could not find hdd to use" fi
When you look at your if / then statement do you see any differences? How about spacing?
-
@george1421 voici mon script final
-
@julio You MUST look at the if statement. It is wrong.
if[[ $osid == 50 ]];then
Should be rewritten as
if [[ $osid == "50" ]]; then
-
-
@george1421 désolé j’ai toujours la meme erreur. je sais pas si je doit changer totalement la ligne 5. en passant j’ai bien
fi à la fin de mon script.