• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. devrick
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 10
    • Best 0
    • Controversial 0
    • Groups 0

    devrick

    @devrick

    0
    Reputation
    1
    Profile views
    10
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    devrick Unfollow Follow

    Latest posts made by devrick

    • RE: Updating a registry file after deployment

      @george1421 My fog.custominstall script

      #!/bin/bash
      . /usr/share/fog/lib/funcs.sh
      echo "Running my script"
      debugPause
      
      if [[ ! -z $mac ]]; then
          curl -A "" -Lkso /tmp/hinfo.sh ${web}/fog/service/hinfo.php -d "mac=$mac"
          if [[ -f /tmp/hinfo.sh ]]; then
              . /tmp/hinfo.sh
          fi
      fi
      
      [[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
      case $osid in
          5|6|7|9)
              clear
              [[ ! -d /ntfs ]] && mkdir -p /ntfs
              getHardDisk
              if [[ -z $hd ]]; then
                  handleError "Could not find hdd to use"
              fi
              getPartitions $hd
              for part in $parts; do
                  umount /ntfs >/dev/null 2>&1
                  fsTypeSetting "$part"
                  case $fstype in
                      ntfs)
                          dots "Testing partition $part"
                          ntfs-3g -o force,rw $part /ntfs
                          ntfsstatus="$?"
                          if [[ ! $ntfsstatus -eq 0 ]]; then
                              echo "Skipped"
                              continue
                          fi
                          if [[ ! -d /ntfs/windows && ! -d /ntfs/Windows && ! -d /ntfs/WINDOWS ]]; then
                              echo "Not found"
                              umount /ntfs >/dev/null 2>&1
                              continue
                          fi
                          echo "Success"
                          break
                          ;;
                      *)
                          echo " * Partition $part not NTFS filesystem"
                          ;;
                  esac
              done
              if [[ ! $ntfsstatus -eq 0 ]]; then
                  echo "Failed"
                  debugPause
                  handleError "Failed to mount $part ($0)\n    Args: $*"
              fi
              echo "Done"
              debugPause
              . ${postdownpath}fog.updateregbarcode
              umount /ntfs
              ;;
          *)
              echo "Non-Windows Deployment"
              debugPause
              return
              ;;
      esac
      

      I went through and tried both wget and curl solutions.
      This one gave me errors. I am running 1.5.9 and here states that curl should be used after 1.4.1

      if [[ ! -z $mac ]]; then
          wget -q -O /tmp/hinfo.txt "http://${web}service/hostinfo.php?mac=$mac"
          if [[ -f /tmp/hinfo.txt ]]; then
              . /tmp/hinfo.txt
          fi
      fi
      

      For this one, I don’t get an error.

      if [[ ! -z $mac ]]; then
          curl -A "" -Lkso /tmp/hinfo.sh ${web}/fog/service/hinfo.php -d "mac=$mac"
          if [[ -f /tmp/hinfo.sh ]]; then
              . /tmp/hinfo.sh
          fi
      fi
      

      This is what is in /tmp/hinfo.sh. It is pulling my web login page.

      <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width, initial-scale=1"/><title>Login</title><link href="../management/css/animate.min.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/font-awesome.min.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/jquery-ui.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/jquery-ui.theme.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/jquery-ui.structure.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/jquery-ui-timepicker-addon.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/select2.min.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/bootstrap.min.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/bootstrap-theme.min.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/theme.bootstrap_3.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/theme.blue.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/bootstrap-dialog.min.css?ver=135" rel="stylesheet" type="text/css"/><link href="../management/css/default/fog.css?ver=135" rel="stylesheet" type="text/css"/><link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/></head><body><nav class="navbar navbar-inverse navbar-fixed-top"><div class="container-fluid"><div class="navbar-header"><button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"><span class="sr-only">Toggle Navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button></div><div class="collapse navbar-collapse"><ul class="nav navbar-nav"><a class="navbar-brand" href="../management/index.php?node=home"><b>FOG</b> Project</a></ul></div></div></nav><div class="container-fluid dashboard"><div class="form-signin"><form class="form-horizontal" method="post" action="?node=home"><h3 class="form-signin-heading text-center"><span class="col-xs-1"><img src="../favicon.ico" class="logoimg" alt="Open Source Computer Cloning Solution"/></span>FOG Project</h3><hr/><div class="form-group"><label class="control-label col-md-2" for="uname">Username</label><div class="col-md-10"><input type="text" class="form-control" name="uname" required="" autofocus="" id="uname"/></div></div><div class="form-group"><label class="control-label col-md-2" for="upass">Password</label><div class="col-md-10"><input type="password" class="form-control" name="upass" required="" id="upass"/></div></div><div class="form-group"><label class="control-label col-md-2" for="ulang">Language</label><div class="col-md-10"><select class="form-control" name="ulang" id="ulang"><option value="中国的">中国的</option><option value="English" selected>English</option><option value="Español">Español</option><option value="Français">Français</option><option value="Deutsch">Deutsch</option><option value="Italiano">Italiano</option><option value="Português">Português</option></select></div></div><div class="form-group"><div class="col-md-offset-2 col-md-10"><button class="btn btn-default btn-block" type="submit" name="login">Login</button></div></div></form><hr/><div class="row"><div class="form-group"><div id="login-form-info"><p>Estimated FOG Sites: <b><i class="icon fa fa-circle-o-notch fa-spin fa-fw"></i></b></p><p>Latest Version: <b><i class="icon fa fa-circle-o-notch fa-spin fa-fw"></i></b></p><p>Latest Development Version: <b><i class="icon fa fa-circle-o-notch fa-spin fa-fw"></i></b></p></div></div></div></div></div><div class="collapse navbar-collapse"><footer class="footer"><nav class="navbar navbar-inverse navbar-fixed-bottom"><div class="container-fluid"><ul class="nav navbar-nav"><li><a href="https://wiki.fogproject.org/wiki/index.php?title=Credits">Credits</a></li><li><a href="?node=client">FOG Client</a></li><li><a href="https://www.paypal.com/cgi-bin/webscr?item_name=Donation+to+FOG+-+A+Free+Cloning+Solution&cmd=_donations&business=fogproject.org@gmail.com" target="_blank">Donate to FOG</a></li></ul></div></nav></footer></div><script src="js/jquery-latest.min.js?ver=135" type="text/javascript"></script><script src="js/jquery.validate.min.js?ver=135" type="text/javascript"></script><script src="js/additional-methods.min.js?ver=135" type="text/javascript"></script><script src="js/jquery.tablesorter.combined.js?ver=135" type="text/javascript"></script><script src="js/select2.min.js?ver=135" type="text/javascript"></script><script src="js/jquery-migrate-latest.min.js?ver=135" type="text/javascript"></script><script src="js/jquery.progressbar.js?ver=135" type="text/javascript"></script><script src="js/jquery.tmpl.js?ver=135" type="text/javascript"></script><script src="js/jquery.placeholder.js?ver=135" type="text/javascript"></script><script src="js/jquery-ui.min.js?ver=135" type="text/javascript"></script><script src="js/flot/jquery.flot.js?ver=135" type="text/javascript"></script><script src="js/flot/jquery.flot.time.js?ver=135" type="text/javascript"></script><script src="js/flot/jquery.flot.pie.js?ver=135" type="text/javascript"></script><script src="js/flot/jquery.flot.JUMlib.js?ver=135" type="text/javascript"></script><script src="js/flot/jquery.flot.gantt.js?ver=135" type="text/javascript"></script><script src="js/jquery-ui-timepicker-addon.js?ver=135" type="text/javascript"></script><script src="js/bootstrap.min.js?ver=135" type="text/javascript"></script><script src="js/bootstrap-dialog.min.js?ver=135" type="text/javascript"></script><script src="js/fog/fog.js?ver=135" type="text/javascript"></script><script src="js/jscolor.min.js?ver=135" type="text/javascript"></script><script src="js/fog/fog.login.js?ver=135" type="text/javascript"></script><!-- Memory Usage: 4.00 MiB--><!-- Memory Peak: 5.46 MiB--></body></html>
      
      posted in FOG Problems
      D
      devrick
    • RE: Updating a registry file after deployment

      @george1421 The following is my fog.custominstall. Would this be correct?

      #!/bin/bash
      echo "Running my script"
      debugPause
      
      if [[ ! -z $mac ]]; then
          curl -A "" -Lkso /tmp/hinfo.sh ${web}/fog/service/hinfo.php -d "mac=$mac"
          if [[ -f /tmp/hinfo.sh ]]; then
              . /tmp/hinfo.sh
          fi
      fi
      
      . /usr/share/fog/lib/funcs.sh
      [[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
      case $osid in
          5|6|7|9)
              clear
              [[ ! -d /ntfs ]] && mkdir -p /ntfs
              getHardDisk
              if [[ -z $hd ]]; then
                  handleError "Could not find hdd to use"
              fi
              getPartitions $hd
              for part in $parts; do
                  umount /ntfs >/dev/null 2>&1
                  fsTypeSetting "$part"
                  case $fstype in
                      ntfs)
                          dots "Testing partition $part"
                          ntfs-3g -o force,rw $part /ntfs
                          ntfsstatus="$?"
                          if [[ ! $ntfsstatus -eq 0 ]]; then
                              echo "Skipped"
                              continue
                          fi
                          if [[ ! -d /ntfs/windows && ! -d /ntfs/Windows && ! -d /ntfs/WINDOWS ]]; then
                              echo "Not found"
                              umount /ntfs >/dev/null 2>&1
                              continue
                          fi
                          echo "Success"
                          break
                          ;;
                      *)
                          echo " * Partition $part not NTFS filesystem"
                          ;;
                  esac
              done
              if [[ ! $ntfsstatus -eq 0 ]]; then
                  echo "Failed"
                  debugPause
                  handleError "Failed to mount $part ($0)\n    Args: $*"
              fi
              echo "Done"
              debugPause
              . ${postdownpath}fog.updateregbarcode
              umount /ntfs
              ;;
          *)
              echo "Non-Windows Deployment"
              debugPause
              return
              ;;
      esac
      
      posted in FOG Problems
      D
      devrick
    • RE: Updating a registry file after deployment

      @george1421 This helped a lot. So you were right. Scrubbing my scripts with dos2unix fixed the issue for the most part. I was using vscode and assumed that it would be ok, but I guess it adds carriage returns as well. I was able to use reged and found some issues that I hope to be able to address.

      I am running into the issue of not being able to call the additional variables from here.
      For example the ${othertag}
      The way I was seeing if the variables could be called was by adding the following to fog.updateregbarcode

      echo "Hello" > /ntfs/test.txt
      ${othertag} > /ntfs/barcode.txt
      

      I even tried

      echo "Hello" > /ntfs/test.txt
      echo ${othertag} > /ntfs/barcode.txt
      

      The test.txt worked had “Hello”, but the barcode.txt was blank in both instances. I have verified that the host’s inventory has information in “Other Tag #1”. I noticed in the link that you previously shared that went over the various variables. And added the following code to fog.custominstall without success.

      if [[ ! -z $mac ]]; then
          curl -A "" -Lkso /tmp/hinfo.sh ${web}/fog/service/hinfo.php -d "mac=$mac"
          if [[ -f /tmp/hinfo.sh ]]; then
              . /tmp/hinfo.sh
          fi
      fi
      

      I am assuming that the variables come from /usr/share/fog/lib/funcs.sh, but I was not able to locate the variable “othertag”.

      posted in FOG Problems
      D
      devrick
    • RE: Updating a registry file after deployment

      @george1421 I am getting the following error:

      No such file or directory//fog.custominstall: line 2: /usr/share/fog/lib/funcs.sh
      /images/postdownloadscripts/fog.custominstall: line 4: syntax error near unexpected token '$' in\r''
      'images/postdownloadscripts//fog.custominstall: line 4: 'case $osid in
      

      The scripts that I have set up.

      fog.postdownload

      #!/bin/bash
      ## This file serves as a starting point to call your custom postimaging scripts.
      ## <SCRIPTNAME> should be changed to the script you're planning to use.
      ## Syntax of post download scripts are
      #. ${postdownpath}<SCRIPTNAME>
      . ${postdownpath}/fog.custominstall
      

      fog.custominstall

      #!/bin/bash
      . /usr/share/fog/lib/funcs.sh
      [[ -z $postdownpath ]] && postdownpath="/images/postdownloadscripts/"
      case $osid in
          5|6|7|9)
              clear
              [[ ! -d /ntfs ]] && mkdir -p /ntfs
              getHardDisk
              if [[ -z $hd ]]; then
                  handleError "Could not find hdd to use"
              fi
              getPartitions $hd
              for part in $parts; do
                  umount /ntfs >/dev/null 2>&1
                  fsTypeSetting "$part"
                  case $fstype in
                      ntfs)
                          dots "Testing partition $part"
                          ntfs-3g -o force,rw $part /ntfs
                          ntfsstatus="$?"
                          if [[ ! $ntfsstatus -eq 0 ]]; then
                              echo "Skipped"
                              continue
                          fi
                          if [[ ! -d /ntfs/windows && ! -d /ntfs/Windows && ! -d /ntfs/WINDOWS ]]; then
                              echo "Not found"
                              umount /ntfs >/dev/null 2>&1
                              continue
                          fi
                          echo "Success"
                          break
                          ;;
                      *)
                          echo " * Partition $part not NTFS filesystem"
                          ;;
                  esac
              done
              if [[ ! $ntfsstatus -eq 0 ]]; then
                  echo "Failed"
                  debugPause
                  handleError "Failed to mount $part ($0)\n    Args: $*"
              fi
              echo "Done"
              debugPause
              . ${postdownpath}fog.updateregbarcode
              umount /ntfs
              ;;
          *)
              echo "Non-Windows Deployment"
              debugPause
              return
              ;;
      esac
      

      fog.updateregbarcode

      #!/bin/bash
      ${othertag} > "/ntfs/barcode.txt"
      regfile="/ntfs/Windows/System32/config/SYSTEM"
      key="\UNITS Barcode\Barcode"
      devtag= ${othertag}
      reged -e "$regfile" &>/dev/null <<EOFREG
      ed $key
      $devtag
      q
      y
      EOFREG
      

      I am not sure on how to move forward. Thank you for your help.

      posted in FOG Problems
      D
      devrick
    • RE: Updating a registry file after deployment

      @george1421 In the example code that you shared.

      #!/bin/bash
      regfile="/ntfs/Windows/System32/config/SOFTWARE"
      key="\Microsoft\Windows\MyTags\SystemTag"
      devtag= ${othertag1}
      reged -e "$regfile" &>/dev/null <<EOFREG
      ed $key
      $devpath
      q
      y
      EOFREG
      

      There is a variable “$devpath” that is defined in fog.copydrivers. Is this something that I should add or could I remove the variable?

      EDIT: I believe that $devpath is suppose to be $devtag

      posted in FOG Problems
      D
      devrick
    • RE: Updating a registry file after deployment

      @george1421 I have been reading it over and I can’t locate the funcs.sh script. Located at

      /usr/share/fog/lib/funcs.sh
      

      There doesn’t seem to be a “fog” folder in “/usr/share”. Would you know where it would be located or maybe if I am overlooking a detail?

      posted in FOG Problems
      D
      devrick
    • RE: Updating a registry file after deployment

      @george1421 Thank you very much!

      posted in FOG Problems
      D
      devrick
    • Updating a registry file after deployment

      I have a small organization that stores its asset tag in a registry file on Windows 10. I want to take “Other Tag #1” from the host’s inventory and input it into this registry file. I am having a hard time trying to make this possible. Thank you in advance.

      posted in FOG Problems
      D
      devrick
    • RE: Deleting an image in the web UI is not removing it from the server.

      @sebastian-roth Thank you for your help. I just saw from a recent post exactly that, here.

      @george1421 said in Make room on fog server's storage:

      @sjensen If you delete the image from the image list (not from within the image definition) the deletion action will only remove the list entry and leave the raw files behind. If you go into the image record and delete the image from there, there is a checkbox to also remove the raw files (or something named similar). This will purge the files from the disk.

      posted in FOG Problems
      D
      devrick
    • Deleting an image in the web UI is not removing it from the server.

      When I delete an image from the FOG web UI it will remove it from there, but the storage space stays the same. The image is located in /images on the server. I am running CentOS 8. I believe that it may be a permissions issue, but when I log in with the management user I am able to manually delete the image from the server’s backend. Thank you for your help.

      posted in FOG Problems
      D
      devrick