export PATH=/usr/bin:/bin:/usr/sbin:/sbin
INFORM_PATH=/mnt/inform
+HAL_PATH=/mnt/hal
SYNC="/bin/sync"
MKDIR="/bin/mkdir"
MOUNT="/bin/mount"
UMOUNT="/bin/umount"
+DIRNAME="/bin/dirname"
REBOOT="/sbin/reboot"
BLKID="/usr/sbin/blkid"
+CP="/bin/cp"
#------------------------------------------------
# mount_partitions
fi
}
+#------------------------------------------------
+# mkdir_p_parent
+#------------------------------------------------
+mkdir_p_parent() {
+ dst_dir=`"$DIRNAME" "$1"`
+ if [ ! -d "$dst_dir" -a ! -L "$dst_dir" ]; then
+ "$MKDIR" -p "$dst_dir"
+ fi
+}
+
+#------------------------------------------------
+# copy_hal_data
+#------------------------------------------------
+copy_hal_data() {
+ if [ ! -e "/hal/.hal_list" ]; then
+ return
+ fi
+
+ need_copy=0
+ while read file
+ do
+ dst="/hal/${file}"
+
+ if [ ! -e $dst ]; then
+ need_copy=1
+ break
+ fi
+ done < /hal/.hal_list
+
+ PART_HAL=$("$BLKID" -L "hal" -o device)
+ if [ "$need_copy" = "1" -a "z$PART_HAL" != "z" ]; then
+ #mount hal partition
+ "$MKDIR" -p ${HAL_PATH}
+ "$MOUNT" ${PART_HAL} ${HAL_PATH} -o ro
+
+ #Load list and copy
+ while read file
+ do
+ src="${HAL_PATH}/$file"
+ dst="/hal/${file}"
+
+ mkdir_p_parent $dst
+
+ "$CP" -f "$src" "$dst"
+
+ done < /hal/.hal_list
+
+ #Done
+ "$UMOUNT" ${HAL_PATH}
+ fi
+}
+
#------------------------------------------------
# do_reboot
#------------------------------------------------
mount_partitions
mount_inform
+copy_hal_data
cd /