Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 24 Oct 2014, 14:13
All times are UTC - 4
 Forum index » Advanced Topics » Cutting edge
Slaxer_Pup 4.12 solid and stable non woof build
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 30 of 32 Posts_count   Goto page: Previous 1, 2, 3, ..., 28, 29, 30, 31, 32 Next
Author Message
amigo

Joined: 02 Apr 2007
Posts: 2261

PostPosted: Sat 20 Feb 2010, 13:04    Post_subject:  

Actually, the 'neatest' patches are to be had by separating the changes between bug-fix, feature, formatting and hacks -or other such 'categories'. It just means making a couple of extra inetrmediate diffs as you add in all your changes, but it keeps the code separate -especially for features/hacks. You'll be glad you did the netx time you go to apply the changes against a new version of the original tools, or whatever.
Personally, I'd just leave the functioning code for the tbz/tlz packages as it will make your patches shorter and neater. Or just comment it and leave it -when you change the number of lines drastically the diffs are harder interpret visually with xdiff or other such viewer.

I agree with the commenting/removal of the code which doesn't allow to use makepkg in the current directory -that's new lately in slack pkgtools.

I appreciate you posting your work -I was able to get an overview of what you had changed pretty easily. Oh, BTW, you have a routine there which creates a script in /var/log/setup -there's a line (~326) in /etc/rc.d/rc.S which wipes that out on every boot. Probably best to create that first when your tool runs and then remove it when finished.

I'm looking at how to integrate some of that into my pkgtools version. I'm also working making all my init routines use dash to speed boot-times. I'm using a statically-linked /bin/dash called specifically by the main rc.* files. /bin/sh is still linked to bash to avoid problems with any scripts we don't have control of.
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sat 20 Feb 2010, 16:35    Post_subject:  

Hey Gilbert (amigo)


thanks for the tips !
-----------------------

here's a small script to help out with those lazy people who like drag N drop package installs Very Happy

if you don't care to see the progress remove the -hold
from the xterm command
*you'll have to manually close the box

Code:
#!/bin/sh

#code by Joe arose  big_bass 
#this is a very fast drag n drop tool
#for installing tgz packages
#it coupled with rox to get the right click
#in the menu
#call this script install_tgz

#.tgz    
if echo `basename "$1"` | grep -q '.tgz$'; then
   
   
Xdialog --wrap --title "YES/NO BOX" \
        --yesno "Do you want to install $1" 0 0

case $? in
  0)
    echo "Yes chosen.";;
  1)
    echo "No chosen."
    exit;;
  255)
    echo "Box closed."
    exit;;

esac
             

xterm -hold -geometry 40x30+150+40 -e installpkg "$1"         

Xdialog --title "Complete" \
           --infobox "\nInstalling $1 has finished.\n" 0 0 3000


#get the menus updated
/usr/sbin/fixmenus #hack for JWM and ICEWM 
jwm -restart       #hack for JWM and ICEWM  Joe Arose aka big_bass


else
 Xdialog --title "not a tgz " \
           --infobox "\ntgz only.\n" 0 0 4000


fi


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sun 21 Feb 2010, 15:16    Post_subject:  

Hey Gilbert (amigo)

Quote:
Actually, the 'neatest' patches are to be had by separating the changes between bug-fix, feature, formatting and hacks -or other such 'categories'. It just means making a couple of extra inetrmediate diffs as you add in all your changes, but it keeps the code separate -especially for features/hacks. You'll be glad you did the netx time you go to apply the changes against a new version of the original tools, or whatever.


well ,I agree and offer the neatest solution
I wish I had something like this when I started trying to figure out
pkgtools !

I made these as all in one scripts that can be run stand alone
the code is cleaner and works and shows what is happening
with a few more comments so I don't forget either
I found another way the EOF is cleaner than the echoing


these scripts are just for demonstrating the code in parts
if you installed my packagetoolsx they are already included


