Advertisement
vonschutter

Untitled

Nov 11th, 2022
1,159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.26 KB | None | 0 0
  1. toggle_oem_run_once () {
  2. # Task to run the OEM post configuaration on first login.
  3. # the OEM post configuration may allow for interaction if desired and would
  4. # best run on several distributions and in a full graphic environment.
  5. #
  6. # Globals:
  7. # Arguments: [script path] [optional:path to .desktop launcher]
  8. # Outputs:
  9. # Returns:
  10. # Usage:
  11. #
  12. # setup_oem_run_once /path/to/script.sh
  13. # End of documentation
  14.     _FILE=${2:-"/etc/xdg/autostart/oem-run.desktop"}
  15.     # If the launcher exists, delete it, else create it.
  16.     if [[ -e ${_FILE} ]] ; then
  17.         if [[ -w "${_FILE}" ]]
  18.         then
  19.             write_information "Removing execution on login of (${_FILE})"
  20.             rm ${_FILE}
  21.         else
  22.             write_warning "Write permission is NOT granted on ${_FILE}"
  23.             write_status "Requesting elevated privileges..."
  24.             sudo rm ${_FILE}
  25.         fi
  26.     else
  27.         cat > ${_FILE} <<-CREATE_START_LINK
  28.         # This will automatically start the RuntTime Data OEM config options on
  29.         # the first login. Once run this launcher will be moved to the /opt/rtd folder
  30.         # so that subsequent logins will not be plagued by the OEM setup.
  31.         #
  32.         [Desktop Entry]
  33.         Type=Application
  34.         Exec=sudo -E $1
  35.         Terminal=true
  36.         Hidden=false
  37.         X-GNOME-Autostart-enabled=true
  38.         Name=${_BACK_TITLE} OEM Run
  39.         Comment=OEM
  40.         CREATE_START_LINK
  41.     fi
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement