Skip to content

Commit 1883155

Browse files
authored
Merge pull request #109 from IGEL-Community:fujitsu-sane
fujitsu sane
2 parents bbbb7c8 + 26e3b0f commit 1883155

5 files changed

Lines changed: 229 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Fujitsu Scanner SANE (19 November)
2+
3+
-----
4+
5+
**NOTE:** Builder works for OS11 (build with Ubuntu 18.04 - bionic) and OS12 (build with Ubuntu 20.04 - focal)
6+
7+
-----
8+
9+
| CP Information | |
10+
|-----------------|------------|
11+
| Package | [Fujitsu Scanner SANE](https://www.pfu.ricoh.com/global/scanners/fi/dl/ubuntu-fi-8040.html) |
12+
| Script Name | [fujitsu-cp-init-script.sh](build/fujitsu-cp-init-script.sh) |
13+
| Packaging Notes | Details can be found in the build script |
14+
| Package automation | [build-fujitsu-cp.sh](build/build-fujitsu-cp.sh) |
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/bin/bash
2+
#set -x
3+
#trap read debug
4+
# Creating an IGELOS CP
5+
## Development machine Ubuntu (OS11 = 22.04; OS12 = 20.04)
6+
#https://www.pfu.ricoh.com/global/scanners/fi/dl/ubuntu-fi-8040.html
7+
#pfufs-ubuntu_2.8.1_amd64.deb
8+
CP="fujitsu"
9+
ZIP_LOC="https://github.com/IGEL-Community/IGEL-Custom-Partitions/raw/master/CP_Packages/Apps"
10+
ZIP_FILE="Fujitsu_Scanner"
11+
FIX_MIME="FALSE"
12+
CLEAN="FALSE"
13+
OS11_CLEAN="11.10.210"
14+
OS12_CLEAN="12.6.0"
15+
USERHOME_FOLDERS="FALSE"
16+
USERHOME_FOLDERS_DIRS=("")
17+
APPARMOR="FALSE"
18+
GETVERSION_FILE="$HOME/Downloads/pfufs-ubuntu_*_amd64.deb"
19+
MISSING_LIBS_OS11=""
20+
MISSING_LIBS_OS12=""
21+
22+
VERSION_ID=$(grep "^VERSION_ID" /etc/os-release | cut -d "\"" -f 2)
23+
24+
if [ "${VERSION_ID}" = "22.04" ]; then
25+
MISSING_LIBS="${MISSING_LIBS_OS11}"
26+
IGELOS_ID="OS11"
27+
elif [ "${VERSION_ID}" = "20.04" ]; then
28+
MISSING_LIBS="${MISSING_LIBS_OS12}"
29+
IGELOS_ID="OS12"
30+
else
31+
echo "Not a valid Ubuntu OS release. OS11 needs 22.04 (bionic) and OS12 needs 20.04 (focal)."
32+
exit 1
33+
fi
34+
35+
if ! compgen -G "${GETVERSION_FILE}" > /dev/null; then
36+
echo "***********"
37+
echo "Obtain Linux SDK driver ${GETVERSION_FILE}, save into $HOME/Downloads and re-run this script "
38+
echo "https://www.pfu.ricoh.com/global/scanners/fi/dl/ubuntu-fi-8040.html"
39+
echo "***********"
40+
exit 1
41+
fi
42+
43+
sudo apt install unzip -y
44+
45+
mkdir build_tar
46+
cd build_tar
47+
48+
for lib in $MISSING_LIBS; do
49+
apt-get download $lib
50+
done
51+
52+
cp ${GETVERSION_FILE} .
53+
54+
mkdir -p custom/${CP}
55+
56+
find . -name "*.deb" | while read LINE
57+
do
58+
dpkg -x "${LINE}" custom/${CP}
59+
done
60+
61+
if [ "${FIX_MIME}" = "TRUE" ]; then
62+
mv custom/${CP}/usr/share/applications/ custom/${CP}/usr/share/applications.mime
63+
fi
64+
65+
if [ "${USERHOME_FOLDERS}" = "TRUE" ]; then
66+
for folder in "${USERHOME_FOLDERS_DIRS[@]}"; do
67+
mkdir -p "$folder"
68+
done
69+
fi
70+
71+
if [ "${CLEAN}" = "TRUE" ]; then
72+
echo "+++++++======= STARTING CLEAN of USR =======+++++++"
73+
wget https://raw.githubusercontent.com/IGEL-Community/IGEL-Custom-Partitions/master/utils/igelos_usr/clean_cp_usr_lib.sh
74+
chmod a+x clean_cp_usr_lib.sh
75+
wget https://raw.githubusercontent.com/IGEL-Community/IGEL-Custom-Partitions/master/utils/igelos_usr/clean_cp_usr_share.sh
76+
chmod a+x clean_cp_usr_share.sh
77+
if [ "${IGELOS_ID}" = "OS11" ]; then
78+
./clean_cp_usr_lib.sh ${OS11_CLEAN}_usr_lib.txt custom/${CP}/usr/lib
79+
./clean_cp_usr_share.sh ${OS11_CLEAN}_usr_share.txt custom/${CP}/usr/share
80+
else
81+
./clean_cp_usr_lib.sh ${OS12_CLEAN}_usr_lib.txt custom/${CP}/usr/lib
82+
./clean_cp_usr_share.sh ${OS12_CLEAN}_usr_share.txt custom/${CP}/usr/share
83+
fi
84+
echo "+++++++======= DONE CLEAN of USR =======+++++++"
85+
fi
86+
87+
wget ${ZIP_LOC}/${ZIP_FILE}.zip
88+
89+
unzip ${ZIP_FILE}.zip -d custom
90+
91+
if [ "${APPARMOR}" = "TRUE" ]; then
92+
mkdir -p custom/${CP}/config/bin
93+
mkdir -p custom/${CP}/lib/systemd/system
94+
mv custom/target/build/${CP}_cp_apparmor_reload custom/${CP}/config/bin
95+
mv custom/target/build/igel-${CP}-cp-apparmor-reload.service custom/${CP}/lib/systemd/system/
96+
fi
97+
mv custom/target/build/${CP}-cp-init-script.sh custom
98+
99+
cd custom
100+
101+
# edit inf file for version number
102+
mkdir getversion
103+
cd getversion
104+
ar -x ${GETVERSION_FILE}
105+
tar xf control.tar.*
106+
VERSION=$(grep Version control | cut -d " " -f 2)
107+
#echo "Version is: " ${VERSION}
108+
mv postinst ../fujitsu_igel_postinst.sh
109+
cd ..
110+
sed -i "/^version=/c version=\"${VERSION}\"" target/${CP}.inf
111+
#echo "${CP}.inf file is:"
112+
#cat target/${CP}.inf
113+
114+
# new build process into zip file
115+
tar cvjf target/${CP}.tar.bz2 ${CP} ${CP}-cp-init-script.sh ${CP}_igel_postinst.sh
116+
zip -g ../${ZIP_FILE}.zip target/${CP}.tar.bz2 target/${CP}.inf
117+
zip -d ../${ZIP_FILE}.zip "target/build/*" "target/igel/*" "target/target/*"
118+
mv ../${ZIP_FILE}.zip ../../${ZIP_FILE}-${VERSION}_${IGELOS_ID}_igel01.zip
119+
120+
cd ../..
121+
rm -rf build_tar
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#! /bin/bash
2+
#set -x
3+
#trap read debug
4+
5+
ACTION="custompart-fujitsu_${1}"
6+
7+
# mount point path
8+
MP=$(get custom_partition.mountpoint)
9+
10+
# custom partition path
11+
CP="${MP}/fujitsu"
12+
13+
# output to systemlog with ID amd tag
14+
LOGGER="logger -it ${ACTION}"
15+
16+
echo "Starting" | $LOGGER
17+
18+
case "$1" in
19+
init)
20+
# Initial permissions
21+
chown -R root:root "${CP}" | $LOGGER
22+
# Linking files and folders on proper path
23+
find ${CP} -printf "/%P\n" | while read DEST
24+
do
25+
if [ ! -z "${DEST}" -a ! -e "${DEST}" ]; then
26+
# Remove the last slash, if it is a dir
27+
[ -d $DEST ] && DEST=${DEST%/} | $LOGGER
28+
if [ ! -z "${DEST}" ]; then
29+
ln -sv "${CP}/${DEST}" "${DEST}" | $LOGGER
30+
fi
31+
fi
32+
done
33+
34+
bash ${MP}/fujitsu_igel_postinst.sh
35+
36+
;;
37+
stop)
38+
# Unlinking files and folders on proper path
39+
find ${CP} -printf "/%P\n" | while read DEST
40+
do
41+
if [ -L "${DEST}" ]; then
42+
unlink $DEST | $LOGGER
43+
fi
44+
done
45+
46+
;;
47+
esac
48+
49+
echo "Finished" | $LOGGER
50+
51+
exit 0
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<profiles>
3+
<profile>
4+
<profile_id>10688</profile_id>
5+
<profilename>Fujitsu SANE CP</profilename>
6+
<firmware>
7+
<model>IGEL OS 11</model>
8+
<version>11.10.430.01</version>
9+
</firmware>
10+
<description>Fujitsu SANE</description>
11+
<overwritesessions>false</overwritesessions>
12+
<is_master_profile>false</is_master_profile>
13+
<is_igel_os>true</is_igel_os>
14+
<settings>
15+
<pclass name="custom_partition.enabled">
16+
<pvalue instancenr="-1" variableExpression="" variableSubstitutionActive="false">true</pvalue>
17+
<variableSubstitutionActive>false</variableSubstitutionActive>
18+
</pclass>
19+
<pclass name="custom_partition.size">
20+
<pvalue instancenr="-1" variableExpression="" variableSubstitutionActive="false">50M</pvalue>
21+
<variableSubstitutionActive>false</variableSubstitutionActive>
22+
</pclass>
23+
</settings>
24+
<instancesettings>
25+
<instance classprefix="custom_partition.source%" serialnumber="31cea061:1730aeba537:-7fff127.0.1.1">
26+
<ivalue classname="custom_partition.source%.username" variableExpression="" variableSubstitutionActive="false">[USERNAME]</ivalue>
27+
<ivalue classname="custom_partition.source%.url" variableExpression="" variableSubstitutionActive="false">https://[UMSSERVER]:8443/ums_filetransfer/fujitsu.inf</ivalue>
28+
<ivalue classname="custom_partition.source%.password" variableExpression="" variableSubstitutionActive="false"></ivalue>
29+
<ivalue classname="custom_partition.source%.init_action" variableExpression="" variableSubstitutionActive="false">/custom/fujitsu-cp-init-script.sh init</ivalue>
30+
<ivalue classname="custom_partition.source%.final_action" variableExpression="" variableSubstitutionActive="false">/custom/fujitsu-cp-init-script.sh stop</ivalue>
31+
<ivalue classname="custom_partition.source%.crypt_password" variableExpression="" variableSubstitutionActive="false"></ivalue>
32+
<ivalue classname="custom_partition.source%.autoupdate" variableExpression="" variableSubstitutionActive="false">true</ivalue>
33+
</instance>
34+
</instancesettings>
35+
</profile>
36+
</profiles>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[INFO]
2+
[PART]
3+
file="fujitsu.tar.bz2"
4+
version="X.X.X"
5+
size="50M"
6+
name="fujitsu"
7+
minfw="11.10.430"

0 commit comments

Comments
 (0)