Code:


#!/bin/sh

# this allows you to run the official package tools without editing
# any files used by it so its safe to use this New GUI at any time
# The new files will be made and used
# by Joe Arose 2-17-2010

# list_of_installed_packages2   located in /var/log/setup/tmp
# xpackage_viewer               located in /var/log/setup/tmp
# viewsrc2                      located in /var/log/setup/tmp

# list_of_installed_packages2   needs a new list generated for xdialog to work
# xpackage_viewer               is the main viewer for the all package list view   
# viewsrc2                      this shows the individual selected package

# xpackage_viewer               is auto generated from this script
# viewsrc2                      is auto generated from this script 

# this replaces the dialog version for xdialog           
# a problem was dialog uses a --file option that is done differently with xdialog
# so  adjustments to the formating of how the PACKAGE DESCRIPTION:
# was parsed generates a valid xdialog list now
# then a new script replaced viewsrc with xpackage_view + viewsrc2
# I split it into subroutines



#  there are 4 parts needed
#  part 1 is generate list_of_installed_packages2
#  part 2 is the xpackage_viewer
#  part 3 is run by viewsrc2 automatically
#  part 4  is reading the package selected reply2
#          and piping that into Xdialog




#----------------------------------------
# generate list_of_installed_packages2
#----------------------------------------

       FILES=$(ls /var/log/packages)
        cd /var/log/packages
      { grep '^PACKAGE DESCRIPTION:$' -Z -H -m1 -A1 $FILES; echo; } \
      | sed -n 'h;n;/\x00/{h;n;};x;s/  */ /g;s/ $//;s/[\"`$]/\\&/g
       s/\(.*\)\x00\([^:]*:\)\? *\(.*\)/ "\1"    "" OFF \\/;p' > /var/log/setup/tmp/list_of_installed_packages2
touch  /var/log/setup/tmp/list_of_installed_packages2
     


#----------------------------------------
# generate viewsrc2
#----------------------------------------

cat << 'EOF' >/var/log/setup/tmp/viewsrc2
#!/bin/sh

#make the package selected to view a string value called RETURN2
RETURN2=`cat /var/log/setup/tmp/return2`

#then pipe that into xdialog

echo "`cat /var/log/packages/$RETURN2`" | Xdialog --title " $RETURN2    files " \--backtitle " $RETURN2   list   "     \--textbox "-" 30 70 0
EOF

chmod a+x /var/log/setup/tmp/viewsrc2




#----------------------------------------
# generate /var/log/setup/tmp/xpackage_viewer
#----------------------------------------
# this makes a script using echo
# with the new formated PACKAGE DESCRIPTION:

# make the xdialog head

cat << 'EOF' >/var/log/setup/tmp/xpackage_viewer
#!/bin/sh
Xdialog --title " Package you wish to view more info"\
--backtitle "Installed packages info  "     \
--radiolist "Select a package you want to view       \
                                             \n"  35 50 2  \
EOF
                                             
# build the list of installed packages                                     
# this the body of the script

echo "`cat /var/log/setup/tmp/list_of_installed_packages2`">>/var/log/setup/tmp/xpackage_viewer

# the chosen value is used to view just that file from the main list

cat << 'EOF' >>/var/log/setup/tmp/xpackage_viewer
2> /var/log/setup/tmp/return2


case $? in
  0)
    echo "Yes chosen.";;
  1)
    echo "No chosen."
    exit;;
  255)
    echo "Box closed."
    exit;;

esac

/var/log/setup/tmp/viewsrc2
EOF


# make it executable
chmod a+x /var/log/setup/tmp/xpackage_viewer

#----------------------------------------
# run the new "viewscr2"
# automatically from /var/log/setup/tmp/xpackage_viewer
#----------------------------------------
 
/var/log/setup/tmp/xpackage_viewer




Code:


#!/bin/sh

