change check_write so it functions similarly to has_root

This commit is contained in:
chess.griffin 2009-01-24 03:37:22 +00:00
parent 14cc6fe331
commit 7baa04f4b9

View file

@ -207,10 +207,14 @@ has_root () {
check_write () { check_write () {
# Check to see whether the user has write permissions on the # Check to see whether the user has write permissions on the
# directory. # directory.
# FIXME: testing change to this function; if working ok, grep for
# check_write and remove commented out code.
if [ ! -w $1 ]; then if [ ! -w $1 ]; then
WRITE="false" #WRITE="false"
return 1
else else
WRITE="true" #WRITE="true"
return 0
fi fi
} }
@ -1490,8 +1494,9 @@ rsync_repo () {
continue continue
fi fi
directory_checks directory_checks
check_write $LOCALREPO/$SLACKVER/ if ! check_write $LOCALREPO/$SLACKVER/; then
if [ "$WRITE" = "false" ]; then #check_write $LOCALREPO/$SLACKVER/
#if [ "$WRITE" = "false" ]; then
if [ "$DIAG" = 1 ]; then if [ "$DIAG" = 1 ]; then
dialog --title "ERROR" --msgbox \ dialog --title "ERROR" --msgbox \
"You do not have write permissions on the target directory." \ "You do not have write permissions on the target directory." \
@ -1876,8 +1881,9 @@ edit_local_slackbuild () {
# This function allows the user to create and edit a local copy of the # This function allows the user to create and edit a local copy of the
# SlackBuild. # SlackBuild.
local SHORTPATH=$LOCALREPO/$SLACKVER/$CATEGORY/$APP local SHORTPATH=$LOCALREPO/$SLACKVER/$CATEGORY/$APP
check_write $SHORTPATH if ! check_write $SHORTPATH; then
if [ "$WRITE" = "false" ]; then #check_write $SHORTPATH
#if [ "$WRITE" = "false" ]; then
dialog --title "ERROR" --msgbox "You do not have write \ dialog --title "ERROR" --msgbox "You do not have write \
permissions on the target directory." 8 30 permissions on the target directory." 8 30
continue continue
@ -1891,8 +1897,9 @@ edit_local_slackbuild () {
delete_local_slackbuild () { delete_local_slackbuild () {
# This function allows the user to delete the local SlackBuild. # This function allows the user to delete the local SlackBuild.
local SHORTPATH=$LOCALREPO/$SLACKVER/$CATEGORY/$APP local SHORTPATH=$LOCALREPO/$SLACKVER/$CATEGORY/$APP
check_write $SHORTPATH if ! check_write $SHORTPATH; then
if [ "$WRITE" = "false" ]; then #check_write $SHORTPATH
#if [ "$WRITE" = "false" ]; then
dialog --title "ERROR" --msgbox \ dialog --title "ERROR" --msgbox \
"You do not have write permissions on the target directory." 8 30 "You do not have write permissions on the target directory." 8 30
continue continue
@ -1970,8 +1977,9 @@ pick_slackbuild () {
edit_local_info () { edit_local_info () {
# This function allows the user to create and edit a local copy of the # This function allows the user to create and edit a local copy of the
# .info file. # .info file.
check_write $LOCALREPO/$SLACKVER/$CATEGORY/$APP if ! check_write $LOCALREPO/$SLACKVER/$CATEGORY/$APP; then
if [ "$WRITE" = "false" ]; then #check_write $LOCALREPO/$SLACKVER/$CATEGORY/$APP
#if [ "$WRITE" = "false" ]; then
dialog --title "ERROR" --msgbox "You do not have write \ dialog --title "ERROR" --msgbox "You do not have write \
permissions on the target directory." 8 30 permissions on the target directory." 8 30
continue continue
@ -1985,8 +1993,9 @@ edit_local_info () {
delete_local_info () { delete_local_info () {
# This function allows the user to delete the local .info file. # This function allows the user to delete the local .info file.
check_write $LOCALREPO/$SLACKVER/$CATEGORY/$APP if ! check_write $LOCALREPO/$SLACKVER/$CATEGORY/$APP; then
if [ "$WRITE" = "false" ]; then #check_write $LOCALREPO/$SLACKVER/$CATEGORY/$APP
#if [ "$WRITE" = "false" ]; then
dialog --title "ERROR" --msgbox \ dialog --title "ERROR" --msgbox \
"You do not have write permissions on the target directory." 8 30 "You do not have write permissions on the target directory." 8 30
continue continue
@ -2472,8 +2481,9 @@ utilities_menu () {
cleanup () { cleanup () {
# Clean up cruft and remove temporary files. # Clean up cruft and remove temporary files.
check_write $TMP if ! check_write $TMP; then
if [ $WRITE = "false" ]; then #check_write $TMP
#if [ $WRITE = "false" ]; then
echo echo
echo "ERROR" echo "ERROR"
echo "Sbopkg attempted to clean out leftover files in \$TMP," echo "Sbopkg attempted to clean out leftover files in \$TMP,"