Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 199805 Details for
Bug 168382
klik client (ebuild request)
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
klik install script (to be run as user)
install (text/plain), 15.04 KB, created by
Arne Babenhauserheide
on 2009-08-01 13:08:30 UTC
(
hide
)
Description:
klik install script (to be run as user)
Filename:
MIME Type:
Creator:
Arne Babenhauserheide
Created:
2009-08-01 13:08:30 UTC
Size:
15.04 KB
patch
obsolete
>#!/bin/bash > ># ># klik 0.5.1.3 installer w/ cmg support ># GPL ># point-and-klik software installation ># by probono at myrealbox dot com ># thanks for valuable help from bfree and Kano ># > >export PATH=/sbin:$PATH # Fedora needs this > ># store the dir to return to it >ORIGDIR=$(pwd) >cd $HOME > >if [ -z "$DIALOG" ] ; then ># Determine which dialog to use in which situation: ># Xdialog (in all other cases) >export DIALOG=Xdialog ># kdialog (in case there is no console available and we are running KDE) >pidof -x kdeinit >/dev/null && export DIALOG=kdialog ># zenity (in case of GNOME) >pidof -x gnome-panel >/dev/null && export DIALOG=zenity ># dialog (in case there is a console available) >GUIMODE=$(tty) >( echo $GUIMODE | grep /dev/tty[:digit:] >/dev/null ) && export DIALOG=dialog >fi > ># by Alexey >if test "$DISPLAY" == ""; then >DIALOG=dialog >fi > ># Setup defaults for whatever dialog we are using >case $DIALOG in > kdialog) > DIALOG_OPTIONS=" --caption klik" ; > KLIKDIR=":klikdir" ;; > Xdialog|dialog) > DIALOG_H=12 > DIALOG_W=60 > DIALOG_OPTIONS=" $DIALOG_H $DIALOG_W" ; > KLIKDIR="~" ;; >esac > >dmsgbox(){ >case $DIALOG in > zenity) > zenity --info --text="$1" --title="klik" > ;; > *) > $DIALOG --msgbox "$1" $DIALOG_OPTIONS > ;; > esac >} >dyesno(){ > $DIALOG --yesno "$1" $DIALOG_OPTIONS >} >dwarningyesno(){ > case $DIALOG in > kdialog) > $DIALOG --warningyesno "$1" $DIALOG_OPTIONS > ;; > Xdialog|dialog) > $DIALOG --yesno "Warning: $1" $DIALOG_OPTIONS > ;; > esac >} >derror(){ > case $DIALOG in > zenity) > zenity --error --text="$1" --title="klik" > ;; > kdialog) > $DIALOG --error "$1" $DIALOG_OPTIONS > ;; > Xdialog|dialog) > $DIALOG --msgbox "ERROR: $1" $DIALOG_OPTIONS > ;; > esac >} > >cat > $HOME/.klik <<\EOF >#!/bin/bash > ># klik client 0.2 ># GPL ># point-and-klik KDE software installation ># by probono at myrealbox dot com ># thanks to bfree for non-KDE part > >export PATH=/sbin:$PATH # Fedora needs this > ># try to get the human-readable version of the host OS >export VERSION=$(cat /etc/*version 2>/dev/null | head -n 1) > ># ># support different types of dialog, thanks bfree ># > >if [ -z "$DIALOG" ] ; then ># Determine which dialog to use in which situation: ># Xdialog (in all other cases) >DIALOG=Xdialog ># kdialog (in case there is no console available and we are running KDE) >pidof -x kdeinit >/dev/null && DIALOG=kdialog ># GNOME >pidof -x gnome-panel >/dev/null && DIALOG=zenity ># dialog (in case there is a console available) >GUIMODE=$(tty) >( echo $GUIMODE | grep /dev/tty[:digit:] >/dev/null ) && DIALOG=dialog >fi > ># by Alexey >if test "$DISPLAY" == ""; then >DIALOG=dialog >fi > >export DIALOG > ># Setup defaults for whatever dialog we are using >case $DIALOG in > kdialog) > DIALOG_OPTIONS=" --caption klik" ; > KLIKDIR=":klikdir" ;; > Xdialog|dialog) > DIALOG_H=12 > DIALOG_W=60 > DIALOG_OPTIONS=" $DIALOG_H $DIALOG_W" ; > KLIKDIR="~" ;; >esac > >dmsgbox(){ > $DIALOG --msgbox "$1" $DIALOG_OPTIONS >} >dyesno(){ > $DIALOG --yesno "$1" $DIALOG_OPTIONS >} >dwarningyesno(){ > case $DIALOG in > kdialog) > $DIALOG --warningyesno "$1" $DIALOG_OPTIONS > ;; > Xdialog|dialog) > $DIALOG --yesno "Warning: $1" $DIALOG_OPTIONS > ;; > esac >} >derror(){ > case $DIALOG in > zenity) > zenity --error --text="$1" --title="klik" > ;; > kdialog) > $DIALOG --error "$1" $DIALOG_OPTIONS > ;; > Xdialog|dialog) > $DIALOG --msgbox "ERROR: $1" $DIALOG_OPTIONS > ;; > esac >} >dexistingdir(){ > case $DIALOG in > kdialog) > $DIALOG --getexistingdirectory $KLIKDIR $DIALOG_OPTIONS > ;; > Xdialog) > $DIALOG --dselect $KLIKDIR $DIALOG_OPTIONS > ;; > dialog) > $DIALOG --fselect $KLIKDIR $DIALOG_OPTIONS > ;; > esac >} > ># important to export those variables so that they can be accessed by the recipes >##export SUSE=$(cat /etc/SuSE-release 2>/dev/null | head -n 1 | cut -d \( -f 1) 2>/dev/null >UBUNTU=$(zcat /usr/share/doc/ubuntu-base/changelog.gz 2>/dev/null | head -n 1 | cut -d \; -f 1 ) 2>/dev/null >export UBUNTU=$(echo ${UBUNTU/ubuntu-meta/Ubuntu}) >##export FEDORA=$(cat /etc/fedora-release 2>/dev/null | head -n 1) >export FEDORA=$(cat /etc/*release | tr -d [[:cntrl:]] 2>/dev/null) >export RUN=`echo $1 | sed s@klik:\/\/@@` && (wget -q http://134.169.172.48/apt/?package=$RUN -U "klik/0.1.3cli (`uname -a` @$VERSION$UBUNTU$SUSE$FEDORA@)" -O - | bash || derror "Error while trying to run $RUN" ) > >EOF >chmod 700 ~/.klik > ># ># create helper protocol for konqueror to send klicks to the klik script ># > >[ x"$KDEHOME" = x ] && KDEHOME=$HOME/.kde > >mkdir -p $KDEHOME/share/services/ >cat > ${KDEHOME}/share/services/klik.protocol <<EOF ># klik 0.2 ># helper protocol for konqueror to send klicks to the klik script ># by probono >[Protocol] >exec=$HOME/.klik '%u' >protocol=klik >input=none >output=none >helper=true >listing=false >reading=false >writing=false >makedir=false >deleting=false >icon=package >Description=klik >EOF > ># ># create ~/.kde/share/applnk/klik ># > >mkdir -p ${KDEHOME}/share/applnk/klik > >cat > ${KDEHOME}/share/applnk/klik/.directory <<EOF >[Desktop Entry] >Encoding=UTF-8 >Name=Applications (installed by klik) >Name[de]=Programme (installiert mit klik) >Icon=rebuild >#package_applications >EOF > ># ># link to the store ># > >cat > ${KDEHOME}/share/applnk/klik/klik.desktop <<EOF >[Desktop Entry] >Encoding=UTF-8 >Exec=konqueror http://klik.atekon.de?from=profile >Icon=package_network >Name=Install more software... >Name[de]=Weitere Software installieren... >EOF > > ># ># set klik protocol handler in Mozilla (tested with Firefox 0.9.3) ># > >PROFILES=$(find $HOME/.mozilla/ | grep prefs.js$) >if [ -z "$PROFILES" ] >then >dmsgbox "You need to start the mozilla/firefox browser once before running the klik installer if you want it to support klik. If you do not use mozilla/firefox you can ignore this message. If you plan on using mozilla/firefox with klik please run and exit the browser and then install klik again." >else >for i in $PROFILES >do > USERJS="$(dirname "$i")/user.js" > ( cat $USERJS 2>/dev/null | grep "klik" >/dev/null 2>&1 ) || ( echo "user_pref(\"network.protocol-handler.app.klik\", \"~/.klik\");" >> $USERJS ) >done > >( ps -d | grep mozilla ) && dmsgbox "You need to restart Mozilla/Firefox before you will be able to use klik there." >fi > ># ># Add support for the klik protocol to elinks ># >[ -e $HOME/.elinks ] || mkdir -p $HOME/.elinks >[ -e $HOME/.elinks/elinks.conf ] || touch $HOME/.elinks/elinks.conf >cat >> $HOME/.elinks/elinks.conf <<EOF > >## protocol >## protocol.user >## protocol.user.klik >## protocol.user.klik._template_ <str> >set protocol.user.klik._template_ = "" >## protocol.user.klik.unix <str> >set protocol.user.klik.unix = "~/.klik %h" >## protocol.user.klik.unix-xwin <str> >set protocol.user.klik.unix-xwin = "~/.klik %h" >EOF > ># >DESCRIPTION="EXPERIMENTAL implementation of cmg-compressed AppDirs (AppImages, really) for klik. Using this technology, every app is contained inside one file that is mounted and unmounted transparently on demand." ># > >mkdir -p ${KDEHOME}/share/mimelnk/all >cat > ${KDEHOME}/share/mimelnk/all/cmg.desktop <<\EOF >[Desktop Entry] >Comment= >Hidden=false >Icon=view_remove >MimeType=application/x-extension-cmg >Patterns=*.cmg >Type=MimeType >EOF > >mkdir -p ${KDEHOME}/share/applnk/.hidden >cat > ${KDEHOME}/share/applnk/.hidden/AppRun.desktop<<\EOF >[Desktop Entry] >Comment= >Exec=$HOME/.zAppRun %U >Icon=view_remove >InitialPreference=2 >MimeType=application/x-extension-cmg;Application >Name= >ServiceTypes= >Terminal=false >Type=Application >EOF > >cat > $HOME/.zAppRun <<\EOF >#!/bin/bash > ># by probono at myrealbox dot com ># thanks to bfree ># GPL > >export PATH=/sbin:$PATH # Fedora needs this > ># ># ok we need dialogs now ># >if [ -z "$DIALOG" ] ; then ># Determine which dialog to use in which situation: ># Xdialog (in all other cases) >export DIALOG=Xdialog ># kdialog (in case there is no console available and we are running KDE) >pidof -x kdeinit >/dev/null && export DIALOG=kdialog >pidof -x gnome-panel > /dev/null && export DIALOG=zenity ># dialog (in case there is a console available) >GUIMODE=$(tty) >( echo $GUIMODE | grep /dev/tty[:digit:] >/dev/null ) && export DIALOG=dialog >fi > ># by Alexey >if test "$DISPLAY" == ""; then >DIALOG=dialog >fi > ># Setup defaults for whatever dialog we are using >case $DIALOG in > kdialog) > DIALOG_OPTIONS=" --caption klik" ; > KLIKDIR=":klikdir" ;; > Xdialog|dialog) > DIALOG_H=12 > DIALOG_W=60 > DIALOG_OPTIONS=" $DIALOG_H $DIALOG_W" ; > KLIKDIR="~" ;; >esac > >derror(){ > case $DIALOG in > zenity) > $DIALOG --error --text "$1" --title="klik" > ;; > kdialog) > $DIALOG --error "$1" $DIALOG_OPTIONS > ;; > Xdialog|dialog) > $DIALOG --msgbox "ERROR: $1" $DIALOG_OPTIONS > ;; > esac >} > ># check fstab and warn if neccessary entries are not there ># better use /media/klik according to FSH? >if [ -z "$(cat /etc/fstab | grep app/7)" ] >then > derror "Your /etc/fstab is not yet prepared for mounting .cmg images. > As root, please make /tmp/app writeable and add the following lines: > > ################################################################ >/tmp/app/1/image /tmp/app/1 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/2/image /tmp/app/2 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/3/image /tmp/app/3 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/4/image /tmp/app/4 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/5/image /tmp/app/5 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/6/image /tmp/app/6 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/7/image /tmp/app/7 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >################################################################" > exit 1 >fi > ># rewrite cmdline to use absolute instead of relative paths, thanks bfree >NEWCMD=$(perl -e '$newcmd=shift(@ARGV);foreach $arg (@ARGV){ @part=split(/\=/,$arg); foreach $part (@part){ (-e "$ENV{PWD}/$part") && ($part="$ENV{PWD}/$part");}$newcmd.=" ".join ("=",@part);} print "$newcmd";' $@) >set -- $NEWCMD > ># if no arguments are passed and ># there is a .cmg in the same directory as this ># script, then use the .cmg >DIRNAME=$(dirname $0) >if [ -z $1 ] >then > CMG=$(find "$DIRNAME" -iname '*.cmg'|head -n 1) || exit 1 > echo "Found $CMG, using it" >else > CMG="$1" > shift >fi > ># make path to CMG absolute, thanks bfree >case $CMG in >/*) ;; >*) CMG=$(pwd)/$CMG ;; >esac > ># determine which filesystem is used as .cmg >#file $CMG | grep ": data" >/dev/null && FS=squash # who knows a better way to recognize it? >##file $CMG | grep "Compressed ROM" >/dev/null && FS=cram >##file $CMG | grep "ISO 9660" >/dev/null && FS=iso > >##if [ -n "$FS" ] >##then > NUMBERS="7 6 5 4 3 2 1" > for NUMBER in $NUMBERS > do > [ -e "/tmp/app/$NUMBER" ] || MNTNUM=$NUMBER > done > case $FS in > squash) MOUNT=/tmp/squash/$MNTNUM ;; > *) MOUNT=/tmp/app/$MNTNUM ;; > esac > mkdir -p $MOUNT || exit 1 > ln -s $CMG $MOUNT/image || exit 1 > mount $MOUNT || derror "Unable to mount $MOUNT" >##else >## # NOTE: exit now cause our cmg isn't mounted >## derror "$CMG does not appear to be either a squashfs, iso9660 or a cramfs file" >## exit 1 >##fi > > # > # execute the wrapper > # the wrapper should take care to keep running until its app closes > # > > # we need this so that on the cmdline, pipes etc work > CMDLINE="yes" > ( tty | grep ^/dev/tty >/dev/null ) && CMDLINE="" > ( tty | grep ^/dev/pts >/dev/null ) && CMDLINE="" > if [ "$CMDLINE" = "yes" ] ; then > RESULT=$($MOUNT/wrapper $@ 2>&1) || derror "$RESULT" > else > $MOUNT/wrapper $@ > fi > > # kill all child processes > # kill $(pidof -x -o %PPID $!) # 2>/dev/null > > # unmount and clean up > umount $MOUNT > rm -f $MOUNT/image > rm -r $MOUNT/ > > ################## > # update klik menu > > CMGDIR=$(dirname $CMG) > [ x"$KDEHOME" = x ] && KDEHOME=$HOME/.kde > > # find cmg files > CMGFILES=$(find $CMGDIR/*.cmg 2>/dev/null) > > # remove old menu entries > rm -rf ${KDEHOME}/share/applnk/klik/*.cmg.desktop > > # create new menu entries > for CMGFILE in $CMGFILES > do > #echo $CMGFILE > BASENAME=$(basename "$CMGFILE") > APPNAME=$(echo $BASENAME | sed 's/.cmg//g' | cut -d _ -f 1) > firstchar=${APPNAME:0:1} # First character. > restchar=${APPNAME:1} # Rest of string(s). > firstchar=$(echo "$firstchar" | tr a-z A-Z) > APPNAME=$firstchar$restchar > cat > $KDEHOME/share/applnk/klik/$BASENAME.desktop <<EOmooF > [Desktop Entry] > Encoding=UTF-8 > Type=Application > Exec=$HOME/.zAppRun $CMGFILE > Icon= > Name=$APPNAME >EOmooF > done >EOF > >chmod 0755 $HOME/.zAppRun > ># ># Create the script for root to install cmg support ># > >if [ -z "$(cat /etc/fstab | grep app/7)" ] >then > >cat > "$HOME/klik-cmg-install-root" <<EOF >#!/bin/bash >echo >> /etc/fstab " >/tmp/app/1/image /tmp/app/1 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/2/image /tmp/app/2 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/3/image /tmp/app/3 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/4/image /tmp/app/4 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/5/image /tmp/app/5 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/6/image /tmp/app/6 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >/tmp/app/7/image /tmp/app/7 cramfs,iso9660 user,noauto,ro,loop,exec 0 0 >" >if ! [ -e /tmp/app ] >then >mkdir -p /tmp/app >chmod 0777 /tmp/app >#dmsgbox "/tmp/app has been created so it can be used by anyone. You may want to make /tmp/app only writable by one group (like users) which you could do with: \nchgrp users /tmp/app \nchmod 770 /tmp/app\" >fi >EOF >chmod 0755 "$HOME/klik-cmg-install-root" > >(sudo sh "$HOME/klik-cmg-install-root" && rm -f "$HOME/klik-cmg-install-root") || (gksudo sh "$HOME/klik-cmg-install-root" && rm -f "$HOME/klik-cmg-install-root") || (dmsgbox "Your /etc/fstab is not setup to use cmg files. Please run $HOME/klik-cmg-install-root as root.") >fi > ># ># ># > >case $DIALOG in >Xdialog) BROWSER="firefox http://klik.atekon.de?from=profile" ;; >zenity) BROWSER="firefox http://klik.atekon.de?from=profile" ;; >dialog) BROWSER="elinks http://klik.atekon.de?from=profile" ;; >*) BROWSER="konqueror http://klik.atekon.de?from=profile" ;; >esac > >kbuildsycoca 2>/dev/null >dmsgbox "Now you can start installing software. \n Opening the klik point-and-klik software store..." && $BROWSER & > >cd $ORIGDIR > ># ># GNOME support for cmg - added by probono Aug 21, 2005 ># > ># how to make $HOME variable here? >mkdir -p $HOME/.local/share/applications/ >cat > $HOME/.local/share/applications/.zAppRun.desktop << EOF >[Desktop Entry] >Encoding=UTF-8 >Name=.zAppRun >MimeType=application/x-extension-cmg; >Exec='$HOME/.zAppRun' >Type=Application >Terminal=false >NoDisplay=true >EOF > >mkdir -p $HOME/.local/share/mime/packages/ >cat > $HOME/.local/share/mime/packages/Override.xml << EOF ><?xml version="1.0" encoding="UTF-8"?> ><mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> > <mime-type type="application/x-extension-cmg"><comment>Compressed Application Image</comment><glob pattern="*.cmg"/> > <magic priority="50"> > <match value="Compressed" type="string" offset="16"/> > </magic> > </mime-type> ></mime-info> >EOF > >update-mime-database ~/.local/share/mime/ >/dev/null 2>&1 >update-desktop-database -v ~/.local/share/applications/ >/dev/null 2>&1 > >mkdir -p $HOME/.local/share/applications $HOME/.gnome2/vfolders/applications 2>/dev/null > ln -sf $KDEHOME/share/applnk/klik $HOME/.local/share/applications 2>/dev/null > ln -s $KDEHOME/share/applnk/klik $HOME/.gnome2/vfolders/applications 2>/dev/null > ># klik protocol handler for all of gnome apps >gconftool-2 -t string -s /desktop/gnome/url-handlers/klik/command "$HOME/.klik %s" &2>/dev/null >gconftool-2 -t bool -s /desktop/gnome/url-handlers/klik/enabled true &2>/dev/null >gconftool-2 -t bool -s /desktop/gnome/url-handlers/klik/needs_terminal false &2>/dev/null
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 168382
: 199805