|
@@ -1,5 +1,5 @@
|
|
|
#!/bin/bash
|
|
|
-#stat --format '%G' inst
|
|
|
+
|
|
|
# Functions
|
|
|
function inst_out
|
|
|
{
|
|
@@ -11,6 +11,11 @@ function inst_fatal
|
|
|
inst_out "FATAL : $1"
|
|
|
}
|
|
|
|
|
|
+function inst_fail
|
|
|
+{
|
|
|
+ inst_fatal 'installation has failed'
|
|
|
+}
|
|
|
+
|
|
|
# Welcome
|
|
|
inst_out 'Script begins'
|
|
|
|
|
@@ -101,7 +106,32 @@ then
|
|
|
fi
|
|
|
|
|
|
# Check if all right
|
|
|
+output="$target$script"
|
|
|
+owner_user=`stat --format '%U' $output`
|
|
|
+owner_group=`stat --format '%G' $output`
|
|
|
|
|
|
+if [ ! -e $output ]
|
|
|
+then
|
|
|
+ inst_fatal "$output does not exist"
|
|
|
+ inst_fail
|
|
|
+ exit 1
|
|
|
+elif [ $owner_user != $user ]
|
|
|
+then
|
|
|
+ inst_fatal "$output owner user is not $user but $owner_user"
|
|
|
+ inst_fail
|
|
|
+ exit 1
|
|
|
+elif [ $owner_group != $user ]
|
|
|
+then
|
|
|
+ inst_fatal "$output group is not $user but $owner_group"
|
|
|
+ inst_fail
|
|
|
+ exit 1
|
|
|
+elif [ ! -x $output ]
|
|
|
+then
|
|
|
+ inst_fatal "$output is not executable"
|
|
|
+ inst_out "fix : sudo chmod u+x $output"
|
|
|
+ inst_fail
|
|
|
+ exit 1
|
|
|
+fi
|
|
|
|
|
|
# End
|
|
|
inst_out 'Script finished'
|