# this allows you to run the official package tools without editing
# any files used by it so its safe to use this New GUI at any time
# by Joe Arose 2-17-2010


#----------------------------------------
# generate /var/log/setup/tmp/new_installer_list
#----------------------------------------

cd /
find / -name '*.tgz' -exec echo  {} \; >/var/log/setup/tmp/new_installer_list

# filter out initrd
cat var/log/setup/tmp/new_installer_list|grep -v 'initrd' >/var/log/setup/tmp/new_installer_list
     
touch  /var/log/setup/tmp/new_installer_list
     


#----------------------------------------
# generate /var/log/setup/tmp/view_all_tgz
#----------------------------------------

cat << 'EOF' >/var/log/setup/tmp/view_all_tgz
#!/bin/sh

# then stick that in your Xdialog pipe and smoke it  :D

echo "`cat /var/log/setup/tmp/new_installer_list`" | Xdialog --title "    TGZ finder " \--backtitle " All  TGZ  list   "     \--textbox "-" 30 70 0
EOF

chmod a+x /var/log/setup/tmp/view_all_tgz

. /var/log/setup/tmp/view_all_tgz





_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
amigo

Joined: 02 Apr 2007
Posts: 2261

PostPosted: Sun 21 Feb 2010, 16:34    Post_subject:  

Well, that does look a lot cleaner! I was working yesterday on ramming some of your GUI code into the regular pkgtool, in a way that the same script could be used with or without Xdialog.

pkgtool would be lots easier to work with if the code was broken up more into functions. And the shallow indenting makes it hard to read... My hacked version is formatted better, but I haven't yet broken out much code into functions. I have added lots of code for handling the extra database files, but it is mostly in one spot so it isn't too hard to work with/around. I forked my version quite some time ago -before the official tools supported tbz/tlz/txz so I handled that a little differently than they did. Once forked, the best way to check/keep up with any fixes or features from upstream is to simply make diffs against the original versions. As I said before, I'm against some of the changes, so I have no desire to take new versions and re-convert them.

You mentioned drag-n-drop package handling... I have for a long time used a rox AppDir front-end to pkgtools which is great for quickly installing or upgrading packages just by dropping them on the icon. Plus, right-clicking brings up a menu with some functions for quickly listing all installed packages, searching for a file to find out what package installed it, listing the contents of package nicely and for searching in a MANIFEST to see what package supplies a certain uninstalled file.

You can get an older version here:
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/AppDirs/Pkg-Tools-0.2.tbz
It uses a variety of GUI (gtk-1.2) helpers which you'll want to install to see how it works. But, you might want to replace those routines with pure Xdialog or gtkdialog code.
Xdialog -I know you have this Smile Did you know there's a GTK2 version?

greq
gtk-shell
gselect:
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/DeskTop/MsgDialog/

afxmsg:
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/AmigoProjects/afxmsg/

gmas:
http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/Applications/Misc/gmas-1.1.0/

It could probably have all been done with just Xdialog, but i was experimenting and some of the widget tools are more attractive and easier to use than even Xdialog
You are definitely on the right track if these can be used as simple frontends to the regular tools.

Say, I've been working on init/boot functionality for my new system and have gotten down to a 6 second bootime(from grub selection to CLI login)! I'm using a statically-linked dash for running the init scripts which brought times down from ~15 seconds to 6-7. Still room to cut a couple more seconds out there...
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Tue 23 Feb 2010, 13:09    Post_subject:  

pkgtoolsx
UPDATED 2-23-2010

*mostly cleaning up the code so its easier to diff and read
added back tbz tlz support
http://puppy2.org/slaxer/pkgtoolsx-13.0-noarch-9.tgz



Xdialog version of packagetools (pkgtools)

so now its an X environment tool !

you should have the my pkgtools-13.0-patched-10-i486-slxr.pet
already installed its safe to have both since no files get over written

one for console one for X

Tip:if you have your packages in another directory copy the
pkgtoolx script into that folder and run it from there the
default is root

