mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-09-28 14:45:51 +00:00
Added support for udevless Linux distributions by providing a fallback
/proc/partitions-based drive detection method. The new method adds
support for Linux 2.4 and older systems. Thanks to Paul Marwick for
reporting and testing.
Fixed invalid error messages with directory-related operations.
Fixed invalid verbosity levels of console output of debug messages in
non-debug builds.
Improved rpm spec file - now supports building on OpenSUSE build
service with various distributions as targets.
47 lines
979 B
Bash
Executable File
47 lines
979 B
Bash
Executable File
#!/bin/sh
|
|
############################################################################
|
|
# Copyright:
|
|
# (C) 2008 Alexander Shaduri <ashaduri 'at' gmail.com>
|
|
# License: See LICENSE_zlib.txt file
|
|
############################################################################
|
|
|
|
|
|
if [ "$1" == "" ] | [ "$2" == "" ] | [ "$3" == "" ]; then
|
|
echo "Usage: $0 <input_file> <cpp_file> <symbol_name>";
|
|
exit 1;
|
|
fi
|
|
|
|
if [ ! -e $1 ]; then
|
|
echo "Cannot open input file \"$1\".";
|
|
exit 2;
|
|
fi
|
|
|
|
|
|
in_file="$1";
|
|
out_file="$2";
|
|
sym_name="$3";
|
|
size=`stat -c "%s" "$in_file"`
|
|
|
|
|
|
# header. extern means "global" in this context (needed because const
|
|
# variables are static by default).
|
|
echo "
|
|
|
|
extern const unsigned char ${sym_name}[] = {
|
|
" > "$out_file";
|
|
|
|
|
|
# file binary. "xxd(1) -i" can also do the trick
|
|
hexdump -v -e '1/1 "0x%X,\n"' "$in_file" >> "$out_file";
|
|
|
|
|
|
# footer. add 0x0 byte for easy stringifying
|
|
echo "
|
|
0x0 };
|
|
|
|
extern const unsigned int ${sym_name}_size = ${size};
|
|
|
|
" >> "$out_file";
|
|
|
|
|