LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-30-2018, 03:12 PM   #1
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
How to find out what user is using sudo while running a "make" ( slackbuild )


The Problem:

From what it looks like that I have looked Gkrellm(2) has no system wide theme dir:
Quote:
bwave@slackcurrent:~$ whereis gkrellm
gkrellm: /usr/bin/gkrellm /usr/man/man1/gkrellm.1.gz

bwave@slackcurrent:~$ whereis gkrellm2
gkrellm2: /usr/lib64/gkrellm2 /usr/include/gkrellm2
it has
Code:
  /usr/lib64/gkrellm2
plugins/
but when I added a themes to that dir, and put one inside of it. closed gkrellm, then started it again it still did not pick it up, so I do not believe that gkrellm has NO system wide themes directory.

so I have this tar I got off the net that someone put 4 different app themes that correspond with e16, I got it to split it up and put them in separate areas so it gets installed in the proper system side app/theme dir, then comes gkrellm(2) as this slackbuild has to be ran as root, getting who is really running this slackbuild I need to know how to do.

using $USER returns root how would I circumvent that and get the real user logged in?

the solution?
how to get the real user running as root when running a slackbuild, may be like this


$sudo ./someapp.Slackbuild

so I can get that name had check for a dir in that home, and put finish the building of the tgz for install?

Asking for a user name could be a security leak as they could as root install it into anyone elses home.

it is the last case statement that I am needing to finish.




Code:
PRGNAM=e16.theme.pack			 
VERSION=${VERSION:-1.0.2}	 
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}		 

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}	 
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}	 

case "$gkrellm" in
  YES) gkrellm=yes ;;
esac



set -e 
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
while read dir ; do
	echo "dir=: $dir"
	while read subdir ; do
		case "$subdir" in
		Eterm)	
			echo "got Eterm"
			ThemePkgName="$dir"
			appName="$subdir"
			Pkgto="$PKG/usr/share/Eterm/themes/$ThemePkgName"
				
			if [[ -d /usr/share/Eterm ]] ; then
			{
				mkdir -p $Pkgto					
				cp -rv $ThemePkgName/$appName/* "$Pkgto"
			}
			fi
			;;
		e16)
			echo "got e16"
			ThemePkgName="$dir"
			appName="$subdir"
			Pkgto="$PKG/usr/share/e16/themes/$ThemePkgName"
				
			if [[ -d /usr/share/e16 ]] ; then
			{
				mkdir -p $Pkgto					
				cp -rv $ThemePkgName/$appName/* "$Pkgto"
			}
			fi
			;;
		audacious)
			echo "got audacious"
			ThemePkgName="$dir"
			appName="$subdir"
			Pkgto="$PKG/usr/share/audacious/Skins/$ThemePkgName"
			
			if [[ -d /usr/share/audacious ]] ; then
			{
				mkdir -p $Pkgto					
				cp -rv $ThemePkgName/$appName/* "$Pkgto"
			}
			fi
			;;
		gkrellm2)
		echo "$USER" = root
		echo "$gkrellm"
		exit
			if [[ "$gkrellm" == 'yes' ]] ; then
			{
				echo "got gkrellm2"
				ThemePkgName="$dir"
				appName="$subdir"
				user="$USER"/.gkrellm2
				Pkgto="$PKG/$user/themes/$ThemePkgName"		
			
				if [[ -d "$user" ]] ; then
				{
					mkdir -p $Pkgto					
					cp -rv $ThemePkgName/$appName/* "$Pkgto"
				}
				fi
			}
			fi
				;;
				esac
	done <<< "$(ls $(pwd)/$dir)"
done <<<"$(ls)"

exit


mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
find $PKG/usr/doc -type f -exec chmod 0644 {} \;

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

Last edited by BW-userx; 10-30-2018 at 03:16 PM.
 
Old 10-30-2018, 05:29 PM   #2
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950

Rep: Reputation: Disabled
I'm not sure this is portable, but it seems to work in Slackware.

Code:
sudo sh -c 'echo $SUDO_USER'
 
Old 10-30-2018, 06:16 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Original Poster
Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by orbea View Post
I'm not sure this is portable, but it seems to work in Slackware.

Code:
sudo sh -c 'echo $SUDO_USER'
waaahhhhttttt? I ended up doing some finagling using who and awk to get me user name. I didn't know there was a variable to that one. But, this slackbuild is not working when I was trying to install into a user home directory, I think they got it
setup to avoid that, then I dug some more and found the doc page on the themes themselves, and it works now if I create a
new directory in share/gkrellm2/themes so now their is 3 different places that app is located within the system. the plugins are in /usr/lib64/gkrellm2/plugins, the themes have to be put into /usr/share/gkrellm2/themes/ in order to work, and the program is in bin.

(marking solved)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sbopkg installs "original" SlackBuild to /usr/doc/<pkg>/ instead of "local" SlackBuild drumz Slackware 29 01-20-2018 12:12 AM
[SOLVED] "sudo: Can't mkdir /var/run/sudo/%user%: File exists" CNBarnes Linux - Server 7 01-10-2011 04:11 PM
"Cannot find assembly...gnome-sharp.dll" when running make against muine-0.6.3 TakeAwayDave Linux - Newbie 3 09-11-2005 07:46 AM
User "list" running process "python" TroelsSmit Linux - Newbie 2 02-22-2005 04:55 AM
normal user want to perform "init 6" by using " sudo acbenny Linux - General 3 08-08-2004 07:41 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration