maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Script for packaging a .deb (https://talk.maemo.org/showthread.php?t=28190)

LABAUDIO 2009-04-09 22:51

Script for packaging a .deb
 
i'am work on new sound theme for os2008.

i follow the very nice HowTo for here

http://synthesize.us/HOWTO_make_a_de...e_without_dpkg


Like you see, is a script for make a .deb package...

But i dont understand how to run properly this script.

+ i'am a french guy but iam suppose to be good in english...

here is a code supposing to be a script :
Code:

#!/bin/bash

# This script should be run from within the directory with the wav files.

# First, create the empty tree under a new "build" directory
# (the name "build" is completely arbitrary here)
mkdir -p build/usr/share/sounds/

# Put the sounds in the sounds directory
cp -v ui-*.wav build/usr/share/sounds/

# move into the build directory, make a docs directory
cd build
mkdir -p usr/share/doc/your-package-name

# write the README file
cat > usr/share/doc/your-package-name/README <<END
This package provides replacement sound effects for Maemo.

It moves the original sounds aside using dpkg-divert(8), and
restores them upon uninstallation.
END

# write the control file
cat > control <<END
Package: your-package-name
Version: 0.1
Section: user/themes
Priority: optional
Architecture: all
Installed-Size: `du -ks usr|cut -f 1`
Maintainer: Your-Name-Here <someone@example.com>
Description: New Maemo sound effects, with auto-backup of the originals
 
 This package contains a set of sound effects for the OSSO Maemo ui. This
 version will preserve your current sounds using dpkg-divert(8) and
 restore them upon uninstallation.
 
 Updates to this package might be posted at
 http://synthesize.us/Maemo_sounds
END

# write the pre-installation script
cat > preinst <<END
#!/bin/sh
if [ "$1" = install ]; then
    for f in ui-battery_low.wav ui-charging_started.wav ui-confirmation_note.wav ui-connection_lost.wav ui-default_beep.wav ui-general_warning.wav ui-gesture_number_recognized.wav ui-information_note.wav ui-key_press.wav ui-new_email.wav ui-operation_ready.wav ui-pen_down.wav ui-recharge_battery.wav ui-shutdown.wav ui-thumb_keyboard_launch.wav ui-wake_up_tune.wav ui-window_close.wav ui-window_open.wav ui-wrong_charger.wav; do
        dpkg-divert --package your-package-name --rename --add /usr/share/sounds/$f
    done
fi
END

# write the post-removal script
cat > postrm <<END
#!/bin/sh
if [ "$1" = remove ]; then
    for f in ui-battery_low.wav ui-charging_started.wav ui-confirmation_note.wav ui-connection_lost.wav ui-default_beep.wav ui-general_warning.wav ui-gesture_number_recognized.wav ui-information_note.wav ui-key_press.wav ui-new_email.wav ui-operation_ready.wav ui-pen_down.wav ui-recharge_battery.wav ui-shutdown.wav ui-thumb_keyboard_launch.wav ui-wake_up_tune.wav ui-window_close.wav ui-window_open.wav ui-wrong_charger.wav; do
        dpkg-divert --package your-package-name --rename --remove /usr/share/sounds/$f
    done
fi
END

# Setting this environment variable fixes Apple's modified GNU tar so that
# it won't make dot-underscore AppleDouble files. Google it for details...
export COPY_EXTENDED_ATTRIBUTES_DISABLE=1

# create the data tarball
# (the tar options "czvf" mean create, zip, verbose, and filename.)
tar czvf data.tar.gz usr/share/sounds/ usr/share/doc/

# create the control tarball
tar czvf control.tar.gz control preinst postrm

# create the debian-binary file
echo 2.0 > debian-binary

# create the ar (deb) archive
ar -r your-package-name.deb debian-binary control.tar.gz data.tar.gz

# move the new deb up a directory
mv your-package-name.deb ..

# remove the tarballs, and cd back up to where we started
rm data.tar.gz control.tar.gz
cd ..

This is where iam stuck...

what mean every # before line...

and i dont know if i need to make this in individual line or if i can drop all the script somewhere for make it...

i need put all that in xterminal in root mode or other applications???

this link upthere give a script but i dont give how to run this script properly...


let me know if you have a better explainations about this script and how i can make it whit more explaination because now iam completely lost...but i never abort...

TX

rattking 2009-04-09 23:25

Re: Script for packaging a .deb
 
Hi
every line that starts with # is a comment and is not run by the script

it looks like you are suppose to save this script in the same directory as your .wav files

open a terminal and cd into the directory where you saved the script
chmod +x script
./script
the script as-is will make a package named "your-package-name" so you will want to change that

LABAUDIO 2009-04-10 04:39

Re: Script for packaging a .deb
 
i put a vista folder in /home/user/
in this folder i put my script.sh file and 19 sounds .wav



i open the xterm
here my output

Code:


BusyBox v1.6.1 (2008-09-18 09:43:17 EEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ sudo gainroot
Root shell enabled


BusyBox v1.6.1 (2008-09-18 09:43:17 EEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/home/user # chmod +x script
chmod: script: No such file or directory
/home/user #

iam so nooby sorry:confused:

iam shure i modified a script.sh good
i place it where is my 19 sounds
and make in terminal but no work...
here my script.sh
Code:

#!/bin/bash

# This script should be run from within the directory with the wav files.

# First, create the empty tree under a new "build" directory
# (the name "build" is completely arbitrary here)
mkdir -p build/home/user/vista

# Put the sounds in the sounds directory
cp -v ui-*.wav build/home/user/vista

# move into the build directory, make a docs directory
cd build
mkdir -p usr/share/doc/theme vista 3.1

# write the README file
cat > usr/share/doc/theme vista 3.1/README <<END
This package provides replacement sound effects for Maemo.

It moves the original sounds aside using dpkg-divert(8), and
restores them upon uninstallation.
END

# write the control file
cat > control <<END
Package: theme vista 3.1
Version: 3.1
Section: user/themes
Priority: optional
Architecture: all
Installed-Size: `du -ks usr|cut -f 1`
Maintainer: Alex Vevey <Alex-vevey@hotmail.com>
Description: New Maemo sound effects (Vista Style), with auto-backup of the originals
 
 This package contains a set of sound effects for the OSSO Maemo ui. This
 version will preserve your current sounds using dpkg-divert(8) and
 restore them upon uninstallation.
 
 Updates to this package might be posted at
 Alex-vevey@hotmail.com
END

# write the pre-installation script
cat > preinst <<END
#!/bin/sh
if [ "$1" = install ]; then
    for f in ui-battery_low.wav ui-charging_started.wav ui-confirmation_note.wav ui-connection_lost.wav ui-default_beep.wav ui-general_warning.wav ui-gesture_number_recognized.wav ui-information_note.wav ui-key_press.wav ui-new_email.wav ui-operation_ready.wav ui-pen_down.wav ui-recharge_battery.wav ui-shutdown.wav ui-thumb_keyboard_launch.wav ui-wake_up_tune.wav ui-window_close.wav ui-window_open.wav ui-wrong_charger.wav; do
        dpkg-divert --package your-package-name --rename --add /home/user/vista$f
    done
fi
END

# write the post-removal script
cat > postrm <<END
#!/bin/sh
if [ "$1" = remove ]; then
    for f in ui-battery_low.wav ui-charging_started.wav ui-confirmation_note.wav ui-connection_lost.wav ui-default_beep.wav ui-general_warning.wav ui-gesture_number_recognized.wav ui-information_note.wav ui-key_press.wav ui-new_email.wav ui-operation_ready.wav ui-pen_down.wav ui-recharge_battery.wav ui-shutdown.wav ui-thumb_keyboard_launch.wav ui-wake_up_tune.wav ui-window_close.wav ui-window_open.wav ui-wrong_charger.wav; do
        dpkg-divert --package your-package-name --rename --remove /home/user/vista$f
    done
fi
END

# Setting this environment variable fixes Apple's modified GNU tar so that
# it won't make dot-underscore AppleDouble files. Google it for details...
export COPY_EXTENDED_ATTRIBUTES_DISABLE=1

# create the data tarball
# (the tar options "czvf" mean create, zip, verbose, and filename.)
tar czvf data.tar.gz home/user/vista usr/share/doc/

# create the control tarball
tar czvf control.tar.gz control preinst postrm

# create the debian-binary file
echo 2.0 > debian-binary

# create the ar (deb) archive
ar -r theme vista 3.1.deb debian-binary control.tar.gz data.tar.gz

# move the new deb up a directory
mv theme vista 3.1.deb ..

# remove the tarballs, and cd back up to where we started
rm data.tar.gz control.tar.gz
cd ..

tx to help me

BrentDC 2009-04-10 04:52

Re: Script for packaging a .deb
 
script is the script name; so if it's script.sh, try:

Code:

chmod +x script.sh
Also, you need to be in the correct directory for this to work. Use the cd command to change directory:

For example:

Code:

cd /path/to/correct/directory/

LABAUDIO 2009-04-10 05:09

Re: Script for packaging a .debi
 
ok here my output

Code:

BusyBox v1.6.1 (2008-09-18 09:43:17 EEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ $ cd /home/user/vista
~/vista $ chmod +x script.sh
chmod: script.sh: Operation not permitted
~/vista $ sudo gainroot
Root shell enabled


BusyBox v1.6.1 (2008-09-18 09:43:17 EEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/home/user/vista # chmod +x script.sh
/home/user/vista # chmod +x script
chmod: script: No such file or directory

iam shure iam not far:o
TX

codeMonkey 2009-04-10 09:58

Re: Script for packaging a .deb
 
Code:

1: /home/user/vista # chmod +x script.sh
2: /home/user/vista # chmod +x script
3: chmod: script: No such file or directory

Line 1 succeeded, hence no errors.
Line 2 failed, because you're trying to add permissions to "script", which doesn't exist.
Line 3 is the error message.

Since line 1 succeeded, you should now be able to run your script.

When you're in the same directory as the script type
Code:

./script.sh
This will work if you have the bash shell installed. If you don't have that, you might need to modify the first line of your script from
Code:

#!/bin/bash
to
Code:

#!/bin/sh

LABAUDIO 2009-04-10 18:07

Re: Script for packaging a .deb
 
ok i modified my script.sh

here my output...

its look i have problem whit ar

Code:

/home/user/vista # ./script.sh
cp: invalid option -- v
BusyBox v1.6.1 (2008-09-18 09:43:17 EEST) multi-call binary

Usage: cp [OPTION]... SOURCE DEST

du: usr: No such file or directory
home/user/vista/
home/user/vista/doc/
home/user/vista/doc/themevista/
home/user/vista/doc/themevista/README
home/user/vista/doc/
home/user/vista/doc/themevista/
home/user/vista/doc/themevista/README
control
preinst
postrm
./script.sh: line 78: ar: not found
mv: cannot rename 'themevista.deb': No such file or directory
/home/user/vista #

and here is my script

Code:

#!/bin/sh

# This script should be run from within the directory with the wav files.

# First, create the empty tree under a new "build" directory
# (the name "build" is completely arbitrary here)
mkdir -p build/home/user/vista

# Put the sounds in the sounds directory
cp -v ui-*.wav build/home/user/vista

# move into the build directory, make a docs directory
cd build
mkdir -p home/user/vista/doc/themevista

# write the README file
cat > home/user/vista/doc/themevista/README <<END
This package provides replacement sound effects for Maemo.

It moves the original sounds aside using dpkg-divert(8), and
restores them upon uninstallation.
END

# write the control file
cat > control <<END
Package: themevista
Version: 3.1
Section: user/themes
Priority: optional
Architecture: all
Installed-Size: `du -ks usr|cut -f 1`
Maintainer: Alex Vevey <Alex-vevey@hotmail.com>
Description: New Maemo sound effects (Vista Style), with auto-backup of the originals
 
 This package contains a set of sound effects for the OSSO Maemo ui. This
 version will preserve your current sounds using dpkg-divert(8) and
 restore them upon uninstallation.
 
 Updates to this package might be posted at
 Alex-vevey@hotmail.com
END

# write the pre-installation script
cat > preinst <<END
#!/bin/sh
if [ "$1" = install ]; then
    for f in ui-battery_low.wav ui-charging_started.wav ui-confirmation_note.wav ui-connection_lost.wav ui-default_beep.wav ui-general_warning.wav ui-gesture_number_recognized.wav ui-information_note.wav ui-key_press.wav ui-new_email.wav ui-operation_ready.wav ui-pen_down.wav ui-recharge_battery.wav ui-shutdown.wav ui-thumb_keyboard_launch.wav ui-wake_up_tune.wav ui-window_close.wav ui-window_open.wav ui-wrong_charger.wav; do
        dpkg-divert --package your-package-name --rename --add /home/user/vista$f
    done
fi
END

# write the post-removal script
cat > postrm <<END
#!/bin/sh
if [ "$1" = remove ]; then
    for f in ui-battery_low.wav ui-charging_started.wav ui-confirmation_note.wav ui-connection_lost.wav ui-default_beep.wav ui-general_warning.wav ui-gesture_number_recognized.wav ui-information_note.wav ui-key_press.wav ui-new_email.wav ui-operation_ready.wav ui-pen_down.wav ui-recharge_battery.wav ui-shutdown.wav ui-thumb_keyboard_launch.wav ui-wake_up_tune.wav ui-window_close.wav ui-window_open.wav ui-wrong_charger.wav; do
        dpkg-divert --package your-package-name --rename --remove /home/user/vista$f
    done
fi
END

# Setting this environment variable fixes Apple's modified GNU tar so that
# it won't make dot-underscore AppleDouble files. Google it for details...
export COPY_EXTENDED_ATTRIBUTES_DISABLE=1

# create the data tarball
# (the tar options "czvf" mean create, zip, verbose, and filename.)
tar czvf data.tar.gz home/user/vista home/user/vista/doc/

# create the control tarball
tar czvf control.tar.gz control preinst postrm

# create the debian-binary file
echo 2.0 > debian-binary

# create the ar (deb) archive
ar -r theme vista 3.1.deb debian-binary control.tar.gz data.tar.gz

# move the new deb up a directory
mv themevista.deb ..

# remove the tarballs, and cd back up to where we started
rm data.tar.gz control.tar.gz
cd ..

tx to help
i know maybe something wrong in the script...
or i dont have application for manage .ar...
:confused:

BrentDC 2009-04-10 19:35

Re: Script for packaging a .deb
 
A little Terminal work can give us some guidance:

Code:

~ $ ar # see if ar is installed on my system
Usage: ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...
      ar -M [<mri-script]
 commands:
  d            - delete file(s) from the archive
  m[ab]        - move file(s) in the archive
  p            - print file(s) found in the archive
  q[f]        - quick append file(s) to the archive
  r[ab][f][u]  - replace existing or insert new file(s) into the archive
  t            - display contents of archive
  x[o]        - extract file(s) from the archive
 command specific modifiers:
  [a]          - put file(s) after [member-name]
  [b]          - put file(s) before [member-name] (same as [i])
  [N]          - use instance [count] of name
  [f]          - truncate inserted file names
  [P]          - use full path names when matching
  [o]          - preserve original dates
  [u]          - only replace files that are newer than current archive contents
 generic modifiers:
  [c]          - do not warn if the library had to be created
  [s]          - create an archive index (cf. ranlib)
  [S]          - do not build a symbol table
  [v]          - be verbose
  [V]          - display the version number
  @<file>      - read options from <file>
 emulation options:
  No emulation specific options
ar: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big srec symbolsrec tekhex binary ihex
~ $ which ar # find where the ar executable is
/usr/bin/ar
~ $ dpkg -S /usr/bin/ar # see which package it belongs to
binutils: /usr/bin/ar

You should now install binutils:

Code:

# apt-get install binutils
The pound sign above (instead of a dollar sign) indicates you need to be root to do that.

LABAUDIO 2009-04-11 02:46

Re: Script for packaging a .deb
 
i cant install binutils
here my xterm output


Code:

~ $ Sudo gainroot
Root shell enabled


BusyBox v1.6.1 (2008-09-18 09:43:17 EEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/ home / user # apt-get install binutils
Reading package lists ... Made
Construction of the tree of dependencies
Reading state information ... Made
No version of the binutils package is available, but there are in the database
data. This generally means that the package is missing, it became obsolete
or is available from another source
E: No package is the package binutils
/ home / user #

how i can instal binutils properly???

BrentDC 2009-04-11 15:35

Re: Script for packaging a .deb
 
OK, I'm guessing a bit here, but I think you need to install the diablo/tools repository. try to install this.

After installing that repository, try to install binutils again. After you install binutils, disable that repository. You can do that in the Application Manager.


All times are GMT. The time now is 19:54.

vBulletin® Version 3.8.8