{"id":247,"date":"2013-02-06T19:49:49","date_gmt":"2013-02-07T03:49:49","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=247"},"modified":"2013-02-07T22:05:09","modified_gmt":"2013-02-08T06:05:09","slug":"customize-a-deb-package","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/customize-a-deb-package\/","title":{"rendered":"Customize a .deb package"},"content":{"rendered":"

In this case I had to fix some startup links in a Networker Debian package.\u00a0 If I recall correctly it was after I had to use alien to create a .deb package from the vendor's rpm packages.<\/p>\n

Package made with alien caused the following errors:<\/strong><\/span><\/p>\n

\r\n# dpkg -i lgtoclnt_7.5.1-2_amd64.deb\r\nSelecting previously deselected package lgtoclnt.\r\n(Reading database ... 22181 files and directories currently installed.)\r\nUnpacking lgtoclnt (from lgtoclnt_7.5.1-2_amd64.deb) ...\r\nSetting up lgtoclnt (7.5.1-2) ...\r\n\/bin\/ln: creating symbolic link `\/etc\/init.d\/rc2.d\/S95networker': No such file or directory\r\n\/bin\/ln: creating symbolic link `\/etc\/init.d\/rc2.d\/K05networker': No such file or directory\r\n...\r\n\/bin\/ln: creating symbolic link `\/etc\/init.d\/rc5.d\/K05networker': No such file or directory\r\n<\/pre>\n

Package info:<\/strong><\/span><\/p>\n

\r\n# dpkg --info lgtoclnt_7.5.1-2_amd64.deb\r\n new debian package, version 2.0.\r\n...\r\n Package: lgtoclnt\r\n Version: 7.5.1-2\r\n Architecture: amd64\r\n...\r\n Description: NetWorker Client\r\n EMC NetWorker protects the critical business data of more than 10,000\r\n enterprise customers worldwide by simplifying, centralizing, and automating\r\n backup and recovery operations across Unix, Windows, Linux and NetWare platforms\r\n in DAS, NAS, and SAN storage environments. Built upon an open, highly scalable\r\n client-server architecture, NetWorker reduces management overhead by providing\r\n "lights out" protection of storage assets in the largest corporate data centers\r\n and the smallest satellite branch offices.\r\n .\r\n (Converted from a rpm package by alien version 8.72.)\r\n<\/pre>\n

Uncompress with ar:<\/strong><\/span><\/p>\n

\r\n# ls\r\n lgtoclnt_7.5.1-2_amd64.deb\r\n\r\n# ar vx lgtoclnt_7.5.1-2_amd64.deb\r\n x - debian-binary\r\n x - control.tar.gz\r\n x - data.tar.gz\r\n<\/pre>\n

Uncompress control file:<\/strong><\/span><\/p>\n

\r\n# tar xzpf control.tar.gz\r\n<\/pre>\n

Now make your changes to pre and post scripts.<\/p>\n

Package control.tar.gz<\/p>\n

\r\n# tar cpf control.tar control md5sums postinst postrm preinst prerm\r\n# rm control md5sums postinst postrm preinst prerm\r\n<\/pre>\n

Package the .deb with ar:<\/strong><\/span><\/p>\n

\r\n# ar -r lgtoclnt_7.5.1-2_amd64.deb debian-binary control.tar.gz data.tar.gz\r\n ar: creating lgtoclnt_7.5.1-2_amd64.deb\r\n<\/pre>\n

Install:<\/strong><\/span><\/p>\n

\r\n# dpkg -i lgtoclnt_7.5.1-2_amd64.deb\r\n Selecting previously deselected package lgtoclnt.\r\n (Reading database ... 22181 files and directories currently installed.)\r\n Unpacking lgtoclnt (from lgtoclnt_7.5.1-2_amd64.deb) ...\r\n Setting up lgtoclnt (7.5.1-2) ...\r\n To install EMC HomeBase Agent run the below script as 'root' user:\r\n \/opt\/homebase-agent\/setup-homebase.sh\r\n<\/pre>\n

Show installed package:<\/strong><\/span><\/p>\n

\r\n# aptitude show lgtoclnt\r\n Package: lgtoclnt\r\n New: yes\r\n State: installed\r\n Automatically installed: no\r\n Version: 7.5.1-2\r\n Priority: extra\r\n Section: alien\r\n Maintainer: root <root@bermuda>\r\n Uncompressed Size: 144M\r\n Description: NetWorker Client\r\n EMC NetWorker protects the critical business data of more than 10,000 enterprise customers worldwide by simplifying, centralizing, and\r\n automating backup and recovery operations across Unix, Windows, Linux and NetWare platforms in DAS, NAS, and SAN storage environments.\r\n Built upon an open, highly scalable client-server architecture, NetWorker reduces management overhead by providing "lights out"\r\n protection of storage assets in the largest corporate data centers and the smallest satellite branch offices.\r\n\r\n(Converted from a rpm package by alien version 8.72.) (Updated postinst and postrm files to be dpkg friendly and start in runlevel 2 )\r\n (-- rrosso 10.21.09)\r\n<\/pre>\n

Although my goal was fix the packaged version, you can also fix startup scripts on Debian and friends with update-rc.d. Example:<\/p>\n

\r\n root@clnt:\/etc\/init.d# touch testscript\r\n# update-rc.d testscript defaults\r\n update-rc.d: warning: \/etc\/init.d\/testscript missing LSB information\r\n update-rc.d: see <http:\/\/wiki.debian.org\/LSBInitScripts>\r\n Adding system startup for \/etc\/init.d\/testscript ...\r\n \/etc\/rc0.d\/K20testscript -> ..\/init.d\/testscript\r\n \/etc\/rc1.d\/K20testscript -> ..\/init.d\/testscript\r\n \/etc\/rc6.d\/K20testscript -> ..\/init.d\/testscript\r\n \/etc\/rc2.d\/S20testscript -> ..\/init.d\/testscript\r\n \/etc\/rc3.d\/S20testscript -> ..\/init.d\/testscript\r\n \/etc\/rc4.d\/S20testscript -> ..\/init.d\/testscript\r\n \/etc\/rc5.d\/S20testscript -> ..\/init.d\/testscript\r\n\r\n# update-rc.d -f testscript remove\r\n Removing any system startup links for \/etc\/init.d\/testscript ...\r\n \/etc\/rc0.d\/K20testscript\r\n \/etc\/rc1.d\/K20testscript\r\n \/etc\/rc2.d\/S20testscript\r\n \/etc\/rc3.d\/S20testscript\r\n \/etc\/rc4.d\/S20testscript\r\n \/etc\/rc5.d\/S20testscript\r\n \/etc\/rc6.d\/K20testscript\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

In this case I had to fix some startup links in a Networker Debian package.\u00a0 If I recall correctly it<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-247","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/247","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=247"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/247\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=247"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=247"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}