Skip to content
Snippets Groups Projects
Commit a6997d29 authored by Denis Pynkin's avatar Denis Pynkin
Browse files

Copy initial files from apertis-image-customization


Copying overlay and scripts from original repository
with adaptation for Debos.

Signed-off-by: default avatarDenis Pynkin <denis.pynkin@collabora.com>
Differential Revision: https://phabricator.apertis.org/D7201
parent 929a6808
No related branches found
No related tags found
No related merge requests found
# Drop all kernel modules: we assume the kernel in use on ARM devices
# already has everything important built-in.
path-exclude=/lib/modules/*
MODULES=list
#!/bin/sh
set -e
# Add extra modules to initramfs
echo "I: Add extra modules to initramfs"
echo netprio_cgroup >> /etc/initramfs-tools/modules
echo cls_cgroup >> /etc/initramfs-tools/modules
if `update-initramfs -u`
then
echo "I: Updated initramfs with netprio_cgroup and cls_cgroup modules"
else
echo "W: Failed to add netprio_cgroup and cls_cgroup modules to initramfs"
fi
#!/bin/bash
set -e
shopt -s dotglob > /dev/null 2>&1
# Hackish: Add user XDG metadata BUG: #1157
echo "I: Adding XDG user metadata."
mkdir -p /etc/skel/{.config,.cache,.dbus}
mkdir -p /etc/skel/.local/{bin,etc,include,lib,libexec,share}
mkdir -p /root/{.config,.cache,.dbus}
mkdir -p /root/.local/{bin,etc,include,lib,libexec,share}
shopt -u
#!/bin/sh
set -e
DEFGROUPS="admin,adm,dialout,cdrom,plugdev,audio,dip,video,staff,shared"
for group in $(echo $DEFGROUPS | tr ',' ' '); do
if /bin/egrep -i "^$group" /etc/group ; then
echo "Group $group exists in /etc/group"
else
echo "Group $group does not exist in /etc/group, creating"
groupadd $group
fi
done
echo "I: add user to ($DEFGROUPS) groups"
usermod -a -G ${DEFGROUPS} user
#!/bin/sh
set -e
# check to make sure sudoers file has ref for admin
ADMINEXISTS="$(awk '$1 == "%admin" { print $1 }' /etc/sudoers)"
if [ -z "$ADMINEXISTS" ]; then
# append admin entry to sudoers
echo "# Members of the admin group may gain root privileges" >> /etc/sudoers
echo "%admin ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
fi
# make sure that NOPASSWD is set for %admin
# expecially in the case that we didn't add it to /etc/sudoers
# just blow the %admin line away and force it to be NOPASSWD
sed -i -e '
/\%admin/ c \
%admin ALL = (ALL) NOPASSWD: ALL
' /etc/sudoers
#!/bin/sh
set -e
# Create /etc/mtab symlink, replacing a regular file if necessary
if [ ! -L /etc/mtab ]
then
rm -f /etc/mtab
ln -s /proc/self/mounts /etc/mtab
fi
#!/bin/sh
set -e
mkdir -p uuid
cd uuid
prefix=
if ls ../binary/casper/initrd.img-* > /dev/null 2>&1; then
prefix=../binary/boot/filesystem.dir/casper/
else
prefix=../binary/boot/filesystem.dir/boot/
fi
UUID=`uuidgen -r`
for initrd in `ls $prefix/initrd.img-* 2> /dev/null`; do
zcat $initrd | cpio --quiet -id
echo $UUID > conf/uuid.conf
find . | cpio --quiet --dereference -o -H newc | gzip > $initrd
rm -rf *
done
echo "I: setting rootfs UUID $UUID in initrd... copying to '.disk/casper-uuid'."
if [ ! -d ../binary/boot/filesystem.dir/.disk ]; then
mkdir -p ../binary/boot/filesystem.dir/.disk
fi
echo $UUID > ../binary/boot/filesystem.dir/.disk/casper-uuid
cd ..
rm -rf uuid
#!/bin/sh
set -e
# Generate openssh keys
echo "I: Regenerate SSH keys"
if dpkg -l openssh-server | tail -n 1 | grep -q ^ii
then
dpkg-reconfigure openssh-server
else
echo "W: openssh-server not found. Avoiding key generation."
fi
#!/bin/sh
set -e
# Move /root to /var/root and add a symlink
mv /root var/root
ln -s var/root /root
#!/bin/sh
set -e
fail () { printf "%s\n" "$*"; exit 1; }
test -n "$ROOTDIR" || fail 'error: $ROOTDIR is not set'
test -d "$ROOTDIR" || fail 'error: $ROOTDIR is not a directory'
cd "$ROOTDIR"
echo "I: commented out such that dpkg and apt will work for NOW"
#echo "I: rm /var/lib/dpkg"
#rm -rf ./var/lib/dpkg
echo "I: rm /var/lib/apt"
rm -f ./var/lib/apt/lists/*Packages
rm -f ./var/lib/apt/lists/*Sources
rm -f ./var/lib/apt/lists/*Release
rm -f ./var/lib/apt/lists/*Release.gpg
echo "I: rm /var/cache/apt"
rm -f ./var/cache/apt/pkgcache.bin
rm -f ./var/cache/apt/srcpkgcache.bin
#!/bin/bash
set -e
shopt -s dotglob
echo "I: create user"
adduser --gecos User --disabled-login user
echo "I: set user password"
echo "user:user" | chpasswd
shopt -u
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment