Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=24d68e7c590f14ee90f578d30969cb16746e9d26
commit 24d68e7c590f14ee90f578d30969cb16746e9d26 Author: James Buren <r...@frugalware.org> Date: Thu Nov 3 09:54:25 2011 -0500 fw32-0.8.1-1-x86_64 * version bump diff --git a/source/fw32-extra/fw32/FrugalBuild b/source/fw32-extra/fw32/FrugalBuild index 1382e12..120014db 100644 --- a/source/fw32-extra/fw32/FrugalBuild +++ b/source/fw32-extra/fw32/FrugalBuild @@ -2,33 +2,17 @@ # Maintainer: James Buren <r...@frugalware.org> pkgname=fw32 -pkgver=0.6 -pkgrel=3 +pkgver=0.8.1 +pkgrel=1 pkgdesc="A framework for maintaining an i686 environment on x86_64." url="http://www.frugalware.org" -rodepends=('util-linux' 'sudo' 'grep' 'coreutils') +depends=('glibc' 'pacman-g2') groups=('fw32-extra') archs=('!i686' 'x86_64' '!ppc' '!arm') -up2date="$pkgver" +up2date="Flasttar http://ftp.frugalware.org/pub/other/$pkgname" backup=('etc/fw32/pacman-g2.conf') -source=(fw32 pacman-g2.conf fw32-run.c fw32.service README.Frugalware) -sha1sums=('8f710817d22b1929d1fbd2f8e4c03e199d847816' \ - 'd84ca5b6d1c37993dd6514d41eb4923a057a0d27' \ - '3ac904555b20ae69b3456238787d3eb7c7146687' \ - '4dbeb369a1ff3ebff4e525b8876528cb79677626' \ - '5a1a10ac1ac80a5fe4018f5d8965c4306e753f7c') - -build() -{ - Fexe /usr/bin/fw32 - for i in fw32-{create,update,install,uninstall,clean,delete,mount,umount}; do - Fln fw32 /usr/bin/$i - done - Ffile /etc/fw32/pacman-g2.conf - Fexec cc -Wall -Wextra $CFLAGS fw32-run.c -o fw32-run - Fexe /usr/bin/fw32-run - Fexec chmod u+s $Fdestdir/usr/bin/fw32-run - Ffile /lib/systemd/system/fw32.service -} +source=(http://ftp.frugalware.org/pub/other/$pkgname/$pkgname-$pkgver.tar.xz) +sha1sums=('b6ff9249b7f29aa3198be46042164f611287dc45') +_F_cd_path="." # optimization OK diff --git a/source/fw32-extra/fw32/README.Frugalware b/source/fw32-extra/fw32/README.Frugalware index 68dbd7b..fd17bca 100644 --- a/source/fw32-extra/fw32/README.Frugalware +++ b/source/fw32-extra/fw32/README.Frugalware @@ -7,20 +7,20 @@ Commands to use (with sudo or root shell): ---- fw32-create -fw32-update systemctl enable fw32.service (required for boot-time fw32 root mounting) ---- === Updating chroot -This needs to be done when packages become out of date or the chroot -system configuration is out of sync with the external system configuration. +This needs to be done when packages become out of date. Command to use (with sudo or root shell): ---- -fw32-update +fw32-upgrade ---- +WARNING: Should not be done while someone is using the chroot. + === Installing packages or groups to chroot Command to use (with sudo or root shell): @@ -29,14 +29,18 @@ Command to use (with sudo or root shell): fw32-install <packages and/or groups> ---- -=== Uninstalling packages or groups from chroot +WARNING: Should not be done while someone is using the chroot. + +=== Removing packages or groups from chroot Command to use (with sudo or root shell): ---- -fw32-uninstall <packages> +fw32-remove <packages> ---- +WARNING: Should not be done while someone is using the chroot. + === Cleaning chroot cache Command to use (with sudo or root shell): @@ -45,6 +49,8 @@ Command to use (with sudo or root shell): fw32-clean ---- +WARNING: Should not be done while someone is using the chroot. + === Deleting chroot Command to use (with sudo or root shell): @@ -62,6 +68,7 @@ Command to use (with sudo or root shell): ---- fw32-delete systemctl disable fw32.service (only needed if you enabled this at setup time) +rm -f /var/cache/pacman-g2/pkg/*i686.fpm (only needed if you want to delete the fpm cache) pacman-g2 -R fw32 ---- @@ -87,6 +94,8 @@ fw32-run <command> [<arguments>] - fw32-clean: Clean the cache of old packages. +WARNING: Should not be used while someone is using the chroot. + - fw32-create: Create the initial chroot. - fw32-delete: Delete the chroot, ensuring everything is umounted. @@ -95,20 +104,24 @@ WARNING: Should not be used while someone is using the chroot. - fw32-install: Install all packages and groups specified to the chroot. -- fw32-mount: Manually mount the chroot base directories. +WARNING: Should not be used while someone is using the chroot. + +- fw32-mount-all: Manually mount the chroot base directories. - fw32-run: Run a command within the chroot. If no command is specified, an attempt is made to execute the user's shell. -- fw32-umount: Manually umount all the directories in the chroot. +- fw32-umount-all: Manually umount all the directories in the chroot. WARNING: Should not be used while someone is using the chroot. -- fw32-uninstall: Uninstall all packages specified from the chroot. +- fw32-remove: Remove all packages or groups specified from the chroot. -- fw32-update: Update the chroot /etc configuration to match the system - /etc configuration. Also, performs a system upgrade of all packages - in the chroot. +WARNING: Should not be used while someone is using the chroot. + +- fw32-upgrade: Performs a system upgrade inside the chroot. + +WARNING: Should not be used while someone is using the chroot. === nobuild packages diff --git a/source/fw32-extra/fw32/fw32 b/source/fw32-extra/fw32/fw32 deleted file mode 100644 index 4b45680..0000000 --- a/source/fw32-extra/fw32/fw32 +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash - -FW32_ROOT="/usr/lib/fw32" -FW32_CONFIG="/etc/fw32/pacman-g2.conf" - -error() -{ - echo $1 - exit 1 -} - -check_access() -{ - [ $UID -ne 0 ] && error "You must be root to perform this action." -} - -mount_base() -{ - grep -q -E "$FW32_ROOT/(tmp|proc|sys|dev)" /proc/mounts - [ $? -eq 0 ] && return - mount --bind /dev $FW32_ROOT/dev - [ $? -ne 0 ] && error "Failed to mount fw32 root directories." - mount --bind /tmp $FW32_ROOT/tmp - [ $? -ne 0 ] && error "Failed to mount fw32 root directories." - mount -t proc none $FW32_ROOT/proc - [ $? -ne 0 ] && error "Failed to mount fw32 root directories." - mount -t sysfs none $FW32_ROOT/sys - [ $? -ne 0 ] && error "Failed to mount fw32 root directories." -} - -mount_home() -{ - grep -q -E "$FW32_ROOT$HOME" /proc/mounts - [ $? -eq 0 ] && return - sudo mkdir -p $FW32_ROOT$HOME - [ $? -ne 0 ] && error "Failed to create fw32 user home directory." - sudo mount --bind $HOME $FW32_ROOT$HOME - [ $? -ne 0 ] && error "Failed to mount fw32 user home directory." -} - -check_root() -{ - check_access - [ ! -d $FW32_ROOT ] && error "fw32 root directory does not exist." - mount_base -} - -_pacmang2() -{ - linux32 pacman-g2 --root $FW32_ROOT --config $FW32_CONFIG --noconfirm $@ - return $? -} - -case $0 in - *fw32-create) - check_access - [ -d $FW32_ROOT ] && error "Root directory appears to already exist." - mkdir -p $FW32_ROOT/{dev,tmp,proc,sys} - [ $? -ne 0 ] && error "Failed to create fw32 root directories." - mount_base - _pacmang2 -Sy shadow coreutils findutils which wget file tar gzip bzip2 util-linux procps kbd psmisc less - [ $? -ne 0 ] && error "Failed to create fw32 root." - ;; - *fw32-update) - check_root - cp -r -f -p -P /etc $FW32_ROOT - _pacmang2 -Syuf - [ $? -ne 0 ] && error "Failed to update fw32 root." - ;; - *fw32-install) - check_root - _pacmang2 -Syf $@ - [ $? -ne 0 ] && error "Failed to install any packages to fw32 root." - ;; - *fw32-uninstall) - check_root - _pacmang2 -Rsc $@ - [ $? -ne 0 ] && error "Failed to uninstall any packages from fw32 root." - ;; - *fw32-clean) - check_root - _pacmang2 -Sc - [ $? -ne 0 ] && error "Failed to clean fw32 root directory." - ;; - *fw32-delete) - check_root - for i in $(grep -o -E "$FW32_ROOT/[a-zA-Z0-9_/]+" /proc/mounts); do - umount $i - [ $? -ne 0 ] && error "Failed to delete fw32 root directory." - done - rm -rf $FW32_ROOT - [ $? -ne 0 ] && error "Failed to delete fw32 root directory." - ;; - *fw32-mount) - check_root - ;; - *fw32-umount) - check_root - for i in $(grep -o -E "$FW32_ROOT/[a-zA-Z0-9_/]+" /proc/mounts); do - umount $i - [ $? -ne 0 ] && error "Failed to umount fw32 root directories." - done - ;; -esac - -exit 0 diff --git a/source/fw32-extra/fw32/fw32-run.c b/source/fw32-extra/fw32/fw32-run.c deleted file mode 100644 index a54a4bd..0000000 --- a/source/fw32-extra/fw32/fw32-run.c +++ /dev/null @@ -1,206 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <limits.h> -#include <errno.h> -#include <unistd.h> -#include <pwd.h> -#include <sys/stat.h> -#include <sys/mount.h> -#include <sys/personality.h> - -#define FW32_ROOT "/usr/lib/fw32" - -static void error(const char *msg) __attribute__ ((noreturn)); -static void check_mounts(void); -static int check_home_directory(const char *dst); -static void make_home_directory(char *dst); -static void mount_home(const char *src); -extern int main(int argc,char **argv); - -static void -error(const char *msg) -{ - fputs(msg,stderr); - - exit(EXIT_FAILURE); -} - -static void -check_mounts(void) -{ - FILE *file; - char line[LINE_MAX], *s, *e; - int tmp, proc, sys, dev; - - file = fopen("/proc/mounts","r"); - - if(!file) - error("Failed to open /proc/mounts.\n"); - - tmp = proc = sys = dev = 0; - - while(fgets(line,sizeof line,file)) - { - s = strchr(line,' '); - if(!s) - continue; - e = strchr(++s,' '); - if(!e) - continue; - *e = 0; - if(!strcmp(s,FW32_ROOT "/tmp")) - tmp = 1; - else if(!strcmp(s,FW32_ROOT "/proc")) - proc = 1; - else if(!strcmp(s,FW32_ROOT "/sys")) - sys = 1; - else if(!strcmp(s,FW32_ROOT "/dev")) - dev = 1; - } - - if(!tmp || !proc || !sys || !dev) - { - fclose(file); - error("fw32 root directories are not mounted.\n"); - } - - fclose(file); -} - -static int -check_home_directory(const char *dst) -{ - FILE *file; - char line[LINE_MAX], *s, *e; - int found; - - file = fopen("/proc/mounts","r"); - - if(!file) - error("Failed to open /proc/mounts.\n"); - - found = 0; - - while(fgets(line,sizeof line,file)) - { - s = strchr(line,' '); - if(!s) - continue; - e = strchr(++s,' '); - if(!e) - continue; - *e = 0; - if(!strcmp(s,dst)) - { - found = 1; - break; - } - } - - fclose(file); - - return found; -} - -static void -make_home_directory(char *dst) -{ - char *p; - - p = dst + 1; - - errno = 0; - - while(1) - { - p = strchr(p,'/'); - - if(!p) - break; - - *p = 0; - - mkdir(dst,0755); - - switch(errno) - { - case EEXIST: - errno = 0; - break; - case 0: - break; - default: - error("Failed to create home directory.\n"); - } - - *p = '/'; - - ++p; - } - - errno = 0; - - mkdir(dst,0755); - - if(errno != 0 && errno != EEXIST) - error("Failed to create home directory.\n"); -} - - -static void -mount_home(const char *src) -{ - char dst[PATH_MAX]; - - snprintf(dst,sizeof dst,"%s%s",FW32_ROOT,src); - - if(check_home_directory(dst)) - return; - - make_home_directory(dst); - - if(mount(src,dst,"",MS_BIND,"")) - error("Failed to mount home directory.\n"); -} - -extern int -main(int argc,char **argv) -{ - struct stat st; - struct passwd *pwd; - - if(!getuid() || geteuid()) - error("This must be run as non-root, be SETUID, and owned by root.\n"); - - if(stat(FW32_ROOT,&st)) - error("fw32 root directory does not exist.\n"); - - check_mounts(); - - pwd = getpwuid(getuid()); - - if(!pwd) - error("Failed to retrieve password entry.\n"); - - mount_home(pwd->pw_dir); - - if(chroot(FW32_ROOT)) - error("Failed to enter chroot.\n"); - - if(personality(PER_LINUX32)) - error("Failed to enable 32 bit emulation.\n"); - - if(chdir(pwd->pw_dir)) - error("Failed to change to home directory.\n"); - - if(setuid(getuid())) - error("Failed to drop root permissions.\n"); - - if(argc < 2) - execl(pwd->pw_shell,pwd->pw_shell,(char *) 0); - else - execvp(argv[1],argv+1); - - return EXIT_SUCCESS; -} diff --git a/source/fw32-extra/fw32/fw32.service b/source/fw32-extra/fw32/fw32.service deleted file mode 100644 index 2a7f4ad..0000000 --- a/source/fw32-extra/fw32/fw32.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Mount fw32 root directories at startup. -After=syslog.target - -[Service] -ExecStart=/usr/bin/fw32-mount -ExecStop=/usr/bin/fw32-umount -Type=oneshot -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target diff --git a/source/fw32-extra/fw32/pacman-g2.conf b/source/fw32-extra/fw32/pacman-g2.conf deleted file mode 100644 index 4afe600..0000000 --- a/source/fw32-extra/fw32/pacman-g2.conf +++ /dev/null @@ -1,4 +0,0 @@ -[options] -LogFile=/var/log/pacman-g2.log -[frugalware-current] -Server=http://www10.frugalware.org/pub/linux/frugalware/frugalware-current/frugalware-i686 \ No newline at end of file _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git