Welcome to mirror list, hosted at ThFree Co, Russian Federation.

preinit « etc « rootfs « hakchi « mod_hakchi « mods - github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1a4eab6318b411546e80a1eac34c876562c231ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
rand(){
  hexdump -e '"%x"' -n 4 /dev/urandom
}

source_parts(){
  [ -z "$temppath" ] && temppath="/tmp"
  mkdir -p "$temppath"
  local script="$temppath/script_$(rand)"
  rm -f "$script"
  local searchpath="$(dirname "$1")"
  [ -d "$searchpath" ] || return 1
  for i in $(find "$searchpath" -maxdepth 1 -path "$1" | sort); do
    cat "$i" >> "$script"
  done
  dos2unix -u "$script"
  source "$script"
  local ret=$?
  rm -f "$script"
  return $ret
}

source_base(){
  if [ -d "$1" ]; then
    source_parts "$1/b????_*"
    return 0
  fi
  if [ -d "$preinitpath" ]; then
    source_parts "$preinitpath/b????_*"
    return 0
  fi
  if [ -d "$rootfs/etc/preinit.d" ]; then
    source_parts "$rootfs/etc/preinit.d/b????_*"
    return 0
  fi
  if [ -d "/etc/preinit.d" ]; then
    source_parts "/etc/preinit.d/b????_*"
    return 0
  fi
  return 1
}

source_config(){
  [ -f "$preinitpath/p0000_config" ] && source "$preinitpath/p0000_config"
}

save_config(){
  [ -f "$preinitpath/pffff_config" ] && source "$preinitpath/pffff_config"
}

script_init(){
  source_base
  source_config
}

preinit(){
  [ -z "$gamepath" ] && [ -d "/newroot" ] && /bin/busybox --install -s /bin/ && cp -a "$rootfs/bin/rsync" /bin/
  source_base
  source_parts "$preinitpath/p????_*"
}