note when asked to install packages select yes ,no ,or quit

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Fri 26 Feb 2010, 11:34    Post_subject:  

Xinstallpkg


I have been working on updating the official slackware package management tools to include a X version
whereas slackware uses a console version tried and true

but lets give that a face lift when we are in X

while doing this I have separated each function into subroutines
also in doing it this way I have maintained not to clobber any files used by the official tools and at the same time keeping thing compatible


there are some tools I use to make my life easier one is dragNdrop
scripts to install but I use a better way when there are many packages to install and that is a new script I wrote called xinstallpkg

it doesnt use any installpkg code in the front end GUI but uses the official installpkg as the backend so as not to break any (sacred rules ) lol



you can place this script anywhere you have a folder with *tgz packages and just click a GUI opens allowing you to use check boxes
to select what you want to install

then everything from there is automatic Very Happy

in slackware you have KDE frontend that does this type of work looks great but its big and bloated
doing it all in Xdialog makes it very very fast and light

*you have to have installpkg already installed

the trick is a making Xdialog work with dynamic
menus

Joe
xinstaller_image.png
 Description   
 Filesize   25.54 KB
 Viewed   1265 Time(s)

xinstaller_image.png

xinstallpkg.tar.gz
Description 
gz

 Download 
Filename  xinstallpkg.tar.gz 
Filesize  1.3 KB 
Downloaded  381 Time(s) 

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sat 27 Feb 2010, 00:06    Post_subject:  

having fun coding these things
a simple but useful drag N drop diff maker using Xdialog
for comparing two files



Code:
#!/bin/sh


# just a simple diff tool for the lazy
# there are better but this is easy :D
# Joe Arose
# call this dnd_diff
DIALOG=Xdialog

$DIALOG --title "first file for DIFF   " \
        --inputbox "Type in a value or Drag N drop.
         enter first file to diff now
        the name will be given from the this file.diff
        and placed in root\n
" 10 70 2> /tmp/one.txt

retval=$?



input=`cat /tmp/one.txt`


case $retval in
  0)
    echo "Input string is '$input'";;
  1)
    echo "Cancel pressed."
    exit;;
  255)
    echo "Box closed."
    exit;;
esac

#----------------------------------
$DIALOG --title "second file for DIFF   " \
        --inputbox "Type in a value or Drag N drop.
        you enter second file to diff now\n
" 10 70 2>/tmp/two.txt

retval=$?

input2=`cat /tmp/two.txt`

case $retval in
  0)
    echo "Input string is '$input2'";;
  1)
    echo "Cancel pressed."
    exit;;
  255)
    echo "Box closed."
    exit;;
esac

diff -pruN $input $input2 >/root/`basename $input`.diff

#or you could do this if you have another editor installed
$DEFAULTTEXTEDITOR  /root/`basename $input`.diff

#geany is the default editor change this if you have another editor
#geany /root/`basename $input`.diff

rm -f /tmp/two.txt
rm -f /tmp/one.txt

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
gronos04

Joined: 30 Dec 2006
Posts: 54
Location: Radfordia QLD

PostPosted: Fri 05 Mar 2010, 18:49    Post_subject:  

