File: fake_home.sh

package info (click to toggle)
efl 1.21.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 261,264 kB
  • sloc: ansic: 1,026,744; cpp: 43,352; cs: 14,773; sh: 5,539; makefile: 3,347; objc: 1,518; pascal: 431; python: 322; xml: 182; sed: 16
file content (15 lines) | stat: -rwxr-xr-x 295 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

cleanup () {
    [ -n "$temp_HOME" ] && rm -r "$temp_HOME"
    [ -n "$temp_XDG_RUNTIME_DIR" ] && rm -r "$temp_XDG_RUNTIME_DIR"
}

trap cleanup EXIT

temp_HOME=$(mktemp -d)
temp_XDG_RUNTIME_DIR=$(mktemp -d)

env HOME="$temp_HOME" \
    XDG_RUNTIME_DIR="$temp_XDG_RUNTIME_DIR" \
    $*