This file is indexed.

/usr/bin/mic-create-isohybrid-recovery-image is in mic2 0.24.12-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash

kickstart=""
while getopts "hk:" options; do
  case $options in
    k)
	kickstart=$OPTARG
	shift 2
	if [ ! -f $kickstart ] ; then
		echo "kickstart file $kickstart doesn't exist."
		exit 1
	fi
	;;
    h) echo "Usage: $0 [-k kickstart] <live-image>"
         exit;;
    \?) echo "Usage: $0 [-k kickstart] <live-image>"
         exit 1;;
    *) echo "Usage: $0 [-k kickstart] <live-image>"
          exit 1;;
  esac
done

if [ $# -ne 1 ] ; then
	echo "Usage: $0 [-k kickstart] <live-image>"
	exit 1
fi

if [ $(/usr/bin/id -u) != 0 ]; then
    echo "You need to be root to run this script"
    exit 1
fi

image=$1
if [ ! -f $image ] ; then
	echo "$image isn't a live image."
	exit 1
fi

# Ensure selinux is turned off, don't know why
if [ -x /usr/sbin/setenforce ] ; then
	selinux=`/usr/sbin/getenforce`
	/usr/sbin/setenforce Permissive
fi

time=$(date +%Y%m%d%H%M%S)
recovery_image="recovery-image-$time.iso"
size=$(/usr/bin/du -s -B 1M $image | awk '{print $1;}')
if [ $size -le 512 ] ; then
	size=512
elif [ $size -le 1024 ] ; then
	size=1024
elif [ $size -le 1536 ] ; then
	size=1536
elif [ $size -le 2048 ] ; then
	size=2048
fi

recovery_mnt=$(/bin/mktemp -d)
live_mnt=$(/bin/mktemp -d)

/usr/bin/file $image | grep "ISO 9660" > /dev/null 2>&1
if [ $? -eq 0 ] ; then
	/bin/mount -o loop $image $live_mnt
	/bin/cp -a $live_mnt/* $recovery_mnt/
	/bin/umount $live_mnt
else
	/usr/bin/file $image | grep "x86 boot sector" > /dev/null 2>&1
	if [ $? -eq 0 ] ; then
		loopdev=$(/sbin/losetup -f)
		/sbin/losetup $loopdev $image
		/sbin/kpartx -a $loopdev
		/bin/mount /dev/mapper/${loopdev/\/dev\//}p1 $live_mnt
	else
		echo "Invalid image."
		exit 1
	fi
	/bin/cp -a $live_mnt/* $recovery_mnt/
	/bin/umount /dev/mapper/${loopdev/\/dev\//}p1
	/sbin/kpartx -d $loopdev
	/sbin/losetup -d $loopdev
fi
rm -rf $live_mnt

if [ -d $recovery_mnt/syslinux ] ; then
	mv $recovery_mnt/syslinux $recovery_mnt/isolinux
fi
if [ -f $recovery_mnt/isolinux/syslinux.cfg ] ; then
	mv $recovery_mnt/isolinux/syslinux.cfg $recovery_mnt/isolinux/isolinux.cfg
elif [ -f $recovery_mnt/isolinux/extlinux.conf ] ; then
	mv $recovery_mnt/isolinux/extlinux.conf $recovery_mnt/isolinux/isolinux.cfg
fi

kernel=$(sed -n '/kernel .*/p' $recovery_mnt/isolinux/isolinux.cfg | head -n 1 | sed 's/^.*kernel //g')
options=$(sed -n '/append .*/p' $recovery_mnt/isolinux/isolinux.cfg | head -n 1 | sed 's/ autoinst//;s/ netinst//;s/ liveinst//;s/ check//;s/ 4//;s/ nosplash//;' | sed 's/^.*append //g')
{
        echo "prompt 0"
        echo "timeout 0"
        echo "default $kernel $options autoinst recover 4 nosplash"
} > $recovery_mnt/isolinux/isolinux.cfg
cdlabel="Moblin"-$(/bin/date +%Y%m%d%H%M%S)
sed -i "s/=CDLABEL=[^ ]*/=CDLABEL=${cdlabel}/g;s/rootfstype=[^ ]*/rootfstype=iso9660/g" $recovery_mnt/isolinux/isolinux.cfg
sed -i "s/=UUID=[^ ]*/=CDLABEL=${cdlabel}/g;s/ rw / ro /g" $recovery_mnt/isolinux/isolinux.cfg
sed -i "s/ overlay=[^ ]*//g" $recovery_mnt/isolinux/isolinux.cfg
rm -rf $recovery_mnt/LiveOS/overlay*

if [ ! -z $kickstart -a -f $kickstart ] ; then
	/bin/cp $kickstart $recovery_mnt/moblin-recovery.ks
fi

/usr/bin/genisoimage -J -r -input-charset utf-8 -hide-rr-moved -hide-joliet-trans-tbl -V $cdlabel -o $recovery_image -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-info-table -boot-load-size 4 $recovery_mnt
rm -rf $recovery_mnt

# Restor selinux to original state
if [ -x /usr/sbin/setenforce ] ; then
	/usr/sbin/setenforce $selinux
fi

/usr/bin/isohybrid -partok $recovery_image
if [ $? -ne 0 ] ; then
	rm -f $recovery_image
	echo "Please use syslinux 3.81 or later version".
	exit 1
else
	if [ -f /usr/bin/implantisomd5 ] ; then
		/usr/bin/implantisomd5 $recovery_image
	fi
	echo "OS recovery image $recovery_image created successfully."
fi