Thanks for all your work on the package installers.
I needed python version 2.4.3 to work on some idigi modules.
Downloaded the source then used src2pkg.
Then used the installer and all went well.
However I get this when I run python
# python
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python 2.4.3 (#1, Mar 1 2010, 19:56:10)
[GCC 4.1.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

It still works but ......

Also what do you use to programme ICs with?
Tried to get the Arduino ide going but could not get avr-gcc to compile so avr-libc was no go. Got these as Slackware sources.
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 08 Mar 2010, 14:36    Post_subject:  

gronos04

its good that your using src2pkg
python is a "python" when you need to compile
it keeps growing a hungry snake it is


but here is a later version of python I complied for slaxer if you need it
http://www.murga-linux.com/puppy/viewtopic.php?t=41298&start=317


*depending what ic's you need to write to?

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Fri 12 Mar 2010, 14:06    Post_subject:  

Quote:
Tried to get the Arduino ide going but could not get avr-gcc to compile so avr-libc was no go. Got these as Slackware sources.


gronos04
you need java installed

http://www.arduino.cc/en/Main/Software
http://www.arduino.cc/playground/Learning/Linux
Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
gronos04

Joined: 30 Dec 2006
Posts: 54
Location: Radfordia QLD

PostPosted: Sun 14 Mar 2010, 15:39    Post_subject:  

big_bass

Yes, I had installed java first.

Will go through the process again when time permits

thanks
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 15 Mar 2010, 17:40    Post_subject:  

minor update to improve speed 3-16-2010
minor update to improve names by using only one underscore when many spaces are found 3-17-2010

this is something I wanted to do for awhile
fix spaces in directory names and files
convert them to use the underscore

many problems are caused by having spaces in file names or directory names even firefox is guilty of this bad habit !


try this one first to see what it does
two scripts here the first is dragN drop or command line call it s2u what it does is space2underscore

the second is auto find fix and repair
call it s2u_auto that does all the work for you
and may take awhile if you have a lot of bad files
--------------------------------------------------------------------




call it s2u what it does is space2underscore

Code:

#!/bin/bash

# Joe Arose version 1.02 
# s2u = space2underscore 
# drag N drop rename files that have spaces placed in the name
# to a corrected format with underscores
# many spaces get replaced with underscores also 
# programs will not function correctly with spaces placed in the name
# added to rox right clicks is even better than drag N drop
# this also works from command line  an example   s2u /path/name of file
# so it can clean up and correct a list of files  also
# note that permissions are preseved !

rm -f /tmp/space2question
rm -f /tmp/space2underscore     
rm -f /tmp/fix_spaces.txt

#this is to show how many files you have spaces it the name
#this is faster

find $pwd -type f |tr " " "?" | grep '?'>>/tmp/fix_spaces.txt




echo  "$@" | tr " " "?" >/tmp/space2question
echo  "$@" | tr -s ' ' '_*' >/tmp/space2underscore     

##special function to clean everything
echo  "$@" |tr -d  '=;:`"<>,?!@#$%^*&(){}[]' |tr -s ' ' '_*'  >/tmp/sanitized


rename_this=`cat /tmp/space2question`


for_this=`cat /tmp/space2underscore`


mv $rename_this $for_this



 Xdialog --title "Complete" \
           --infobox "\nConversion to $for_this has finished.\n" 0 0 2000

rm -f /tmp/space2question
rm -f /tmp/space2underscore     
 
 
 










call it s2u_auto that does all the work for you

Code:

#!/bin/bash

# Joe Arose version 1.02 
# s2u_auto  = space2underscore  auto find and repair
# rename files that have spaces placed in the name
# to a corrected format with underscores
# many spaces get replaced with underscores also 
# programs will not function correctly with spaces placed in the name
# note that permissions are preseved !


rm -f /tmp/space2underscore
rm -f /tmp/space2question
rm -f /tmp/fix_spaces.txt

#this is to show how many folders you have spaces in the name
#this is faster fix directories first later it will fix the files

find $pwd -type d |tr " " "?" | grep '?'>>/tmp/fix_spaces.txt


for pkg in `cat /tmp/fix_spaces.txt` ;do
echo "$pkg" | tr " " "?" >/tmp/space2question
echo "$pkg" | tr -s ' ' '_*' >/tmp/space2underscore 


rename_this=`cat /tmp/space2question`
for_this=`cat /tmp/space2underscore`

mv $rename_this $for_this

# just in case give it some time to process example n" 0 0 1000
# the delay here is one second 1000 =1sec

Xdialog --title "working" \
           --infobox "\n Auto conversion  working $for_this.\n" 0 0 1000

done


 Xdialog --title "Complete" \
           --infobox "\n Auto conversion folders  finished.\n" 0 0 3000

#-----------------------------
#  fix all the files now
#----------------------------
rm -f /tmp/space2underscore
rm -f /tmp/space2question
rm -f /tmp/fix_spaces.txt

#this is to show how many files you have spaces in the name
#this is faster
find $pwd -type f |tr " " "?" | grep '?'>>/tmp/fix_spaces.txt


for pkg in `cat /tmp/fix_spaces.txt` ;do
echo "$pkg"| tr " " "?" >/tmp/space2question
echo "$pkg" |tr -s ' ' '_*' >/tmp/space2underscore


rename_this=`cat /tmp/space2question`
for_this=`cat /tmp/space2underscore`

mv $rename_this $for_this

#just in case give it some time to process

Xdialog --title "working" \
           --infobox "\n Auto conversion  working $for_this.\n" 0 0 1000

done


 Xdialog --title "Complete" \
           --infobox "\n Auto conversion files  finished.\n" 0 0 3000


rm -f /tmp/space2underscore
rm -f /tmp/space2question
rm -f /tmp/fix_spaces.txt












I also did a complete rewrite of a light xdialog pkgtools
for those wondering why ?
package management
is what sets down the standard of the distro the packages used
and its future development direction

@amigo I would like to add your fixes to the dependency
database checking that you worked on if you have a subroutine for it

Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Thu 18 Mar 2010, 13:06    Post_subject:  

this is a drag N drop sanitize bad names of directories or files
one a at time will come in handy if your fixing downloaded files too

call it sana
sana = sana sana colita de rana "for the spanish translation"

**I need to run some checks of packages and files for the package tools and an indexer for html so these are some small routines I am using to filter and clean with and they come in handy as small stand alone apps

make a new file and call it this
c^%a#!?n{}_y@o]u[_?@r%e"a$d_><t=h:i*()s


now drag n drop it on the script you named sana


Code:

#!/bin/bash

# Joe Arose version 1.05

# added to rox right clicks is even better than drag N drop
# this also works from command line  an example   sana /path/name of file
# so it can clean up and correct a list of files  also
# note that permissions are preseved !

#sanitize
#one at a time

rm -f /tmp/tmp/sanitized
rm -f /tmp/borked_name   



##special function to clean everything
echo  "$@" | tr -d '=;:`"<>,?!@#$%^*&(){}[]' |tr -s ' ' '_*' >/tmp/sanitized
echo  "$@" | tr " " "?" | tr  '=;:"`<>,!@#$?%^*&(){}[]' '?' >/tmp/borked_name




rename_bork=`cat /tmp/borked_name`
echo  "$rename_bork"


for_cleaned=`cat /tmp/sanitized`
echo "$for_cleaned"

mv $rename_bork $for_cleaned



 Xdialog --title "Complete" \
           --infobox "\nConversion to $for_cleaned has finished.\n" 0 0 2000


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Fri 19 Mar 2010, 13:17    Post_subject:  

This auto detects and renames badly named files and directories
anywhere you place it


sana_auto

NOTE
# this is disabled to allow you to test first uncomment lines 44;91 when you know what will be renamed

so its safe to test as is with to see which files would be renamed if you uncommented those lines

wow ! this nice Cool

I ran this on three of my partitions without any problems
all the files were renamed correctly

I thought of another good use for this when you want to burn to CD sometimes there are problems with long mis-formatted names this will fix those types of problems

will save hours of work
a small but powerful app

take a look at this file it shows what will be renamed
/tmp/fix_borked_names.txt

theses files show what will be renamed
/tmp/fix_borked_names_dir
/tmp/fix_borked_names_files



Code:

#!/bin/bash

# Joe Arose version 1.06 
# sana_auto  =  auto find and repair
# sana =  sanitize  these =;"`<>,!@#$?%^*&(){}[]
# sana =  sana sana colita de rana   "for the spanish translation"
# kde mime images have a ":" so leave them alone
# to a corrected format with underscores
# many bad characters get deleted 
# programs will not function correctly with spaces placed in the name
# note that permissions are preseved !

# this is disabled to allow you to test first uncomment lines 44;91 when you know what will be renamed 
so its safe to test

# if you plan to edit this comment out the "mv"  lines for safety while testing line 44 ;91

rm -f /tmp/sanitized
rm -f /tmp/borked_name
rm -f /tmp/fix_borked_names.txt


#this is faster fix directories first later it will fix the files


find $pwd -type d | tr " " "?" | tr  '=;"`<>,!@#$?%^*&(){}[]' '?'| grep '?' >>/tmp/fix_borked_names.txt

#so you have a list of changed files that have ???
cp /tmp/fix_borked_names.txt /tmp/fix_borked_names_dir$$


##special function to clean everything

for pkg in `cat /tmp/fix_borked_names.txt` ;do
echo "$pkg" | tr -d '=;`"<>,?!@#$%^*&(){}[]' |tr -s ' ' '_*' >/tmp/sanitized
echo "$pkg" | tr " " "?" | tr  '=;"`<>,!@#$?%^*&(){}[]' '?' >/tmp/borked_name


rename_bork=`cat /tmp/borked_name`
echo  "$rename_bork"


for_cleaned=`cat /tmp/sanitized`
echo "$for_cleaned"

#mv $rename_bork $for_cleaned



 Xdialog --title "working on directories" \
           --infobox "\nConversion to $for_cleaned has finished.\n" 0 0 1000

done


 Xdialog --title "Complete" \
           --infobox "\n Auto conversion folders  finished.\n" 0 0 3000

#-----------------------------
#  fix all the files now
#----------------------------

rm -f /tmp/sanitized
rm -f /tmp/borked_name
rm -f /tmp/fix_borked_names.txt


find $pwd -type f | tr " " "?" | tr  '=;"`<>,!@#$?%^*&(){}[]' '?'| grep '?' >>/tmp/fix_borked_names.txt


#so you have a list of changed files that have ???
cp /tmp/fix_borked_names.txt /tmp/fix_borked_names_files$$


##special function to clean everything


for pkg in `cat /tmp/fix_borked_names.txt` ;do
echo "$pkg" | tr -d '=;`"<>,?!@#$%^*&(){}[]' |tr -s ' ' '_*' >/tmp/sanitized
echo "$pkg" | tr " " "?" | tr  '=;"`<>,!@#$?%^*&(){}[]' '?' >/tmp/borked_name





rename_bork=`cat /tmp/borked_name`
echo  "$rename_bork"


for_cleaned=`cat /tmp/sanitized`
echo "$for_cleaned"

#mv $rename_bork $for_cleaned



 Xdialog --title "working on files" \
           --infobox "\nConversion to $for_cleaned has finished.\n" 0 0 1000

done


 Xdialog --title "Complete" \
           --infobox "\n Auto conversion files  finished.\n" 0 0 3000


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send_private_message 
gronos04

Joined: 30 Dec 2006
Posts: 54
Location: Radfordia QLD

PostPosted: Thu 25 Mar 2010, 02:05    Post_subject:
Sub_title: Upgrading base applications
 

I would like to upgrade some base apps.
I wanted to install the latests alsa 1.0.22.
src2pkg worked perfectly, compiled and gave me a .tgz package.
Used pkgtool on the package thinking that it might just overwrite it but no luck.
Could someone please outline the steps to upgrade applications that were never installed by pkgtool?
I am running slaxer_pup as a frugal install.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 30 of 32 Posts_count   Goto page: Previous 1, 2, 3, ..., 28, 29, 30, 31, 32 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Cutting edge
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1602s ][ Queries: 13 (0.0131s) ][ GZIP on ]