summarylogtreecommitdiffstats
path: root/simona-scripts
blob: ef716c7f6485ea2abdfde23ab024c54701a0fb45 (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
#!/bin/bash
# Simona Pisano - 2018-11-18 -
# simona-scripts
# Libertamente utilizzabile sotto GPL v3

if [[ $1 == "-h" || $1 == "--help" || $1 == "list" || $1 == "" ]] ; then

  cat << EOF
simona-scripts - GPL v3 license
image-mount       - image    - mount a big amount of image file (use -h for a full list)
image-umount      - imageu   - related to image-mount. umount all what mounted
pendrive-detect   - pendrive - detect a pendrive, size, full device
ioscheduler-list  - iosched  - list scheduler for all block devices
boot-kernel-list  - boot     - list kernels inside /boot, extract version (lile uname -r), say what is used in recent boot
uuid-change       - uuid     - change uuid of a volume
macinstall                   - install id files (commanded by config file)
EOF

  exit
elseif [[ $1 == "--version" ]]
  echo "simona-scripts Version 0.0"
  exit
fi

case $1 in
image|imageu|pendrive|ioched|boot)
  case $1 in
    image)    launch="image-mount" ;;
    imageu)   launch="image-umount" ;;
    pendrive) launch="pendrive-detect" ;;
    ioched)   launch="ioscheduler-list" ;;
    boot)     launch="boot-kernel-list" ;;
    uuid)     launch="uuid-change" ;;
    *) ;;
  esac
  ;;
image-mount|image-umount|pendrive-detect|ioscheduler-list|boot-kernel-list|uuid-change)
  launch=$1
  ;;
*)
  echo "Sorry, but this one is not a known simonascript bash script."
  launch=""
  ;;
esac

if [[ $launch != "" ]] ; then
  if [[ -r /bin/$launch ]] ; then
    echo "Launch '$launch'..."
    shift
    #. "$launch"
    exec "$launch" "$@"
  else
    echo "Installed package 'simona-script' is damaged. Script is unavailable. Please reinstall."
  fi
fi